chore: import official kitty sources from upstream
Bring the kovidgoyal/kitty codebase in as the base of FWS-Kitty, vendored at upstream commit 91fb38a without its git history.
This commit is contained in:
1134 files changed
+433629
No files matched your search
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 193 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 240 240"><g transform="translate(0 -812.362)"><rect width="100.446" height="161.551" x="72.824" y="850.13" ry="0" style="fill:#ddd;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:5.86876726;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="M67.896 1029.71h104.208a7.065 7.065 0 0 0 7.065-7.066V918.436a7.065 7.065 0 0 0-7.065-7.065H67.896a7.065 7.065 0 0 0-7.065 7.065v104.208a7.065 7.065 0 0 0 7.065 7.065m55.813-38.35h37.444a4.239 4.239 0 0 1 0 8.479H123.71a4.239 4.239 0 0 1 0-8.478m-45.032-45.71a4.239 4.239 0 0 1 5.991-5.99l26.48 26.464a4.24 4.24 0 0 1 0 5.992l-26.48 26.48a4.239 4.239 0 0 1-5.991-5.992l23.484-23.484z" style="stroke-width:1.41299629"/><path d="M96.085 898.143c1.881 0 3.386-3.574 3.386-8.17 0-4.595-1.505-8.169-3.386-8.169-1.88 0-3.385 3.574-3.385 8.17 0 4.595 1.504 8.17 3.385 8.17" style="clip-rule:evenodd;fill:#c0c81f;fill-opacity:1;fill-rule:evenodd;stroke-width:3.09913683"/><path d="M193.128 836.886c-4.596-4.85-25.53 1.022-38.295 8.936-9.957-5.106-21.956-8.17-34.721-8.17-13.02 0-25.02 3.064-34.977 8.17-12.765-7.914-33.955-14.042-38.295-8.936-4.595 5.106 3.32 26.296 12.765 38.04-.766 3.064-1.276 6.128-1.276 9.446 0 10.212 4.34 19.659 11.744 27.318h42.124c-1.276-2.553.511-4.085 8.17-4.085 7.659.255 9.19 1.532 8.17 4.085h42.124c7.404-7.66 11.744-17.36 11.744-27.318 0-3.318-.51-6.382-1.276-9.446 8.935-11.744 16.594-33.189 11.999-38.04m-97.015 67.4c-8.935 0-16.339-7.404-16.339-16.34s7.404-16.339 16.34-16.339 16.339 7.404 16.339 16.34-7.404 16.339-16.34 16.339m47.997 0c-8.936 0-16.34-7.404-16.34-16.34s7.404-16.339 16.34-16.339 16.34 7.404 16.34 16.34-7.15 16.339-16.34 16.339" style="clip-rule:evenodd;fill:#784421;fill-opacity:1;fill-rule:evenodd;stroke-width:2.55301046"/><g style="fill:#2b1100;fill-opacity:1"><path d="M168.507 903.265c15.318-19.148 46.72-28.339 67.655-15.063-24.509-3.83-46.72 2.553-67.655 15.063" style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:2.55301046;fill:#2b1100;fill-opacity:1"/><path d="M167.486 898.67c8.68-20.425 34.466-33.7 55.145-26.552-21.7 2.808-39.316 11.233-55.145 26.551m-.256 9.957c15.83-15.063 50.806-20.169 61.528-4.34-21.7-6.893-40.593-3.83-61.527 4.34" style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:2.55301046;fill:#2b1100;fill-opacity:1"/></g><g style="fill:#2b1100;fill-opacity:1"><path d="M71.493 903.265c-15.318-19.148-46.72-28.339-67.655-15.063 24.509-3.83 46.72 2.553 67.655 15.063" style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:2.55301046;fill:#2b1100;fill-opacity:1"/><path d="M72.514 898.67c-8.68-20.425-34.466-33.7-55.145-26.552 21.7 2.808 39.316 11.233 55.145 26.551m.256 9.957c-15.83-15.063-50.806-20.169-61.528-4.34 21.7-6.893 40.593-3.83 61.527 4.34" style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:2.55301046;fill:#2b1100;fill-opacity:1"/></g><path d="M52.6 893.563c-6.382 0-11.743 3.32-14.296 8.425h-.766c-6.893 0-12.765 5.106-12.765 11.489 0 8.935 9.19 13.786 17.615 10.722 5.106 7.404 16.084 7.915 20.17 0 6.126-.255 16.083-1.276 17.615-10.722 1.021-6.383-5.617-11.489-12.765-11.489h-.766c-2.042-5.106-7.659-8.425-14.041-8.425m134.8 0c6.382 0 11.743 3.32 14.296 8.425h.766c3.574 0 12.765 5.106 12.765 11.489 0 8.935-9.19 13.786-17.615 10.722-5.107 7.404-16.084 7.915-20.17 0-6.126-.255-16.083-1.276-17.615-10.722-1.021-6.383 9.19-11.489 12.765-11.489h.766c2.042-5.106 7.659-8.425 14.041-8.425" style="clip-rule:evenodd;fill:#483737;fill-opacity:1;fill-rule:evenodd;stroke-width:2.55301046"/><path d="M143.542 898.143c1.881 0 3.386-3.574 3.386-8.17 0-4.595-1.505-8.169-3.386-8.169-1.88 0-3.386 3.574-3.386 8.17 0 4.595 1.505 8.17 3.386 8.17" style="clip-rule:evenodd;fill:#c0c81f;fill-opacity:1;fill-rule:evenodd;stroke-width:3.09913683"/></g></svg>
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
Executable
+129
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from copy import deepcopy
|
||||
from typing import Any
|
||||
|
||||
SRC = 'kitty.svg'
|
||||
base = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# To generate this template create an icon using Icon Composer on macOS and in
|
||||
# the saved .icon (which is a folder) look for icon.js
|
||||
icon_settings: dict[str, Any] = {
|
||||
'fill-specializations': [
|
||||
{'value': {'automatic-gradient': 'extended-gray:1.00000,1.00000'}},
|
||||
{'appearance': 'dark', 'value': {'automatic-gradient': 'display-p3:0.20500,0.20500,0.20500,1.00000'}},
|
||||
],
|
||||
'groups': [
|
||||
{
|
||||
'layers': [
|
||||
{
|
||||
'blend-mode': 'normal',
|
||||
'glass': False,
|
||||
'hidden': False,
|
||||
'image-name': 'icon.svg',
|
||||
'name': 'icon',
|
||||
'opacity': 1,
|
||||
'position': {'scale': 0.9, 'translation-in-points': [0, 0]},
|
||||
}
|
||||
],
|
||||
'shadow': {'kind': 'neutral', 'opacity': 0.5},
|
||||
'translucency': {'enabled': True, 'value': 0.5},
|
||||
}
|
||||
],
|
||||
'supported-platforms': {'circles': ['watchOS'], 'squares': 'shared'},
|
||||
}
|
||||
|
||||
|
||||
def abspath(x: str) -> str:
|
||||
return os.path.abspath(os.path.join(base, x))
|
||||
|
||||
|
||||
def run(*args: str) -> None:
|
||||
try:
|
||||
subprocess.check_call(args)
|
||||
except OSError:
|
||||
raise SystemExit(f'You are missing the {args[0]} program needed to generate the kitty logo')
|
||||
|
||||
|
||||
def get_svg_viewbox(file_path: str) -> tuple[float, ...]:
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
tree = ET.parse(file_path)
|
||||
root = tree.getroot()
|
||||
viewbox = root.get('viewBox')
|
||||
if viewbox:
|
||||
return tuple(float(x) for x in viewbox.split())
|
||||
width = root.get('width')
|
||||
height = root.get('height')
|
||||
return (0.0, 0.0, float(width or 0), float(height or 0))
|
||||
|
||||
|
||||
def create_icon(name: str, svg_path: str, output_path: str) -> str:
|
||||
view_box = get_svg_viewbox(svg_path)
|
||||
sz = view_box[-1]
|
||||
scale = 0.9 * 1024 / sz
|
||||
icon_dir = os.path.join(output_path, f'{name}.icon')
|
||||
if os.path.exists(icon_dir):
|
||||
shutil.rmtree(icon_dir)
|
||||
os.mkdir(icon_dir)
|
||||
s = deepcopy(icon_settings)
|
||||
for group in s['groups']:
|
||||
for layer in group['layers']:
|
||||
layer['image-name'] = os.path.basename(svg_path)
|
||||
layer['name'] = name
|
||||
layer['position']['scale'] = scale
|
||||
with open(os.path.join(icon_dir, 'icon.json'), 'w') as f:
|
||||
json.dump(s, f, indent=2)
|
||||
assets_dir = os.path.join(icon_dir, 'Assets')
|
||||
os.mkdir(assets_dir)
|
||||
shutil.copy(svg_path, assets_dir)
|
||||
return icon_dir
|
||||
|
||||
|
||||
def create_assets() -> None:
|
||||
actool = [
|
||||
'xcrun',
|
||||
'actool',
|
||||
'--warnings',
|
||||
'--platform',
|
||||
'macosx',
|
||||
'--compile',
|
||||
base,
|
||||
'--minimum-deployment-target',
|
||||
'15.0',
|
||||
'--output-partial-info-plist',
|
||||
'/dev/stdout',
|
||||
]
|
||||
icon = create_icon('kitty', abspath(SRC), base)
|
||||
run(*(actool + ['--app-icon', 'kitty', icon]))
|
||||
shutil.rmtree(icon)
|
||||
|
||||
|
||||
def render(output: str, sz: int = 256) -> None:
|
||||
src = abspath(SRC)
|
||||
print(f'Rendering {os.path.basename(src)} at {sz}x{sz}...')
|
||||
run('rsvg-convert', '-w', str(sz), '-h', str(sz), '-o', output, src)
|
||||
run('optipng', '-quiet', '-o7', '-strip', 'all', output)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if 'darwin' in sys.platform.lower():
|
||||
create_assets()
|
||||
if sys.argv[-1] == 'remote-macos':
|
||||
return
|
||||
else:
|
||||
run('ssh', 'ox', 'zsh', '-ilc', '~/bin/update-kitty && python3 ~/kitty-src/logo/make.py remote-macos')
|
||||
run('rsync', '-avz', '--include=*.icns', '--include=*.car', '--exclude=*', 'ox:~/kitty-src/logo/', base + '/')
|
||||
render(abspath('kitty.png'))
|
||||
render(abspath('kitty-128.png'), sz=128)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user