Bug 438204 - Desktop entry files with uppercase in filenames are not recognized by Shortcuts
Summary: Desktop entry files with uppercase in filenames are not recognized by Shortcuts
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kglobalaccel
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.81.0
Platform: unspecified Linux
: HI normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 437987 438877 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-06-07 11:10 UTC by Oxalica
Modified: 2021-07-22 13:51 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.22.4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oxalica 2021-06-07 11:10:01 UTC
SUMMARY

Desktop entry files (*.desktop) with uppercase letter in filenames are not recognized by Shortcuts. 

STEPS TO REPRODUCE
1. Install alacritty with any package manager. This desktop entry file will be installed <https://github.com/alacritty/alacritty/blob/v0.8.0/extra/linux/Alacritty.desktop>
2. Open Application Launcher, type `Alacritty`, then the entry `Alacritty` is shown with icon. Clicking can open it without issue. This indicates Application Launcher correctly recognized the desktop file.
3. Open System Settings - Shortcuts - Add Application, type `Alacritty`, select it, and click `OK`. It failed to recognized the desktop file.

OBSERVED RESULT

It shows only a `_launch` action in the right-hand-side panel. You can set any shortcut on `_launch`, like `Ctrl-Alt-T`. Click `Apply` button. Hit the shortcut, and nothing happens.

There is an error log is shown in journalctl when clicking `OK` in `Add Application` dialog:

> Jun 04 07:49:35 invar kglobalaccel5[2299]: kf.globalaccel.kglobalacceld: No desktop file found for service "alacritty.desktop"

It's trying to open lowercase-d name `alacritty.desktop`, instead of the real name `Alacritty.desktop`.

If renaming the installed file `Alacritty.desktop` to `alacritty.desktop`, desktop actions and shortcuts work correctly as expected.

EXPECTED RESULT

Shortcuts should work no matter if the desktop entry file contains uppercase letter, and a desktop action `New Terminal` should be shown, which is provided in the desktop entry file.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: NixOS, X11, KDE (Also reproduced on Arch Linux)
(available in About System)
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

Related issues:
- NixOS (with some screenshots): https://github.com/NixOS/nixpkgs/issues/125592
- alacritty: https://github.com/alacritty/alacritty/issues/5008
- Discussion about why alacritty use uppercase filename: https://github.com/alacritty/alacritty/pull/3425

The issue is not limited to alacritty. It seems all programs with desktop entry file containing uppercase letters are affected, including:
- qBittorrent (org.qbittorrent.qBittorrent.desktop)
- obs-studio (com.obsproject.Studio.desktop)
Comment 1 Nate Graham 2021-06-08 19:38:19 UTC
Very strange.

David, would you mind taking a look?
Comment 2 Nate Graham 2021-06-08 22:34:29 UTC
*** Bug 437987 has been marked as a duplicate of this bug. ***
Comment 3 Lukas Sabota 2021-07-04 18:28:21 UTC
I can confirm this issue as well.  It looks like the desktop filename is getting somehow converted to lowercase before it gets written to the configuration.  Adding a shortcut to Alacritty.desktop in kde 5.22.2.1 writes the following in kglobalshortcutsrc:

[alacritty.desktop]    
_k_friendly_name=Alacritty    
_launch=Meta+\\\\,,
Comment 4 David Redondo 2021-07-20 06:52:13 UTC
*** Bug 438877 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2021-07-22 13:48:26 UTC
Git commit 84a4c73b9490666027db55eb849cf7ed8ee37847 by Nate Graham, on behalf of David Redondo.
Committed on 22/07/2021 at 13:47.
Pushed by ngraham into branch 'master'.

kcms/keys: Use storageId instead of desktopEntryName

The latter is always lower case while storageId preserves the
original capitalization.

M  +1    -1    kcms/keys/kcm_keys.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/84a4c73b9490666027db55eb849cf7ed8ee37847
Comment 6 Nate Graham 2021-07-22 13:51:22 UTC
Git commit b2797b48eb38ea931cc54255b52219100c74a1b9 by Nate Graham, on behalf of David Redondo.
Committed on 22/07/2021 at 13:51.
Pushed by ngraham into branch 'Plasma/5.22'.

kcms/keys: Use storageId instead of desktopEntryName

The latter is always lower case while storageId preserves the
original capitalization.


(cherry picked from commit 84a4c73b9490666027db55eb849cf7ed8ee37847)

M  +1    -1    kcms/keys/kcm_keys.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/b2797b48eb38ea931cc54255b52219100c74a1b9