feat: generate shortcuts

This commit is contained in:
aclist committed 2026-07-11 15:33:52 +09:00
1 parent b50d061e1f
commit caf071f997
13 files changed
+380 -40

No files matched your search

+19 -4
View File
@@ -1,18 +1,33 @@
import textwrap
from pathlib import Path
from dzgui.util.dirs import copy_dzgui_to_xdg_data, find_icon_resource, make_parents
def write_desktop_file(exe_path: Path) -> None:
icon = find_icon_resource()
def write_desktop_file(share_path: Path) -> None:
template = f"""\
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec={share_path}/launch.sh
Exec={exe_path}
Name=DZGUI
Comment=dzgui
Icon={share_path}/dzgui
Icon={icon}
Categories=Game"""
file = share_path / "dzgui.desktop"
copy_dzgui_to_xdg_data(exe_path)
share_path = exe_path.parent.parent
file = share_path.joinpath("applications/dzgui.desktop")
make_parents(file)
file.write_text(textwrap.dedent(template))
def write_desktop_shortcut(exe_path: Path) -> None:
# TODO: symlink the above, /Desktop
# TODO: dynamically link to prior option in UI
pass