Closed marcosrdac closed 4 years ago
When you launch sxhkd, you can specify a chain break key with the '-a' flag. For example, sxhkd -a space allows you to use the space bar to end a chain instead of escape.
Thanks, @sawsuh. I've read about this option, but that is not exactly what I mean: I want to do some stuff in the colon mode via keypresses (navigate through windows in this case), and some other thing + end colon mode (e.g. opening a terminal and be in normal mode again) with an only key press. I want to skip pressing ESC in this last case, but only here. I means, just, like sending a vim copy command (y) after having selected a block of text with "v".
I know there isn't something like that out of the box for now in sxhkd, but I would like to do that by any indirect, functional way, (e.g. sending ESC automatically before $TERMINAL with a pre xdotool command). I'm interested in any solution like this, because the necessary pre-ESC just pisses me off!
Maybe you can emulate modes using multiple sxhkd instances. And toggle which one is active by sending the USR2
signal which toggles the grabbing state of the the bindings.
Thanks by your attention, @Lythenas! I must say that I've found the perfect solution when reading @baskerville's code: sending sxhkd SIGALRM tells it to abort its chord chain. Just made a pull request (#170) to the base project, so that people can know it by reading sxhkd's manual.
So, what I do now on my configs, in case anyone is looking for that:
# focus the node for the given path jump
alt + v : alt + {h,j,k,l,Tab}
bspc node -f @{west,south,north,east,brother}
alt + v : alt + Return
pkill -ALRM sxhkd; $TERMINAL
And I'm done. Thanks to all of you!
EDIT okay I found another solution:
# discord
super + Return; {d, @d}
{tdrop -m -n cordless -f '-e cordless' termite, \
pkill -ALRM sxhkd}
Original comment:
# focus the node for the given path jump alt + v : alt + {h,j,k,l,Tab} bspc node -f @{west,south,north,east,brother} alt + v : alt + Return pkill -ALRM sxhkd; $TERMINAL
And I'm done. Thanks to all of you!
I thought this could be an answer to this bug: https://github.com/baskerville/sxhkd/issues/83#issuecomment-271738276 tried it, and it worked. Then I realized it only worked on one command.
Meaning:
super + Return; r
redshift_toggle; pkill -ALRM sxhkd
this, and only this case, works, but:
super + Return; d
tdrop -m -n cordless -f '-e cordless' termite; pkill -ALRM sxhkd
Here it doesn't work, it keeps me in the chain. If I press super + Return
, then d
, cordless opens, and if I then press r
, the redshift_toggle is triggered and the chain is ended.
Perhaps @lythenas solution is the best, although I still don't understand @baskerville answer here:
When sxhkd receives the initial chord, it has no way of knowing whether it should lock the chain or not.
In my opinion it shouldn't know, it should exit a chain when you tell it to via a command made to exit the chain.
It's also important to know that the signal is being sent after your "tdrop" command exits. Is it a dropdown terminal? Because if it is, the command is probably not exiting until the dropdown terminal is closed, and therefore (as it never happens) no signal will be sent to sxhkd.
Another good solution would be using "&" instead of ";":
super + Return; d
tdrop -m -n cordless -f '-e cordless' termite & pkill -ALRM sxhkd
So that "tdrop" runs in background and ALRM is sent to the sxhkd. This tip is useful for any command that isn't run instantaneously.
You're right, I didn't think of that. Now I'm sad cause I felt so clever with my last solution :D
Thank you for raising awareness of chords. I've been using sxhkd for a long time now and I didn't know it had this functionality for mimicking i3 modes. Here's a completely WM agnostic way of resizing windows (relies on wmutils)
mod1 + r: {h,j,k,l}
wrs {-20 0,0 20,0 -20,20 0} $(pfw)
mod1 + r: Escape
pkill -ALRM sxhkd
I`m trying to do this: focus at more than one pane with
And it looks like VIM's visual mode in my head, when I walk through my text (be them nodes). The only thing I dislike my setup is having to Escape in order to end the "visual mode" chain. I would like to send a command like
alt+v; alt+k; alt+k; alt+Return
So that it would: enter visual mode (alt+v), include above node in selection (alt+k), do that again (alt+k), and send the command to open a terminal as big as my current focus/selection (alt+Return).
I tried to xdotool the solution
But I read it's not possible to do that. Is there any way I could tell sxhkd to escape the block chain and also open the terminal without me typing Escape? (signalling or sending a proper command would be awesome, but I'm ready for the workarounds!)
I appreciate your attention!
PS.: I'm just obcessed with this software :D