4

Question:

I'm using i3-wm and I have Mod3 working as a hotkey. I have the following in ./config/i3/config:

#This command works
  bindsym Mod3+f exec "firefox" 

#This doesn't work nor do my other scripts
  bindsym Mod3+w exec "openBrowser" 

Both of these commands work fine when I run them from bash but only the 'firefox' command runs with the hotkey. Running my own script doesn't work.

Additional Details:

openBrowser is a script in /opt/bin/ which is in my path. Also tried doing:

#This command works
  bindsym Mod3+f exec /opt/bin/openBrowser

I've also tried other scripts none of which work when invoked by i3. Thus I've determined it's not an issue with the script.

I also noticed when I'm in bash if I do Mod3+w my cursor blinks, where as if I do Mod3+[any unset key] the key writes it's value to the screen. So it seems i3 is at least trying to run the function.

15
  • You have openBrowser in your config but also tried /opt/bin/openbrowser. So how the file is actually called? Case matters. Also, do you have any relative paths in that script? i3 runs it from other directory than your script is located in. This could also be a reason. Try to start the script from the directory where i3 config is located.
    – ddnomad
    Oct 23, 2016 at 15:20
  • Just a typo the second time, I used openBrowser which is the correct naming. Oct 23, 2016 at 15:35
  • Try to execute it from the console in a folder where i3 config is located. It should reveal errors if any
    – ddnomad
    Oct 23, 2016 at 15:37
  • @ddnomad as I mentioned in the text both commands work fine when I run them from bash. Oct 23, 2016 at 15:39
  • Can you add a source of a script to your question? I guess you're trying to open a Tor browser using an i3 shortcut?
    – ddnomad
    Oct 23, 2016 at 15:40

2 Answers 2

6
+100

I attempted to duplicate the issue you describe. What I found is that I had two i3 config files existing at the same time. ~/.config/i3/config and ~/.i3/config.

In my case, editing ~/.config/i3/config had no effect because it seems that ~/.i3/config trumps it.

It's a long shot, but see if maybe you have more than one config file, and possibly you are editing the wrong one.

3
  • This is not the case for me because I added the exec "firefox" command in the same file and it loaded no problem. So I'm sure the config file loads. Sep 1, 2017 at 12:32
  • Maybe try this: bindsym Mod3+f exec set > /tmp/set.out and have a look at the PATH, to see if it is what you expect. Sep 1, 2017 at 13:08
  • nvm it was the case that I had 2 config files like you. I was able to figure some other stuff out with Mod3+f exec set > /tmp/set.out. Thanks. Sep 1, 2017 at 13:17
3

The exec command starts an application by passing the command you specify to a shell. This implies that your programs will be searched in your $PATH. The default $PATH usually does not include /opt/bin, for example my is:

andreatsh@debian:~ 11:28 > echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Try adding /opt/bin to your path, put in your ~/.bashrc:

export PATH=$PATH:/opt

I did some tests and this solves the problem for me. Now:

bindsym Mod3+w exec somescript
bindsym Mod3+w exec /opt/bin/somescript

have the same behavior and the script works.

4
  • thanks for trying but I already addressed the possibility of a path issue in my question text. Oct 28, 2016 at 15:21
  • @PhilipKirkbride The default config has bindsym Mod3+w layout tabbed, maybe there is a conflict caused by binsym Mod3+w exec "openBrowser", or this last bindsym is overwritten by the first?
    – andreatsh
    Oct 28, 2016 at 17:07
  • you mean it has 'bindsym Mod+w layout tabbed' it doesn't reference mod3, and mod refers to windows or alt key. I also tried other letters so I can rule that out. Oct 28, 2016 at 17:27
  • 1
    Have you tried to enable i3 logging? Maybe you could get some useful error messages, or it could be a bug of your release version.
    – andreatsh
    Oct 28, 2016 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .