diff --git a/home/config/nil/wayland.nix b/home/config/nil/wayland.nix index e68293d..5d1513f 100644 --- a/home/config/nil/wayland.nix +++ b/home/config/nil/wayland.nix @@ -31,8 +31,8 @@ let slurp = "${pkgs.slurp}/bin/slurp"; swaylock = "${config.programs.swaylock.package}/bin/swaylock"; swaymsg = "${config.wayland.windowManager.sway.package}/bin/swaymsg"; - swayrbar = "${pkgs.swayrbar.override { withPulseaudio = true; }}/bin/swayrbar"; tofi-drun = "${config.programs.tofi.package}/bin/tofi-drun"; + waybar = "${config.programs.waybar.package}/bin/waybar"; wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy"; wpctl = "${osConfig.services.pipewire.wireplumber.package}/bin/wpctl"; xargs = "${pkgs.findutils}/bin/xargs"; @@ -367,6 +367,228 @@ in lib.mkIf (osConfig.hardware.graphics.enable or false) { }; }; + programs.waybar = { + enable = true; + package = pkgs.waybar.override { + cavaSupport = false; + hyprlandSupport = false; + jackSupport = false; + mpdSupport = false; + sndioSupport = false; + }; + + settings = { + main = { + layer = "top"; + position = "bottom"; + + modules-left = [ + "sway/workspaces" + "tray" + ]; + + modules-center = [ "sway/window" ]; + + modules-right = [ + "network#down" + "network#up" + "bluetooth" + "cpu" + "memory" + "memory#swap" + "temperature" + "disk" + "battery" + "idle_inhibitor" + "backlight" + "mpris" + "pulseaudio#sink" + "pulseaudio#source" + "clock" + ]; + + ipc = true; + + "sway/window" = { + format = "{title}"; + on-click-right = with cmd; "${swaymsg} -t get_tree | jq -r '.. | select(.focused?) | .pid' | ${xargs} kill --"; + }; + + "network#down" = { + format = "󰅀 {bandwidthDownBytes}"; + }; + + "network#up" = { + format = "󰅃 {bandwidthUpBytes}"; + }; + + bluetooth = { + format-connected-battery = "󰂯 {device_battery_percentage} %"; + tooltip-format-connected-battery = "{device_enumerate}"; + tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_battery_percentage} %"; + }; + + cpu = { + format = " {usage} %"; + }; + + memory = { + format = " {percentage} %"; + tooltip-format = "{used:0.1f} / {total:0.1f} GiB"; + }; + + "memory#swap" = { + format = " {swapPercentage} %"; + tooltip-format = "{swapUsed:0.1f} / {swapTotal:0.1f} GiB"; + }; + + temperature = let + fmt = "{temperatureC} °C"; + in { + format = "󰔏 ${fmt}"; + format-critical = "󰸁 ${fmt}"; + tooltip-format = fmt; + }; + + disk = { + format = " {percentage_used} %"; + path = "/home"; + tooltip-format = "{used} / {total}"; + }; + + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = "󱎴"; + deactivated = "󰷛"; + }; + + timeout = 15.0; + }; + + battery = let + fmt = "{capacity} %"; + dis = { + "5" = "󱃍"; + "10" = "󰁺"; + "20" = "󰁻"; + "30" = "󰁼"; + "40" = "󰁽"; + "50" = "󰁿"; + "60" = "󰁿"; + "70" = "󰂀"; + "80" = "󰂁"; + "90" = "󰂂"; + "100" = "󰁹"; + }; + chr = { + "5" = "󰢟"; + "10" = "󰢜"; + "20" = "󰂆"; + "30" = "󰂇"; + "40" = "󰂈"; + "50" = "󰢝"; + "60" = "󰂉"; + "70" = "󰢞"; + "80" = "󰂊"; + "90" = "󰂋"; + "100" = "󰂅"; + }; + in { + states = { + "5" = 5; + "10" = 10; + "20" = 20; + "30" = 30; + "40" = 40; + "50" = 50; + "60" = 60; + "70" = 70; + "80" = 80; + "90" = 90; + "100" = 100; + }; + + format-full = "󰚥 ${fmt}"; + format-time = "{H}:{M}"; + weighted-average = true; + } + // lib.mapAttrs' (state: icon: { + name = "format-discharging-${state}"; + value = "${icon} ${fmt}"; + }) dis + // lib.mapAttrs' (state: icon: { + name = "format-charging-${state}"; + value = "${icon} ${fmt}"; + }) chr; + + backlight = { + format = " {percent} %"; + + on-scroll-up = with cmd; "${brightnessctl} s +1%"; + on-scroll-down = with cmd; "${brightnessctl} s 1%-"; + }; + + mpris = { + format = "{status}"; + status-icons = { + playing = ""; + paused = ""; + stopped = ""; + }; + }; + + "pulseaudio#sink" = let + fmt = "{volume} %"; + in { + format = "{icon} ${fmt}"; + format-bluetooth = "󰂰 ${fmt}"; + format-muted = " ${fmt}"; + + format-icons = { + headphone = ""; + default = [ "" "" ]; + }; + + format-source = "󰍬 ${fmt}"; + format-source-muted = "󰍭 ${fmt}"; + + on-click = cmd.pwvucontrol; + on-click-right = with cmd; "${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-scroll-up = with cmd; "${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 1%+"; + on-scroll-down = with cmd; "${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 1%-"; + }; + + "pulseaudio#source" = let + fmt = "{volume} %"; + in { + format = "{format_source}"; + format-source = "󰍬 ${fmt}"; + format-source-muted = "󰍭 ${fmt}"; + + on-click = cmd.pwvucontrol; + on-click-right = with cmd; "${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + on-scroll-up = with cmd; "${wpctl} set-volume @DEFAULT_AUDIO_SOURCE@ 1%+"; + on-scroll-down = with cmd; "${wpctl} set-volume @DEFAULT_AUDIO_SOURCE@ 1%-"; + }; + + clock = { + format = " {:%H:%M %Z}"; + format-alt = "󰃭 {:%Y-%m-%d}"; + tooltip-format = "{calendar}"; + calendar = { + mode = "month"; + weeks-pos = "left"; + on-scroll = 1; + format = { + weeks = "{:%W}"; + }; + }; + }; + }; + }; + }; + programs.yt-dlp.enable = true; services.gammastep = lib.optionalAttrs (osConfig ? location) ( @@ -547,12 +769,11 @@ in lib.mkIf (osConfig.hardware.graphics.enable or false) { bars = [ { + command = waybar; fonts = lib.mkForce { names = [ "monospace" ]; size = 11.0; }; - - statusCommand = swayrbar; } ]; @@ -582,8 +803,8 @@ in lib.mkIf (osConfig.hardware.graphics.enable or false) { XF86MonBrightnessDown = "exec ${brightnessctl} -e set 5%-"; XF86AudioRaiseVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ +2dB"; XF86AudioLowerVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ -2dB"; - XF86AudioMute = "exec set-mute @DEFAULT_AUDIO_SINK@ toggle"; - XF86AudioMicMute = "exec set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + XF86AudioMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle"; + XF86AudioMicMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; XF86AudioNext = "exec ${playerctl} next"; XF86AudioPrev = "exec ${playerctl} previous"; XF86AudioPlay = "exec ${playerctl} play";