Recent

Author Topic: (Re)Create .desktop file using Project Options?  (Read 4856 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3026
    • tomboy-ng, a rewrite of the classic Tomboy
Re: (Re)Create .desktop file using Project Options?
« Reply #15 on: June 29, 2024, 08:21:17 am »
Looking good Don.

After some reflection, I am leaning towards making this a stand-alone tool. I created a prototype. (See attached).

I understand why. But Lazarus already has, in the project information, quite a bit of what you need to know. Including the i18n stuff. How about making it a Lazarus plugin ?  And, then, a wrapper that will let a version of it stand alone ? But there are other standalone ones (no idea if they are good, I use vim).



Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dsiders

  • Hero Member
  • *****
  • Posts: 1218
Re: (Re)Create .desktop file using Project Options?
« Reply #16 on: June 30, 2024, 12:23:17 am »
After some reflection, I am leaning towards making this a stand-alone tool. I created a prototype. (See attached).
Not ready to share code yet. It's not complete.
Comments?

Looks great!

Thanks for the feedback.

Have you thought about making it work also on Windows and Mac OS?

I got started with this because I (as a Linux newbie) couldn't find anything on Linux that was similar to the Create Shortcut option on every File Explorer context menu. Windows doesn't use .desktop, and i see no reason to create yet another way to do a thing can be easily done already.

macOS is... well... Apple. I don't own any "rotten fruit"  hardware, so it'd be difficult to test anything. And the code example in the previous replies tells me I don't want to get involved. :)

IMHO, as far as possible most fields should be filled with default values, including the icon field... (one can be provided initially)

If you talking about the .ico generated during compile, you can't use that. png, svg. or xpm only in .desktop files. So rather than guess, just let the user provide the path and file name. It already fills in as many known items as possible. I going to try to upload my efforts to-date some time tomorrow (Sun).
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

dsiders

  • Hero Member
  • *****
  • Posts: 1218
Re: (Re)Create .desktop file using Project Options?
« Reply #17 on: June 30, 2024, 12:34:33 am »
Looking good Don.

Thanks Davo.

After some reflection, I am leaning towards making this a stand-alone tool. I created a prototype. (See attached).

I understand why. But Lazarus already has, in the project information, quite a bit of what you need to know. Including the i18n stuff. How about making it a Lazarus plugin ?  And, then, a wrapper that will let a version of it stand alone ? But there are other standalone ones (no idea if they are good, I use vim).

If you're talking about i18n for captions on controls, then yes. And, I can implement that in the stand-alone version too. If you're talking about localized content for keys like Name[de] or Comment[es], then the Lazarus translation tools won't help much with those. The values are not TTranslateString constants in source code somewhere. ATM the localized value has to be entered manually (unless I find a free translation URL that doesn't require an API key).

I'm just not convinced any longer that a single platform solution like this deserves to be integrated in to the IDE. As it is, it satisfies the itch I was trying to scratch.

I had not stumbled across either of those items yet. More to consider. Thanks for the links/clues.

I'll try to package and upload my source tomorrow (Sun).
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

dsiders

  • Hero Member
  • *****
  • Posts: 1218
Re: (Re)Create .desktop file using Project Options?
« Reply #18 on: June 30, 2024, 08:05:23 pm »
Here's the code to date. Linux only.
It does not make the .desktop file executable or run update-desktop-database.
More information available in source code comments.

Perhaps others will find it useful. If you do. let me know and I'll add it to a public git repo.

Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

dbannon

  • Hero Member
  • *****
  • Posts: 3026
    • tomboy-ng, a rewrite of the classic Tomboy
Re: (Re)Create .desktop file using Project Options?
« Reply #19 on: July 01, 2024, 08:12:42 am »
I'll have a test when I get some time Don.

I do think you need to make the .desktop file executable, some uses of it depend on that.

I'd not be too worried about update-desktop-database, that database does seem to be bypassed by at least some desktops. My Mate for example keeps its list of apps to open a particular file "somewhere else" and personally I'd rather keep that process under my own control rather than having every app I install claiming to be be able to open every file on my system !

I don't put a MimeType in any .desktop file I make and it only applies to type 1 (Application) ones anyway.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018