blob: 294e91efcaf071619858bfa7296de4d1e62f5665 (
plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#!/bin/sh
tearing() {
status=$(xrandr --verbose | grep TearFree | head -n 1 | xargs)
if [[ $status == "TearFree: on" ]]; then
xrandr --output HDMI-A-0 --set TearFree off
else
xrandr --output HDMI-A-0 --set TearFree on
fi
}
kill_program() {
target=$(ps ax | awk '{print $5}' | cut -d "[" -f1 | sed 's/COMMAND//g' | grep . | dmenu -p "Enter program to kill: ")
sudo killall $target
}
jellyfin() {
status=$(pidof jellyfin)
if [[ -z $status ]]; then
jellyfin
else
killall jellyfin
fi
}
compositor() {
status=$(pidof picom)
if [[ -z $status ]]; then
picom
else
killall picom
fi
}
redshift() {
status=$(pidof redshift)
if [[ -z $status ]]; then
redshift_run
else
killall redshift
fi
}
vpn() {
status=$(sudo wg | sed 1q)
if [[ $status = 'interface: wg0-client-cl1' ]]
then
vpnStatus=on
else
vpnStatus=off
fi
case "$(printf "on\noff" | dmenu -i -p "VPN is $vpnStatus: ")" in
'on')
wg-quick up ~/.config/wg0-client-cl1.conf
notify-send "VPN is turned ON";;
'off')
wg-quick down ~/.config/wg0-client-cl1.conf
notify-send "VPN is OFF";;
*) exit 1;;
esac
}
monero() {
status=$(pidof xmrig)
if [[ -z $status ]]; then
status=off
else
status=on
fi
case "$(printf "on\noff" | dmenu -i -p "Monero is $status: ")" in
'on') /home/khan/projects/monero/xmrig/run;;
'off') sudo killall xmrig;;
*) exit 1;;
esac
}
status() {
redstats=$(pidof redshift)
compstats=$(pidof picom)
tearing=$(xrandr --verbose | grep TearFree | head -n 1 | xargs)
moneropid=$(pidof xmrig)
if [[ -z $redstats ]]; then
redstats=off
else
redstats=on
fi
if [[ -z $compstats ]]; then
compstats=off
else
compstats=on
fi
if [[ -z $moneropid ]]; then
moneropid=off
else
moneropid=on
fi
if [[ $tearing == "TearFree: on" ]]; then
tearing=on
else
tearing=off
fi
notify-send Status "Redshift: $redstats\nTearFree: $tearing\nMonero: $moneropid\nCompositor: $compstats"
}
case "$(printf "compositor\ntearfree\nredshift\nJellyfin\nmonero\nVPN\nkill\nstatus\nreboot\nshutdown\n" | dmenu -i -p 'Power: ')" in
'tearfree') tearing;;
'redshift') redshift;;
'Jellyfin') jellyfin;;
'compositor') compositor;;
'monero') monero;;
'VPN') vpn;;
'kill') kill_program;;
'status') status;;
'reboot') sudo reboot;;
'shutdown') sudo shutdown now;;
*) exit 1;;
esac
|