@@ -51,6 +51,7 @@ and copy `dxhd` executable file to somewhere in your `$PATH`
51
51
* in-place reloading (` dxhd -r ` )
52
52
* calculating the time parsing a config file took (` dxhd -p ` )
53
53
* support for any shell scripting language (sh, bash, ksh, zsh, python, perl etc.) given as a shebang
54
+ * support for global variable declarations in a config
54
55
* support for scripting, as much as a user wishes!
55
56
56
57
### Demo
@@ -75,6 +76,8 @@ A dxhd config file should contain a shebang (defaults to `/bin/sh`) on top of a
75
76
```
76
77
#!/shebang
77
78
79
+ test=5 # a globally declared variable for each keybinding command
80
+
78
81
## a comment
79
82
######### also a comment
80
83
@@ -126,6 +129,7 @@ that was one of the main reasons I started developing dxhd
126
129
127
130
* dxhd uses shebang to determine which shell to use (so you don't have to set an environment variable)
128
131
* dxhd config file syntax matches shell, python, perl and probably some other languages syntax
132
+ * dxhd config lets you declare global variables for each keybinding command
129
133
* dxhd is great with scripting, because of it's elegant syntax. multi line scripts do not need ` \ ` at the end of line
130
134
* dxhd allows you to have different range in a keybinding's action, for example, ` 1-9 ` in a keybinding, and ` 11-19 ` in it's action
131
135
* dxhd has support for mouse bindings out of the box, no patching required!
@@ -162,6 +166,35 @@ echo world
162
166
163
167
Yes! And no. dxhd has released key events and ranges, but no chords (yet - [ wip] ( https://github.com/dakyskye/dxhd/issues/8 ) )
164
168
169
+ ### How does global variables inside a config file work
170
+
171
+ Everything after (if there is) the shebang before the first comment/keybinding is collected and passed to each keybinding command
172
+
173
+ A shell example:
174
+
175
+ ``` sh
176
+ #! /bin/sh
177
+
178
+ INFO=" $( wmctrl -m) "
179
+
180
+ # # print info about my WM
181
+ # super + i
182
+ echo " Info about your WM:"
183
+ echo " $INFO "
184
+ ```
185
+
186
+ A Python example:
187
+
188
+ ``` py
189
+ # !/usr/bin/python
190
+
191
+ foo= " foo bar"
192
+
193
+ # # print the value of foo variable
194
+ # super + i
195
+ print (foo)
196
+ ```
197
+
165
198
### Is dxhd faster than sxhkd
166
199
167
200
They haven't benchmarked yet, so I don't know.
0 commit comments