百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dxhd

> 编程语言
开源

Daky 的 X11 快捷键守护程序

100 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Daky 的 X11 快捷键守护程序

dxhd

daky's X11 hotkey daemon

dxhd is heavily inspired by sxhkd, written in Go, and has an elegant syntax for configuration files!

Thanks JetBrains for providing dxhd with free licenses.

READ THIS NOTICE FIRST

Dear repository visitor, I'm sorry I wrote a horrible codebase years ago which I've tried to rewrite a couple of times now but never finished because of losing interest sometimes, because of work sometimes, because of my "time for a new side-project" mood sometimes.

However, I want to tell you the rewrite will definitely take place, because I want to apply things I have learnt to dxhd. I want to write a proper parser this time, I want to structure codebase properly this time, I want to show my today's Go knowledge & practice in dxhd codebase because current master branch does not represent it. I usually put dxhd in my CV but always hate to do it because current master codebase does not show my present Go skills but rather my past mistakes that taught me how not to program.

The rewrite process will begin in 2022 summer: July and august.

READ THIS SECOND (older notice)

dxhd is being rewritten in the Rust programming language. The two main collaborators, dakyskye and NotUnlikeTheWaves, are working on it.

Follow issue #39 for more information regarding the rewrite.

dxhd is going to be rewritten in Go only to provide much better codebase to make contributions easier as well as have a quality code so others can reference from it.

The reason why a rewrite is required is that the current codebase is terrible (but the app works well so it does not matter for an end-user). There is only one known bug in the parser which I have documented here. It will be resolved, as well as many things will be improved, after releasing the rewritten dxhd.

The bug:

bash
#!/bin/sh

# super + {a,b}
echo it was either {aaaaa,bbbbbbb}
echo I want to print {aaaaa,bbbbbbb}
echo I can print anything {tho, though}

Parser will error on this. There is a workaround you can use (for some cases):

bash
#!/bin/sh

# super + {a,b}
what={aaaaa,bbbbbbb}
echo it was either "$what"
echo I want to print "$what"
# echo I can print anything {tho, though} 

# modifier + @keys

Running

By just running dxhd, you only get information level logs, however, you can set DEBUG environment variable, which will output more information, like what bindings are registered, what command failed etc.

To kill every running instance of dxhd, you can use built-in -k flag, which under the hood uses pkill command to kill instances.

Daemonisation

Rather than dxhd self daemonising itself, let other programs do their job.

The --background (-b) flag is a simple workaround for daemonising dxhd. It uses /usr/sh shell to achieve it, as Go does not allow forking a process without executing it.

Examples

  • shell
  • python
  • author's config

License

Licensed under the MIT license.

FAQ

Why was dxhd made

Because I had (and have) 20 workspaces, and sxhkd did not allow me to define 11-19 range easily which was one of the main reasons I started developing dxhd.

What makes dxhd better than sxhkd

  • dxhd uses shebang to determine which shell to use (so you don't have to set an environment variable).
  • dxhd configuration file syntax matches shell, Python, Perl and probably some other language syntaxes.
  • dxhd config lets you declare global variables for each keybinding command.
  • dxhd is great with scripting, because of its elegant syntax. Multi line scripts do not need \ at the end of line.
  • dxhd allows you to have different range in a keybinding's command, for example, 1-9 in a keybinding, and
  • 11-19 in its body (command area).
  • dxhd has support for mouse bindings out of the box, no patching required!

How do I port my sxhkd config to dxhd

It is simple enough! (I personally used Vim macros when I did it... Vim users will get it)

  • convert any line starting with single # to a dxhd comment (so ## or more)
  • put a # before every keybinding (super + a to # super + a)
  • remove spaces before lines ( echo foo to echo foo) (optional)
  • remove every end-line backslash (echo bar \ to echo bar) (most likely optional, unsure)

So you'd end up from:

bash
# print hello world
super + a
	echo hello \
	echo world

with

bash
#!/bin/sh

## print hello world
# super + a
echo hello
echo world

I use ranges, released key events and chords from sxhkd, does dxhd have them

Yes! And no. dxhd has released key events and ranges, but no chords (yet - WIP)

How do global variables inside a config file work

Everything after (if there is) the shebang before the first comment/keybinding is collected and passed to each keybinding's command.

A shell example:

bash
#!/bin/sh

INFO="$(wmctrl -m)"

## print info about my WM
# super + i
echo "Info about your WM:"
echo "$INFO"

A Python example:

python
#!/usr/bin/python

foo="foo bar"

## print the value of foo variable
# super + i
print(foo)

Is dxhd faster than sxhkd

They haven't benchmarked yet, so I don't know. However, I have been using dxhd since the first release and haven't noticed any speed loss!

Why is the released binary file +8mb +6mb +3mb

Because it's statically built, to make sure it will work on any supported machine!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Godaemondxhdgogolang

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言