OSDN Git Service

instantupdate auto repairs repos
[instantos/instantOS.git] / programs / instanthotkeys
1 #!/usr/bin/env bash
2 # Show a list of available key bindings
3
4 dlbinds() {
5     curl -s 'https://raw.githubusercontent.com/instantOS/instantos.github.io/master/youtube/hotkeys.md' 2>/dev/null |
6         sed 's/^\([^|#]\)/    \1/g' |
7         sed 's/^##*[ ]*/ /g' >~/.cache/instantos/hotkeys.md \
8     || \
9     cp /usr/share/instantutils/keybinds .cache/instantos/hotkeys.md
10 }
11
12 if ! [ -e ~/.cache/instantos/hotkeys.md ]; then
13     mkdir -p ~/.cache/instantos 2>&1 >/dev/null
14     dlbinds
15 fi
16
17 cat ~/.cache/instantos/hotkeys.md >/tmp/hotkeys
18
19 # allow user to add to the list
20 if [ -e ~/.config/instantos/hotkeys ]; then
21     echo -e "user generated notes:\n" >>/tmp/hotkeys
22     cat ~/.config/instantos/hotkeys >>/tmp/hotkeys
23 fi
24
25 dlbinds &
26
27 # optional GUI mode
28 if [ -z "$1" ]; then
29     less --mouse --wheel-lines=3 /tmp/hotkeys
30 else
31     sed 's/^/>/g' /tmp/hotkeys | 
32       instantmenu -i -c -l 35 -fn "Fira Code Nerd Font:pixelsize=13" -bw 3
33 fi