-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
executable file
·50 lines (44 loc) · 1.58 KB
/
test
File metadata and controls
executable file
·50 lines (44 loc) · 1.58 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
declare CAKB_JSON_FOLDER="${HOME}/.local/share/omarchy.plugins/cakb/json"
declare CAKB_USER_JSON_FOLDER="~/.config/cakb/json"
dynamic_bindings() {
local active_window config
local keymap=`cat unknown_app.json`
active_window_json=`hyprctl activewindow -j`
local active_window_class=`echo ${active_window_json} | jq -r '{initialClass} | "\(.initialClass)"'`
local active_window_title=`echo ${active_window_json} | jq -r '{initialTitle} | "\(.initialTitle)"'`
config="${CAKB_JSON_FOLDER}/${active_window_class}.json"
if test -f "$config"; then
keymap=`cat ${config}`
fi
config="${CAKB_USER_JSON_FOLDER}/${active_window_class}.json"
if test -f "$config"; then
keymap=`cat ${config}`
fi
echo "$keymap" |
jq -r '.[] | {modmask, key, keycode, description, dispatcher, arg} | "\(.modmask),\(.key)@\(.keycode),\(.description),\(.dispatcher),\(.arg)"' |
sed -r \
-e 's/null//' \
-e 's,~/.local/share/omarchy/bin/,,' \
-e 's,uwsm app -- ,,' \
-e 's,uwsm-app -- ,,' \
-e 's/@0//' \
-e 's/,@/,code:/' \
-e 's/^0,/,/' \
-e 's/^1,/SHIFT,/' \
-e 's/^4,/CTRL,/' \
-e 's/^5,/SHIFT CTRL,/' \
-e 's/^8,/ALT,/' \
-e 's/^9,/SHIFT ALT,/' \
-e 's/^12,/CTRL ALT,/' \
-e 's/^13,/SHIFT CTRL ALT,/' \
-e 's/^64,/SUPER,/' \
-e 's/^65,/SUPER SHIFT,/' \
-e 's/^68,/SUPER CTRL,/' \
-e 's/^69,/SUPER SHIFT CTRL,/' \
-e 's/^72,/SUPER ALT,/' \
-e 's/^73,/SUPER SHIFT ALT,/' \
-e 's/^76,/SUPER CTRL ALT,/' \
-e 's/^77,/SUPER SHIFT CTRL ALT,/'
}
dynamic_bindings