diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index f28b9b672..b4742c787 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -160,7 +160,7 @@ let "floating_modifier ${floating.modifier}" (windowBorderString window floating) "hide_edge_borders ${window.hideEdgeBorders}" - "force_focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}" + "focus_wrapping ${focus.wrapping}" "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" "focus_on_window_activation ${focus.newWindow}" "mouse_warping ${if focus.mouseWarping then "output" else "none"}" @@ -256,16 +256,15 @@ in { ++ flatten (map (b: optional (isList b.fonts) "Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") - cfg.config.bars); + cfg.config.bars) ++ [ + (mkIf (any (s: s.workspace != null) cfg.config.startup) + ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " + + "use 'xsession.windowManager.i3.config.assigns' instead." + + "See https://github.com/nix-community/home-manager/issues/265.")) + (mkIf cfg.config.focus.forceWrapping + ("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, " + + "use 'xsession.windowManager.i3.config.focus.wrapping' instead.")) + ]; }) - - (mkIf (cfg.config != null - && (any (s: s.workspace != null) cfg.config.startup)) { - warnings = [ - ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " - + "use 'xsession.windowManager.i3.config.assigns' instead." - + "See https://github.com/nix-community/home-manager/issues/265.") - ]; - }) ]); } diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index d04a11762..3fe0b7551 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -510,13 +510,28 @@ in { if (isSway && isBool val) then (lib.hm.booleans.yesNo val) else val; }; + wrapping = mkOption { + type = types.enum [ "yes" "no" "force" "workspace" ]; + default = { + i3 = if cfg.config.focus.forceWrapping then "force" else "yes"; + # the sway module's logic was inverted and incorrect, + # so preserve it for backwards compatibility purposes + sway = if cfg.config.focus.forceWrapping then "yes" else "no"; + }.${moduleName}; + description = '' + Whether the window focus commands automatically wrap around the edge of containers. + + See + ''; + }; + forceWrapping = mkOption { type = types.bool; default = false; description = '' - Whether to force focus wrapping in tabbed or stacked container. + Whether to force focus wrapping in tabbed or stacked containers. - See + This option is deprecated, use instead. ''; }; diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index fdcbaabcd..a18a4212d 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -271,7 +271,7 @@ let "floating_modifier ${floating.modifier}" (windowBorderString window floating) "hide_edge_borders ${window.hideEdgeBorders}" - "focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}" + "focus_wrapping ${focus.wrapping}" "focus_follows_mouse ${focus.followMouse}" "focus_on_window_activation ${focus.newWindow}" "mouse_warping ${ @@ -442,7 +442,10 @@ in { ++ flatten (map (b: optional (isList b.fonts) "Specifying sway.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") - cfg.config.bars); + cfg.config.bars) ++ [ + (mkIf cfg.config.focus.forceWrapping + "sway.config.focus.forceWrapping is deprecated, use focus.wrapping instead.") + ]; }) { diff --git a/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf b/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf index 92f23a921..3b8fca8a2 100644 --- a/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf b/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf index 27234b96d..dccf535a3 100644 --- a/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse no focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-fonts-expected.conf b/tests/modules/services/window-managers/i3/i3-fonts-expected.conf index d85d978e0..8e8cb9da3 100644 --- a/tests/modules/services/window-managers/i3/i3-fonts-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-fonts-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf index b3b4c33de..2b7251d2f 100644 --- a/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf b/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf index d7fe4b610..baca14115 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf b/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf index dedad29e0..a51edb9a0 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output