initial version of my new laptop setup
This commit is contained in:
parent
09f38ef5bf
commit
c79f514dbe
18 changed files with 709 additions and 67 deletions
31
nixos/hosts/thalassa/null/hyprland/eww/scripts/battery.sh
Executable file
31
nixos/hosts/thalassa/null/hyprland/eww/scripts/battery.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
bat=/sys/class/power_supply/BAT0
|
||||
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
|
||||
|
||||
echo "{\"percent\": \"$per\", \"icon\": \"$icon\", \"charging\": \"$charging\", \"visible\": \"true\", \"status\": \"$status\"}"
|
15
nixos/hosts/thalassa/null/hyprland/eww/scripts/volume.sh
Executable file
15
nixos/hosts/thalassa/null/hyprland/eww/scripts/volume.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
per="$(pamixer --get-volume)"
|
||||
|
||||
if pamixer --get-mute | grep -q true; then
|
||||
icon="婢"
|
||||
elif [ "$per" -gt 66 ]; then
|
||||
icon="墳" # high
|
||||
elif [ "$per" -gt 33 ]; then
|
||||
icon="奔" # med
|
||||
else
|
||||
icon="奄" #low
|
||||
fi
|
||||
|
||||
printf "{\"icon\": \"${icon}\", \"percent\": \"${per}\"}"
|
16
nixos/hosts/thalassa/null/hyprland/eww/scripts/wifi.sh
Executable file
16
nixos/hosts/thalassa/null/hyprland/eww/scripts/wifi.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
if nmcli g | rg -q "\bconnected\b"; then
|
||||
icon=""
|
||||
ssid=$(nmcli -t -f name connection show --active)
|
||||
if echo $ssid | rg -q "Wired"; then
|
||||
status="Connected via cable"
|
||||
else
|
||||
status="Connected to ${ssid}"
|
||||
fi
|
||||
else
|
||||
icon=""
|
||||
status="offline"
|
||||
fi
|
||||
|
||||
printf "{\"icon\": \"${icon}\", \"status\": \"${status}\"}"
|
30
nixos/hosts/thalassa/null/hyprland/eww/scripts/workspaces.lua
Executable file
30
nixos/hosts/thalassa/null/hyprland/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)
|
8
nixos/hosts/thalassa/null/hyprland/eww/scripts/workspaces.sh
Executable file
8
nixos/hosts/thalassa/null/hyprland/eww/scripts/workspaces.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue