hell n back
This commit is contained in:
parent
3ee6761b45
commit
cac7203033
45 changed files with 2988 additions and 177 deletions
30
modules/eww/scripts/workspaces.lua
Executable file
30
modules/eww/scripts/workspaces.lua
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/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.." \" \"\")"
|
||||
box = box .. btn
|
||||
elseif c ~= "\n" then
|
||||
local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..c.."\" \"\")"
|
||||
box = box .. btn
|
||||
end
|
||||
end
|
||||
|
||||
box = box .. ")"
|
||||
|
||||
print(box)
|
||||
Loading…
Add table
Add a link
Reference in a new issue