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

Some key bindings do not work reliably when also using gnome-settings-daemon

asked Dec 17 '14

kviktor gravatar image

updated Dec 18 '14

Adaephon gravatar image

I have a shell script in my home directory that lets me control spotify and I'm trying to use it with these lines in my i3 config.

bindsym X86AudioPlay exec sh /home/kviktor/spotify-control play
bindsym X86AudioNext exec sh /home/kviktor/spotify-control next
bindsym X86AudioPrev exec sh /home/kviktor/spotify-control prev

(The script can be found on GitHub)

The commands work reliably, when started from a shell. However they do not always work when using the key bindings. Sometimes this image pops and nothing else happens: image description

I'm on Ubuntu 12.04 and i3 version 4.7.2 (2014-01-23, branch "tags/4.7.2"). Spotify is started with exec from my i3 configuration. I also have gnome-settings-daemon running.

Comments

This window is definitely not from *i3*, so I'd guess that it is an issue with spotify-control. So the question is: does that also happen when you call it from a shell?

Adaephon gravatar imageAdaephon (Dec 17 '14)edit

`exec sh /home/kviktor/spotify-control play` into my shell works like a charm. It seems like the script is not even ran.

kviktor gravatar imagekviktor (Dec 17 '14)edit

While `exec` is also a valid shell command, here it is a *i3* command and **not** part of the actual command, which in this case starts with `sh`. Could you post a link to the source of that script or, if it is not too long, add it to the question?

Adaephon gravatar imageAdaephon (Dec 17 '14)edit
1

Ok, so the script only sends messages to spotify via DBus and nothing else. That only leaves the Spotify as creator of the image. I would say that `bindsym` works just fine, as indeed *something* is happening, just not the expected thing. There may be an issue with Spotify itself.

Adaephon gravatar imageAdaephon (Dec 17 '14)edit

1 answer

Sort by » oldest newest most voted
2

answered Dec 18 '14

Adaephon gravatar image

gnome-settings-daemon is interfering with your key bindings. The keys X86AudioPlay, X86AudioPrev and X86AudioNext are also bound to functions gnome-settings-daemon and depending on whether i3 or gnome-settings-daemon grab the keys first, your i3 key bindings work or you get the image.

It should be possible to solve the issue by removing the key bindings from the gnome settings.

It may be possible to do this from within the Gnome Control Center or you can use the gsettings tool. You can retrieve the current media-key settings with

gsettings list-recursively org.gnome.settings-daemon.plugins.media-keys

By default these keys are bound to the play, previous and next functions and you can unset them with:

gsettings set org.gnome.settings-daemon.plugins.media-keys next ''
gsettings set org.gnome.settings-daemon.plugins.media-keys play ''
gesttings set org.gnome.settings-daemon.plugins.media-keys previous ''

Alternatively, if you do not have gsettings, you can use dconf:

dconf write /org/gnome/settings-daemon/plugins/media-keys/next "''"
dconf write /org/gnome/settings-daemon/plugins/media-keys/play "''"
dconf write /org/gnome/settings-daemon/plugins/media-keys/previous "''"

You can view bindings that have changed from the default configuration with

dconf dump /org/gnome/settings-daemon/plugins/media-keys/

Question Tools

Stats

Asked: Dec 17 '14

Seen: 2,038 times

Last updated: Dec 18 '14