Forum > IDE/CodeTools
(Re)Create .desktop file using Project Options?
MarkMLl:
--- Quote from: bobby100 on June 23, 2024, 10:55:20 pm ---On Windows, the .lnk files are binary files, but one can use Shell API to create or read .lnk files.
--- End quote ---
OK, so they exist as a file rather than being embedded in the registry or as EAs, and the IDE could decide on the format (i.e. .lnk vs .desktop) based on the binary format.
MarkMLl
duralast:
--- Quote from: MarkMLl on June 23, 2024, 11:04:08 pm ---OK, so they exist as a file rather than being embedded in the registry
MarkMLl
--- End quote ---
.lnk files are in the registry, but the Windows default is not to show them from the NeverShowExt property.
dbannon:
(Linux comments) I consider making a Desktop file more a packaging thing than a building one. In my git tree I have a template desktop file (as shown below) and use sed to edit it as necessary as I build each particular type of package. But the important things remain constant.
--- Code: ---[Desktop Entry]
Name=tomboy-ng
Name[de]=tomboy-ng
Name[es]=tomboy-ng
Name[fr]=tomboy-ng
Name[nl]=tomboy-ng
Comment=Cross Platform Notes
Comment[de]=Notizen Plattformübergreifend
Comment[es]=Notas Multiplatforma
Comment[fr]=Notes Multiplateforme
Comment[nl]=Platformoverschrijdend notities
GenericName=Note Taker
GenericName[de]=Notizanwendung
GenericName[es]=Tomador de apuntes
GenericName[fr]=Application de prise de notes
GenericName[nl]=Notities maken
Exec=env QT_QPA_PLATFORM=xcb tomboy-ng %f
Icon=/usr/share/icons/hicolor/256x256/apps/tomboy-ng.png
Terminal=false
Type=Application
Categories=GNOME;Utility
Keywords=notes;
--- End code ---
It has a number of lines that are subject to i18n so that would need be considered in a build model. The executable, depending on packaging, is typically found in the PATH so thats easy, an icon is necessary, packaging says that belongs in /usr/share/icons/ but that requires root access to install. Its also reasonable to put that icon in (eg) $HOME/.icons and the Desktop file in $HOME/.local/share/applications/ (and system will look for it there) but that conflicts with the idea that an "install" is multiuser. So, its a solution for a DIY install script, not a formal package.
So, Don's "make a desktop" form can -
[x] get executable name from the Lazarus project,
[x] offer to use executable name as application name,
[x] request a Comment and Generic Name (and push those to the i18n pot file)
[x] suggest an icon location
[x] Suggest Terminal is false for GUI app
[x] request Categories
[x] request Keywords (and push that to the i18n pot file)
[x] Maybe, just maybe, a button to put desktop file and an icon in the (local) appropriate places ???
Note that I set an environment variable, QT_QPA_PLATFORM=xcb in the Exec line, thats needed for a Qt5 app (else some things don't work under Wayland) and does no harm for a gtk2 app.
A big, strong warning that a desktop file in your source tree is of no use at all. It must go into either $HOME/.local/share/applications/ or /usr/share/applications/ to be used. I see lots of messages to the forum "I made a desktop file but it gets ignored"
A desktop file is not absolutely necessary but does a heap of good things.
[x] Automatically (when installed) shows up in menu system
[x] Defines what Icon is associated with the app.
[x] Allows running the app in a predetermined environment or with predefined options. Such as my 'xcb' above.
[x] is observed by any menu (or menu like) launch or from the command line with, eg, $> gtk-launch myapp [enter}
I think its a good idea Don, we already do something vaguely similar for Mac users with the app bundle.
Davo
Phew ! I hate long posts, sorry !
bobby100:
--- Quote from: duralast on June 24, 2024, 03:58:28 am ---
--- Quote from: MarkMLl on June 23, 2024, 11:04:08 pm ---OK, so they exist as a file rather than being embedded in the registry
MarkMLl
--- End quote ---
.lnk files are in the registry, but the Windows default is not to show them from the NeverShowExt property.
--- End quote ---
You are making confusion. Files are on the physical media (hdd etc), but the file extensions are displayed or not according to the settings in the registry.
@dbannon
my .desktop file is like this:
--- Code: ---Name=MiniDexed Control Center
Version=1.0
Exec=MiniDexedCC
Comment=Librarian/Editor for MiniDexed
Icon=MiniDexedCC.png
Type=Application
Terminal=false
StartupNotify=true
Encoding=UTF-8
Categories=Utility;
--- End code ---
where the icons are in /usr/share/pixmaps and the app in /usr/bin and it works fine on Linux Mint.
I use Debreate for packaging, and this is the file created by Debreate
MarkMLl:
--- Quote from: duralast on June 24, 2024, 03:58:28 am ---
--- Quote from: MarkMLl on June 23, 2024, 11:04:08 pm ---OK, so they exist as a file rather than being embedded in the registry
MarkMLl
--- End quote ---
.lnk files are in the registry, but the Windows default is not to show them from the NeverShowExt property.
--- End quote ---
Right, so if they're in the registry they're not files then.
Are you saying that, like the old .reg files, they can be used to load stuff into the registry? Because that sounds like what's needed.
MarkMLl
Navigation
[0] Message Index
[#] Next page
[*] Previous page