Version 0.1.0
This commit is contained in:
215
home-manager/20_waybar/01_config.nix
Normal file
215
home-manager/20_waybar/01_config.nix
Normal file
@@ -0,0 +1,215 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/waybar/config".text = ''
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// °˖* ૮( • ᴗ 。)っ🍸 pewdiepie/archdaemon/dionysh shhheersh
|
||||
// Waybar config
|
||||
// vers. 1.0.0-nix
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
|
||||
{
|
||||
"layer": "top",
|
||||
"position": "top",
|
||||
"margin-top": 12,
|
||||
"margin-bottom": -8,
|
||||
"width": 2010,
|
||||
"height": 34,
|
||||
|
||||
// ── Modules Layout ─────────────────────────────────────────────────────
|
||||
"modules-left": [
|
||||
"clock",
|
||||
"custom/power",
|
||||
"network",
|
||||
"bluetooth",
|
||||
"custom/microphone",
|
||||
"custom/vpn"
|
||||
],
|
||||
|
||||
"modules-center": [
|
||||
"custom/workspace-1",
|
||||
"custom/workspace-2",
|
||||
"custom/asus-profile",
|
||||
"custom/workspace-3",
|
||||
"custom/workspace-4"
|
||||
],
|
||||
|
||||
"modules-right": [
|
||||
"custom/battery",
|
||||
"custom/volume",
|
||||
"custom/brightness"
|
||||
],
|
||||
|
||||
// ── Clock ──────────────────────────────────────────────────────────────
|
||||
"clock": {
|
||||
"tooltip-format": "{calendar}",
|
||||
"format-alt": " {:%a, %d %b %Y}",
|
||||
"format": "[ {:%I:%M %p} ]"
|
||||
},
|
||||
|
||||
// ── Network ────────────────────────────────────────────────────────────
|
||||
"network": {
|
||||
"format-wifi": "{icon}",
|
||||
"format-icons": ["[ ]", "[ ]", "[ ]", "[ ]", "[ ]"],
|
||||
"format-ethernet": "",
|
||||
"format-alt": "",
|
||||
"format-disconnected": "",
|
||||
"tooltip-format-wifi": "{icon} {essid}\n⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
|
||||
"tooltip-format-ethernet": " {ifname}\n⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
|
||||
"tooltip-format-disconnected": "Disconnected",
|
||||
"on-click": "nm-connection-editor",
|
||||
"interval": 5,
|
||||
"nospacing": 1
|
||||
},
|
||||
|
||||
// ── Keyboard ───────────────────────────────────────────────────────────
|
||||
"keyboard-state": {
|
||||
"numlock": true,
|
||||
"capslock": true,
|
||||
"format": " {layout}"
|
||||
},
|
||||
|
||||
// ── Bluetooth ──────────────────────────────────────────────────────────
|
||||
"bluetooth": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"enabled": "[ ]",
|
||||
"disabled": "[ ]"
|
||||
},
|
||||
"on-click": "~/.config/waybar/scripts/bluetooth-toggle.sh",
|
||||
"tooltip-format": "Bluetooth is {status}",
|
||||
"interval": 5
|
||||
},
|
||||
|
||||
|
||||
// // ── Asus Profile ───────────────────────────────────────────────────────
|
||||
// "custom/asus-profile": {
|
||||
// "exec": "~/.config/waybar/scripts/asus-profile.sh",
|
||||
// "interval": 3,
|
||||
// "format": "{}",
|
||||
// "tooltip": true,
|
||||
// "tooltip-format": "Toggle ASUS profile",
|
||||
// "on-click": "/home/pewds/.config/cycle-profile.sh"
|
||||
// },
|
||||
|
||||
// ── Battery (scripted + built-in) ──────────────────────────────────────
|
||||
"custom/battery": {
|
||||
"exec": "~/.config/waybar/scripts/battery.sh",
|
||||
"return-type": "json",
|
||||
"interval": 10,
|
||||
"on-click": "xfce4-power-manager-settings"
|
||||
},
|
||||
|
||||
|
||||
"battery": {
|
||||
"format": "{icon} {capacity}%",
|
||||
"format-icons": {
|
||||
"charging": [
|
||||
"","","","","","","","","",""
|
||||
],
|
||||
"default": [
|
||||
"","","","","","","","","",""
|
||||
]
|
||||
},
|
||||
"format-full": "Charged ",
|
||||
"interval": 5,
|
||||
"states": {
|
||||
"warning": 20,
|
||||
"critical": 10
|
||||
},
|
||||
"tooltip": true
|
||||
},
|
||||
|
||||
// ── Microphone ─────────────────────────────────────────────────────────
|
||||
"custom/microphone": {
|
||||
"exec": "~/.config/waybar/scripts/mic.sh",
|
||||
"interval": 1,
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Mic Toggle",
|
||||
"on-click": "pactl set-source-mute @DEFAULT_SOURCE@ toggle"
|
||||
},
|
||||
|
||||
// ── Brightness ─────────────────────────────────────────────────────────
|
||||
"custom/brightness": {
|
||||
"exec": "~/.config/waybar/scripts/brightness.sh",
|
||||
"return-type": "json",
|
||||
"interval": 2,
|
||||
"on-click": "~/.config/waybar/scripts/brightness-toggle.sh",
|
||||
"on-scroll-up": "brightnessctl set +5%",
|
||||
"on-scroll-down": "brightnessctl set 5%-"
|
||||
},
|
||||
|
||||
"backlight": {
|
||||
"format": " {percent}%",
|
||||
"format-icons": ["","","","","",""],
|
||||
"class": "flicker-bar",
|
||||
"on-click": "~/.config/waybar/scripts/brightness-slider.sh"
|
||||
},
|
||||
|
||||
// ── Workspaces (custom scripts) ────────────────────────────────────────
|
||||
"custom/workspace-1": {
|
||||
"exec": "~/.config/waybar/scripts/workspaces/workspace-1.sh",
|
||||
"interval": 1,
|
||||
"on-click": "hyprctl dispatch workspace 1",
|
||||
"tooltip": "Switch to workspace 1"
|
||||
},
|
||||
|
||||
"custom/workspace-2": {
|
||||
"exec": "~/.config/waybar/scripts/workspaces/workspace-2.sh",
|
||||
"interval": 1,
|
||||
"on-click": "hyprctl dispatch workspace 2",
|
||||
"tooltip": "Switch to workspace 2"
|
||||
},
|
||||
|
||||
"custom/workspace-3": {
|
||||
"exec": "~/.config/waybar/scripts/workspaces/workspace-3.sh",
|
||||
"interval": 1,
|
||||
"on-click": "hyprctl dispatch workspace 3",
|
||||
"tooltip": "Switch to workspace 3"
|
||||
},
|
||||
|
||||
"custom/workspace-4": {
|
||||
"exec": "~/.config/waybar/scripts/workspaces/workspace-4.sh",
|
||||
"interval": 1,
|
||||
"on-click": "hyprctl dispatch workspace 4",
|
||||
"tooltip": "Switch to workspace 4"
|
||||
},
|
||||
|
||||
// ── Volume ─────────────────────────────────────────────────────────────
|
||||
"custom/volume": {
|
||||
"exec": "~/.config/waybar/scripts/volume.sh",
|
||||
"return-type": "json",
|
||||
"interval": 1,
|
||||
"on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
|
||||
"on-scroll-up": "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+",
|
||||
"on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
|
||||
},
|
||||
|
||||
|
||||
// ── VPN ────────────────────────────────────────────────────────────────
|
||||
"custom/vpn": {
|
||||
"exec": "~/.config/waybar/scripts/nordvpn-status.sh",
|
||||
"interval": 5,
|
||||
"on-click": "~/.config/waybar/scripts/nordvpn-toggle.sh",
|
||||
"format": "{}",
|
||||
"markup": "pango",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "VPN Status / Toggle"
|
||||
},
|
||||
|
||||
// ── Power ──────────────────────────────────────────────────────────────
|
||||
"custom/power": {
|
||||
"format": "[ ]",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Power Menu",
|
||||
"on-click": "~/.config/waybar/scripts/powermenu.sh"
|
||||
},
|
||||
|
||||
// ── Spacer ─────────────────────────────────────────────────────────────
|
||||
"custom/squares": {
|
||||
"format": " ",
|
||||
"tooltip": false
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
||||
192
home-manager/20_waybar/02_style.nix
Normal file
192
home-manager/20_waybar/02_style.nix
Normal file
@@ -0,0 +1,192 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/waybar/style.css".text = ''
|
||||
/*
|
||||
──────────────────────────────────────────────────────────────────────────
|
||||
°˖* ૮( • ᴗ 。)っ🍸 pewdiepie/archdaemon/dionysh shhheersh
|
||||
Waybar CSS styling
|
||||
vers. 1.0-nix
|
||||
──────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
|
||||
/* === Base Waybar Styling =============================================== */
|
||||
waybar * {
|
||||
border: 4px;
|
||||
border-radius: 4px;
|
||||
min-height: 0;
|
||||
font-family: "JetBrainsMono Nerd Font";
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#waybar {
|
||||
background-color: #3b4252;
|
||||
border-radius: 2px;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: #282c34;
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.5s;
|
||||
color: #9cdef2;
|
||||
border: 3px solid #61afef;
|
||||
border-left: 3px solid #56b6c2;
|
||||
border-right: 3px solid #56b6c2;
|
||||
}
|
||||
|
||||
/* === Workspaces ======================================================== */
|
||||
#workspaces {
|
||||
background-color: transparent;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
all: initial;
|
||||
min-width: 0;
|
||||
box-shadow: inherit;
|
||||
padding: 6px 6px;
|
||||
margin: 6px 3px;
|
||||
border-radius: 4px;
|
||||
background-color: #2e3440;
|
||||
color: #56b6c2;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
color: #fab387;
|
||||
background-color: #56b6c2;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
color: #2e3440;
|
||||
background-color: #56b6c2;
|
||||
}
|
||||
|
||||
/* === Default Module Container Styling ================================== */
|
||||
#custom-microphone, #bluetooth, #custom-bluetooth, #custom-brightness,
|
||||
#custom-volume, #custom-battery, #custom-power, #custom-asus-profile,
|
||||
#network, #battery, #pulseaudio, #backlight, #custom-vpn, #clock,
|
||||
#tray {
|
||||
padding: 6px 12px;
|
||||
margin: 6px 6px;
|
||||
background-color: #292d35;
|
||||
border: 2px solid #61afef;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* === Audio ============================================================= */
|
||||
#pulseaudio.muted {
|
||||
background-color: #f38ba8;
|
||||
color: #1e1e2e;
|
||||
}
|
||||
|
||||
/* === Bluetooth ========================================================= */
|
||||
#bluetooth.disabled {
|
||||
color: #fab387;
|
||||
}
|
||||
|
||||
#custom-bluetooth {
|
||||
color: #56b6c2;
|
||||
transition: color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
/* === Network =========================================================== */
|
||||
#network.disconnected {
|
||||
background-color: #e06c75;
|
||||
color: #1e1e2e;
|
||||
}
|
||||
|
||||
/* === Clock ============================================================= */
|
||||
#clock {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: #fab387;
|
||||
}
|
||||
|
||||
/* === Asus Profile ====================================================== */
|
||||
#custom-asus-profile {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: #e5c07b;
|
||||
}
|
||||
|
||||
/* === VPN =============================================================== */
|
||||
#custom-vpn {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* === Battery =========================================================== */
|
||||
#custom-battery {
|
||||
border-radius: 2px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* 🔴 Critical */
|
||||
#custom-battery .battery-critical {
|
||||
background-color: #bf616a;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 🟠 Warning */
|
||||
#custom-battery .battery-warning {
|
||||
background-color: #fab387;
|
||||
color: #2e3440;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* 🟢 Normal */
|
||||
#custom-battery .battery-normal {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* === Brightness ======================================================== */
|
||||
#backlight {
|
||||
background-color: #3b4252;
|
||||
}
|
||||
/* === Tray ============================================================== */
|
||||
#tray {
|
||||
padding: 4px 8px;
|
||||
background-color: #1e1e2e;
|
||||
}
|
||||
/* === Custom Workspace Labels =========================================== */
|
||||
#custom-work-left, #custom-work-right {
|
||||
padding: 6px 6px;
|
||||
margin: 6px 3px;
|
||||
}
|
||||
|
||||
#custom-workspace-1:hover, #custom-workspace-2:hover,
|
||||
#custom-workspace-3:hover,
|
||||
#custom-workspace-4:hover {
|
||||
color: #fab387;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
/* === Hover Effects ===================================================== */
|
||||
/* Unified look for all interactive modules */
|
||||
#custom-microphone:hover, #custom-volume:hover, #pulseaudio:hover,
|
||||
#network:hover, #custom-vpn:hover, #bluetooth:hover,
|
||||
#custom-bluetooth:hover, #custom-power:hover, #custom-asus-profile:hover,
|
||||
#custom-battery:hover, #battery:hover, #backlight:hover,
|
||||
#custom-brightness:hover, #clock:hover, #tray:hover {
|
||||
background-color: #4c566a;
|
||||
border: 2px solid #56b6c2;
|
||||
color: #56b6c2;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
/* === Tooltips ========================================================== */
|
||||
tooltip {
|
||||
color: #56b6c2;
|
||||
background-color: #3b4252;
|
||||
border: 1px solid #56b6c2;
|
||||
font-weight: bold;
|
||||
}
|
||||
tooltip label {
|
||||
color: #78bec7;
|
||||
}
|
||||
'';
|
||||
}
|
||||
301
home-manager/20_waybar/03_scripts.nix
Normal file
301
home-manager/20_waybar/03_scripts.nix
Normal file
@@ -0,0 +1,301 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/waybar/scripts/asus-profile.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── asus-profile.sh ───────────────────────────────────────
|
||||
# Description: Display current ASUS power profile with color
|
||||
# Usage: Called by Waybar `custom/asus-profile`
|
||||
# Dependencies: asusctl, awk
|
||||
# ──────────────────────────────────────────────────────────
|
||||
|
||||
profile=$(asusctl profile -p | awk '/Active profile/ {print $NF}')
|
||||
|
||||
case "$profile" in
|
||||
Performance)
|
||||
text="RAZGON"
|
||||
fg="#bf616a"
|
||||
;;
|
||||
Balanced)
|
||||
text="STABILIZATION"
|
||||
fg="#fab387"
|
||||
;;
|
||||
Quiet)
|
||||
text="REACTOR SLEEP"
|
||||
fg="#56b6c2"
|
||||
;;
|
||||
*)
|
||||
text="ASUS ??"
|
||||
fg="#ffffff"
|
||||
;;
|
||||
esac
|
||||
echo "<span foreground='$fg'>$text</span>"
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/battery.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── battery.sh ─────────────────────────────────────────────
|
||||
# Description: Shows battery % with ASCII bar + dynamic tooltip
|
||||
# Usage: Waybar `custom/battery` every 10s
|
||||
# Dependencies: upower, awk, seq, printf
|
||||
# ──────────────────────────────────────────────────────────
|
||||
|
||||
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
# Get detailed info from upower
|
||||
time_to_empty=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk -F: '/time to empty/ {print $2}' | xargs)
|
||||
time_to_full=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk -F: '/time to full/ {print $2}' | xargs)
|
||||
|
||||
# Icons
|
||||
charging_icons=( )
|
||||
default_icons=( )
|
||||
|
||||
index=$((capacity / 10))
|
||||
[ $index -ge 10 ] && index=9
|
||||
|
||||
if [[ "$status" == "Charging" ]]; then
|
||||
icon=${charging_icons[$index]}
|
||||
elif [[ "$status" == "Full" ]]; then
|
||||
icon=""
|
||||
else
|
||||
icon=${default_icons[$index]}
|
||||
fi
|
||||
|
||||
# ASCII bar
|
||||
filled=$((capacity / 10))
|
||||
empty=$((10 - filled))
|
||||
bar=$(printf '█%.0s' $(seq 1 $filled))
|
||||
pad=$(printf '░%.0s' $(seq 1 $empty))
|
||||
ascii_bar="[$bar$pad]"
|
||||
|
||||
# Color thresholds
|
||||
if [ "$capacity" -lt 20 ]; then
|
||||
fg="#bf616a" # red
|
||||
elif [ "$capacity" -lt 55 ]; then
|
||||
fg="#fab387" # orange
|
||||
else
|
||||
fg="#56b6c2" # cyan
|
||||
fi
|
||||
|
||||
|
||||
# JSON output
|
||||
echo "{\"text\":\"<span foreground='$fg'>$icon $ascii_bar $capacity%</span>\",\"tooltip\":\"$tooltip\"}"
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/bluetooth-toggle.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── bluetooth-toggle.sh ──────────────────────────────────────────────────────
|
||||
# Toggle Bluetooth on/off using rfkill.
|
||||
# Usage: Waybar `bluetooth` module :on-click
|
||||
# Output: (changes state only)
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
if rfkill list bluetooth | grep -q "Soft blocked: yes"; then
|
||||
rfkill unblock bluetooth
|
||||
else
|
||||
rfkill block bluetooth
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/brightness.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── brightness.sh ─────────────────────────────────────────
|
||||
# Description: Shows current brightness with ASCII bar + tooltip
|
||||
# Usage: Waybar `custom/brightness` every 2s
|
||||
# Dependencies: brightnessctl, seq, printf, awk
|
||||
# ─────────────────────────────────────────────────────────
|
||||
|
||||
# Get brightness percentage
|
||||
brightness=$(brightnessctl get)
|
||||
max_brightness=$(brightnessctl max)
|
||||
percent=$((brightness * 100 / max_brightness))
|
||||
|
||||
# Build ASCII bar
|
||||
filled=$((percent / 10))
|
||||
empty=$((10 - filled))
|
||||
bar=$(printf '█%.0s' $(seq 1 $filled))
|
||||
pad=$(printf '░%.0s' $(seq 1 $empty))
|
||||
ascii_bar="[$bar$pad]"
|
||||
|
||||
# Icon
|
||||
icon=""
|
||||
|
||||
# Color thresholds
|
||||
if [ "$percent" -lt 20 ]; then
|
||||
fg="#bf616a" # red
|
||||
elif [ "$percent" -lt 55 ]; then
|
||||
fg="#fab387" # orange
|
||||
else
|
||||
fg="#56b6c2" # cyan
|
||||
fi
|
||||
|
||||
# Device name (first column from brightnessctl --machine-readable)
|
||||
device=$(brightnessctl --machine-readable | awk -F, 'NR==1 {print $1}')
|
||||
|
||||
# Tooltip text
|
||||
tooltip="Brightness: $percent%\nDevice: $device"
|
||||
|
||||
# JSON output
|
||||
echo "{\"text\":\"<span foreground='$fg'>$icon $ascii_bar $percent%</span>\",\"tooltip\":\"$tooltip\"}"
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/brightness-toggle.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── brightness-toggle.sh ─────────────────────────────
|
||||
# Description: Cycle screen brightness between 30%, 60%, and 100%
|
||||
# Usage: Waybar `custom/brightness` on-click
|
||||
# Dependencies: brightnessctl
|
||||
# ─────────────────────────────────────────────────────
|
||||
|
||||
current=$(brightnessctl get)
|
||||
max=$(brightnessctl max)
|
||||
percent=$((current * 100 / max))
|
||||
|
||||
if [ "$percent" -lt 45 ]; then
|
||||
brightnessctl set 60%
|
||||
elif [ "$percent" -lt 85 ]; then
|
||||
brightnessctl set 100%
|
||||
else
|
||||
brightnessctl set 30%
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/mic.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── mic.sh ─────────────────────────────────────────────────
|
||||
# Description: Shows microphone mute/unmute status with icon
|
||||
# Usage: Called by Waybar `custom/microphone` module every 1s
|
||||
# Dependencies: pactl (PulseAudio / PipeWire)
|
||||
# ───────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q 'yes'; then
|
||||
# Muted → mic-off icon
|
||||
echo "<span foreground='#fab387'>[ ]</span>"
|
||||
else
|
||||
# Active → mic-on icon
|
||||
echo "<span foreground='#56b6c2'>[ ]</span>"
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/nordvpn-toggle.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── vpn-toggle.sh ─────────────────────────────────────────
|
||||
# Description: Toggle VPN on/off via systemd service
|
||||
# Usage: Called by Waybar `custom/vpn` on click
|
||||
# Dependencies: systemctl, ip
|
||||
# ──────────────────────────────────────────────────────────
|
||||
|
||||
if ip a | grep -q "10\.6\.0\."; then
|
||||
# VPN active → stop service (disconnect)
|
||||
systemctl stop nordvpn-retry.service
|
||||
systemctl stop nordvpnd.service
|
||||
else
|
||||
# VPN inactive → start service (connect)
|
||||
systemctl start nordvpn-retry.service
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/nordvpn-status.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── nordvpn-status.sh ──────────────────────────────────────
|
||||
# Description: Checks if VPN interface is active via IP range
|
||||
# Usage: Called by Waybar `custom/vpn` every 5s
|
||||
# Dependencies: ip, curl (optional, for country lookup)
|
||||
# Output: Pango markup → [ФАНТОМ]: Country or KAPUTT
|
||||
# Example: <span foreground='#fab387'>[ФАНТОМ]: Japan</span>
|
||||
# <span foreground='#bf616a'>[ФАНТОМ]: KAPUTT</span>
|
||||
# ───────────────────────────────────────────────────────────
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
if sudo ipsec statusall 2>/dev/null | grep -q "ESTABLISHED"; then
|
||||
country=$(curl -s ifconfig.co/country 2>/dev/null)
|
||||
[[ -z "$country" ]] && country="UNKNOWN"
|
||||
echo "<span foreground='#fab387'>[УЗЕЛ]: $country</span>"
|
||||
else
|
||||
echo "<span foreground='#bf616a'>[НЕТ СВЯЗИ]</span>"
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/powermenu.sh".text = ''
|
||||
#!/usr/bin/env bash
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Rofi Power Menu
|
||||
# Provides a simple system power menu integrated with Waybar.
|
||||
# Example:
|
||||
# ./powermenu.sh
|
||||
# # Opens a Rofi menu with power options
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
rofi_command="rofi -dmenu -p Power"
|
||||
|
||||
options="Shutdown\nReboot\nLogout\nSuspend\nLock"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command)"
|
||||
case $chosen in
|
||||
Shutdown) systemctl poweroff ;;
|
||||
Reboot) systemctl reboot ;;
|
||||
Logout) hyprctl dispatch exit ;;
|
||||
Suspend) systemctl suspend ;;
|
||||
Lock) ~/.config/hyprlock/lock.sh ;;
|
||||
esac
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/volume.sh".text = ''
|
||||
#!/bin/bash
|
||||
# ── volume.sh ─────────────────────────────────────────────
|
||||
# Description: Shows current audio volume with ASCII bar + tooltip
|
||||
# Usage: Waybar `custom/volume` every 1s
|
||||
# Dependencies: wpctl, awk, bc, seq, printf
|
||||
# ───────────────────────────────────────────────────────────
|
||||
|
||||
# Get raw volume and convert to int
|
||||
vol_raw=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{ print $2 }')
|
||||
vol_int=$(echo "$vol_raw * 100" | bc | awk '{ print int($1) }')
|
||||
|
||||
# Check mute status
|
||||
is_muted=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q MUTED && echo true || echo false)
|
||||
|
||||
# Get default sink description (human-readable)
|
||||
sink=$(wpctl status | awk '/Sinks:/,/Sources:/' | grep '\*' | cut -d'.' -f2- | sed 's/^\s*//; s/\[.*//')
|
||||
|
||||
# Icon logic
|
||||
if [ "$is_muted" = true ]; then
|
||||
icon=""
|
||||
vol_int=0
|
||||
elif [ "$vol_int" -lt 50 ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
|
||||
# ASCII bar
|
||||
filled=$((vol_int / 10))
|
||||
empty=$((10 - filled))
|
||||
bar=$(printf '█%.0s' $(seq 1 $filled))
|
||||
pad=$(printf '░%.0s' $(seq 1 $empty))
|
||||
ascii_bar="[$bar$pad]"
|
||||
|
||||
# Color logic
|
||||
if [ "$is_muted" = true ] || [ "$vol_int" -lt 10 ]; then
|
||||
fg="#bf616a" # red
|
||||
elif [ "$vol_int" -lt 50 ]; then
|
||||
fg="#fab387" # orange
|
||||
else
|
||||
fg="#56b6c2" # cyan
|
||||
fi
|
||||
|
||||
# Tooltip text
|
||||
if [ "$is_muted" = true ]; then
|
||||
tooltip="Audio: Muted\nOutput: $sink"
|
||||
else
|
||||
tooltip="Audio: $vol_int%\nOutput: $sink"
|
||||
fi
|
||||
|
||||
# Final JSON output
|
||||
echo "{\"text\":\"<span foreground='$fg'>$icon $ascii_bar $vol_int%</span>\",\"tooltip\":\"$tooltip\"}"
|
||||
'';
|
||||
|
||||
}
|
||||
56
home-manager/20_waybar/04_workspace.nix
Normal file
56
home-manager/20_waybar/04_workspace.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.file.".config/waybar/scripts/workspaces/workspace-1.sh".text = ''
|
||||
#!/bin/bash
|
||||
# workspace-1.sh — highlight workspace 1 if active
|
||||
|
||||
active=$(hyprctl activeworkspace -j | jq '.id')
|
||||
|
||||
if [ "$active" -eq 1 ]; then
|
||||
echo "[<span foreground='#fab387'>●</span>]"
|
||||
else
|
||||
echo "[А]"
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/workspaces/workspace-2.sh".text = ''
|
||||
#!/bin/bash
|
||||
# workspace-2.sh — highlight workspace 2 if active
|
||||
|
||||
active=$(hyprctl activeworkspace -j | jq '.id')
|
||||
|
||||
if [ "$active" -eq 2 ]; then
|
||||
echo "[<span foreground='#fab387'>●</span>]"
|
||||
else
|
||||
echo "[Б]"
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/workspaces/workspace-3.sh".text = ''
|
||||
#!/bin/bash
|
||||
# workspace-3.sh — highlight workspace 3 if active
|
||||
|
||||
active=$(hyprctl activeworkspace -j | jq '.id')
|
||||
|
||||
if [ "$active" -eq 3 ]; then
|
||||
echo "[<span foreground='#fab387'>●</span>]"
|
||||
else
|
||||
echo "[В]"
|
||||
fi
|
||||
'';
|
||||
|
||||
home.file.".config/waybar/scripts/workspaces/workspace-4.sh".text = ''
|
||||
#!/bin/bash
|
||||
# workspace-4.sh — highlight workspace 4 if active
|
||||
|
||||
active=$(hyprctl activeworkspace -j | jq '.id')
|
||||
|
||||
if [ "$active" -eq 4 ]; then
|
||||
echo "[<span foreground='#fab387'>●</span>]"
|
||||
else
|
||||
echo "[Г]"
|
||||
fi
|
||||
'';
|
||||
|
||||
}
|
||||
10
home-manager/20_waybar/default.nix
Normal file
10
home-manager/20_waybar/default.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./01_config.nix
|
||||
./02_style.nix
|
||||
./03_scripts.nix
|
||||
./04_workspace.nix
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user