chore: mess with waybar for the laptop configuration

This commit is contained in:
Ahwx 2025-05-09 03:44:17 +02:00
parent b9e2e56206
commit 1f302adc0f
2 changed files with 480 additions and 395 deletions

View file

@ -28,8 +28,10 @@
"modules-left": [
"privacy",
"group/network",
"network",
"custom/vpn",
"custom/spotify",
"custom/devices",
"tray",
],
@ -45,7 +47,7 @@
"bluetooth",
// "wireplumber",
"group/audio",
"battery",
"group/battery",
"group/clock"
],
@ -69,17 +71,17 @@
"format": "{name}"
},
"group/network": {
"orientation": "horizontal",
"modules": [
"network",
"custom/vpn",
],
"drawer": {
"transition-left-to-right": true,
"transition-duration": 500
}
},
// "group/network": {
// "orientation": "horizontal",
// "modules": [
// "network",
// "custom/vpn",
// ],
// "drawer": {
// "transition-left-to-right": true,
// "transition-duration": 500
// }
// },
"network": {
"format": "󰈀 {ifname}",
@ -92,27 +94,28 @@
"tooltip-format-disconnected": "Disconnected"
},
"custom/vpn": {
"format": "{icon}",
"tooltip-format": "{text}",
"format-icons": [ "","" ],
"return-type": "json",
"exec": "~/.local/bin/waybar-vpn",
"interval": 30
},
"custom/spotify": {
"interval": 1,
"interval": 5,
"return-type": "json",
"exec": "~/.local/bin/waybar-music",
"on-click": "playerctl play-pause",
"escape": true
},
// "custom/vpn": {
// "format": "{icon} VPN <span color='#aaaaaa'>{}</span>",
// "format-icons": {
// "connected": "",
// "disconnected": ""
// },
"custom/devices": {
"interval": 60,
// "return-type": "json",
// "exec": "/usr/local/bin/waybar-vpn current",
// "on-click": "/usr/local/bin/waybar-vpn connect",
// "on-click-middle": "/usr/local/bin/waybar-vpn disconnect",
// "on-click-right": "/usr/local/bin/get-public-ip-info",
// "interval": 30
// },
"exec": "~/.local/bin/waybar-devices",
},
"privacy": {
"icon-spacing": 8,
@ -275,6 +278,18 @@
"interval": "once"
},
"group/battery": {
"orientation": "horizontal",
"modules": [
"battery",
"custom/powerdraw"
],
"drawer": {
"transition-left-to-right": false,
"transition-duration": 500
}
},
"battery": {
"bat": "BAT1",
"interval": 30,
@ -293,6 +308,11 @@
"format-icons": [" ", " ", " ", " ", " "],
},
"custom/powerdraw": {
"interval": 60,
"exec": "~/.local/bin/waybar-powerdraw",
},
"group/clock": {
"orientation": "horizontal",
"modules": [ "custom/clock#minutes", "clock#time", "clock#date" ],
@ -390,8 +410,12 @@
margin: 0px 0px 0px 10px;
}
#network, #resources, #audio, #clock {
padding: 0 4px;
#network, #resourcese {
padding: 0px 2px 0px 2px;
}
#audio, #battery, #clock {
padding: 0px 6px 0px 6px;
}
.drawer-child > label {
@ -475,7 +499,17 @@
#custom-spotify {
color: #ffffff;
padding-right: 10px;
padding-right: 5px;
}
#custom-devices {
color: #ffffff;
padding: 0px 2px 0px 2px;
}
#custom-powerdraw {
color: #ffffff;
padding: 0px;
}
'';

View file

@ -178,6 +178,57 @@
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
'';
};
"/home/${username}/.local/bin/waybar-devices" = {
executable = true;
text = ''
#!/usr/bin/env bash
if [[ $(cat /proc/acpi/button/lid/LID0/state | grep "open") ]]; then
LTEXT="󰌢 "
else
LTEXT="󰛧 "
fi
MICROPHONE_STATE="$(sudo /home/liv/.local/src/framework-system/target/debug/framework_tool --privacy | tail -n2 | head -n1)"
CAMERA_STATE="$(sudo /home/liv/.local/src/framework-system/target/debug/framework_tool --privacy | tail -n1)"
if [[ "$(echo $MICROPHONE_STATE | grep 'Microphone: Connected')" ]]; then
MIC=1
MTEXT="󰍬 - available!"
else
MIC=0
MTEXT=" "
fi
if [[ "$(echo $CAMERA_STATE | grep 'Camera: Connected')" ]]; then
CAM=1
CTEXT="󰄀 - available!"
else
CAM=0
CTEXT="󰗟 "
fi
echo "$LTEXT $CTEXT $MTEXT"
'';
};
"/home/${username}/.local/bin/waybar-powerdraw" = {
executable = true;
text = ''
#!/usr/bin/env zsh
if [[ "$(cat /sys/class/power_supply/BAT1/status)" == "Discharging" ]]; then; cat /sys/class/power_supply/BAT1/current_now /sys/class/power_supply/BAT1/voltage_now | xargs | awk '{print $1*$2/1e12 " W"}'; fi
'';
};
"/home/${username}/.local/bin/waybar-vpn" = {
executable = true;
text = ''
#!/usr/bin/env bash
ip route | grep -q '10.7.0.0' \
&& echo '{"text":"Connected","class":"connected","percentage":100}' \
|| echo '{"text":"Disconnected","class":"disconnected","percentage":0}'
'';
};
};
home.packages = with pkgs; [
wf-recorder