{ config, pkgs, myConfig, ... }: let # FIXME: waybar overlaps fullscreen display when restarting waybar hakase-popup-launch = pkgs.writeShellScriptBin "hakase-popup-launch" '' tui_name=$1 active_popup=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r '.[] | select(.class | startswith("org.hakase.")) | .class') if [[ -z "''${tui_name}" ]]; then echo "Usage: $(basename "$0") [tui-name]" exit 1 fi popup_checker() { if [[ -z "$active_popup" ]]; then echo "no_popup" elif [[ "$active_popup" != "org.hakase.popup.''${tui_name}" ]]; then echo "different" else echo "same" fi } launch() { exec ${pkgs.util-linux}/bin/setsid uwsm-app -- xdg-terminal-exec --app-id=org.hakase.popup."''${tui_name}" -e "''${tui_name}" } focus() { exec ${pkgs.hyprland}/bin/hyprctl dispatch focuswindow "class:org.hakase.popup.''${tui_name}" } replace() { ${pkgs.hyprland}/bin/hyprctl dispatch closewindow "class:''${active_popup}" sleep 0.3 launch } run() { local status status=$(popup_checker) if [[ "$status" == "no_popup" ]]; then launch elif [[ "$status" == "same" ]]; then focus elif [[ "$status" == "different" ]]; then replace fi } run ''; in { wayland.windowManager.hyprland.settings = { exec-once = [ "uwsm app -- waybar" ]; bind = [ "SUPER, Escape, exec, hakase-popup-launch btop" "SUPER, N, exec, hakase-popup-launch impala" "SUPER, B, exec, hakase-popup-launch bluetui" "SUPER, T, exec, hakase-popup-launch wiremix" ]; windowrulev2 = [ # --- POPUP RULES (Wifi, BT, Audio) --- "float, class:^(org\.hakase\.popup\..*)$" "size 900 600, class:^(org\.hakase\.popup\..*)$" "center, class:^(org\.hakase\.popup\..*)$" "animation slide right, class:^(org\.hakase\.popup\..*)$" "dimaround, class:^(org\.hakase\.popup\..*)$" ]; }; imports = [ ./style.nix ]; home.packages = [ hakase-popup-launch pkgs.jq pkgs.socat pkgs.util-linux pkgs.bluetui pkgs.impala pkgs.wiremix pkgs.pamixer ]; programs.waybar = { enable = true; settings = { mainBar = { reload_style_on_change = true; layer = "top"; position = "top"; spacing = 0; height = 26; modules-left = ["custom/omarchy" "hyprland/workspaces" "hyprland/workspaces#special"]; modules-center = ["clock" "custom/update" "custom/screenrecording-indicator"]; modules-right = [ "group/tray-expander" "bluetooth" "network" "pulseaudio" "cpu" "battery" ]; "hyprland/workspaces" = { on-click = "activate"; show-special = false; all-outputs = true; format = "{icon}"; format-icons = { "music" = "󰎆"; "gaming" = "󰊖"; "steam" = "󰓓"; "default" = ""; "active" = "󱓻"; # Numbered workspaces 1-5 "1" = "1"; "2" = "2"; "3" = "3"; "4" = "4"; "5" = "5"; # Kanji for workspaces 6-10 "6" = "六"; "7" = "七"; "8" = "八"; "9" = "九"; "10" = "十"; # Dice for workspaces 11-15 "11" = "⚀"; "12" = "⚁"; "13" = "⚂"; "14" = "⚃"; "15" = "⚄"; # Circled numbers for 16-20 "16" = "⑯"; "17" = "⑰"; "18" = "⑱"; "19" = "⑲"; "20" = "⑳"; }; persistent-workspaces = { "1" = []; "2" = []; "3" = []; "4" = []; "5" = []; }; }; "hyprland/workspaces#special" = { on-click = "activate"; show-special = true; special-visible-only = true; all-outputs = true; ignore-workspaces = ["^([0-9]+|gaming|steam|music)$"]; format = "{icon}"; format-icons = { "special:youtube" = "󰗃"; "special:custom" = "󱗼"; "special:preload" = "󱗼"; "youtube" = "󰗃"; "custom" = "󱗼"; "preload" = "󱗼"; "default" = "󱗼"; }; }; "custom/omarchy" = { format = ""; on-click = "vicinae-toggle"; on-click-right = "hyprctl dispatch overview:toggle"; tooltip-format = "Omarchy Menu\n\nSuper + Alt + Space"; }; "cpu" = { interval = 5; format = "󰍛"; on-click = "hakase-popup-launch btop"; on-click-right = "xdg-terminal-exec"; }; "clock" = { format = "{:%H:%M %a %b %d}"; format-alt = "{:L%d %B W%V %Y}"; tooltip = false; on-click-right = "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select"; }; "network" = { format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; format = "{icon}"; format-wifi = "{icon}"; format-ethernet = "󰀂"; format-disconnected = "󰤮"; tooltip-format-wifi = "{essid} ({frequency} GHz)\n⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}"; tooltip-format-ethernet = "⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}"; tooltip-format-disconnected = "Disconnected"; interval = 3; spacing = 1; on-click = "hakase-popup-launch impala"; }; "battery" = { format = "{capacity}% {icon}"; format-discharging = "{icon}"; format-charging = "{icon}"; format-plugged = ""; format-icons = { charging = ["󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅"]; default = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; }; format-full = "󰂅"; tooltip-format-discharging = "{power:>1.0f}W↓ {capacity}%"; tooltip-format-charging = "{power:>1.0f}W↑ {capacity}%"; interval = 5; on-click = "omarchy-menu power"; states = { warning = 20; critical = 10; }; }; "bluetooth" = { format = ""; format-disabled = "󰂲"; format-connected = "󰂱"; format-no-controller = ""; tooltip-format = "Devices connected: {num_connections}"; on-click = "hakase-popup-launch bluetui"; }; "pulseaudio" = { format = "{icon}"; on-click = "hakase-popup-launch wiremix "; on-click-right = "pamixer -t"; tooltip-format = "Playing at {volume}%"; scroll-step = 5; format-muted = ""; format-icons = { default = ["" "" ""]; }; }; "group/tray-expander" = { orientation = "inherit"; drawer = { transition-duration = 600; children-class = "tray-group-item"; }; modules = ["custom/expand-icon" "tray"]; }; "custom/expand-icon" = { format = ""; tooltip = false; }; "custom/screenrecording-indicator" = { on-click = "omarchy-cmd-screenrecord"; exec = "$OMARCHY_PATH/default/waybar/indicators/screen-recording.sh"; signal = 8; return-type = "json"; }; "tray" = { icon-size = 12; spacing = 17; }; }; }; }; }