-
Notifications
You must be signed in to change notification settings - Fork 5
/
optimus-manager-ar.1s.sh
executable file
·97 lines (84 loc) · 3.19 KB
/
optimus-manager-ar.1s.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
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
#!/usr/bin/env bash
# Thanks for idea and base script cyberalex4life <3
# You can set parameters in this file
source ~/.config/optimus-manager-argos/omarc 2> /dev/null
nvidia_switch="optimus-manager --no-confirm --switch nvidia"
hybrid_switch="optimus-manager --no-confirm --switch hybrid"
integrated_switch="optimus-manager --no-confirm --switch integrated"
notify_switch="notify-send -h int:transient:2 -i \\\"dialog-information-symbolic\\\" \\\"Optimus Manager Indicator\\\" \\\"Switching graphics and restaring X server to finalize process! \\\" ; "
activate_integrated="\"\
if zenity --question --title \\\"Optimus Manager Indicator\\\" --text \\\"Restart X server to switch on Integrated?\\\" --width=256; \
then \
$notify_switch \
sleep 2; \
$integrated_switch; \
else \
exit 1; \
fi \
\""
activate_hybrid="\"\
if zenity --question --title \\\"Optimus Manager Indicator\\\" --text \\\"Restart X server to switch on Hybrid?\\\" --width=256; \
then \
$notify_switch \
sleep 2; \
$hybrid_switch; \
else \
exit 1; \
fi \
\""
activate_nvidia="\"\
if zenity --question --title \\\"Optimus Manager Indicator\\\" --text \\\"Restart X server to switch on NVIDIA?\\\" --width=256; \
then \
$notify_switch \
sleep 2; \
$nvidia_switch; \
else \
exit 1; \
fi \
\""
nvidia_settings="\"nvidia-settings -p 'PRIME Profiles'\""
QUERY=$(optimus-manager --print-mode | grep 'Current GPU mode' | awk '{print $5}')
if [ "$QUERY" == 'nvidia' ] || [ "$QUERY" == 'hybrid' ]; then
if [ "$QUERY" == 'nvidia' ]; then
nvidia_state_icon=primeindicatornvidiasymbolic
else
nvidia_state_icon=primeindicatorhybridsymbolic
fi
MULTIPLE_DATA=false
_OPTIMUS_MANAGER_ARGOS_SHOW_TEMP=${_OPTIMUS_MANAGER_ARGOS_SHOW_TEMP:-1}
_OPTIMUS_MANAGER_ARGOS_SHOW_POWER=${_OPTIMUS_MANAGER_ARGOS_SHOW_POWER:-0}
panel_string = ""
if [ "$_OPTIMUS_MANAGER_ARGOS_SHOW_TEMP" != '0' ]; then
TEMP=$(nvidia-smi -q -d TEMPERATURE | grep 'GPU Current Temp' | awk '{print $5}')
if [ "$MULTIPLE_DATA" == true ]; then
panel_string="$panel_string -"
fi
panel_string="$panel_string $TEMP\xe2\x84\x83"
MULTIPLE_DATA=true
fi
if [ "$_OPTIMUS_MANAGER_ARGOS_SHOW_POWER" != '0' ]; then
POWER=$(nvidia-smi -q -d POWER | grep 'Power Draw' | awk '{print $4}')
if [ "$MULTIPLE_DATA" == true ]; then
panel_string="$panel_string -"
fi
panel_string="$panel_string $POWER\x57"
MULTIPLE_DATA=true
fi
panel_string="$panel_string | "
else
nvidia_state_icon=primeindicatorintelsymbolic
panel_string=""
fi
echo -e "$panel_string | iconName=$nvidia_state_icon"
echo "---"
echo "NVIDIA Settings | iconName=$nvidia_state_icon bash=$nvidia_settings terminal=false"
echo "---"
echo "Switch:"
echo "Integrated | iconName='primeindicatorintelsymbolic' bash=$activate_integrated terminal=false"
echo "Hybrid | iconName='primeindicatorhybridsymbolic' bash=$activate_hybrid terminal=false"
echo "NVIDIA | iconName='primeindicatornvidiasymbolic' bash=$activate_nvidia terminal=false"
_OPTIMUS_MANAGER_ARGOS_SHOW_CURRENT_PROFILE=${_OPTIMUS_MANAGER_ARGOS_SHOW_CURRENT_PROFILE:-0}
if [ "$_OPTIMUS_MANAGER_ARGOS_SHOW_CURRENT_PROFILE" != '0' ]; then
echo "---"
echo "Current profile : $(optimus-manager --print-mode | grep 'Current GPU mode' | awk '{print $5}') | "
fi