more laptop config

This commit is contained in:
Vivian 2022-08-24 23:44:40 +02:00
parent c79f514dbe
commit 4fed5d2c38
6 changed files with 92 additions and 48 deletions

View file

@ -1,26 +1,17 @@
#!/usr/bin/env lua
function trim(s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
aw = io.popen("hyprctl monitors | grep active | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'")
active_workspace = aw:read("*a")
aw:close()
ew = io.popen("hyprctl workspaces | grep ID | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'")
existing_workspaces = ew:read("*a")
ew:close()
box = "(box :orientation \"v\" :spacing 1 :space-evenly \"true\" "
for i = 1, #existing_workspaces do
local c = existing_workspaces:sub(i,i)
if tonumber(c) == tonumber(active_workspace) then
local btn = "(button :class \"active\" :onclick \"hyprctl dispatch workspace "..c.." \" \"\")"
for i = 1,10 do
if i == tonumber(active_workspace) then
local btn = "(button :class \"active\" :onclick \"hyprctl dispatch workspace "..i.." \" \"\")"
box = box .. btn
elseif c ~= "\n" then
local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..c.."\" \"\")"
else
local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..i.."\" \"\")"
box = box .. btn
end
end