diff --git a/apps/jellyfin-mpv-shim/default.nix b/apps/jellyfin-mpv-shim/default.nix index 1ed34a6..fbe2778 100644 --- a/apps/jellyfin-mpv-shim/default.nix +++ b/apps/jellyfin-mpv-shim/default.nix @@ -1,15 +1,18 @@ {pkgs, ...}: { + imports = [ + ./immersion.nix + ]; services.jellyfin-mpv-shim = { enable = true; package = pkgs.jellyfin-mpv-shim; - + mpvConfig = { osc = false; osd-bar = false; load-scripts = true; input-vo-keyboard = true; input-default-bindings = true; - + # Automatic subtitle selection logic: # Prefer English subtitles slang = "eng,en"; @@ -29,12 +32,12 @@ use_mpv_config = false; enable_osc = false; menu_mouse = true; - + # Shim specific auto-sub logic # "subs-fallback" is a known good setting for the shim to handle this subtitle_color = "#FFFFFFFF"; subtitle_size = 100; - + audio_output = "hdmi"; auto_play = true; fullscreen = true; @@ -54,14 +57,14 @@ home.file.".config/jellyfin-mpv-shim/scripts/autocrop.lua" = { source = "${pkgs.mpvScripts.autocrop}/share/mpv/scripts/autocrop.lua"; }; - + home.file.".config/jellyfin-mpv-shim/fonts" = { source = "${pkgs.mpvScripts.uosc}/share/fonts"; recursive = true; }; wayland.windowManager.hyprland.settings = { - exec-once = [ "systemctl --user start jellyfin-mpv-shim" ]; + exec-once = ["systemctl --user start jellyfin-mpv-shim"]; windowrule = [ # --- JELLYFIN MPV SHIM --- "match:class ^(jellyfin-mpv-shim)$, float on" @@ -72,4 +75,5 @@ "match:class ^(jellyfin-mpv-shim)$, no_blur on" ]; }; -} \ No newline at end of file +} + diff --git a/apps/jellyfin/immersion.nix b/apps/jellyfin/immersion.nix new file mode 100644 index 0000000..70194ce --- /dev/null +++ b/apps/jellyfin/immersion.nix @@ -0,0 +1,44 @@ +{ + config, + pkgs, + ... +}: let + # Dynamically turns off all unfocused monitors, and restores them on toggle + toggleImmersive = pkgs.writeShellScriptBin "toggle-immersive" '' + STATE_FILE="$XDG_RUNTIME_DIR/hypr_immersive_mode" + + if [ -f "$STATE_FILE" ]; then + # 1. Restore: Reloading Hyprland snaps monitors back to your declared Nix defaults + hyprctl reload + rm "$STATE_FILE" + ${pkgs.libnotify}/bin/notify-send -u low "Immersive Mode" "Deactivated — Displays restored." + else + # 2. Activate: Mark state and dynamically disable all non-focused monitors + touch "$STATE_FILE" + + # Use jq to find every monitor that does NOT currently have focus + for mon in $(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[] | select(.focused == false) | .name'); do + ${pkgs.hyprland}/bin/hyprctl keyword monitor "$mon, disable" + done + + # OPTIONAL: Remove borders and gaps for a true cinema experience + # ${pkgs.hyprland}/bin/hyprctl keyword general:gaps_in 0 + # ${pkgs.hyprland}/bin/hyprctl keyword general:gaps_out 0 + # ${pkgs.hyprland}/bin/hyprctl keyword general:border_size 0 + # ${pkgs.hyprland}/bin/hyprctl keyword decoration:rounding 0 + + ${pkgs.libnotify}/bin/notify-send -u low "Immersive Mode" "Activated — Focused display only." + fi + ''; +in { + wayland.windowManager.hyprland = { + enable = true; + + settings = { + # Bind to your preferred combo (e.g., Super + Alt + M) + bind = [ + "$mod ALT, M, exec, ${toggleImmersive}/bin/toggle-immersive" + ]; + }; + }; +} diff --git a/modules/home/gaming.nix b/modules/home/gaming.nix index 351fedf..228b2d0 100644 --- a/modules/home/gaming.nix +++ b/modules/home/gaming.nix @@ -66,6 +66,14 @@ ) stayFocusedGames); in { + xdg.desktopEntries.steam-bigpicture = { + name = "Steam (Big Picture GLX)"; + exec = "env STEAM_RUNTIME=1 steam -no-cef-sandbox -cef-force-glx -bigpicture"; + icon = "steam"; + terminal = false; + categories = ["Game"]; + comment = "Launch Steam in Big Picture mode with Wayland fixes"; + }; home.packages = with pkgs; [ protonup-qt mangohud