From 59340e4d6d90dae049b7a6d1a88f4376e3b19827 Mon Sep 17 00:00:00 2001 From: kenji Date: Sat, 27 Dec 2025 22:11:03 -0600 Subject: [PATCH] fix: music-launcher --- apps/hyprland/home.nix | 1 - apps/hyprland/hypr/exec.nix | 2 +- apps/hyprland/hypr/rules.nix | 8 -------- apps/hyprland/music.nix | 22 -------------------- home/hakase.nix | 1 + modules/home/music.nix | 40 ++++++++++++++++++++++++++++++++++++ scripts/switch-wallpaper.sh | 6 ------ 7 files changed, 42 insertions(+), 38 deletions(-) delete mode 100644 apps/hyprland/music.nix create mode 100644 modules/home/music.nix delete mode 100755 scripts/switch-wallpaper.sh diff --git a/apps/hyprland/home.nix b/apps/hyprland/home.nix index 7530f12..cc97bf5 100644 --- a/apps/hyprland/home.nix +++ b/apps/hyprland/home.nix @@ -7,7 +7,6 @@ ./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 b7c71d2..b09341a 100644 --- a/apps/hyprland/hypr/exec.nix +++ b/apps/hyprland/hypr/exec.nix @@ -24,7 +24,7 @@ "[workspace 1] uwsm app -- xdg-terminal-exec" "[workspace special:steam silent] uwsm app -- steam" - "music-launcher" + "launch-music" ]; }; } diff --git a/apps/hyprland/hypr/rules.nix b/apps/hyprland/hypr/rules.nix index d3749a5..03cb752 100644 --- a/apps/hyprland/hypr/rules.nix +++ b/apps/hyprland/hypr/rules.nix @@ -27,18 +27,10 @@ # --- MUSIC RULES (Jellyfin-TUI) --- "workspace special:music silent, title:^(jellyfin-tui)$" "workspace special:music silent, initialTitle:^(jellyfin-tui)$" - "noinitialfocus, title:^(jellyfin-tui)$" - "noinitialfocus, initialTitle:^(jellyfin-tui)$" - "suppressevent activate, title:^(jellyfin-tui)$" - "suppressevent activate, initialTitle:^(jellyfin-tui)$" # --- CAVA RULES --- "workspace special:music silent, title:^(cava)$" "workspace special:music silent, initialTitle:^(cava)$" - "noinitialfocus, title:^(cava)$" - "noinitialfocus, initialTitle:^(cava)$" - "suppressevent activate, title:^(cava)$" - "suppressevent activate, initialTitle:^(cava)$" # --- GAMING RULES --- # Steam Apps, Gamescope, Lutris, Heroic, and Wine/Proton apps diff --git a/apps/hyprland/music.nix b/apps/hyprland/music.nix deleted file mode 100644 index 058a165..0000000 --- a/apps/hyprland/music.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ 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 & - '') - ]; -} diff --git a/home/hakase.nix b/home/hakase.nix index ff707f7..62519da 100644 --- a/home/hakase.nix +++ b/home/hakase.nix @@ -12,6 +12,7 @@ ../modules/home/waybar.nix ../modules/home/theme.nix ../modules/home/gaming.nix + ../modules/home/music.nix inputs.walker.homeManagerModules.default inputs.sops-nix.homeManagerModules.sops ]; diff --git a/modules/home/music.nix b/modules/home/music.nix new file mode 100644 index 0000000..e9070a6 --- /dev/null +++ b/modules/home/music.nix @@ -0,0 +1,40 @@ +{pkgs, ...}: let + launch-music = pkgs.writeShellScriptBin "launch-music" '' + # Log output for debugging + LOGfile="/tmp/launch-music.log" + exec > >(tee -a "$LOGfile") 2>&1 + + echo "--- Launching Music Apps ---" + date + + # Launch Jellyfin + echo "Launching jellyfin-tui..." + uwsm app -- /usr/bin/env ghostty --class=jellyfin-tui --title=jellyfin-tui -e jellyfin-tui & + PID_JELLY=$! + echo "Jellyfin launched with PID $PID_JELLY" + + # Wait for window to appear + echo "Waiting for window..." + sleep 3 + + # Focus + echo "Focusing jellyfin-tui..." + hyprctl dispatch focuswindow title:jellyfin-tui + + # Preselect Down + echo "Preselecting down..." + hyprctl dispatch layoutmsg preselect d + + # Launch Cava + echo "Launching cava..." + uwsm app -- /usr/bin/env ghostty --class=cava --title=cava -e cava & + PID_CAVA=$! + echo "Cava launched with PID $PID_CAVA" + + echo "Launch script completed." + ''; +in { + home.packages = [ + launch-music + ]; +} diff --git a/scripts/switch-wallpaper.sh b/scripts/switch-wallpaper.sh deleted file mode 100755 index 0de0bf1..0000000 --- a/scripts/switch-wallpaper.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -echo "Hello world!" - -exec - -