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 Nov 20 '14

updated Nov 20 '14

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

2 answers

Sort by » oldest newest most voted
1

answered Nov 20 '14

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
1

answered Nov 20 '14

lasers gravatar image

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

Comments

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

0x000000 gravatar image0x000000 (Nov 16 '15)edit

Question Tools

Stats

Asked: Nov 20 '14

Seen: 1,831 times

Last updated: Nov 20 '14