tofi icon indicating copy to clipboard operation
tofi copied to clipboard

Seemingly no way to modify environment $PATH

Open semliki opened this issue 2 years ago • 5 comments

I cannot find any docs relating to an option to set path variables, i've tried everything shell-wise to pass some environment vars to tofi but it doesn't want to take it. I'm running this on my home server with Sway, and I'm using nomachine to remote, and by default all of their binaries and stuff are in /usr/NX/bin on Arch. Tofi will not search this directory, or really any outside of /usr/bin and /bin, when not in .desktop mode. It's also annoying because I have custom scripts on ~/bin and those aren't seen either. And again, no obvious way to add or update the $PATH that tofi uses. I hope I'm just being stupid, but if I'm not, this is quite an oversight.

semliki avatar Aug 24 '23 22:08 semliki

I see that you use $XDG_USER_DIRS to get user dirs, I really do not want to deal with XDG because I'm trying to prevent as much Xorg cruft from polluting my system as I can, and I don't think xdg-user-dirs is necessary. Could we not add a simple read from $PATH if $XDG_DATA_DIRS == NULL? Something simple like:

if (xdg_data_dirs == NULL) {
	xdg_data_dirs = getenv("PATH");
}

Or ideally, give a config option to set a custom path or add to the default path set in the current code, so users can explicitly choose without just being given no choice at all in the manner without pulling the source and building yourself like I'm probably going to do when I get home lol.

semliki avatar Aug 24 '23 22:08 semliki

Hey, sorry for the late reply.

I'm not sure what's going wrong here, in normal tofi-run mode tofi just reads from your $PATH to get binaries: https://github.com/philj56/tofi/blob/b32c9954d3da430392575e9e637a2d8d114e34d0/src/compgen.c#L171-L208

It does cache results however, in $XDG_CACHE_HOME (which defaults to ~/.cache) /tofi-compgen. Maybe you started it up without a custom $PATH, then tried changing it, but the cache didn't get updated? If that's the case, removing ~/.cache/tofi-compgen would force a regeneration of the cache and presumably fix the issue. Otherwise, I'm not sure what would cause it.

philj56 avatar Nov 28 '23 19:11 philj56