add(jellyfin): immersion mode

immersion turns off all other monitor. great for movies
This commit is contained in:
kenji
2026-07-03 20:54:02 -05:00
parent fd1bea0e6e
commit 1b06c411ef
3 changed files with 63 additions and 7 deletions
+5 -1
View File
@@ -1,4 +1,7 @@
{pkgs, ...}: {
imports = [
./immersion.nix
];
services.jellyfin-mpv-shim = {
enable = true;
package = pkgs.jellyfin-mpv-shim;
@@ -61,7 +64,7 @@
};
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"
@@ -73,3 +76,4 @@
];
};
}
+44
View File
@@ -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"
];
};
};
}
+8
View File
@@ -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