Skip to content

Commit 088fef9

Browse files
committed
refactor(gnome): avoid keybinding merge fold
Generate workspace keybinding fragments with mergeAttrsList instead of repeatedly merging into an accumulator.
1 parent b1526ba commit 088fef9

1 file changed

Lines changed: 32 additions & 31 deletions

File tree

  • modules/home/programs/graphical/desktop-environment/gnome

modules/home/programs/graphical/desktop-environment/gnome/default.nix

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -132,44 +132,45 @@ in
132132
let
133133
workspaceCount = cfg.desktop.wm.preferences.num-workspaces or 10;
134134
in
135-
lib.foldl'
136-
(
137-
acc: i:
135+
lib.attrsets.mergeAttrsList (
136+
[
137+
{
138+
"move-to-workspace-right" = [
139+
"<Shift><Super>Right"
140+
"<Shift><Super>l"
141+
];
142+
"move-to-workspace-left" = [
143+
"<Shift><Super>Left"
144+
"<Shift><Super>h"
145+
];
146+
"switch-to-workspace-right" = [
147+
"<Control><Alt>Right"
148+
"<Control><Alt>l"
149+
];
150+
"switch-to-workspace-left" = [
151+
"<Control><Alt>Left"
152+
"<Control><Alt>h"
153+
];
154+
"switch-applications" = [
155+
"<Super><Tab>"
156+
];
157+
"switch-applications-backward" = [
158+
"<Shift><Super><Tab>"
159+
];
160+
}
161+
]
162+
++ map (
163+
i:
138164
let
139165
num = if i == 10 then "0" else toString i;
140166
in
141-
acc
142-
// {
167+
{
143168
"move-to-workspace-${toString i}" = [ "<Shift><Super>${num}" ];
144169
"switch-to-application-${toString i}" = [ "<Super>${num}" ];
145170
"switch-to-workspace-${toString i}" = [ "<Control><Alt>${num}" ];
146171
}
147-
)
148-
{
149-
"move-to-workspace-right" = [
150-
"<Shift><Super>Right"
151-
"<Shift><Super>l"
152-
];
153-
"move-to-workspace-left" = [
154-
"<Shift><Super>Left"
155-
"<Shift><Super>h"
156-
];
157-
"switch-to-workspace-right" = [
158-
"<Control><Alt>Right"
159-
"<Control><Alt>l"
160-
];
161-
"switch-to-workspace-left" = [
162-
"<Control><Alt>Left"
163-
"<Control><Alt>h"
164-
];
165-
"switch-applications" = [
166-
"<Super><Tab>"
167-
];
168-
"switch-applications-backward" = [
169-
"<Shift><Super><Tab>"
170-
];
171-
}
172-
(lib.range 1 workspaceCount)
172+
) (lib.range 1 workspaceCount)
173+
)
173174
)
174175

175176
"Window manager keybindings";

0 commit comments

Comments
 (0)