1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 10:49:48 +01:00

i3, sway: extract border functionality to common function (#1947)

* i3, sway: extract border functionality to common function

Converted the i3 module to use default_border and
default_floating_border and extracted that functionality out to be
shared between the i3 and sway modules.

* i3: add sumnerevans as maintainer
This commit is contained in:
Sumner Evans 2021-04-28 13:52:31 -06:00 committed by GitHub
parent a759143ae1
commit 19ebab97e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 18 deletions

6
.github/CODEOWNERS vendored
View file

@ -250,7 +250,13 @@
/modules/services/unison.nix @pacien /modules/services/unison.nix @pacien
/modules/services/window-managers/i3-sway/i3.nix @sumnerevans
/tests/modules/services/window-managers/i3 @sumnerevans
/modules/services/window-managers/i3-sway/lib @sumnerevans
/modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans /modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans
/tests/modules/services/window-managers/sway @sumnerevans
/modules/services/wlsunset.nix @matrss /modules/services/wlsunset.nix @matrss
/tests/modules/services/wlsunset @matrss /tests/modules/services/wlsunset @matrss

View file

@ -140,7 +140,7 @@ let
inherit (commonFunctions) inherit (commonFunctions)
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
floatingCriteriaStr windowCommandsStr colorSetStr; floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString;
startupEntryStr = { command, always, notification, workspace, ... }: '' startupEntryStr = { command, always, notification, workspace, ... }: ''
${if always then "exec_always" else "exec"} ${ ${if always then "exec_always" else "exec"} ${
@ -157,12 +157,7 @@ let
with cfg.config; '' with cfg.config; ''
font pango:${concatStringsSep ", " fonts} font pango:${concatStringsSep ", " fonts}
floating_modifier ${floating.modifier} floating_modifier ${floating.modifier}
new_window ${if window.titlebar then "normal" else "pixel"} ${ ${windowBorderString window floating}
toString window.border
}
new_float ${if floating.titlebar then "normal" else "pixel"} ${
toString floating.border
}
hide_edge_borders ${window.hideEdgeBorders} hide_edge_borders ${window.hideEdgeBorders}
force_focus_wrapping ${if focus.forceWrapping then "yes" else "no"} force_focus_wrapping ${if focus.forceWrapping then "yes" else "no"}
focus_follows_mouse ${if focus.followMouse then "yes" else "no"} focus_follows_mouse ${if focus.followMouse then "yes" else "no"}
@ -209,6 +204,8 @@ let
''; '';
in { in {
meta.maintainers = with maintainers; [ sumnerevans ];
options = { options = {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = mkEnableOption "i3 window manager."; enable = mkEnableOption "i3 window manager.";

View file

@ -120,6 +120,15 @@ rec {
${optionalString (smartBorders != "off") "smart_borders ${smartBorders}"} ${optionalString (smartBorders != "off") "smart_borders ${smartBorders}"}
''; '';
windowBorderString = window: floating:
let
titlebarString = { titlebar, border, ... }:
"${if titlebar then "normal" else "pixel"} ${toString border}";
in concatStringsSep "\n" [
"default_border ${titlebarString window}"
"default_floating_border ${titlebarString floating}"
];
floatingCriteriaStr = criteria: floatingCriteriaStr = criteria:
"for_window ${criteriaStr criteria} floating enable"; "for_window ${criteriaStr criteria} floating enable";
windowCommandsStr = { command, criteria, ... }: windowCommandsStr = { command, criteria, ... }:

View file

@ -245,7 +245,7 @@ let
inherit (commonFunctions) inherit (commonFunctions)
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
floatingCriteriaStr windowCommandsStr colorSetStr; floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString;
startupEntryStr = { command, always, ... }: '' startupEntryStr = { command, always, ... }: ''
${if always then "exec_always" else "exec"} ${command} ${if always then "exec_always" else "exec"} ${command}
@ -265,12 +265,7 @@ let
with cfg.config; '' with cfg.config; ''
font pango:${concatStringsSep ", " fonts} font pango:${concatStringsSep ", " fonts}
floating_modifier ${floating.modifier} floating_modifier ${floating.modifier}
default_border ${if window.titlebar then "normal" else "pixel"} ${ ${windowBorderString window floating}
toString window.border
}
default_floating_border ${
if floating.titlebar then "normal" else "pixel"
} ${toString floating.border}
hide_edge_borders ${window.hideEdgeBorders} hide_edge_borders ${window.hideEdgeBorders}
focus_wrapping ${if focus.forceWrapping then "yes" else "no"} focus_wrapping ${if focus.forceWrapping then "yes" else "no"}
focus_follows_mouse ${focus.followMouse} focus_follows_mouse ${focus.followMouse}

View file

@ -1,7 +1,7 @@
font pango:monospace 8 font pango:monospace 8
floating_modifier Mod1 floating_modifier Mod1
new_window normal 2 default_border normal 2
new_float normal 2 default_floating_border normal 2
hide_edge_borders none hide_edge_borders none
force_focus_wrapping no force_focus_wrapping no
focus_follows_mouse no focus_follows_mouse no

View file

@ -1,7 +1,7 @@
font pango:monospace 8 font pango:monospace 8
floating_modifier Mod1 floating_modifier Mod1
new_window normal 2 default_border normal 2
new_float normal 2 default_floating_border normal 2
hide_edge_borders none hide_edge_borders none
force_focus_wrapping no force_focus_wrapping no
focus_follows_mouse yes focus_follows_mouse yes