linuxmint / xed

X-Apps [Text] Editor (Cross-DE, backward-compatible, GTK3, traditional UI)
GNU General Public License v2.0
454 stars 85 forks source link

Desktop files syntax highlighting for 'PrefersNonDefaultGPU' key #650

Closed amicalmant closed 3 months ago

amicalmant commented 3 months ago

 * Xed version (xed --version)
 * Distribution - (Mint 17.2, Arch, Fedora 25, etc...)
Mint 22 Cinnamon

**Issue**
When I edit a .desktop file (app shortcut), all the keys such as "Type", "Name", "Comment", "Exec", etc., are highlighted but the new "PrefersNonDefaultGPU" is not, yet. Can we please add this key in the list?

**Steps to reproduce**
* Edit any video or graphic launcher in ~/.local/share/applications that should run with your discrete GPU loaded by default (e.g. org.shotcut.Shotcut.desktop) and add this line as per the Free Desktop Entry Specification (https://specifications.freedesktop.org/desktop-entry-spec/latest/recognized-keys.html):
PrefersNonDefaultGPU=true

**Expected behaviour**
The new key name should be highlighted.

**Other information**
[org.shotcut.Shotcut.desktop.zip](https://github.com/user-attachments/files/16512495/org.shotcut.Shotcut.desktop.zip)
mtwebster commented 3 months ago

It's a relatively new keyword, and isn't part of the language spec yet: https://gitlab.gnome.org/GNOME/gtksourceview/-/blob/master/data/language-specs/desktop.lang?ref_type=heads

If it gets added it would be there. Maybe open an issue in that repo?

If you want to fix it for yourself for now, you can edit the 'desktop.lang' files in both /usr/share/gtksourceview-3.0/language-specs and /usr/share/gtksourceview-4/language-specs and add:

      <keyword>PrefersNonDefaultGPU</keyword>

to the 'standard-key' section.

In the past couple of Cinnamon versions, its desktop file editor has also supported the gpu key: image

amicalmant commented 1 month ago

Thank you for this quick fix. Not a big deal but a nice-to-have little feature. :-)