You are not logged in.

#1 2013-01-03 19:41:59

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

sxhkd — Simple X HotKey Daemon

Homepage:
    https://github.com/baskerville/sxhkd

Mailing List:
    sxhkd at librelist dot com

Last edited by bloom (2015-02-16 17:24:58)


gh · da · ds · cr · ab · fkr

Offline

#2 2013-01-03 19:56:19

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,709

Re: sxhkd — Simple X HotKey Daemon

bloom wrote:

sxhkd is intended to replace xbindkeys.

May I ask why? I'm not trying to be snarky, I'm genuinely curious. Does this new tool add functionality, or fix something broken in xbindkeys?

Last edited by 2ManyDogs (2013-01-03 19:59:20)

Online

#3 2013-01-04 02:10:18

chneukirchen
Member
Registered: 2010-02-11
Posts: 100

Re: sxhkd — Simple X HotKey Daemon

It doesn't include a scheme interpreter, at least.

@bloom, how hard would it be to also add grabs for mouse-clicks on the root window? This could be pretty useful together with minimalist window managers.

Offline

#4 2013-01-04 10:33:41

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

Re: sxhkd — Simple X HotKey Daemon

2ManyDogs wrote:

Does this new tool add functionality, or fix something broken in xbindkeys?

I prefer to remove functionalities ☺

I had a few issues with xbindkeys which led me to write sxhkd:

  • It isn't KISS (Guile, -k, -mk, ...).

  • The commands of the configuration file have to be surrounded by double quotes and don't support environment variables.

  • There are two mechanisms for reloading the configuration file: none of them works.

  • Implicit modifier names ('alt', 'super', ...) are not supported.

Last edited by bloom (2013-01-04 11:40:45)


gh · da · ds · cr · ab · fkr

Offline

#5 2013-01-04 10:42:00

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

Re: sxhkd — Simple X HotKey Daemon

chneukirchen wrote:

how hard would it be to also add grabs for mouse-clicks on the root window?

It would be quite simple, but could you provide a concrete use case example?

Last edited by bloom (2013-01-04 11:40:27)


gh · da · ds · cr · ab · fkr

Offline

#6 2013-01-04 12:04:31

irtigor
Member
Registered: 2011-01-21
Posts: 44

Re: sxhkd — Simple X HotKey Daemon

To launch a menu (mygtkmenu, dzen, 9menu...) with right-click, or change workspaces with middle-click. Another ideia would be to implement keychains in a similar way to subtle and openbox (press a master key, release it, then press another to exec/finish the action).

Offline

#7 2013-01-04 17:27:06

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: sxhkd — Simple X HotKey Daemon

bloom wrote:
  • The commands of the configuration file have to be surrounded by double quotes and don't support environment variables.

  • There are two mechanisms for reloading the configuration file: none of them works.

These are the two reasons that I am going to start using this, especially the bolded one. Thanks.

Offline

#8 2013-01-04 21:59:51

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

Re: sxhkd — Simple X HotKey Daemon

chneukirchen wrote:

How hard would it be to also add grabs for mouse-clicks on the root window?

I've implemented this in the mouse branch.

This branch provides the following new keysym names: button1, button2, button3, ..., button24.

The next important feature I plan to implement is templates:

super + alt + 0-9
    mpc -q seek %{0-9%}0%

super + h,j,k,l
    bspc focus %{left,down,up,right%}

Last edited by bloom (2013-01-04 22:01:53)


gh · da · ds · cr · ab · fkr

Offline

#9 2013-01-04 22:28:09

chneukirchen
Member
Registered: 2010-02-11
Posts: 100

Re: sxhkd — Simple X HotKey Daemon

bloom wrote:
chneukirchen wrote:

How hard would it be to also add grabs for mouse-clicks on the root window?

I've implemented this in the mouse branch.

This branch provides the following new keysym names: button1, button2, button3, ..., button24.

This seems to work on any click, not just on the root window. (Which perhaps is cool too, but not what I want.)

Offline

#10 2013-01-05 10:04:42

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

Re: sxhkd — Simple X HotKey Daemon

chneukirchen wrote:

This seems to work on any click, not just on the root window.

Hotkeys are, by definition, global.


gh · da · ds · cr · ab · fkr

Offline

#11 2013-01-05 20:01:14

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: sxhkd — Simple X HotKey Daemon

I've got a feature request:

Would it be possible to to have multiple config files that merge into one? What I mean is, when sxhkd runs it loads the default config file or whatever one is specified by -c. Then, if I were to later run the command sxhkd -merge CONF_FILE_2, the commands in CONF_FILE_2 would be added to those in the originally loaded file.

The reason for this is simple: you can maintain a list of universal hotkeys in one conf file, and a list that is specific to a different machine, WM, etc. You could simple create multiple list with the same commands defined, but then if you want to change one of the universal hotkeys, you have multiple files to edit instead of just one.

Offline

#12 2013-01-05 21:27:06

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

Re: sxhkd — Simple X HotKey Daemon

bslackr wrote:

Would it be possible to to have multiple config files that merge into one? What I mean is, when sxhkd runs it loads the default config file or whatever one is specified by -c. Then, if I were to later run the command sxhkd -merge CONF_FILE_2, the commands in CONF_FILE_2 would be added to those in the originally loaded file.

That could be achieved by adding a -f FIFO option. Then you would output the content of your supplemental configuration files to it, but when receiving SIGUSR1, it would not be possible to reload the FIFO...

bslackr wrote:

The reason for this is simple: you can maintain a list of universal hotkeys in one conf file, and a list that is specific to a different machine, WM, etc.

It makes sense.


gh · da · ds · cr · ab · fkr

Offline

#13 2013-01-05 21:31:59

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

Re: sxhkd — Simple X HotKey Daemon

I have implemented sequences, which means that you can now use the following:

super + {h,j,k,l}
    bspc focus {left,down,up,right}

instead of

super + h
    bspc focus left
super + j
    bspc focus down
super + k
    bspc focus up
super + l
    bspc focus right

Last edited by bloom (2013-01-05 21:33:21)


gh · da · ds · cr · ab · fkr

Offline

#14 2013-01-06 10:18:27

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

Re: sxhkd — Simple X HotKey Daemon

@bslackr:
I've added support for extra configuration files, and the synopsis is now:

sxhkd [-h|-v|-c CONFIG_FILE] [EXTRA_CONFIG ...]

gh · da · ds · cr · ab · fkr

Offline

#15 2013-01-06 12:26:58

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: sxhkd — Simple X HotKey Daemon

irtigor wrote:

[...]  Another ideia would be to implement keychains in a similar way to subtle and openbox (press a master key, release it, then press another to exec/finish the action).

Take a look at xchainkeys, which is somewhat similar to this project, but has its emphasis on keychaining. Supports the crucial feature of passing through the prefix key to the focused application (e.g. what screen does with C-a a or ratpoison does with C-t t).

Offline

#16 2013-01-06 15:21:48

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: sxhkd — Simple X HotKey Daemon

bloom wrote:

@bslackr:
I've added support for extra configuration files, and the synopsis is now:

sxhkd [-h|-v|-c CONFIG_FILE] [EXTRA_CONFIG ...]

Awesome, thanks.

Offline

#17 2013-01-06 18:31:22

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: sxhkd — Simple X HotKey Daemon

I'm trying to invoke sxhkd from my xinitrc with the default configuration file and one extra configuration file, but for some reason only the default configuration file is working. When I kill it, and then invoke the same command from the terminal, all hotkeys work. Do you have any reason why this might be?

Here's the command:

sxhkd ~/.config/sxhkd/$HOST &

Edit: Nevermind, this has nothing to do with sxhkd. $HOST doesn't exist in sh, which startx runs. I just had to change how slim invokes startx.

Last edited by bslackr (2013-01-06 18:50:14)

Offline

#18 2013-01-07 10:24:39

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

Re: sxhkd — Simple X HotKey Daemon

I've added support for the specification of alternative shells: the content of the first defined environment variable among:

  • SXHKD_SHELL

  • SHELL

will be used as the shell absolute path.


gh · da · ds · cr · ab · fkr

Offline

#19 2013-01-08 17:15:13

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

Re: sxhkd — Simple X HotKey Daemon

I've added support for pointer motion hotkeys.

Example:

ctrl + super + !button1
    echo Pointer root coordinates: %i, %i.

gh · da · ds · cr · ab · fkr

Offline

#20 2013-01-09 14:25:35

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

Re: sxhkd — Simple X HotKey Daemon

Sequences now span the entire hotkey, making the following possible:

super + {alt,ctrl,alt + ctrl} + Eject
    sudo systemctl {suspend,reboot,poweroff}

gh · da · ds · cr · ab · fkr

Offline

#21 2013-01-09 17:46:11

VCoolio
Member
From: Netherlands
Registered: 2010-01-05
Posts: 119

Re: sxhkd — Simple X HotKey Daemon

Hi, awesome tool, thanks for that. Especially the sequences stuff. Uses maybe one third of the lines I have with xbindkeys, allthough that always worked fine for me. Question: when run from commandline, sxhkd not only has output for sxhkd, but also for the apps you call with a keybinding. Not sure if that's a bug or a feature. Did you deliberately do this? Is it configurable? (apart from appending >/dev/null 2>&1 to every command line in sxhkdrc)

Offline

#22 2013-01-09 20:07:47

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

Re: sxhkd — Simple X HotKey Daemon

This is a valid complaint, therefore, I've created a new option:

-r REDIR_FILE
    Redirect the commands output to the given file.

Thanks.

Last edited by bloom (2013-01-09 20:08:00)


gh · da · ds · cr · ab · fkr

Offline

#23 2013-01-09 21:58:21

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

Re: sxhkd — Simple X HotKey Daemon

Very simple/sloppy vim syntax:

if exists("b:current_syntax")
    finish
endif

syntax include @Shell syntax/sh.vim

syn match sxMapping "[^ #].*" contains=sxKey,sxMod,sxConj,sxTemplate
syn match sxKey "[^ {,}+]\+" contained contains=sxKeyMod
syn match sxKeyMod "[!@]" contained
syn keyword sxMod super hyper meta alt control ctrl shift mode_switch lock mod1 mod2 mod3 mod4 mod5 contained
syn match sxConj "+" contained
syn region sxTemplate matchgroup=sxBrace start=/{/ end=/}/ contained keepend oneline contains=sxKey,sxMod,sxConj,sxComma
syn match sxComma "," contained


syn match sxComment "^#.*$"
syn match sxCmd "^ .*$" containedin=ALL contains=@Shell

hi def link sxKey Identifier
hi def link sxKeyMod Special
hi def link sxMod Keyword
hi def link sxBrace Special
hi def link sxConj Delimiter
hi def link sxComma Delimiter
hi def link sxComment Comment

let b:current_syntax = "sxhkdrc"

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

Offline

#24 2013-01-10 09:43:11

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,841

Re: sxhkd — Simple X HotKey Daemon

Trying this out it looks very good. One issue I have though is I can't get it to recognise my windows key. It was "mod4" under xbindkeys (and my WM) and xev says it's "Super_L", but trying both "super" and "mod4" in sxhkd results in nothing happening.

If I use "super + F3" (and maybe some other combinations, I'd have to check) results in the following messages:

# F3 Contacts
super + F3
    tmnl -title Contacts -e bash -i -c contacts
Could not grab key 69 with modfield 64: the combination is already grabbed.
Could not grab key 69 with modfield 80: the combination is already grabbed.
Could not grab key 69 with modfield 66: the combination is already grabbed.
Could not grab key 69 with modfield 82: the combination is already grabbed.
Could not grab key 69 with modfield 64: the combination is already grabbed.
Could not grab key 69 with modfield 80: the combination is already grabbed.
Could not grab key 69 with modfield 66: the combination is already grabbed.
Could not grab key 69 with modfield 82: the combination is already grabbed.

I do use the windows key in my WM (spectrwm) so these may be related to that - but not the with the Fx keys which I'm trying to map using sxhkd.
"alt + Fx" is working fine.

Finally, it's not recognising the XF86 audio keys:

#-- Audio Keys 
   
XF86AudioRaiseVolume
    amixer sset Master 1+ unmute

XF86AudioLowerVolum
    amixer sset Master 1- unmute

XF86AudioMute
    amixer sset Master toggle
Unrecognized key name: 'XF86AudioRaiseVolume'.
Invalid hotkey: 'XF86AudioRaiseVolume'.
Unrecognized key name: 'XF86AudioLowerVolum'.
Invalid hotkey: 'XF86AudioLowerVolum'.
Unrecognized key name: 'XF86AudioMute'.
Invalid hotkey: 'XF86AudioMute'

These are the names returned by xev.

Any ideas what I'm doing wrong?


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#25 2013-01-10 10:24:22

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

Re: sxhkd — Simple X HotKey Daemon

Stebalien wrote:

Very simple/sloppy vim syntax

Thanks a lot (at first, I thought you wanted me to implement a vim like syntax in sxhkd ☺)!
I made a pathogen friendly repo for this here.


gh · da · ds · cr · ab · fkr

Offline

Board footer

Powered by FluxBB