-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapps
executable file
·92 lines (64 loc) · 1.55 KB
/
apps
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
export WMRC_DEPENDENCIES='pgrep'
APPS='unclutter -idle 1
redshift-qt
libinput-gestures-setup start
xhost +si:localuser:$USER
keepassxc
kdeconnect-indicator
flameshot
thunderbird
signal-desktop --start-in-tray
dino --gapplication-service
snixembed --fork
safeeyes
gromit-mpx
blueman-applet
openrgb -c ff6f00 -b 100
'
app_list() {
APPLIST=""
if [ -n "$2" ]; then
for A in $(echo "$*" | sed "s/$1//g"); do
APPLIST="$APPLIST\n$(echo "$APPS" |
grep -P "^ *$A( |$)" ||
warn "Application not listed" "$A"
)"
done
else
APPLIST="$APPS"
fi
}
start() {
local CMD
local EXE
app_list "$@"
for A in $(echo "$APPLIST" | sed 's/^ *//g; s/ /\ /g'); do
CMD="$(echo "$A" | sed 's/\ / /g')"
EXE="$(echo "$CMD" | cut -d' ' -f1)"
if [ -n "$(command -v "$EXE")" ]; then
if pgrep -u "$(whoami)" "$EXE" >/dev/null; then
warn "Application already running" "$EXE"
continue
else
info "Starting application" "$EXE"
$CMD >/dev/null 2>&1 &
fi
else
warn "Application not installed" "$EXE"
fi
done
}
stop() {
local EXE
app_list "$@"
for A in $(echo "$APPLIST" | sed 's/^ *//g; s/ /\ /g'); do
EXE="$(echo "$A" | sed 's/\ / /g' | cut -d' ' -f1)"
if pgrep -u "$(whoami)" "$EXE" >/dev/null; then
killall -u "$(whoami)" -9 "$EXE" &
else
warn "Application not running" "$EXE"
continue
fi
done
}