From 3dc1fa61e042c5df464b21c023d1e50f71d6f2d7 Mon Sep 17 00:00:00 2001 From: kenji Date: Sat, 27 Dec 2025 21:49:57 -0600 Subject: [PATCH] add: music-launcher --- apps/hyprland/home.nix | 1 + apps/hyprland/hypr/exec.nix | 3 +-- apps/hyprland/music.nix | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 apps/hyprland/music.nix diff --git a/apps/hyprland/home.nix b/apps/hyprland/home.nix index cc97bf5..7530f12 100644 --- a/apps/hyprland/home.nix +++ b/apps/hyprland/home.nix @@ -7,6 +7,7 @@ ./hypr/animation.nix ./hypr/misc.nix ./hypr/input.nix + ./music.nix ]; wayland.windowManager.hyprland.enable = true; wayland.windowManager.hyprland.systemd.enable = false; # for UWSM support... diff --git a/apps/hyprland/hypr/exec.nix b/apps/hyprland/hypr/exec.nix index 8327930..b7c71d2 100644 --- a/apps/hyprland/hypr/exec.nix +++ b/apps/hyprland/hypr/exec.nix @@ -24,8 +24,7 @@ "[workspace 1] uwsm app -- xdg-terminal-exec" "[workspace special:steam silent] uwsm app -- steam" - "[workspace special:music silent] uwsm app -- /usr/bin/env ghostty --class=jellyfin-tui --title=jellyfin-tui -e jellyfin-tui" - "[workspace special:music silent] uwsm app -- /usr/bin/env ghostty --class=cava --title=cava -e cava" + "music-launcher" ]; }; } diff --git a/apps/hyprland/music.nix b/apps/hyprland/music.nix new file mode 100644 index 0000000..058a165 --- /dev/null +++ b/apps/hyprland/music.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ + (writeShellScriptBin "music-launcher" '' + # Launch Jellyfin TUI first + uwsm app -- /usr/bin/env ghostty --class=jellyfin-tui --title=jellyfin-tui -e jellyfin-tui & + + # Wait for window to appear + sleep 0.5 + + # Focus the window to apply layout rules (Required for layoutmsg) + # This ensures the preselect command applies to this specific window + ${pkgs.hyprland}/bin/hyprctl dispatch focuswindow title:jellyfin-tui + + # Force the next window to be placed to the right (Side-by-Side / Horizontal) + # Change to 'preselect d' for Top/Bottom split + ${pkgs.hyprland}/bin/hyprctl dispatch layoutmsg preselect r + + # Launch Cava + uwsm app -- /usr/bin/env ghostty --class=cava --title=cava -e cava & + '') + ]; +}