aboutsummaryrefslogtreecommitdiff
path: root/bin/bin/gfx-status
blob: 93d564a77dd5a94b8506fe40ccf69966a8333144 (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
#!/bin/bash
 
pci_integrated=$(lspci | grep VGA | sed -n '1p' | cut -f 1 -d " ")
pci_discrete=$(lspci | grep VGA | sed -n '2p' | cut -f 1 -d " ")
 
integrated=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_integrated | grep -o -P ':.:...:')
discrete=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_discrete | grep -o -P ':.:...:')
 
name_integrated=$(lspci | grep VGA | sed -n '1p' | sed -e "s/.* VGA compatible controller[ :]*//g" | sed -e "s/ Corporation//g" | sed -e "s/ Technologies Inc//g" | sed -e 's/\[[0-9]*\]: //g' | sed -e 's/\[[0-9:a-z]*\]//g' | sed -e 's/(rev [a-z0-9]*)//g' | sed -e "s/ Integrated Graphics Controller//g")
name_discrete=$(lspci | grep VGA | sed -n '2p' | sed -e "s/.* VGA compatible controller[ :]*//g" | sed -e "s/ Corporation//g" | sed -e "s/ Technologies Inc//g" | sed -e 's/\[[0-9]*\]: //g' | sed -e 's/\[[0-9:a-z]*\]//g' | sed -e 's/(rev [a-z0-9]*)//g' | sed -e "s/ Integrated Graphics Controller//g")
 
if [ "$integrated" = ":+:Pwr:" ]
then
integrated_condition="on"
elif [ "$integrated" = ": :Pwr:" ]
then
integrated_condition="on"
elif [ "$integrated" = ": :Off:" ]
then
integrated_condition="off"
fi
 
if [ "$discrete" = ":+:Pwr:" ]
then
discrete_condition="on"
elif [ "$discrete" = ": :Pwr:" ]
then
discrete_condition="on"
elif [ "$discrete" = ": :Off:" ]
then
discrete_condition="off"
fi

notify-send -t 5000 \
-i "/home/xero/.config/awesome/themes/ghost/gfx.png" \
'  gfx status 
░░▒▒▓▓███▓▓▒▒░░' \
" intel  = $integrated_condition 
 radeon = $discrete_condition"