Skip to content

Instantly share code, notes, and snippets.

@ntropy83
Last active November 17, 2022 20:51
Show Gist options
  • Save ntropy83/a95e4996bda896742fb93c629448df46 to your computer and use it in GitHub Desktop.
Save ntropy83/a95e4996bda896742fb93c629448df46 to your computer and use it in GitHub Desktop.
A conky that automatically switches with nvidia rtd3 suspend
## A conky that automatically switches with nvidia rtd3 suspend
## Below you find two files, both can go to the $HOME directory
## .conkyrc
# set to yes if you want Conky to be forked in the background
background yes
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
#xftfont sans:size=10
xftfont Clean:size=10
# Text alpha when using Xft
xftalpha 0.8
# Update interval in seconds
update_interval 1.0
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window yes
# If own_window is yes, you may use type normal, desktop or override
#dock
own_window_type dock
# Use pseudo transparency with own_window?
own_window_transparent yes
own_window_type conky
own_window_argb_visual yes
own_window_class override
# If own_window_transparent is set to no, you can set the background
colour here
#own_window_colour black
# If own_window is yes, these window manager hints may be used
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
no_buffers false
double_buffer yes
# Minimum size of text area
minimum_size 500 500
#Maximum width
maximum_width 500
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around graphs
draw_graph_borders no
# Draw borders around text
draw_borders no
# Stippled borders?
#stippled_borders 8
# border margins
#border_margin 1
# border width
#border_width 1
# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment none
#alignment top_middle
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 3
gap_y 25
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer yes
default_color F4EEE4
default_shade_color 000000
default_outline_color 222222
cpu_avg_samples 2
net_avg_samples 2
#${font size=18}$Nodename $kernel
#${alignc}${font OpenLogos:pixelsize=40}J
TEXT
${voffset 10}${color #009940}${font OpenLogos:size=30}${image ~/.conky/manjaro.png -s 80x80 -f 86400}${voffset 50}${font}${kernel}
${voffset -2}Tuxedo OS 1
${alignc}${color lightgrey}Uptime:$color $uptime
${color lightgrey}${alignc}${time %A - %d-%m-%Y - %H:%M.%S}
${color #009940}CPU $stippled_hr ${alignr}
${color lightgrey}AMD Ryzen 9 6900HX
${color lightgrey}Freq.: $color${freq_g} GHz ${color lightgrey}${alignr}Temp: ${execi 5 sensors | grep 'Tctl' | cut -c 16-24}
${color lightgrey}Usage: ${color lightgrey}$cpu% ${cpubar 3}$color
${color lightgrey}Power Draw: ${execi 5 sensors | grep 'slowPPT' | cut -c '16-21'}
${cpugraph 1, a1a1a1 cd8500}
${color #009940}GPU $stippled_hr ${alignr}
${color lightgrey}AMD Radeon 680M (Usage: ${execi 5 cat /sys/class/drm/card0/device/gpu_busy_percent} %)
${color}Mesa version: ${execi 3600 glxinfo | grep 'Version' | cut -c 14-24}${alignr}Temp: ${execi 5 cat /sys/class/drm/card0/device/hwmon/hwmon*/temp1_input | cut -c 1-2} °C
${color}VRAM used/total: ${execi 2 cat /sys/class/drm/card0/device/mem_info_gtt_used | awk '{ byte =$1 /1024/1024 ; printf ("%.f\n", byte " MiB")}'} MiB / ${execi 5 cat /sys/class/drm/card0/device/mem_info_gtt_total | cut -c 1-4} MiB
${if_match "${execi 5 cat /sys/class/drm/card1/device/power_state}" == "D3cold"}${color lightgrey}NVIDIA Geforce RTX 3070Ti (suspended D3cold)${else}${execi 5 sh ~/.conkyrc_nvidia.sh}${endif}
${color #009940}Memory $stippled_hr ${alignr}
${color lightgrey}Ram: ${color lightgrey} $mem / $memmax ${membar 3}
${color lightgrey}Usage:${color lightgrey} $memperc%
${color lightgrey}Swap: ${color lightgrey} $swap / $swapmax ${swapbar 3}
${color lightgrey}Usage:${color lightgrey} $swapperc%
${color #009940}Procs $stippled_hr ${alignr}
${color lightgrey}Total:$color $processes ${color lightgrey}Running:$color $running_processes
${color lightgrey}PID CPU% MEM%$color Proc
${color lightgrey}${top_mem pid 1}${top_mem cpu 1}$color${top_mem mem 1} ${top_mem name 1}
${color lightgrey}${top_mem pid 2}${top_mem cpu 2}$color${top_mem mem 2} ${top_mem name 2}
${color lightgrey}${top_mem pid 3}${top_mem cpu 3}$color${top_mem mem 3} ${top_mem name 3}
${color lightgrey}${top_mem pid 4}${top_mem cpu 4}$color${top_mem mem 4} ${top_mem name 4}
${color lightgrey}${top_mem pid 5}${top_mem cpu 5}$color${top_mem mem 5} ${top_mem name 5}
${color #009940}Disk $stippled_hr ${font}
${color lightgrey}root $alignr ${color lightgrey}${fs_used /} / ${fs_size /}
${fs_bar 3 /}
${color lightgrey}datadisk $alignr ${color lightgrey}${fs_used /datadisk} / ${fs_size /datadisk}
${fs_bar 3 /datadisk}
${color #009940}Networking $stippled_hr ${font}
${color lightgrey}WLAN
${downspeedgraph wlp4s0 15,100 a1a1a1 cd8500} $alignr${color lightgrey}${upspeedgraph wlp4s0 15,100 cd8500 a1a1a1}
${color grey}Down:${color white} ${downspeed wlp4s0}/s${color lightgrey} ${offset 70} ${alignr}Up:${color white} ${upspeed wlp4s0}/s
${color grey}Downloaded:$color ${totaldown wlp4s0}
${color grey}Uploaded: $color ${totalup wlp4s0}
LAN
${color lightgrey}${downspeedgraph enp3s0 15,100 a1a1a1 cd8500} $alignr${color lightgrey}${upspeedgraph enp3s0 15,100 cd8500 a1a1a1}
${color grey}Down:${color white} ${downspeed enp3s0}/s${color lightgrey} ${offset 70} ${alignr}Up:${color white} ${upspeed enp3s0}/s
${color grey}Downloaded:$color ${totaldown enp3s0}
${color grey}Uploaded: $color ${totalup enp3s0}
${color #009940}Battery $stippled_hr ${font}
${color lightgrey}Battery: ${battery BAT0} ${battery_bar BAT0}
${battery_time BAT0}
-----------------------------------------
## .conkyrc_nvidia.sh
#!/bin/sh
if [ $(cat /sys/class/drm/card1/device/power/runtime_usage) -gt 0 ]
then
echo "NVIDIA Geforce RTX 3070Ti (Usage: G $(nvidia-smi -q | grep 'Gpu' | cut -c '45-49'), M $(nvidia-smi -q | grep 'Memory' | grep '%' | cut -c '45-49'), E $(nvidia-smi -q | grep 'Encoder' | grep '%' | cut -c '45-49'), D $(nvidia-smi -q | grep 'Decoder' | grep '%' | cut -c '45-49'))
Driver Version: $(nvidia-smi -q | grep 'Driver Version' | cut -c '45-53') Temp: $(nvidia-smi -q | grep 'GPU Current Temp' | cut -c '45-46') °C
VRAM used/total: $(nvidia-smi -q | grep 'Used' | cut -zc '45-50') / $(nvidia-smi -q | grep 'Total' | cut -zc '45-52')
Power Draw: $(nvidia-smi -q | grep 'Power Draw' | cut -zc '45-52')"
else
echo "NVIDIA Geforce RTX 3070Ti (idle)"
fi
sleep 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment