Autore: wirelessduck Data: To: Steve Litt CC: dng Oggetto: Re: [DNG] Gnome - Introducing stronger dependencies on systemd
> On 14 Jun 2025, at 09:53, Steve Litt <slitt@???> wrote:
>
> wirelessduck--- via Dng said on Fri, 13 Jun 2025 23:29:25 +1000
>
>
>> I haven’t yet got into using dmenu so I’ve stuck with the
>> xfce4-appfinder package hooked to alt+f2 and alt+f3 same as it was in
>> XFCE. This one is good as it searches through .desktop application
>> files in addition to $PATH. If I could get dmenu to somehow search
>> .desktop files then I might give it another go.
>
> You CAN get dmenu to search .desktop files, and here's how you do it:
>
> I believe all your .desktop files are in your home directory and all
> end in .desktop. If your needs would be satisfied by a simple sorting
> of desktop files, you can pipe ls -1 ~/.desktop into dmenu, and do
> whatever is required to run the chosen one.
>
> But perhaps you want to actually work with stuff contained in the
> .desktop files. This is a little harder. You can make a Python program
> to open each, put all its information in sort order, sort it, and send
> it to a cache file. But before doing that, you actually send the (old)
> cache file into dmenu, and once the user chooses, THEN build the new
> cache file. So very occasionally dmenu will work with a stale cache
> file, but you just run it again. If you don't like the cache file idea,
> you can write a C program that reads the .desktop files, puts each
> record in the order you want it to sort, pipe it to sort, then redirect
> the result to dmenu. The C program and sort program are so
> instantaneous that you can dispense with the cache step and still
> perceive no delay between pressing the hotkey and viewing the dmenu
> result.
>
> It would take a little work, but you could even mix the on-path
> executables with the .desktop records.
>
> SteveT
>
> Steve Litt
Thanks Steve.
I think I might need to dig out my old copy of K&R second edition when I have some spare time to brush up on C. Otherwise bash/perl would probably be plenty fast enough for this.