Add new window switcher on super+tab and smaller fixes

This commit is contained in:
Crylia
2022-06-16 00:30:56 +02:00
parent 454c80336c
commit fb22b50a97
13 changed files with 358 additions and 68 deletions

View File

@@ -0,0 +1,26 @@
local awful = require("awful")
local watch = awful.widget.watch
watch(
[[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]],
3,
function(_, stdout)
local cpu_freq = {}
for value in stdout:gmatch("%d+") do
table.insert(cpu_freq, value)
end
local average = 0
if User_config.clock_mode == "average" then
for i = 1, #cpu_freq do
average = average + cpu_freq[i]
end
average = math.floor(average / #cpu_freq)
awesome.emit_signal("update::cpu_freq_average", average)
elseif User_config.clock_mode then
awesome.emit_signal("update::cpu_freq_core", cpu_freq[User_config.clock_mode])
end
end
)

View File

@@ -0,0 +1,14 @@
local awful = require("awful")
local watch = awful.widget.watch
watch(
[[ bash -c "sensors | grep 'Package id 0:' | awk '{print $4}'" ]],
3,
function(_, stdout)
local temp = tonumber(stdout:match("%d+"))
awesome.emit_signal(
"update::cpu_temp",
temp
)
end
)

View File

@@ -0,0 +1,26 @@
local awful = require("awful")
local watch = awful.widget.watch
local total_prev = 0
local idle_prev = 0
watch(
[[ cat "/proc/stat" | grep '^cpu ' ]],
3,
function(_, stdout)
local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice =
stdout:match("(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s")
local total = user + nice + system + idle + iowait + irq + softirq + steal
local diff_idle = idle - idle_prev
local diff_total = total - total_prev
local diff_usage = math.floor(((1000 * (diff_total - diff_idle) / diff_total + 5) / 10) + 0.5)
awesome.emit_signal("update::cpu_usage", diff_usage)
total_prev = total
idle_prev = idle
collectgarbage("collect")
end
)

View File

@@ -0,0 +1,10 @@
local awful = require("awful")
local watch = awful.widget.watch
watch(
[[ bash -c "nvidia-smi -q -d TEMPERATURE | grep 'GPU Current Temp' | awk '{print $5}'"]],
3,
function(_, stdout)
awesome.emit_signal("update::gpu_temp", stdout:match("%d+"):gsub("\n", ""))
end
)

View File

@@ -0,0 +1,11 @@
local awful = require("awful")
local watch = awful.widget.watch
watch(
[[ bash -c "nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'"]],
3,
function(_, stdout)
stdout = stdout:match("%d+")
awesome.emit_signal("update::gpu_usage", stdout)
end
)

View File

@@ -0,0 +1,6 @@
require("src.tools.helpers.cpu_temp")
require("src.tools.helpers.cpu_usage")
require("src.tools.helpers.cpu_freq")
require("src.tools.helpers.ram")
require("src.tools.helpers.gpu_usage")
require("src.tools.helpers.gpu_temp")

View File

@@ -0,0 +1,11 @@
local awful = require("awful")
local watch = awful.widget.watch
watch(
[[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]],
3,
function(_, stdout)
local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n")
awesome.emit_signal("update::ram_widget", MemTotal, MemFree, MemAvailable)
end
)