Skip to content

Commit

Permalink
i3: remove i3/i3-gaps distinction
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Jan 7, 2023
1 parent 709a87f commit 20aab1e
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 49 deletions.
9 changes: 9 additions & 0 deletions modules/misc/news.nix
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,15 @@ in
A new module is available: 'services.clipman'.
'';
}

{
time = "2023-01-07T10:47:03+00:00";
condition = hostPlatform.isLinux;
message = ''
'services.window-managers.[i3|sway].config.[window|floating].titlebar' now defaults to
'true'.
'';
}
];
};
}
17 changes: 2 additions & 15 deletions modules/services/window-managers/i3-sway/i3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ let
commonOptions = import ./lib/options.nix {
inherit config lib cfg pkgs;
moduleName = "i3";
isGaps = cfg.package == pkgs.i3-gaps;
};

configModule = types.submodule {
Expand Down Expand Up @@ -209,16 +208,7 @@ in {
xsession.windowManager.i3 = {
enable = mkEnableOption "i3 window manager";

package = mkOption {
type = types.package;
default = pkgs.i3;
defaultText = literalExpression "pkgs.i3";
example = literalExpression "pkgs.i3-gaps";
description = ''
i3 package to use.
If 'i3.config.gaps' settings are specified, 'pkgs.i3-gaps' will be set as a default package.
'';
};
package = mkPackageOption pkgs "i3" { };

config = mkOption {
type = types.nullOr configModule;
Expand Down Expand Up @@ -260,10 +250,7 @@ in {
};
}

(mkIf (cfg.config != null) {
xsession.windowManager.i3.package =
mkDefault (if (cfg.config.gaps != null) then pkgs.i3-gaps else pkgs.i3);
})
(mkIf (cfg.config != null) { xsession.windowManager.i3.package = pkgs.i3; })

(mkIf (cfg.config != null) {
warnings = (optional (isList cfg.config.fonts)
Expand Down
21 changes: 5 additions & 16 deletions modules/services/window-managers/i3-sway/lib/options.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName
, isGaps ? true }:
{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }:

with lib;

Expand Down Expand Up @@ -158,7 +157,7 @@ let
defaultText = "i3bar";
description = "Command that will be used to start a bar.";
example = if isI3 then
"\${pkgs.i3-gaps}/bin/i3bar -t"
"\${pkgs.i3}/bin/i3bar -t"
else
"\${pkgs.waybar}/bin/waybar";
};
Expand Down Expand Up @@ -389,11 +388,7 @@ in {
options = {
titlebar = mkOption {
type = types.bool;
default = !isGaps;
defaultText = if isI3 then
"xsession.windowManager.i3.package != nixpkgs.i3-gaps (titlebar should be disabled for i3-gaps)"
else
"false";
default = true;
description = "Whether to show window titlebars.";
};

Expand Down Expand Up @@ -432,11 +427,7 @@ in {
options = {
titlebar = mkOption {
type = types.bool;
default = !isGaps;
defaultText = if isI3 then
"xsession.windowManager.i3.package != nixpkgs.i3-gaps (titlebar should be disabled for i3-gaps)"
else
"false";
default = true;
description = "Whether to show floating window titlebars.";
};

Expand Down Expand Up @@ -826,10 +817,8 @@ in {
};
});
default = null;
description = if isSway then ''
description = ''
Gaps related settings.
'' else ''
i3Gaps related settings. The i3-gaps package must be used for these features to work.
'';
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import $HOME/.cache/wal/colors-sway

font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/services/window-managers/sway/sway-default.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse always
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse no
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/services/window-managers/sway/sway-modules.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
font pango:monospace 8.000000
floating_modifier Mod1
default_border pixel 2
default_floating_border pixel 2
default_border normal 2
default_floating_border normal 2
hide_edge_borders none
focus_wrapping no
focus_follows_mouse yes
Expand Down

0 comments on commit 20aab1e

Please sign in to comment.