mirror of
https://github.com/morten-olsen/nixos-config.git
synced 2026-02-08 00:36:27 +01:00
init
This commit is contained in:
44
user/files/eww/scripts/battery
Executable file
44
user/files/eww/scripts/battery
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
bat=/sys/class/power_supply/BAT0/
|
||||
per="$(cat "$bat/capacity")"
|
||||
|
||||
icon() {
|
||||
|
||||
[ $(cat "$bat/status") = Charging ] && echo "" && exit
|
||||
|
||||
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=""
|
||||
notify-send -u critical "Battery Low" "Connect Charger"
|
||||
elif [ "$per" -gt "0" ]; then
|
||||
icon=""
|
||||
notify-send -u critical "Battery Low" "Connect Charger"
|
||||
else
|
||||
echo && exit
|
||||
fi
|
||||
echo "$icon"
|
||||
}
|
||||
|
||||
percent() {
|
||||
echo $per
|
||||
}
|
||||
|
||||
[ "$1" = "icon" ] && icon && exit
|
||||
[ "$1" = "percent" ] && percent && exit
|
||||
exit
|
||||
21
user/files/eww/scripts/change-active-workspace
Executable file
21
user/files/eww/scripts/change-active-workspace
Executable file
@@ -0,0 +1,21 @@
|
||||
#! /bin/bash
|
||||
function clamp {
|
||||
min=$1
|
||||
max=$2
|
||||
val=$3
|
||||
python -c "print(max($min, min($val, $max)))"
|
||||
}
|
||||
|
||||
direction=$1
|
||||
current=$2
|
||||
if test "$direction" = "down"
|
||||
then
|
||||
target=$(clamp 1 10 $(($current+1)))
|
||||
echo "jumping to $target"
|
||||
hyprctl dispatch workspace $target
|
||||
elif test "$direction" = "up"
|
||||
then
|
||||
target=$(clamp 1 10 $(($current-1)))
|
||||
echo "jumping to $target"
|
||||
hyprctl dispatch workspace $target
|
||||
fi
|
||||
3
user/files/eww/scripts/get-active-workspace
Executable file
3
user/files/eww/scripts/get-active-workspace
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
hyprctl monitors -j | jq --raw-output .[0].activeWorkspace.id
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^workspace>>' | stdbuf -o0 awk -F '>>|,' '{print $2}'
|
||||
11
user/files/eww/scripts/get-workspaces
Executable file
11
user/files/eww/scripts/get-workspaces
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
spaces (){
|
||||
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
|
||||
seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
|
||||
}
|
||||
|
||||
spaces
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||
spaces
|
||||
done
|
||||
2
user/files/eww/scripts/getram
Executable file
2
user/files/eww/scripts/getram
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')
|
||||
2
user/files/eww/scripts/getvol
Executable file
2
user/files/eww/scripts/getvol
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1
|
||||
13
user/files/eww/scripts/wifi
Executable file
13
user/files/eww/scripts/wifi
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
symbol() {
|
||||
[ $(cat /sys/class/net/w*/operstate) = down ] && echo && exit
|
||||
echo
|
||||
}
|
||||
|
||||
name() {
|
||||
nmcli | grep "^wlp" | sed 's/\ connected\ to\ /Connected to /g' | cut -d ':' -f2
|
||||
}
|
||||
|
||||
[ "$1" = "icon" ] && symbol && exit
|
||||
[ "$1" = "name" ] && name && exit
|
||||
Reference in New Issue
Block a user