feat: adds ncspot module for waybar

This commit is contained in:
Ahwx 2025-05-05 23:08:52 +02:00
parent 1d755b2d52
commit 1dc166065b
2 changed files with 472 additions and 433 deletions

View file

@ -22,447 +22,461 @@
home.file = { home.file = {
"/home/${username}/.config/waybar/config" = { "/home/${username}/.config/waybar/config" = {
text = '' text = ''
[{ [{
"layer": "top", "layer": "top",
"position": "top", "position": "top",
"modules-left": [ "modules-left": [
"privacy", "privacy",
"group/network", "group/network",
"tray", "custom/spotify",
], "tray",
],
"modules-center": [ "modules-center": [
"hyprland/workspaces", "hyprland/workspaces",
], ],
"modules-right": [ "modules-right": [
"custom/yubikey#icon", "custom/yubikey#icon",
"custom/yubikey#data", "custom/yubikey#data",
"group/hardware", "group/hardware",
"group/resources", "group/resources",
"bluetooth", "bluetooth",
// "wireplumber", // "wireplumber",
"group/audio", "group/audio",
"battery", "battery",
"group/clock" "group/clock"
], ],
"hyprland/window": { "hyprland/window": {
"format": "{}", "format": "{}",
"rewrite": { "rewrite": {
"(.*) - zsh": "> [$1]" "(.*) - zsh": "> [$1]"
}, },
"separate-outputs": true "separate-outputs": true
}, },
"sway/workspaces": { "sway/workspaces": {
"all-outputs": true, "all-outputs": true,
"disable-scroll": true, "disable-scroll": true,
"format": "{name}" "format": "{name}"
}, },
"hyprland/workspaces": { "hyprland/workspaces": {
"all-outputs": true, "all-outputs": true,
"disable-scroll": true, "disable-scroll": true,
"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}",
"format-wifi": " {ipaddr}/{cidr} <span color='#aaaaaa'>{signalStrength}%</span>", "format-wifi": " {ipaddr}/{cidr} <span color='#aaaaaa'>{signalStrength}%</span>",
"format-ethernet": "󰈀 {ipaddr}/{cidr}", "format-ethernet": "󰈀 {ipaddr}/{cidr}",
"format-disconnected": "󰈂", "format-disconnected": "󰈂",
"tooltip-format": "{ifname} via {gwaddr}", "tooltip-format": "{ifname} via {gwaddr}",
"tooltip-format-wifi": "{essid} ({signalStrength}%)", "tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname}", "tooltip-format-ethernet": "{ifname}",
"tooltip-format-disconnected": "Disconnected" "tooltip-format-disconnected": "Disconnected"
}, },
// "custom/vpn": { "custom/spotify": {
// "format": "{icon} VPN <span color='#aaaaaa'>{}</span>", "interval": 1,
// "format-icons": { "return-type": "json",
// "connected": "", "exec": "~/.local/bin/waybar-music",
// "disconnected": "" "on-click": "playerctl play-pause",
// }, "escape": true
// "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
// },
"privacy": { // "custom/vpn": {
"icon-spacing": 8, // "format": "{icon} VPN <span color='#aaaaaa'>{}</span>",
"icon-size": 14, // "format-icons": {
"transition-duration": 250, // "connected": "",
"modules": [ // "disconnected": ""
{ // },
"type": "screenshare", // "return-type": "json",
"tooltip": true, // "exec": "/usr/local/bin/waybar-vpn current",
"tooltip-icon-size": 24 // "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",
"type": "audio-out", // "interval": 30
"tooltip": true, // },
"tooltip-icon-size": 24
},
{
"type": "audio-in",
"tooltip": true,
"tooltip-icon-size": 24
}
]
},
"tray": { "privacy": {
"icon-size": 12, "icon-spacing": 8,
"spacing": 0 "icon-size": 14,
}, "transition-duration": 250,
"modules": [
{
"type": "screenshare",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-out",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-in",
"tooltip": true,
"tooltip-icon-size": 24
}
]
},
"sway/mode": { "tray": {
"format": " {}", "icon-size": 12,
"tooltip": false "spacing": 0
}, },
"custom/yubikey#icon": { "sway/mode": {
"exec": "~/.local/bin/waybar-yubikey 0", "format": " {}",
"return-type": "json" "tooltip": false
}, },
"custom/yubikey#data": { "custom/yubikey#icon": {
"exec": "~/.local/bin/waybar-yubikey 1", "exec": "~/.local/bin/waybar-yubikey 0",
"return-type": "json" "return-type": "json"
}, },
"group/hardware": { "custom/yubikey#data": {
"orientation": "horizontal", "exec": "~/.local/bin/waybar-yubikey 1",
"modules": [ "return-type": "json"
"cpu", },
"temperature#cpu",
"temperature#gpu",
"temperature#nvme",
"temperature#wifi"
],
"drawer": {
"transition-left-to-right": false,
"transition-duration": 500
}
},
"cpu": { "group/hardware": {
"interval": 30, "orientation": "horizontal",
"format": " {avg_frequency:3.2f}GHz <span color='#aaaaaa'>{usage}%</span>", "modules": [
"states": { "cpu",
"warning": 70, "temperature#cpu",
"critical": 90 "temperature#gpu",
}, "temperature#nvme",
}, "temperature#wifi"
],
"drawer": {
"transition-left-to-right": false,
"transition-duration": 500
}
},
"temperature#cpu": { "cpu": {
"hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input", "interval": 30,
"critical-threshold": 80, "format": " {avg_frequency:3.2f}GHz <span color='#aaaaaa'>{usage}%</span>",
"format": " CPU <span color='#aaaaaa'>{temperatureC}°C</span>" "states": {
}, "warning": 70,
"critical": 90
},
},
"temperature#gpu": { "temperature#cpu": {
"hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": "· GPU <span color='#aaaaaa'>{temperatureC}°C</span>" "format": " CPU <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"temperature#nvme": { "temperature#gpu": {
"hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": "· NVMe <span color='#aaaaaa'>{temperatureC}°C</span>" "format": "· GPU <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"temperature#wifi": { "temperature#nvme": {
"hwmon-path": "/sys/class/hwmon/hwmon11/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": "· WiFi <span color='#aaaaaa'>{temperatureC}°C</span>" "format": "· NVMe <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"group/resources": { "temperature#wifi": {
"orientation": "horizontal", "hwmon-path": "/sys/class/hwmon/hwmon11/temp1_input",
"modules": [ "memory", "disk#root" ], "critical-threshold": 80,
"drawer": { "format": "· WiFi <span color='#aaaaaa'>{temperatureC}°C</span>"
"transition-left-to-right": false, },
"transition-duration": 500
}
},
"memory": { "group/resources": {
"interval": 60, "orientation": "horizontal",
"format": "󰘚 {used:3.1f}GiB/<span color='#aaaaaa'>{total:3.1f}GiB</span>" "modules": [ "memory", "disk#root" ],
}, "drawer": {
"transition-left-to-right": false,
"transition-duration": 500
}
},
"disk#root": { "memory": {
"interval": 360, "interval": 60,
"format": " {used}/<span color='#aaaaaa'>{total}</span>", "format": "󰘚 {used:3.1f}GiB/<span color='#aaaaaa'>{total:3.1f}GiB</span>"
"path": "/" },
},
"bluetooth": { "disk#root": {
// "controller": "controller1", "interval": 360,
"on-click": "~/.local/bin/waybar-bluetooth toggle", "format": " {used}/<span color='#aaaaaa'>{total}</span>",
"format": "<span color='#aaaaaa'>󰂲</span>", "path": "/"
"format-disabled": "<span color='#333333'></span>", },
"format-connected": "",
"format-connected-battery": " {device_battery_percentage}%",
"tooltip-format": "{controller_alias}\t\t[{controller_address}]",
"tooltip-format-connected": "{controller_alias}\t\t[{controller_address}]\n\n{device_enumerate}",
"tooltip-format-connected-battery": "{controller_alias}\t\t[{controller_address}]\n\n{device_enumerate}",
"tooltip-format-enumerate-connected": "{device_alias}\t\t[{device_address}]",
"tooltip-format-enumerate-connected-battery": "{device_alias} ({device_battery_percentage})\t\t[{device_address}]"
},
"group/audio": { "bluetooth": {
"orientation": "horizontal", // "controller": "controller1",
"modules": [ "on-click": "~/.local/bin/waybar-bluetooth toggle",
"wireplumber", "format": "<span color='#aaaaaa'>󰂲</span>",
"custom/audio-internal", "format-disabled": "<span color='#333333'></span>",
"custom/audio-headphones", "format-connected": "",
"custom/audio-hdmi" "format-connected-battery": " {device_battery_percentage}%",
], "tooltip-format": "{controller_alias}\t\t[{controller_address}]",
"drawer": { "tooltip-format-connected": "{controller_alias}\t\t[{controller_address}]\n\n{device_enumerate}",
"transition-left-to-right": false, "tooltip-format-connected-battery": "{controller_alias}\t\t[{controller_address}]\n\n{device_enumerate}",
"transition-duration": 500 "tooltip-format-enumerate-connected": "{device_alias}\t\t[{device_address}]",
} "tooltip-format-enumerate-connected-battery": "{device_alias} ({device_battery_percentage})\t\t[{device_address}]"
}, },
"wireplumber": { "group/audio": {
"format": "{icon} {node_name}/<span color='#aaaaaa'>{volume}</span>", "orientation": "horizontal",
"format-muted": "", "modules": [
"on-click": "pavucontrol-qt", "wireplumber",
"on-click-right": "helvum", "custom/audio-internal",
"format-icons": ["", "", ""] "custom/audio-headphones",
}, "custom/audio-hdmi"
],
"drawer": {
"transition-left-to-right": false,
"transition-duration": 500
}
},
"custom/audio-internal": { "wireplumber": {
"format": "󱡬 ", "format": "{icon} {node_name}/<span color='#aaaaaa'>{volume}</span>",
"tooltip-format": "Internal", "format-muted": "",
"on-click": "audio-router analog", "on-click": "pavucontrol-qt",
"interval": "once" "on-click-right": "helvum",
}, "format-icons": ["", "", ""]
},
"custom/audio-hdmi": { "custom/audio-internal": {
"format": "󰡁 ", "format": "󱡬 ",
"tooltip-format": "HDMI", "tooltip-format": "Internal",
"on-click": "audio-router hdmi", "on-click": "audio-router analog",
"interval": "once" "interval": "once"
}, },
"battery": { "custom/audio-hdmi": {
"bat": "BAT1", "format": "󰡁 ",
"interval": 30, "tooltip-format": "HDMI",
"states": { "on-click": "audio-router hdmi",
"warning": 20, "interval": "once"
"critical": 10 },
},
"format-time": "{H}:{m}",
"format": "{icon} {time} <span color='#aaaaaa'>{capacity}%</span>",
"format-discharging": "{icon} <span color='#aaaaaa'>{capacity}%</span>",
"format-discharging-warning": "{icon} <span color='#FF5F1F'>{capacity}%</span>",
"format-discharging-critical": "{icon} <span color='#FF3131'>{capacity}%</span>",
"format-charging": "{icon} <span color='#DAF7A6'>{capacity}%</span><span color='#aaaaaa'> @ {power:2.0f}W</span>",
"format-full": "󱐥 <span color='#aaaaaa'>{capacity}%</span>",
"format-not-charging": "󱐤 <span color='#aaaaaa'>{capacity}%</span>",
"format-icons": [" ", " ", " ", " ", " "],
},
"group/clock": { "battery": {
"orientation": "horizontal", "bat": "BAT1",
"modules": [ "custom/clock#minutes", "clock#time", "clock#date" ], "interval": 30,
"drawer": { "states": {
"transition-left-to-right": false, "warning": 20,
"transition-duration": 500 "critical": 10
} },
}, "format-time": "{H}:{m}",
"format": "{icon} {time} <span color='#aaaaaa'>{capacity}%</span>",
"format-discharging": "{icon} <span color='#aaaaaa'>{capacity}%</span>",
"format-discharging-warning": "{icon} <span color='#FF5F1F'>{capacity}%</span>",
"format-discharging-critical": "{icon} <span color='#FF3131'>{capacity}%</span>",
"format-charging": "{icon} <span color='#DAF7A6'>{capacity}%</span><span color='#aaaaaa'> @ {power:2.0f}W</span>",
"format-full": "󱐥 <span color='#aaaaaa'>{capacity}%</span>",
"format-not-charging": "󱐤 <span color='#aaaaaa'>{capacity}%</span>",
"format-icons": [" ", " ", " ", " ", " "],
},
"clock#date": { "group/clock": {
"interval": 60, "orientation": "horizontal",
"format": " <span color='#ffffff'> {:%a %e %b %Y}</span>", "modules": [ "custom/clock#minutes", "clock#time", "clock#date" ],
"tooltip-format": "<big>{:%B %Y}</big>\n<tt>{calendar}</tt>", "drawer": {
"calendar": { "transition-left-to-right": false,
"mode" : "year", "transition-duration": 500
"mode-mon-col" : 2, }
"weeks-pos" : "right", },
"on-scroll" : 1,
"format": {
"months": "<span color='#ffead3'><b>{}</b></span>",
"days": "<span color='#ecc6d9'><b>{}</b></span>",
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
}
},
"actions": {
"on-click-right": "mode",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down"
}
},
"clock#time": { "clock#date": {
"interval": 60, "interval": 60,
"format": " {:%I:%M %p}", "format": " <span color='#ffffff'> {:%a %e %b %Y}</span>",
"actions": { "tooltip-format": "<big>{:%B %Y}</big>\n<tt>{calendar}</tt>",
"on-scroll-up": "tz_up", "calendar": {
"on-scroll-down": "tz_down" "mode" : "year",
} "mode-mon-col" : 2,
}, "weeks-pos" : "right",
"on-scroll" : 1,
"format": {
"months": "<span color='#ffead3'><b>{}</b></span>",
"days": "<span color='#ecc6d9'><b>{}</b></span>",
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
}
},
"actions": {
"on-click-right": "mode",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down"
}
},
"custom/clock#minutes": { "clock#time": {
"interval": 60, "interval": 60,
"format": " <span color='#aaaaaa'>{}</span> ", "format": " {:%I:%M %p}",
"exec": "~/.local/bin/waybar-minutes" "actions": {
} "on-scroll-up": "tz_up",
} "on-scroll-down": "tz_down"
] }
},
"custom/clock#minutes": {
"interval": 60,
"format": " <span color='#aaaaaa'>{}</span> ",
"exec": "~/.local/bin/waybar-minutes"
}
}
]
''; '';
}; };
"/home/${username}/.config/waybar/style.css" = { "/home/${username}/.config/waybar/style.css" = {
text = '' text = ''
* { * {
border: none; border: none;
border-radius: 0; border-radius: 0;
font-family: 'CommitMono Nerd Font'; font-family: 'CommitMono Nerd Font';
font-weight: 400; font-weight: 400;
font-size: 11px; font-size: 11px;
min-height: 26px; min-height: 26px;
/* margin: 0 0px; */ /* margin: 0 0px; */
} }
window#waybar.top { window#waybar.top {
/* background-color: rgba(115, 116, 116, 0.22); */ /* background-color: rgba(115, 116, 116, 0.22); */
background-color: rgba(0, 0, 0, 0.75); background-color: rgba(0, 0, 0, 0.75);
border-bottom: none; border-bottom: none;
color: #eeeeee; color: #eeeeee;
transition-property: background-color; transition-property: background-color;
transition-duration: .5s; transition-duration: .5s;
} }
window#waybar.hidden { window#waybar.hidden {
opacity: 0.5; opacity: 0.5;
} }
label#window { label#window {
text-shadow: 0px 0px 3px #18181e; text-shadow: 0px 0px 3px #18181e;
} }
tooltip { tooltip {
background: rgba(43, 48, 59, 0.5); background: rgba(43, 48, 59, 0.5);
border: 1px solid rgba(100, 114, 125, 0.5); border: 1px solid rgba(100, 114, 125, 0.5);
} }
tooltip label { tooltip label {
color: white; color: white;
} }
.modules-left > widget > label, .modules-left > widget > label,
.modules-left > box > widget > label, .modules-left > box > widget > label,
.modules-right > widget > label, .modules-right > widget > label,
.modules-right > box > widget > label { .modules-right > box > widget > label {
padding: 0 10px; padding: 0 10px;
margin: 0px 0px 0px 10px; margin: 0px 0px 0px 10px;
} }
#network, #resources, #audio, #clock { #network, #resources, #audio, #clock {
padding: 0 4px; padding: 0 4px;
} }
.drawer-child > label { .drawer-child > label {
margin: 0px 10px; margin: 0px 10px;
} }
#custom-audio-internal, #custom-audio-internal,
#custom-audio-motu, #custom-audio-motu,
#custom-audio-headphones, #custom-audio-headphones,
#custom-audio-hdmi #custom-audio-hdmi
{ {
padding: 4px 2px; padding: 4px 2px;
border-radius: 0px; border-radius: 0px;
} }
#workspaces { #workspaces {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
#workspaces button { #workspaces button {
/*padding: 4px 6px;*/ /*padding: 4px 6px;*/
padding: 4px 6px; padding: 4px 6px;
color: #555555; color: #555555;
border-radius: 0px; border-radius: 0px;
/*min-width: 32px;*/ /*min-width: 32px;*/
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover { #workspaces button:hover {
box-shadow: inherit; box-shadow: inherit;
text-shadow: inherit; text-shadow: inherit;
background: transparent; background: transparent;
color: #ffffff; color: #ffffff;
} }
#workspaces button.active { #workspaces button.active {
box-shadow: inherit; box-shadow: inherit;
text-shadow: inherit; text-shadow: inherit;
background: transparent; background: transparent;
color: #ffffff; color: #ffffff;
} }
#workspaces button.focused { #workspaces button.focused {
color: #eeeeee; color: #eeeeee;
} }
#workspaces button.focused:hover { #workspaces button.focused:hover {
color: #ffffff; color: #ffffff;
} }
#workspaces button.urgent { #workspaces button.urgent {
color: #ffffff; color: #ffffff;
background-color: #e27878; background-color: #e27878;
} }
#language { #language {
/* margin: 0px 0px 0px 0px; */ /* margin: 0px 0px 0px 0px; */
color: #cccccc; color: #cccccc;
} }
#tray { #tray {
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
/* margin-left: 10px; */ /* margin-left: 10px; */
} }
#tray image { #tray image {
margin: 0px 10px 0px 0px; margin: 0px 10px 0px 0px;
} }
#mode { #mode {
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
border: 2px solid #e2a478; border: 2px solid #e2a478;
margin: 0px 10px 0px 0px; margin: 0px 10px 0px 0px;
border-radius: 5px; border-radius: 5px;
} }
#custom-yubikey.icon { #custom-yubikey.icon {
background: #f9409d; background: #f9409d;
} }
#custom-spotify {
color: #ffffff;
padding-right: 10px;
}
''; '';
}; };

View file

@ -52,7 +52,7 @@
output_off="{\"text\": \"<span color='#aaaaaa'></span>\", \"tooltip\": \"Not recording\", \"alt\": \"\", \"class\": \"\" }" output_off="{\"text\": \"<span color='#aaaaaa'></span>\", \"tooltip\": \"Not recording\", \"alt\": \"\", \"class\": \"\" }"
output_rec="{\"text\": \"<span color='#e98989'></span>\", \"tooltip\": \"Recording\", \"alt\": \"\", \"class\": \"\" }" output_rec="{\"text\": \"<span color='#e98989'></span>\", \"tooltip\": \"Recording\", \"alt\": \"\", \"class\": \"\" }"
pidof wf-recorder > /dev/null 2>&1 pidof wf-recorder > /dev/null 2>&1
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
@ -86,57 +86,57 @@
"/home/${username}/.local/bin/waybar-bluetooth" = { "/home/${username}/.local/bin/waybar-bluetooth" = {
executable = true; executable = true;
text = '' text = ''
#!/usr/bin/env zsh #!/usr/bin/env zsh
typeset -A known=( typeset -A known=(
'headphones' '38:18:4C:D1:AE:48' 'headphones' '38:18:4C:D1:AE:48'
'airpods' '2C:18:09:EF:BD:11' 'airpods' '2C:18:09:EF:BD:11'
) )
function get_addr_or_fail () { function get_addr_or_fail () {
if [ "$known[$1]" = "" ] if [ "$known[$1]" = "" ]
then
printf 'No device specified\n'
exit 1
fi
printf "$known[$1]"
}
case "$1" in
"list")
for k v ("''${(@kv)known}") printf "$k\n"
;;
"toggle")
device=""
tmp="$2"
if [ "$tmp" = "" ]
then then
tmp=$($0 list | bemenu --ignorecase) printf 'No device specified\n'
exit 1
fi fi
device=$(get_addr_or_fail "$tmp") printf "$known[$1]"
is_connected=$(bluetoothctl info $device | grep -i 'connected: yes') }
if [ "$is_connected" != "" ]
then case "$1" in
bluetoothctl disconnect $device "list")
else for k v ("''${(@kv)known}") printf "$k\n"
bluetoothctl connect $device ;;
fi "toggle")
;; device=""
"status") tmp="$2"
device=$(get_addr_or_fail "$2") if [ "$tmp" = "" ]
is_connected=$(bluetoothctl info $device | grep -i 'connected: yes') then
if [ "$is_connected" != "" ] tmp=$($0 list | bemenu --ignorecase)
then fi
echo "{\"text\": \"Connected\", \"class\": \"custom-btdevice\", \"alt\": \"connected\" }" device=$(get_addr_or_fail "$tmp")
else is_connected=$(bluetoothctl info $device | grep -i 'connected: yes')
echo "{\"text\": \"Disconnected\", \"class\": \"custom-btdevice\", \"alt\": \"disconnected\" }" if [ "$is_connected" != "" ]
fi then
;; bluetoothctl disconnect $device
*) else
printf "$0 list|toggle <device>|status <device>\n" bluetoothctl connect $device
exit 1 fi
;; ;;
esac "status")
device=$(get_addr_or_fail "$2")
is_connected=$(bluetoothctl info $device | grep -i 'connected: yes')
if [ "$is_connected" != "" ]
then
echo "{\"text\": \"Connected\", \"class\": \"custom-btdevice\", \"alt\": \"connected\" }"
else
echo "{\"text\": \"Disconnected\", \"class\": \"custom-btdevice\", \"alt\": \"disconnected\" }"
fi
;;
*)
printf "$0 list|toggle <device>|status <device>\n"
exit 1
;;
esac
''; '';
# "/home/${username}/.local/bin/waybar-cpu" = { # "/home/${username}/.local/bin/waybar-cpu" = {
# executable = true; # executable = true;
@ -152,10 +152,35 @@
echo $(( (24 - $(date +%H)) * 60 - $(date +%M) )) echo $(( (24 - $(date +%H)) * 60 - $(date +%M) ))
''; '';
}; };
"/home/${username}/.local/bin/waybar-music" = {
executable = true;
text = ''
#!/usr/bin/env bash
class=$(playerctl metadata --player=ncspot --format '{{lc(status)}}')
if [[ $class == "playing" ]]; then
info=$(playerctl metadata --player=ncspot --format '{{artist}} - {{title}}')
if [[ $\{#info} > 40 ]]; then
info=$(echo $info | cut -c1-40)"..."
fi
text="$info"
elif [[ $class == "paused" ]]; then
info=$(playerctl metadata --player=ncspot --format '{{artist}} - {{title}}')
if [[ $\{#info} > 40 ]]; then
info=$(echo $info | cut -c1-40)"..."
fi
text=" $info"
elif [[ $class == "stopped" ]]; then
text=""
fi
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
'';
};
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
wf-recorder wf-recorder
bemenu bemenu
]; ];
} }