misc/scripts/fetch

41 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2019-01-26 18:51:26 +01:00
#!/usr/bin/env fish
# Outputs colored text
function color
set_color $argv[1]
for i in $argv[2..-1]
echo -n $i
end
set_color normal
end
set cpu_model (awk '/model name/ {print $6; exit}' /proc/cpuinfo)
set cpu_freq (awk '{printf("%.2fHz", $0/1e6)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
set cpu_temp (awk '{printf("%dK", $0/1e3+273.15)}' /sys/class/thermal/thermal_zone3/temp)
2019-09-24 16:59:37 +02:00
set gpu_model (glxinfo | awk '/Device:/ {print $2,$3,$4,$5,$6}')
2019-01-26 18:51:26 +01:00
set mem_used (awk '/Active/ {printf("%.1f", $2/1e6); exit}' /proc/meminfo)
set mem_tot (awk '/MemTotal/ {printf("%.1f", $2/1e6); exit}' /proc/meminfo)
set uptime (awk '{printf("%d:%02d:%02d",($1/60/60/24),($1/60/60%24),($1/60%60))}' /proc/uptime)
set kernel (uname -sr)
set os (awk -F= '/^NAME/ {print $2}' /etc/os-release)
set screen (xrandr | grep \* | awk '{print $1}')
set shell (basename $SHELL)
echo -n \33c
echo (color blue OS:) $os GNU+$kernel
echo (color blue CPU:) $cpu_model $cpu_freq [$cpu_temp]
echo (color blue GPU:) $gpu_model
echo (color blue RAM:) $mem_used/$mem_tot GB
echo (color blue Screen:) $screen
echo (color blue Uptime:) $uptime
echo (color blue WM:) bspwm
echo (color blue Shell:) $shell
echo (color blue Font:) gohufont
echo