George
George

Reputation: 225

Bindsym does not execute i3wm command

This shortcut does not work in i3wm. It's supposed to show the window list of open apps. Nothing visible happens, when keyboard shortcut is pressed.
bindsym $mod+space exec bash -c "/home/george/./dmenu-i3-window-jumper.sh"

However the script runs fine from terminal.

The bash code for the script:
https://github.com/minos-org/minos-desktop-tools/blob/master/tools/dmenu-i3-window-jumper

Upvotes: 0

Views: 3084

Answers (1)

Skoglar
Skoglar

Reputation: 46

This is a two side issue

First some small config stuff:

  1. I think you got an extra dot in there as ./ in that context just represents the folder preceding it (i.e: /home/george)
  2. You can use the $HOME variable as a stand in for your home folder, i3 will pick it up
  3. I would argue there is really no need for the bash -c, since your file has both a .sh extension and a #!/bin/sh header on the first line, which means you just need to give it execution permissions with chmod +x and it will run with bash anyways.

So in synthesis, you gotta

chmod +x /home/george/dmenu-i3-window-jumper.sh

so the script can be run without calling bash directly, and your bindsym could be simplified to

bindsym $mod+space exec "$HOME/dmenu-i3-window-jumper.sh"

And then there is the script stuff:

You see, around line 44 the script checks to see if the STDIN is in a terminal, if its not then it tries to pipe a file to the arg array

if [ ! -t 0 ]; then
    #add input comming from pipe or file to $@
    set -- "${@}" $(cat)
fi

This seems to be the main problem, since you're not running the command in a terminal and you're not giving it a file either.

Your options are A: changing the if so it will always pass an empty string to the argument array

if [ ! -t 0 ]; then
    #add input comming from pipe or file to $@
    set -- "${@}" ""
fi

or B: create a dummy file with touch ~/dummy and then pass it to the script on the bindsym

bindsym $mod+space exec "$HOME/dmenu-i3-window-jumper.sh < $HOME/dummy"

Both seem to work fine on my setup, good luck!

Upvotes: 3

Related Questions