You are not logged in.

#151 2013-09-20 17:34:33

Supplantr
Member
From: a state of sunshine
Registered: 2011-12-12
Posts: 149
Website

Re: sxhkd — Simple X HotKey Daemon

bloom wrote:

Could you provide further instructions on how to reproduce?

I'll assume urxvt is being used.

  1. Open a virtual terminal on an empty desktop.

  2. Execute:

    tabbed urxvt -embed &

    in said terminal.

  3. Close said terminal, leaving only the tabbed window.

  4. Close (via bspc window -c) the tabbed window.

  5. sxhkd doesn't respond to keypresses.

  6. Switch to alternative tty and execute:

    DISPLAY=:0 urxvt &

    and sxhkd becomes responsive again.

It may be worth noting that switching to an empty desktop during the last step (e.g. DISPLAY=:0 bspc desktop -f \^3, where the third desktop is empty) also works.

[edit]: Just a moment too late!

Last edited by Supplantr (2013-09-20 17:35:25)


I use linux and I dont understand nothing in this post.

Offline

#152 2013-09-20 19:18:27

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: sxhkd — Simple X HotKey Daemon

Supplantr wrote:

if a tabbed instance containing any embedded windows is the only window on its bspwm desktop when it's closed, sxhkd becomes unresponsive.

It was a bspwm bug which is fixed by 0d1a111.

Thanks for reporting!

Last edited by bloom (2013-09-20 19:30:51)


gh · da · ds

Offline

#153 2013-09-21 17:03:28

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: sxhkd — Simple X HotKey Daemon

Supplantr wrote:

"is there a way to easily use one key to cycle through multiple actions?"

As of 6f195e7, the following binding:

x
    echo {a-c}

will generate the following output when x is pressed 4 times:

a
b
c
a

gh · da · ds

Offline

#154 2013-10-01 15:19:25

moneylcj
Member
Registered: 2011-04-07
Posts: 14

Re: sxhkd — Simple X HotKey Daemon

is line length  limited?  This sequence can't be parsed rightly.

super + y;{0-6}
    echo {\'xterm -title MAIN-TERMINAL -e tmux\' \'MAIN-TERMINAL\',\
        \'wicd-client -n\' \'Wicd Network Manager\',\
        \'xterm -title VIFM -e /usr/bin/vifm\' \'VIFM\',\
        \'xterm -title TERMINAL-HTOP -e sudo htop\' \'TERMINAL-HTOP\',\
        \'gvim\' \'MAIN-GVIM\',\
        \'sgvim\' \'ROOT-GVIM\',\
        \'firefox\' \'Vimperator\'
    }

Offline

#155 2013-10-01 15:32:01

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: sxhkd — Simple X HotKey Daemon

moneylcj wrote:
        \'firefox\' \'Vimperator\'

There's a missing backslash at the end of the above line.


gh · da · ds

Offline

#156 2013-10-01 16:29:26

moneylcj
Member
Registered: 2011-04-07
Posts: 14

Re: sxhkd — Simple X HotKey Daemon

bloom wrote:
moneylcj wrote:
        \'firefox\' \'Vimperator\'

There's a missing backslash at the end of the above line.

Thanks bloom

modify \'firefox\' \'Vimperator\'  to  \'firefox\' \'Vimperator\'\
press super+o then 1-6,   output is

{'xterm -title MAIN-TERMINAL -e tmux' 'MAIN-TERMINAL','wicd-client -n' 'Wicd Network Manager','xterm -title VIFM -e /usr/bin/vifm' 'VIFM','xterm -title TERMINAL-HTOP -e sudo htop' 'TERMINAL-HTOP','gvim' 'MAIN-GVIM','sgvim' 'ROO

But when delete the  longest line, everything is ok.

Error:

super + y;{0-6}
    echo {\'xterm -title MAIN-TERMINAL -e tmux\' \'MAIN-TERMINAL\',\
        \'wicd-client -n\' \'Wicd Network Manager\',\
        \'xterm -title VIFM -e /usr/bin/vifm\' \'VIFM\',\
        \'xterm -title TERMINAL-HTOP -e sudo htop\' \'TERMINAL-HTOP\',\
        \'gvim\' \'MAIN-GVIM\',\
        \'sgvim\' \'ROOT-GVIM\',\
        \'firefox\' \'Vimperator\'\
    }

OK:

super + y;{0-5}
    echo {\'xterm -title MAIN-TERMINAL -e tmux\' \'MAIN-TERMINAL\',\
        \'wicd-client -n\' \'Wicd Network Manager\',\
        \'xterm -title VIFM -e /usr/bin/vifm\' \'VIFM\',\
        \'gvim\' \'MAIN-GVIM\',\
        \'sgvim\' \'ROOT-GVIM\',\
        \'firefox\' \'Vimperator\'\
    }

Offline

#157 2013-10-02 08:35:15

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: sxhkd — Simple X HotKey Daemon

moneylcj wrote:

Is line length  limited?

Yes it is and I've slightly increased the limit so that the given examples are all parsed successfully.


gh · da · ds

Offline

#158 2013-10-07 15:02:27

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: sxhkd — Simple X HotKey Daemon

what is the correct way to restart sxhkd?

i mean if i change my config file and want to reload sxhkd
I have this set up is it ok?

mode_switch + shift +r
			sxhkd -c ~/.config/sxhkd/myconfig

Last edited by chickenPie4tea (2013-10-07 15:03:47)


You can like linux without becoming a fanatic!

Offline

#159 2013-10-07 15:26:35

Stebalien
Member
Registered: 2010-04-27
Posts: 1,237
Website

Re: sxhkd — Simple X HotKey Daemon

You can send SIGUSR1 to reload sxhkd:

killall -SIGUSR1 sxhkd

Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

#160 2013-10-07 16:51:05

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: sxhkd — Simple X HotKey Daemon

@Stebalien  thanks for that - I couldn't find the best way to do it in the documentation on sxhkd

the SIGUSR1 command, never come across it before, don't know the first thing abt signals, need to look  it up, anyhow it works.

Last edited by chickenPie4tea (2013-10-07 16:56:26)


You can like linux without becoming a fanatic!

Offline

#161 2013-10-12 19:19:38

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: sxhkd — Simple X HotKey Daemon

how do you refer to the arrow keys?


You can like linux without becoming a fanatic!

Offline

#162 2013-10-14 20:28:01

robstwd
Member
From: Brisbane
Registered: 2010-10-31
Posts: 32

Re: sxhkd — Simple X HotKey Daemon

chickenPie4tea wrote:

how do you refer to the arrow keys?

The sxhkd github readme includes:

The keysym names are given by the output of xev.

And according to the arch wiki page for Extra Keyboard Keys, "...in a graphical environment...with the following command you can start xev and show only the relevant parts:"

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'

The result of which on my system, the arrow keys have the keysyms of:

113 Left
111 Up
116 Down
114 Right

And an example keybinding in my sxhkdrc is:

super + {Left,Right}
    bspc desktop --focus {prev,next}

Offline

#163 2014-01-05 20:56:44

3xOSC
Member
Registered: 2013-03-18
Posts: 107

Re: sxhkd — Simple X HotKey Daemon

For thinkpad users, we have a key whereby you press "fn+home" and it increases brightness.  That combination in xev is called "XFMonBrightnessUp".

I would like that hotkey to not only brighten up my screen, but also to run "notify-send 'brightness' '75%'" so that I will get a notification indicating the level it is at for dunst.

At the moment, I have placed this in my sxhkd:

XFMonBrightnessUp
    notify-send "brighter"

as a test, and I haven't had any luck.  Any ideas?


Edit:   SOLVED.

I am an idiot, it is actually called "XF86MonBrightnessUp"

Last edited by 3xOSC (2014-01-05 21:00:30)

Offline

#164 2014-01-11 04:45:14

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxhkd — Simple X HotKey Daemon

A small improvement could be made to the man page, clarifying that the '~' character replays the captured event/s -after- the command is executed.
(in the case of non-final elements in a key chain, earlier keys are replayed immediately since no command is bound directly to them.. I presume)

Also..
I take it that two-part brace expansion only works properly when the first expansion is part of the initial element of the keychain.

The reason I say this:

super + F6; {h,i,j} {x,y,z}
    echo {hello,I\'m,John} {xylophone,yeti,zebra}

.. the first brace-expansion is always expanded to 'hello', even though the binding appears to work as intended (super+F6 followed by h|i|j then x|y|z).

In case further clarification is needed, I'm saying that only three possible strings can be echoed with the above config, and they are 'hello xylophone' 'hello yeti' 'hello zebra'.

Whether the first pressed key was h,i, or j has no effect.

Fact that may be related: if you use : instead of ;, the {h,i,j} clause is ignored completely.. it's as if you had written

super + F6: {x,y,z}
    echo hello {xylophone,yeti,zebra}

Edit: Another bug report:
Synthetic key events that match an sxhkd rule will cause sxhkd to enter an infinite loop:

shift + s
    xdotool type S

This is an unrealistic example; my actual use case involves conditionally passing the captured event to the current window (so I can't use ~, it will unconditionally pass on the event)

AFAICS the fix involves ungrabbing the key immediately before executing the command, and regrabbing it after the command returns. That still leaves the possibility of forking commands causing a loop, but nobody can do anything to avoid that, I think, aside from just not doing things that cause race conditions smile

EDIT2: posted on github.

Last edited by likytau (2014-01-11 05:28:06)

Offline

#165 2014-01-11 05:21:37

Iao
Member
Registered: 2012-11-09
Posts: 20

Re: sxhkd — Simple X HotKey Daemon

super + Menu
   dmenu_run -i -q -h 24 -y 24 -o 0.83 -fn "Source Sans Pro-10" -nb "#000000" -nf "#aaaaaa" -sb "#3c3c3c" -sf "#ffffff" & \
   bspc config top_padding 48
   
super + Menu ; {Return,Escape}
   bspc config top_padding 24

My panel is 24px high, placed at the top of the screen. dmenu is also 24px high, placed directly beneath the panel. I'm trying to change the top padding to open space for dmenu when it is launched, and revert to the original padding when it is closed.

For this to be possible with sxhkd, it would need an option to allow chains that include grabbed chords and an option to allow nonconsecutive presses. The latter because when dmenu is launched, you need to type your command first then press return. I was wondering if you'd consider these features worthwhile to implement.

Also, I'm not sure if this is supposed to happen but when dmenu is launched, sxhkd chords won't work until dmenu is closed.

Offline

#166 2014-01-11 05:35:21

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxhkd — Simple X HotKey Daemon

Iao wrote:
super + Menu
   dmenu_run -i -q -h 24 -y 24 -o 0.83 -fn "Source Sans Pro-10" -nb "#000000" -nf "#aaaaaa" -sb "#3c3c3c" -sf "#ffffff" & \
   bspc config top_padding 48
   
super + Menu ; {Return,Escape}
   bspc config top_padding 24

My panel is 24px high, placed at the top of the screen. dmenu is also 24px high, placed directly beneath the panel. I'm trying to change the top padding to open space for dmenu when it is launched, and revert to the original padding when it is closed.

For this to be possible with sxhkd, it would need an option to allow chains that include grabbed chords and an option to allow nonconsecutive presses. The latter because when dmenu is launched, you need to type your command first then press return. I was wondering if you'd consider these features worthwhile to implement.

Also, I'm not sure if this is supposed to happen but when dmenu is launched, sxhkd chords won't work until dmenu is closed.

For any program at all to implement that, you'd first have to define how, exactly, they can distinguish between the [chord, secondkey] and [chord] cases, even in theory.

(BTW: dmenu grabs the entire keyboard, exclusively, my WM's bindings don't work in dmenu either.)

Offline

#167 2014-01-11 06:31:32

Iao
Member
Registered: 2012-11-09
Posts: 20

Re: sxhkd — Simple X HotKey Daemon

likytau wrote:

For any program at all to implement that, you'd first have to define how, exactly, they can distinguish between the [chord, secondkey] and [chord] cases, even in theory.

After some testing, I've found that identical functionality is actually already possible. In the chain, you just need to use the key release version of the original chord. Here is an example:

super + KP_Enter
   pamixer --toggle-mute
   
@super + @KP_Enter; Return
   pamixer --toggle-mute

However, this isn't an ideal implementation because you cannot use the key release version of the chord alone. I guess that doesn't matter much, though. I can't think of when it'd be useful, but I'm sure someone would want the option at some point.

(BTW: dmenu grabs the entire keyboard, exclusively, my WM's bindings don't work in dmenu either.)

Ah, okay.

Offline

#168 2014-01-11 08:14:07

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxhkd — Simple X HotKey Daemon

Well, you surprised me.  Because I was thinking of key events being singular, rather than split up into keydown and keyup, I was thinking that it's completely impossible to implement what you requested. Clearly that's not the case. But now that I think about it again, you could kind of kludge it to work in the way you originally requested by having  the simpler keybinding have an implicit timeout period at the end.

That is, the simpler version could fire after [the user presses the shortcut, and the timeout runs out], the chain version could fire normally (pressing the consecutive keys before the timeout occurs). Seems irritating, I don't know of any better way yet though.

Offline

#169 2014-01-11 12:49:41

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: sxhkd — Simple X HotKey Daemon

Iao wrote:
super + Menu
   dmenu_run -i -q -h 24 -y 24 -o 0.83 -fn "Source Sans Pro-10" -nb "#000000" -nf "#aaaaaa" -sb "#3c3c3c" -sf "#ffffff" & \
   bspc config top_padding 48
   
super + Menu ; {Return,Escape}
   bspc config top_padding 24

My panel is 24px high, placed at the top of the screen. dmenu is also 24px high, placed directly beneath the panel. I'm trying to change the top padding to open space for dmenu when it is launched, and revert to the original padding when it is closed.

The proper way to do this is:

super + Menu
    bspc config -d focused top_padding 24; \
    $(dmenu_path | dmenu -i -q -h 24 -y 24 -o 0.83 -fn "Source Sans Pro-10" -nb "#000000" -nf "#aaaaaa" -sb "#3c3c3c" -sf "#ffffff"); \
    bspc config -d focused top_padding 0

Remarks:

  • dmenu_run forks, that's why I replaced it by an explicit, non-forking call.

  • I changed the padding of the local desktop, to avoid altering the padding of another monitor.

  • You should use an environment variable for the panel height, instead of writing 24 everywhere.


gh · da · ds

Offline

#170 2014-01-11 14:34:41

Iao
Member
Registered: 2012-11-09
Posts: 20

Re: sxhkd — Simple X HotKey Daemon

Thank you.

Offline

#171 2014-01-20 09:24:21

angelic_sedition
Member
Registered: 2014-01-20
Posts: 124
Website

Re: sxhkd — Simple X HotKey Daemon

I'll preface this by saying that, as a former xbindkeys user, sxhkd is truly a breath of fresh air. I honestly can't think of another program I have been more happy to stumble across. I especially love that it supports chaining and modes. I do a lot of remapping and have been experimenting with this to see what I can do and have had some interesting things happen.

I have grave set up as a prefix key and since setting up any mapping with "grave : something" will basically cause any "grave ; somethingelse" to also trigger a mode, I was trying to see if I could use both a prefix key and a mode when I double tap grave by doing the following:

grave ; grave : q
    anything (I tested with 'xdotool key Escape' and 'urxvt')

This actually produces a sort of hybrid between a prefix key and a mode. When I have this set up and I press grave twice it results in an around 5 second time period where it will act as a mode and multiple commands can be entered as if grave had been pressed (i.e I have grave ; # set to go to # desktop.. If I press grave twice I can then hit 1 2 3 4 etc. and use any commands for a few seconds before it will stop).

Is this an intended effect? If not, it might make a great feature, for example if you wanted to do a few things without having to hit a prefix key every time but it wasn't going to take long enough that you wanted to have to escape it. I don't know just how useful it would be if you could specify seconds or if you could even do much else with it, but I think it's a pretty interesting result regardless.

Last edited by angelic_sedition (2014-01-20 09:27:07)

Offline

#172 2014-01-20 12:35:29

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: sxhkd — Simple X HotKey Daemon

angelic_sedition wrote:

This actually produces a sort of hybrid between a prefix key and a mode.

There was a bug, the following:

a ; b : c
	echo abc

was not working as expected.
It is fixed by 520b1f1.

angelic_sedition wrote:

Is this an intended effect?

No and I can't reproduce it.

If I understand you correctly, the following:

a ; c
	echo ac

a ; a : b
	echo aab

yields ac when you press aac?


gh · da · ds

Offline

#173 2014-01-20 17:56:11

angelic_sedition
Member
Registered: 2014-01-20
Posts: 124
Website

Re: sxhkd — Simple X HotKey Daemon

Yes, that's correct. Not only that but if you also have the following,

a ; d
        echo ad

aacdcdd.. will yeld acdcdd.. for a period of about five seconds.

I looked back through my sxhkdrc and commented out all grave mappings but the following and was still able to reproduce this effect.

grave ; grave : u
	bspc control --toggle-visibility

grave ; m
	urxvt

I tested it with different letters and commands, and the effect was still the same. Commenting out the first part made it stop working (meaning that I am successfully reloading my sxhkdrc). With these mappings, if I hit grave grave m m m, the result will be to spawn 3 urxvt terminals. Any other keypresses that aren't mapped during this five second time period have no effect.

Anyway, I don't know why this bug is only happening to me. Also, I installed sxhkd-git from the aur and the number is 114-1.

The updated version has no problems with this (though chaining only works to a certain depth; i.e.  "a ; b : d ; c" will result in something mapped to  "a ; b : c."

Last edited by angelic_sedition (2014-02-08 16:53:54)

Offline

#174 2014-06-01 15:58:05

Kamiru_
Member
Registered: 2014-04-15
Posts: 5

Re: sxhkd — Simple X HotKey Daemon

Hello, I made a script for bspwm: http://hastebin.com/onepomojim.bash
When I execute the script from my terminal it works perfectly fine, however, if I execute the script with sxhkd it doesn't work, does anyone know why?

The script is binded with:

super + button1
     selecto

(selecto is the name of the script, I placed it in my /usr/bin directory)

Offline

#175 2014-06-01 16:43:57

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxhkd — Simple X HotKey Daemon

Kamiru_ wrote:

Hello, I made a script for bspwm: http://hastebin.com/onepomojim.bash
When I execute the script from my terminal it works perfectly fine, however, if I execute the script with sxhkd it doesn't work, does anyone know why?

The script is binded with:

super + button1
     selecto

(selecto is the name of the script, I placed it in my /usr/bin directory)

Is the space in the hashband meant to be there?
Anyway try:

super + button1
    /bin/zsh /usr/bin/selecto

Offline

Board footer

Powered by FluxBB