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