baskerville / sxhkd

Simple X hotkey daemon
BSD 2-Clause "Simplified" License
2.78k stars 139 forks source link

Some bindings (with number keys and i3-msg?) don't work, why? #252

Open eater opened 3 years ago

eater commented 3 years ago

I'm running sxhkd 0.6.2 with i3 and occasionally I find a binding doesn't do anything, but I can't quite figure out what the pattern is, which ones work and when and why.

These work:

super + 3
    i3empty.py -s next

super + h 
    i3-msg \[con_mark="3"\] focus

super + shift + equal
    i3-msg \[con_mark="3"\] focus

These do not work:

super + 3 
    i3-msg \[con_mark="3"\] focus

super + equal
    i3-msg \[con_mark="3"\] focus
emanuele6 commented 3 years ago

why are there quotes areound the 3? should there be quotes there? In shell syntax, \[con_mark="3"\] and \[con_mark=3\] have the exact same meaning.

eater commented 3 years ago

The behavior is the same with or without the quotes. I use them out of habit because sometimes there is a space character in those i3 window criteria. For example [title="biology class" class="zoom"]

emanuele6 commented 3 years ago

@eater that is different.

i3-msg \[con_mark="3"\] and i3-msg \[con_mark=3\] are exactly the same thing, I'm not saying they behave similarly.

i3-msg will receive [con_mark=3] as the argument in both cases, it would be a different story for \[con_mark=\"3\"\] or '[con_mark="3"]' for which i3-msg will receive [con_mark="3"]

If you are using i3-msg \[something="somethingelse"\] cmd out of habit explicitly for the case you described, you should stop because it's a very bad habit.

With i3-msg \[title="biology class"\] focus, i3-msg will receive [title=biology class] and will probably (I'm not sure, i don't use the i3 window manager) cause a syntax error with or without quotes; instead use i3-msg '[title="title"]' focus (or even i3-msg '[title="title"] focus' that is supported according to i3-msg(1)) which will forward the quotes correctly.

But, if it is as you said and, to i3, [something="thing"] and [something=thing] are equivalent, then this nonsensical quoting is not a cause of your problem.

eater commented 3 years ago

Agreed, that's not the cause of the problem. (The "biology class" example was taken from i3 config file syntax, and as you say is a bad habit for shell or sxhkd syntax.)