https://github.com/webfreak001/xkeybind
Interface for global keyboard shortcuts on X11 in D applications.
https://github.com/webfreak001/xkeybind
Last synced: 5 months ago
JSON representation
Interface for global keyboard shortcuts on X11 in D applications.
- Host: GitHub
- URL: https://github.com/webfreak001/xkeybind
- Owner: WebFreak001
- License: mit
- Created: 2016-01-02T01:14:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-02T01:19:44.000Z (over 10 years ago)
- Last Synced: 2025-01-11T04:13:06.348Z (over 1 year ago)
- Language: D
- Size: 2.93 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XKeyBinD
Interface for global keyboard shortcuts on X11 in D applications.
## Usage
```d
import xkeybind;
void main() {
XKeyBind.load(); // Opens a X11 display and initializes virtual modifier locations
// Alternatively also usable with a Modifier and an integer keycode
XKeyBind.bind("Ctrl-Shift-X", (mod, key) { // Binds a key from a string (see notation below) with a handler
writeln("Pressed!");
XKeyBind.unbind("Ctrl-Shift-X"); // Unbinds all handlers from a key
});
while (true) {
// Handle window events
XKeyBind.update(); // Handles X11 key press events and calls handlers
}
}
```
## String key notation
(Modifiers-)Key
Any number of modifiers combined with hyphens and a key at the end.
Valid modifiers:
* shift
* control
* ctrl
* alt, altl
* altgr, altr
* super, superl
* superr
* hyper, hyperl
* hyperr
* meta, metal
* metar
Keys are parsed using `XStringToKeysym`