7

I want to run a shell script ~/.local/bin/test.sh via dmenu. If I run dmenu via $mod+D and browse for the entry test.sh I couldn't find it.

The path ~/.local/bin is already set to my $PATH variable in ~/.profile

$ echo $PATH
/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

I also removed ~/.cache/dmenu_run and restart i3. What can I do to launch the test script via dmenu?

4

Delete ~/.cache/dmenu_run or ~/dmenu_cache, depending on which you have, and log back in. After your PATH is reloaded from .profile after logging in, dmenu should regenerate the cache from $PATH. dmenu seems to be bad about renewing its own cache, and needs to be forced to do it sometimes.

Also check that you have enabled the executable bit for script:

$ ls -l ~/.local/bin/test.sh
-rwxrwxrwx 1 user group 152 Jan 11 04:09 /home/user/.local/bin/test.sh
  • Sorry, I forgot to mention that I already removed ~/.cache/dmenu_run and restart the i3 but it doesn't affects the behavior of dmenu. – Hölderlin Jan 7 '17 at 13:58
  • @Hölderlin It's important that you logout, and log back in to reload ~/.profile – Kenneth B. Jensen Jan 7 '17 at 18:12
3

I had the same problem.

This Arch Linux forum post describes the problem:

Setting $PATH in ~/.bashrc doesn't ensure your WM/dmenu will inherit this env.
A more relevant question to ask is, "How do you login?" Usually the env exported in ~/.bash_profile or ~/.profile are available in your X applications.
Launch dmenu_run as you normally do, then in dmenu, type
echo $PATH > /tmp/path
Then in a terminal, cat /tmp/path to see what that $PATH is.

In my case, $PATH directories set in my ~/.profile weren't picked up by dmenu. My window manager is started from .xinitrc, and adding an additional export PATH=$PATH:/dir/of/interest in the .xinitrc file before the exec my_wm line fixed the problem. It is a bit clunky though.

As noted previously, I had to remove the ~/.cache/dmenu_run file and log in again after making the change to get it to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.