diff --git a/modules/home/waybar/default.nix b/modules/home/waybar/default.nix
index 626b8b9..6999893 100644
--- a/modules/home/waybar/default.nix
+++ b/modules/home/waybar/default.nix
@@ -22,447 +22,461 @@
home.file = {
"/home/${username}/.config/waybar/config" = {
text = ''
- [{
- "layer": "top",
- "position": "top",
+ [{
+ "layer": "top",
+ "position": "top",
- "modules-left": [
- "privacy",
- "group/network",
- "tray",
- ],
+ "modules-left": [
+ "privacy",
+ "group/network",
+ "custom/spotify",
+ "tray",
+ ],
- "modules-center": [
- "hyprland/workspaces",
- ],
+ "modules-center": [
+ "hyprland/workspaces",
+ ],
- "modules-right": [
- "custom/yubikey#icon",
- "custom/yubikey#data",
- "group/hardware",
- "group/resources",
- "bluetooth",
- // "wireplumber",
- "group/audio",
- "battery",
- "group/clock"
- ],
+ "modules-right": [
+ "custom/yubikey#icon",
+ "custom/yubikey#data",
+ "group/hardware",
+ "group/resources",
+ "bluetooth",
+ // "wireplumber",
+ "group/audio",
+ "battery",
+ "group/clock"
+ ],
- "hyprland/window": {
- "format": "{}",
- "rewrite": {
- "(.*) - zsh": "> [$1]"
- },
- "separate-outputs": true
- },
+ "hyprland/window": {
+ "format": "{}",
+ "rewrite": {
+ "(.*) - zsh": "> [$1]"
+ },
+ "separate-outputs": true
+ },
- "sway/workspaces": {
- "all-outputs": true,
- "disable-scroll": true,
- "format": "{name}"
- },
+ "sway/workspaces": {
+ "all-outputs": true,
+ "disable-scroll": true,
+ "format": "{name}"
+ },
- "hyprland/workspaces": {
- "all-outputs": true,
- "disable-scroll": true,
- "format": "{name}"
- },
+ "hyprland/workspaces": {
+ "all-outputs": true,
+ "disable-scroll": true,
+ "format": "{name}"
+ },
- "group/network": {
- "orientation": "horizontal",
- "modules": [
- "network",
- "custom/vpn",
- ],
- "drawer": {
- "transition-left-to-right": true,
- "transition-duration": 500
- }
- },
-
- "network": {
- "format": " {ifname}",
- "format-wifi": " {ipaddr}/{cidr} {signalStrength}%",
- "format-ethernet": " {ipaddr}/{cidr}",
- "format-disconnected": "",
- "tooltip-format": "{ifname} via {gwaddr}",
- "tooltip-format-wifi": "{essid} ({signalStrength}%)",
- "tooltip-format-ethernet": "{ifname}",
- "tooltip-format-disconnected": "Disconnected"
- },
+ "group/network": {
+ "orientation": "horizontal",
+ "modules": [
+ "network",
+ "custom/vpn",
+ ],
+ "drawer": {
+ "transition-left-to-right": true,
+ "transition-duration": 500
+ }
+ },
+
+ "network": {
+ "format": " {ifname}",
+ "format-wifi": " {ipaddr}/{cidr} {signalStrength}%",
+ "format-ethernet": " {ipaddr}/{cidr}",
+ "format-disconnected": "",
+ "tooltip-format": "{ifname} via {gwaddr}",
+ "tooltip-format-wifi": "{essid} ({signalStrength}%)",
+ "tooltip-format-ethernet": "{ifname}",
+ "tooltip-format-disconnected": "Disconnected"
+ },
- // "custom/vpn": {
- // "format": "{icon} VPN {}",
- // "format-icons": {
- // "connected": "",
- // "disconnected": ""
- // },
- // "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
- // },
+ "custom/spotify": {
+ "interval": 1,
+ "return-type": "json",
+ "exec": "~/.local/bin/waybar-music",
+ "on-click": "playerctl play-pause",
+ "escape": true
+ },
- "privacy": {
- "icon-spacing": 8,
- "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
- }
- ]
- },
+ // "custom/vpn": {
+ // "format": "{icon} VPN {}",
+ // "format-icons": {
+ // "connected": "",
+ // "disconnected": ""
+ // },
+ // "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
+ // },
- "tray": {
- "icon-size": 12,
- "spacing": 0
- },
+ "privacy": {
+ "icon-spacing": 8,
+ "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": {
- "format": " {}",
- "tooltip": false
- },
+ "tray": {
+ "icon-size": 12,
+ "spacing": 0
+ },
- "custom/yubikey#icon": {
- "exec": "~/.local/bin/waybar-yubikey 0",
- "return-type": "json"
- },
+ "sway/mode": {
+ "format": " {}",
+ "tooltip": false
+ },
- "custom/yubikey#data": {
- "exec": "~/.local/bin/waybar-yubikey 1",
- "return-type": "json"
- },
+ "custom/yubikey#icon": {
+ "exec": "~/.local/bin/waybar-yubikey 0",
+ "return-type": "json"
+ },
- "group/hardware": {
- "orientation": "horizontal",
- "modules": [
- "cpu",
- "temperature#cpu",
- "temperature#gpu",
- "temperature#nvme",
- "temperature#wifi"
- ],
- "drawer": {
- "transition-left-to-right": false,
- "transition-duration": 500
- }
- },
+ "custom/yubikey#data": {
+ "exec": "~/.local/bin/waybar-yubikey 1",
+ "return-type": "json"
+ },
- "cpu": {
- "interval": 30,
- "format": " {avg_frequency:3.2f}GHz {usage}%",
- "states": {
- "warning": 70,
- "critical": 90
- },
- },
+ "group/hardware": {
+ "orientation": "horizontal",
+ "modules": [
+ "cpu",
+ "temperature#cpu",
+ "temperature#gpu",
+ "temperature#nvme",
+ "temperature#wifi"
+ ],
+ "drawer": {
+ "transition-left-to-right": false,
+ "transition-duration": 500
+ }
+ },
- "temperature#cpu": {
- "hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
- "critical-threshold": 80,
- "format": " CPU {temperatureC}°C"
- },
+ "cpu": {
+ "interval": 30,
+ "format": " {avg_frequency:3.2f}GHz {usage}%",
+ "states": {
+ "warning": 70,
+ "critical": 90
+ },
+ },
- "temperature#gpu": {
- "hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input",
- "critical-threshold": 80,
- "format": "· GPU {temperatureC}°C"
- },
+ "temperature#cpu": {
+ "hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
+ "critical-threshold": 80,
+ "format": " CPU {temperatureC}°C"
+ },
- "temperature#nvme": {
- "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input",
- "critical-threshold": 80,
- "format": "· NVMe {temperatureC}°C"
- },
+ "temperature#gpu": {
+ "hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input",
+ "critical-threshold": 80,
+ "format": "· GPU {temperatureC}°C"
+ },
- "temperature#wifi": {
- "hwmon-path": "/sys/class/hwmon/hwmon11/temp1_input",
- "critical-threshold": 80,
- "format": "· WiFi {temperatureC}°C"
- },
+ "temperature#nvme": {
+ "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input",
+ "critical-threshold": 80,
+ "format": "· NVMe {temperatureC}°C"
+ },
- "group/resources": {
- "orientation": "horizontal",
- "modules": [ "memory", "disk#root" ],
- "drawer": {
- "transition-left-to-right": false,
- "transition-duration": 500
- }
- },
+ "temperature#wifi": {
+ "hwmon-path": "/sys/class/hwmon/hwmon11/temp1_input",
+ "critical-threshold": 80,
+ "format": "· WiFi {temperatureC}°C"
+ },
- "memory": {
- "interval": 60,
- "format": " {used:3.1f}GiB/{total:3.1f}GiB"
- },
+ "group/resources": {
+ "orientation": "horizontal",
+ "modules": [ "memory", "disk#root" ],
+ "drawer": {
+ "transition-left-to-right": false,
+ "transition-duration": 500
+ }
+ },
- "disk#root": {
- "interval": 360,
- "format": " {used}/{total}",
- "path": "/"
- },
+ "memory": {
+ "interval": 60,
+ "format": " {used:3.1f}GiB/{total:3.1f}GiB"
+ },
- "bluetooth": {
- // "controller": "controller1",
- "on-click": "~/.local/bin/waybar-bluetooth toggle",
- "format": "",
- "format-disabled": "",
- "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}]"
- },
+ "disk#root": {
+ "interval": 360,
+ "format": " {used}/{total}",
+ "path": "/"
+ },
- "group/audio": {
- "orientation": "horizontal",
- "modules": [
- "wireplumber",
- "custom/audio-internal",
- "custom/audio-headphones",
- "custom/audio-hdmi"
- ],
- "drawer": {
- "transition-left-to-right": false,
- "transition-duration": 500
- }
- },
+ "bluetooth": {
+ // "controller": "controller1",
+ "on-click": "~/.local/bin/waybar-bluetooth toggle",
+ "format": "",
+ "format-disabled": "",
+ "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}]"
+ },
- "wireplumber": {
- "format": "{icon} {node_name}/{volume}",
- "format-muted": "",
- "on-click": "pavucontrol-qt",
- "on-click-right": "helvum",
- "format-icons": ["", "", ""]
- },
+ "group/audio": {
+ "orientation": "horizontal",
+ "modules": [
+ "wireplumber",
+ "custom/audio-internal",
+ "custom/audio-headphones",
+ "custom/audio-hdmi"
+ ],
+ "drawer": {
+ "transition-left-to-right": false,
+ "transition-duration": 500
+ }
+ },
- "custom/audio-internal": {
- "format": " ",
- "tooltip-format": "Internal",
- "on-click": "audio-router analog",
- "interval": "once"
- },
+ "wireplumber": {
+ "format": "{icon} {node_name}/{volume}",
+ "format-muted": "",
+ "on-click": "pavucontrol-qt",
+ "on-click-right": "helvum",
+ "format-icons": ["", "", ""]
+ },
- "custom/audio-hdmi": {
- "format": " ",
- "tooltip-format": "HDMI",
- "on-click": "audio-router hdmi",
- "interval": "once"
- },
+ "custom/audio-internal": {
+ "format": " ",
+ "tooltip-format": "Internal",
+ "on-click": "audio-router analog",
+ "interval": "once"
+ },
- "battery": {
- "bat": "BAT1",
- "interval": 30,
- "states": {
- "warning": 20,
- "critical": 10
- },
- "format-time": "{H}:{m}",
- "format": "{icon} {time} {capacity}%",
- "format-discharging": "{icon} {capacity}%",
- "format-discharging-warning": "{icon} {capacity}%",
- "format-discharging-critical": "{icon} {capacity}%",
- "format-charging": "{icon} {capacity}% @ {power:2.0f}W",
- "format-full": " {capacity}%",
- "format-not-charging": " {capacity}%",
- "format-icons": [" ", " ", " ", " ", " "],
- },
+ "custom/audio-hdmi": {
+ "format": " ",
+ "tooltip-format": "HDMI",
+ "on-click": "audio-router hdmi",
+ "interval": "once"
+ },
- "group/clock": {
- "orientation": "horizontal",
- "modules": [ "custom/clock#minutes", "clock#time", "clock#date" ],
- "drawer": {
- "transition-left-to-right": false,
- "transition-duration": 500
- }
- },
+ "battery": {
+ "bat": "BAT1",
+ "interval": 30,
+ "states": {
+ "warning": 20,
+ "critical": 10
+ },
+ "format-time": "{H}:{m}",
+ "format": "{icon} {time} {capacity}%",
+ "format-discharging": "{icon} {capacity}%",
+ "format-discharging-warning": "{icon} {capacity}%",
+ "format-discharging-critical": "{icon} {capacity}%",
+ "format-charging": "{icon} {capacity}% @ {power:2.0f}W",
+ "format-full": " {capacity}%",
+ "format-not-charging": " {capacity}%",
+ "format-icons": [" ", " ", " ", " ", " "],
+ },
- "clock#date": {
- "interval": 60,
- "format": " {:%a %e %b %Y}",
- "tooltip-format": "{:%B %Y}\n{calendar}",
- "calendar": {
- "mode" : "year",
- "mode-mon-col" : 2,
- "weeks-pos" : "right",
- "on-scroll" : 1,
- "format": {
- "months": "{}",
- "days": "{}",
- "weeks": "W{}",
- "weekdays": "{}",
- "today": "{}"
- }
- },
- "actions": {
- "on-click-right": "mode",
- "on-scroll-up": "shift_up",
- "on-scroll-down": "shift_down"
- }
- },
+ "group/clock": {
+ "orientation": "horizontal",
+ "modules": [ "custom/clock#minutes", "clock#time", "clock#date" ],
+ "drawer": {
+ "transition-left-to-right": false,
+ "transition-duration": 500
+ }
+ },
- "clock#time": {
- "interval": 60,
- "format": " {:%I:%M %p}",
- "actions": {
- "on-scroll-up": "tz_up",
- "on-scroll-down": "tz_down"
- }
- },
+ "clock#date": {
+ "interval": 60,
+ "format": " {:%a %e %b %Y}",
+ "tooltip-format": "{:%B %Y}\n{calendar}",
+ "calendar": {
+ "mode" : "year",
+ "mode-mon-col" : 2,
+ "weeks-pos" : "right",
+ "on-scroll" : 1,
+ "format": {
+ "months": "{}",
+ "days": "{}",
+ "weeks": "W{}",
+ "weekdays": "{}",
+ "today": "{}"
+ }
+ },
+ "actions": {
+ "on-click-right": "mode",
+ "on-scroll-up": "shift_up",
+ "on-scroll-down": "shift_down"
+ }
+ },
- "custom/clock#minutes": {
- "interval": 60,
- "format": " {} ",
- "exec": "~/.local/bin/waybar-minutes"
- }
- }
- ]
+ "clock#time": {
+ "interval": 60,
+ "format": " {:%I:%M %p}",
+ "actions": {
+ "on-scroll-up": "tz_up",
+ "on-scroll-down": "tz_down"
+ }
+ },
+
+ "custom/clock#minutes": {
+ "interval": 60,
+ "format": " {} ",
+ "exec": "~/.local/bin/waybar-minutes"
+ }
+ }
+ ]
'';
};
"/home/${username}/.config/waybar/style.css" = {
text = ''
- * {
- border: none;
- border-radius: 0;
- font-family: 'CommitMono Nerd Font';
- font-weight: 400;
- font-size: 11px;
- min-height: 26px;
- /* margin: 0 0px; */
- }
+ * {
+ border: none;
+ border-radius: 0;
+ font-family: 'CommitMono Nerd Font';
+ font-weight: 400;
+ font-size: 11px;
+ min-height: 26px;
+ /* margin: 0 0px; */
+ }
- window#waybar.top {
- /* background-color: rgba(115, 116, 116, 0.22); */
- background-color: rgba(0, 0, 0, 0.75);
- border-bottom: none;
- color: #eeeeee;
- transition-property: background-color;
- transition-duration: .5s;
- }
+ window#waybar.top {
+ /* background-color: rgba(115, 116, 116, 0.22); */
+ background-color: rgba(0, 0, 0, 0.75);
+ border-bottom: none;
+ color: #eeeeee;
+ transition-property: background-color;
+ transition-duration: .5s;
+ }
- window#waybar.hidden {
- opacity: 0.5;
- }
+ window#waybar.hidden {
+ opacity: 0.5;
+ }
- label#window {
- text-shadow: 0px 0px 3px #18181e;
- }
+ label#window {
+ text-shadow: 0px 0px 3px #18181e;
+ }
- tooltip {
- background: rgba(43, 48, 59, 0.5);
- border: 1px solid rgba(100, 114, 125, 0.5);
- }
+ tooltip {
+ background: rgba(43, 48, 59, 0.5);
+ border: 1px solid rgba(100, 114, 125, 0.5);
+ }
- tooltip label {
- color: white;
- }
+ tooltip label {
+ color: white;
+ }
- .modules-left > widget > label,
- .modules-left > box > widget > label,
- .modules-right > widget > label,
- .modules-right > box > widget > label {
- padding: 0 10px;
- margin: 0px 0px 0px 10px;
- }
+ .modules-left > widget > label,
+ .modules-left > box > widget > label,
+ .modules-right > widget > label,
+ .modules-right > box > widget > label {
+ padding: 0 10px;
+ margin: 0px 0px 0px 10px;
+ }
- #network, #resources, #audio, #clock {
- padding: 0 4px;
- }
+ #network, #resources, #audio, #clock {
+ padding: 0 4px;
+ }
- .drawer-child > label {
- margin: 0px 10px;
- }
+ .drawer-child > label {
+ margin: 0px 10px;
+ }
- #custom-audio-internal,
- #custom-audio-motu,
- #custom-audio-headphones,
- #custom-audio-hdmi
- {
- padding: 4px 2px;
- border-radius: 0px;
- }
+ #custom-audio-internal,
+ #custom-audio-motu,
+ #custom-audio-headphones,
+ #custom-audio-hdmi
+ {
+ padding: 4px 2px;
+ border-radius: 0px;
+ }
- #workspaces {
- margin: 0px 0px 0px 0px;
- }
+ #workspaces {
+ margin: 0px 0px 0px 0px;
+ }
- #workspaces button {
- /*padding: 4px 6px;*/
- padding: 4px 6px;
- color: #555555;
- border-radius: 0px;
- /*min-width: 32px;*/
- }
+ #workspaces button {
+ /*padding: 4px 6px;*/
+ padding: 4px 6px;
+ color: #555555;
+ border-radius: 0px;
+ /*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 {
- box-shadow: inherit;
- text-shadow: inherit;
- background: transparent;
- color: #ffffff;
- }
+ #workspaces button:hover {
+ box-shadow: inherit;
+ text-shadow: inherit;
+ background: transparent;
+ color: #ffffff;
+ }
- #workspaces button.active {
- box-shadow: inherit;
- text-shadow: inherit;
- background: transparent;
- color: #ffffff;
- }
+ #workspaces button.active {
+ box-shadow: inherit;
+ text-shadow: inherit;
+ background: transparent;
+ color: #ffffff;
+ }
- #workspaces button.focused {
- color: #eeeeee;
- }
+ #workspaces button.focused {
+ color: #eeeeee;
+ }
- #workspaces button.focused:hover {
- color: #ffffff;
- }
+ #workspaces button.focused:hover {
+ color: #ffffff;
+ }
- #workspaces button.urgent {
- color: #ffffff;
- background-color: #e27878;
- }
+ #workspaces button.urgent {
+ color: #ffffff;
+ background-color: #e27878;
+ }
- #language {
- /* margin: 0px 0px 0px 0px; */
- color: #cccccc;
- }
+ #language {
+ /* margin: 0px 0px 0px 0px; */
+ color: #cccccc;
+ }
- #tray {
- background-color: rgba(0, 0, 0, 0);
- /* margin-left: 10px; */
- }
+ #tray {
+ background-color: rgba(0, 0, 0, 0);
+ /* margin-left: 10px; */
+ }
- #tray image {
- margin: 0px 10px 0px 0px;
- }
+ #tray image {
+ margin: 0px 10px 0px 0px;
+ }
- #mode {
- background-color: rgba(0, 0, 0, 0);
- border: 2px solid #e2a478;
- margin: 0px 10px 0px 0px;
- border-radius: 5px;
- }
+ #mode {
+ background-color: rgba(0, 0, 0, 0);
+ border: 2px solid #e2a478;
+ margin: 0px 10px 0px 0px;
+ border-radius: 5px;
+ }
- #custom-yubikey.icon {
- background: #f9409d;
- }
+ #custom-yubikey.icon {
+ background: #f9409d;
+ }
+
+ #custom-spotify {
+ color: #ffffff;
+ padding-right: 10px;
+ }
'';
};
diff --git a/modules/home/waybar/scripts.nix b/modules/home/waybar/scripts.nix
index e0766b9..5788fa8 100644
--- a/modules/home/waybar/scripts.nix
+++ b/modules/home/waybar/scripts.nix
@@ -52,7 +52,7 @@
output_off="{\"text\": \"\", \"tooltip\": \"Not recording\", \"alt\": \"\", \"class\": \"\" }"
output_rec="{\"text\": \"\", \"tooltip\": \"Recording\", \"alt\": \"\", \"class\": \"\" }"
-
+
pidof wf-recorder > /dev/null 2>&1
if [ $? -eq 0 ]
then
@@ -86,57 +86,57 @@
"/home/${username}/.local/bin/waybar-bluetooth" = {
executable = true;
text = ''
- #!/usr/bin/env zsh
+ #!/usr/bin/env zsh
- typeset -A known=(
- 'headphones' '38:18:4C:D1:AE:48'
- 'airpods' '2C:18:09:EF:BD:11'
- )
-
- function get_addr_or_fail () {
- 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" = "" ]
+ typeset -A known=(
+ 'headphones' '38:18:4C:D1:AE:48'
+ 'airpods' '2C:18:09:EF:BD:11'
+ )
+
+ function get_addr_or_fail () {
+ if [ "$known[$1]" = "" ]
then
- tmp=$($0 list | bemenu --ignorecase)
+ printf 'No device specified\n'
+ exit 1
fi
- device=$(get_addr_or_fail "$tmp")
- is_connected=$(bluetoothctl info $device | grep -i 'connected: yes')
- if [ "$is_connected" != "" ]
- then
- bluetoothctl disconnect $device
- else
- bluetoothctl connect $device
- fi
- ;;
- "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 |status \n"
- exit 1
- ;;
- esac
+ printf "$known[$1]"
+ }
+
+ case "$1" in
+ "list")
+ for k v ("''${(@kv)known}") printf "$k\n"
+ ;;
+ "toggle")
+ device=""
+ tmp="$2"
+ if [ "$tmp" = "" ]
+ then
+ tmp=$($0 list | bemenu --ignorecase)
+ fi
+ device=$(get_addr_or_fail "$tmp")
+ is_connected=$(bluetoothctl info $device | grep -i 'connected: yes')
+ if [ "$is_connected" != "" ]
+ then
+ bluetoothctl disconnect $device
+ else
+ bluetoothctl connect $device
+ fi
+ ;;
+ "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 |status \n"
+ exit 1
+ ;;
+ esac
'';
# "/home/${username}/.local/bin/waybar-cpu" = {
# executable = true;
@@ -152,10 +152,35 @@
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; [
wf-recorder
bemenu
];
}
-