The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

config dmenu not picking up user $PATH

asked 2014-11-20 03:34:25 +0000

updated 2014-11-20 03:38:41 +0000

When running dmenu, my local $HOME/bin scripts aren't being picked up. So I checked the value of $PATH by writing a cheat script that dmenu would run.

Sure enough, $HOME/bin was not included in the output:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

So perhaps the culprit is how .bashrc is configured?

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Aha!

So I move the $PATH assignment in .bashrc before it can exit for not running interactively:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

But still no luck. My current workaround is to change the config file to call a script with a wrapped dmenu command, dmenu.sh:

bindsym $mod+d exec ~/bin/dmenu.sh

The contents of my ~/bin/dmenu.sh:

#!/bin/bash
PATH=~/bin:$PATH dmenu_run

Does anyone have a better solution?

My environment: Xubuntu 14.04

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-11-20 03:49:08 +0000

Although my workaround in the original question fixes the issue with dmenu, there will still be other scripts that won't run properly if my session won't acknowledge my local $PATH settings.

It turns out that it's not i3wm's responsibility to source .bashrc, but creating an ~/.xsessionrc file with the following $PATH assignment works:

if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
edit flag offensive delete link more
1

answered 2014-11-20 04:02:17 +0000

lasers gravatar image

I have export PATH="$PATH:$HOME/.local/bin" in ~/.profile

edit flag offensive delete link more

Comments

This, and (I think) deleting `~/.cache/dmenu_run` is what worked for me.

0x000000 gravatar image0x000000 ( 2015-11-16 23:54:12 +0000 )edit

Question Tools

Stats

Asked: 2014-11-20 03:34:25 +0000

Seen: 1,831 times

Last updated: Nov 20 '14