Add StartupNotify to kitty.desktop

See https://gitlab.gnome.org/GNOME/mutter/-/issues/2739

Also rename kitty.desktop to kitty-terminal.desktop as otherwise
xdg-menu-install complains about no vendor prefix.
This commit is contained in:
Kovid Goyal 2024-04-08 10:00:06 +05:30
parent d630b3d8a7
commit 597710dd53
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 10 deletions

View file

@ -41,7 +41,7 @@ Desktop integration on Linux
--------------------------------
If you want the kitty icon to appear in the taskbar and an entry for it to be
present in the menus, you will need to install the :file:`kitty.desktop` file.
present in the menus, you will need to install the :file:`kitty-terminal.desktop` file.
The details of the following procedure may need to be adjusted for your
particular desktop, but it should work for most major desktop environments.
@ -50,18 +50,18 @@ particular desktop, but it should work for most major desktop environments.
# Create symbolic links to add kitty and kitten to PATH (assuming ~/.local/bin is in
# your system-wide PATH)
ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten ~/.local/bin/
# Place the kitty.desktop file somewhere it can be found by the OS
cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
# Place the kitty-terminal.desktop file somewhere it can be found by the OS
cp ~/.local/kitty.app/share/applications/kitty-terminal.desktop ~/.local/share/applications/
# If you want to open text files and images in kitty via your file manager also add the kitty-open.desktop file
cp ~/.local/kitty.app/share/applications/kitty-open.desktop ~/.local/share/applications/
# Update the paths to the kitty and its icon in the kitty.desktop file(s)
# Update the paths to the kitty and its icon in the kitty desktop file(s)
sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop
.. note::
In :file:`kitty-open.desktop`, kitty is registered to handle some supported
MIME types. This will cause kitty to take precedence on some systems where
the default apps are not explicitly set. For example, you expect to use
the default apps are not explicitly set. For example, if you expect to use
other GUI file managers to open dir paths when using commands such as
:program:`xdg-open`, you should configure the default opener for the MIME
type ``inode/directory``::

View file

@ -1340,7 +1340,7 @@ def create_linux_bundle_gunk(ddir: str, args: Options) -> None:
shutil.copy2(f'logo/kitty.{ext}', icdir)
deskdir = os.path.join(ddir, 'share', 'applications')
safe_makedirs(deskdir)
with open(os.path.join(deskdir, 'kitty.desktop'), 'w') as f:
with open(os.path.join(deskdir, 'kitty-terminal.desktop'), 'w') as f:
f.write(
'''\
[Desktop Entry]
@ -1350,11 +1350,11 @@ def create_linux_bundle_gunk(ddir: str, args: Options) -> None:
GenericName=Terminal emulator
Comment=Fast, feature-rich, GPU based terminal
TryExec=kitty
StartupNotify=true
Exec=kitty
Icon=kitty
Categories=System;TerminalEmulator;
'''
)
''')
with open(os.path.join(deskdir, 'kitty-open.desktop'), 'w') as f:
f.write(
'''\
@ -1364,14 +1364,14 @@ def create_linux_bundle_gunk(ddir: str, args: Options) -> None:
Name=kitty URL Launcher
GenericName=Terminal emulator
Comment=Open URLs with kitty
StartupNotify=true
TryExec=kitty
Exec=kitty +open %U
Icon=kitty
Categories=System;TerminalEmulator;
NoDisplay=true
MimeType=image/*;application/x-sh;application/x-shellscript;inode/directory;text/*;x-scheme-handler/kitty;x-scheme-handler/ssh;
'''
)
''')
if os.path.exists(in_src_launcher):
os.remove(in_src_launcher)