-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsxmo_lc.sh
executable file
·51 lines (42 loc) · 1.44 KB
/
sxmo_lc.sh
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
command -v /usr/bin/sxmo_common.sh > /dev/null && . /usr/bin/sxmo_common.sh
command -v sxmo_hook_icons.sh > /dev/null && . sxmo_hook_icons.sh
off="🔹"
on="🔅"
itm=${icon_itm:-">"}
icon_cls=${icon_cls:-🗙}
icon_trm=${icon_trm:-}
icon_hom=${icon_hom:-}
icon_light=
LC=${LC:-lc.py}
command -v "$LC" > /dev/null || LC=./lc.py
MENU_CMD=${MENU_CMD:-sxmo_dmenu.sh}
command -v "$MENU_CMD" > /dev/null || MENU_CMD='bemenu --fn "DejaVuSansMono 22" -l 30 -w --tb \#285577 --tf \#FFFFFF --scf \#285577 --hf \#FFFFFF --hb \#285577'
MENU_CMD="$MENU_CMD -ip '$icon_light LC'"
TERM="sxmo_keyboard.sh open; sxmo_terminal.sh"
command -v sxmo_terminal.sh > /dev/null|| TERM=foot
status=$($LC -r)
while true; do
line=$((
# echo "$icon_trm Command Line"
echo "$status" | sed -e "s/^\([^ ]\)/$itm \1/" -e "s/-/$off/" -e "s/#/$on/"
echo "$icon_cls Exit menu - quit"
) | eval "$MENU_CMD")
if [[ $line =~ $on ]] ; then
$LC ${line:1:1} &
status=$(echo "$status" | sed -e "s/${line:1:1} #/${line:1:1} -/")
elif [[ $line =~ $off ]] ; then
$LC ${line:1:1} &
status=$(echo "$status" | sed -e "s/${line:1:1} -/${line:1:1} #/")
elif [[ $line == "" || $line =~ "Exit" ]] ; then
exit
elif [[ $line =~ "Refresh" || $line =~ "$itm" ]] ; then
status=$($LC -r)
elif [[ $line =~ "Command" || $line =~ "cmd" ]] ; then
eval "$TERM" -T LightControl -f 'DejaVuSansMono:size=22' $LC
exit
else
$LC $line
status=$($LC -r)
fi
done