forked from digirium/xfce-genmon-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nvidiainfo
executable file
·88 lines (81 loc) · 2 KB
/
nvidiainfo
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
#!/bin/bash
# nvidiainfo - NVIDIA monitor for XFCE genmon plugin
# Copyright (C) 2013 Digirium, see <https://github.com/Digirium/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CF=C
showclock=no
iconfile=$HOME/.genmon-icon/nvidiainfo.png
while getopts ":cFi:v" opt
do
case $opt in
c)
showclock=yes
;;
F)
CF=F
;;
i)
case "$OPTARG" in
/*)
iconfile="$OPTARG"
;;
*)
iconfile="$HOME/.genmon-icon/$OPTARG"
;;
esac
;;
v)
echo "nvidiainfo 1.0.2 - (C) 2013 Digirium, see <https://github.com/Digirium)"
echo "Released under the GNU GPL."
exit 0
;;
*)
echo "Invalid option: -$OPTARG"
exit 1
;;
esac
done
version=$(nvidia-settings -q NvidiaDriverVersion -t)
gputemp=$(nvidia-settings -q gpucoretemp -t)
usedmem=$(nvidia-settings -q [gpu:0]/UsedDedicatedGPUMemory -t)
clocks2=$(nvidia-settings -q [gpu:0]/GPUCurrentClockFreqsString -t)
nvclock=$(echo $clocks2 | sed 's/nvclock=\([0-9]*\),.*$/\1/')
memclock=$(echo $clocks2 | sed 's/^.*, memclock=\([0-9]*\)$/\1/')
case $CF in
F)
let "F=($gputemp*9/5)+32"
gputemp=$F
;;
esac
case $showclock in
no)
cat <<-EOF
<img>$iconfile</img>
<txt>${gputemp}°$CF
${usedmem}M</txt>
<tool>Nvidia Driver Version: $version
GPU clock: ${nvclock}MHz Memory clock: ${memclock}MHz</tool>
EOF
;;
yes)
cat <<-EOF
<img>$iconfile</img>
<txt>${gputemp}°$CF ${nvclock}MHz
${usedmem}M ${memclock}MHz</txt>
<tool>Nvidia Driver Version: $version</tool>
EOF
;;
esac
exit 0