Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tofi-drun is missing correctly configured .desktop files #115

Open
jsimonrichard opened this issue Aug 2, 2023 · 4 comments
Open

tofi-drun is missing correctly configured .desktop files #115

jsimonrichard opened this issue Aug 2, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jsimonrichard
Copy link

TL;DR: tofi-drun is missing applications that fuzzel displays.

If I had to guess, I would say this bug is related to that fact that I'm using a non-standard system from the XDG point-of-view; I'm running NixOS with Home Manager.

The missing desktop files are located in /etc/profiles/per-user/jsimonrichard/share/applications, and the parent directory of that folder is in XDG_DATA_DIRS. If you're familiar with NixOS and want to take a look at my config, you can: https://github.com/jsimonrichard/nix-config. But it's very much a work in progress. What's strange is that tofi-drun displays some of the applications in that directory; I suppose those working desktop files could be duplicated somewhere else, but if they are I can't find them. They're not in any of the directories listed in XDG_DATA_DIRS.

@Cowboylaserkittenjetshark

I just ran into what seems like the same issue. I fixed it by deleting the cache files mentioned here. It seemed like these got regenerated as needed on my Arch system, I'm not sure what NixOS is/isn't doing to cause them not to be.

@carschandler
Copy link

carschandler commented Oct 4, 2023

I am also facing this issue on Nix. The file has an outdated list of my actual desktop entries and is not "regenerating as needed." Mine correctly pulls from $XDG_DATA_DIRS/applications, but just isn't refreshing the file. Manually deleting the tofi-drun file does cause it to be regenerated successfully.

@philj56 philj56 added the bug Something isn't working label Nov 27, 2023
@philj56 philj56 self-assigned this Nov 27, 2023
@philj56
Copy link
Owner

philj56 commented Nov 27, 2023

Hey, thanks for the report and sorry for the long delay.

Tofi indeed caches a list of found .desktop files in "$XDG_CACHE_HOME/tofi-drun". I'm not sure what exactly would cause the problem, but as the saying goes, there are only two hard things in Computer Science: cache invalidation and naming things. I try to check the validity of the cache without doing too much work by checking the modified time of the directories in your application paths:

https://github.com/philj56/tofi/blob/b32c9954d3da430392575e9e637a2d8d114e34d0/src/drun.c#L246C1-L259C3

This apparently isn't 100% reliable, but startup speed is my main concern with tofi. I might try to have a look into nix at some point, to see if this is a frequent issue there, but yeah as an interim solution deleting the cache will force it to be regenerated and should fix any issues.

@philj56 philj56 removed their assignment Nov 27, 2023
@Pamplemousse
Copy link

For home-manager users out there, a solution is to delete the cache on each configuration activation:

home.activation = {
  # https://github.com/philj56/tofi/issues/115#issuecomment-1701748297
  regenerateTofiCache = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
    tofi_cache=${config.xdg.cacheHome}/tofi-drun
    [[ -f "$tofi_cache" ]] && rm "$tofi_cache"
  '';
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants