hell n back

This commit is contained in:
Jet Pham 2024-03-22 23:35:56 -07:00
parent 3ee6761b45
commit cac7203033
45 changed files with 2988 additions and 177 deletions

38
modules/eww/scripts/battery.sh Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
bat=/sys/class/power_supply/BAT1/
per="$(cat "$bat/capacity")"
status="$(cat "$bat/status")"
if [ "$per" -gt "90" ]; then
icon=""
elif [ "$per" -gt "80" ]; then
icon=""
elif [ "$per" -gt "70" ]; then
icon=""
elif [ "$per" -gt "60" ]; then
icon=""
elif [ "$per" -gt "50" ]; then
icon=""
elif [ "$per" -gt "40" ]; then
icon=""
elif [ "$per" -gt "30" ]; then
icon=""
elif [ "$per" -gt "20" ]; then
icon=""
elif [ "$per" -gt "10" ]; then
icon=""
elif [ "$per" -gt "0" ]; then
icon=""
else
icon=""
fi
if [ -s /sys/class/power_supply/BAT1/capacity ]; then
echo "{\"percent\": \"$per\", \"icon\": \"$icon\", \"charging\": \"$charging\", \"visible\": \"true\", \"status\": \"$status\"}"
else
echo "{\"visible\": \"false\" }"
fi

View file

@ -0,0 +1,13 @@
#!/bin/sh
if eww windows | grep -q "\*brightness"; then
eww update bright-level="$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%')"
else
eww close volume
eww open brightness
eww update bright-level="$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%')"
sleep 2
sleep 1
eww close brightness
fi

18
modules/eww/scripts/volume.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
if eww windows | rg -q "\*volume"; then
eww update volume-level=$(pamixer --get-volume)
eww update volume-muted=$(pamixer --get-mute)
eww update volume-hidden=false
else
eww close brightness
eww open volume
eww update volume-level=$(pamixer --get-volume)
eww update volume-muted=$(pamixer --get-mute)
eww update volume-hidden=false
sleep 2
eww update volume-hidden=true
sleep 1
eww close volume
fi

12
modules/eww/scripts/wifi.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
if iwctl station wlan0 show | grep -q "connected"; then
icon=""
ssid=Amadeus
status="Connected to ${ssid}"
else
icon="睊"
status="offline"
fi
echo "{\"icon\": \"${icon}\", \"status\": \"${status}\"}"

View 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)

View file

@ -0,0 +1,9 @@
#!/bin/sh
workspaces() {
./scripts/workspaces.lua
}
workspaces
tail -f /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | grep --line-buffered "Changed to workspace" | while read -r; do
workspaces
done