summaryrefslogtreecommitdiff
path: root/.config/hypr/macros.m4
blob: 98e1efff82a9d420e13573cb11c76b8e36f42e10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
changequote([,])

define(__submap, [
	bind = $modkey, $2, submap, $1
	submap = $1
	$3
	bind = , catchall, submap, reset
	submap = reset
])

define(__bindX, [
	ifelse([$#], 4, [
		bind$1 = $2, $3, exec, exec $4 2>/dev/null >&2
	], [
		bind$1 = $modkey, $2, exec, exec $3 2>/dev/null >&2
	])
])

define(__bind,  [__bindX(, $@)])
define(__binde, [__bindX(e,$@)])
define(__subbind, [
	__bindX(,,$@)
	bind = , $1, submap, reset
])

define(__setup_env, [
	esyscmd([
		sed -E '
			/^export/!d
			/`/d
			s/^export ([A-Z0-9a-z_]+)="(.*)"/env = \1, \2/
			s/^export ([A-Z0-9a-z_]+)=\x27(.*)\x27/env = \1, \2/
			s/^export ([A-Z0-9a-z_]+)=(.*)/env = \1, \2/
		' ~/.bashrc
	])
])