tony / oxwm

refactor(nix): use `escapeNixString` for keybind modifier strings Browse files
emzywastaken committed 2026-02-18 parent cf150e6 commit 241576b6d2ebc8c2eb8f59a11a2de6b4b27e8dcf
Showing 1 changed file with 4 additions and 3 deletions. UnifiedSplit
+4 −3 hm.nix
@@ -5,6 +5,7 @@
5 ... 5 ...
6 }: let 6 }: let
7 inherit (lib) mkEnableOption mkOption mkIf types concatMapStringsSep concatStringsSep concatMapStrings boolToString optional; 7 inherit (lib) mkEnableOption mkOption mkIf types concatMapStringsSep concatStringsSep concatMapStrings boolToString optional;
8 + inherit (lib.strings) escapeNixString;
8 cfg = config.programs.oxwm.settings; 9 cfg = config.programs.oxwm.settings;
9 10
10 # Converts a nix submodule into a single oxwm bar block 11 # Converts a nix submodule into a single oxwm bar block
@@ -406,7 +407,7 @@ in {
406 407
407 oxwm.set_terminal("${cfg.terminal}") 408 oxwm.set_terminal("${cfg.terminal}")
408 oxwm.set_modkey("${cfg.modkey}") 409 oxwm.set_modkey("${cfg.modkey}")
409 - oxwm.set_tags({${concatMapStringsSep ", " (t: ''"${t}"'') cfg.tags}}) 410 + oxwm.set_tags({${concatMapStringsSep ", " escapeNixString cfg.tags}})
410 411
411 local blocks = { 412 local blocks = {
412 ${concatMapStringsSep ",\n" blockToLua cfg.bar.blocks} 413 ${concatMapStringsSep ",\n" blockToLua cfg.bar.blocks}
@@ -439,14 +440,14 @@ in {
439 } 440 }
440 ${ 441 ${
441 concatMapStrings (bind: '' 442 concatMapStrings (bind: ''
442 - oxwm.key.bind({ ${concatMapStringsSep ", " (m: ''"${m}"'') bind.mods} }, "${bind.key}", ${bind.action}) 443 + oxwm.key.bind({ ${concatMapStringsSep ", " escapeNixString bind.mods} }, "${bind.key}", ${bind.action})
443 '') 444 '')
444 cfg.binds 445 cfg.binds
445 } 446 }
446 ${ 447 ${
447 concatMapStrings (chord: '' 448 concatMapStrings (chord: ''
448 oxwm.key.chord({ 449 oxwm.key.chord({
449 - ${concatMapStringsSep ",\n " (note: ''{ { ${concatMapStringsSep ", " (m: ''"${m}"'') note.mods} }, "${note.key}" }'') chord.notes} 450 + ${concatMapStringsSep ",\n " (note: ''{ { ${concatMapStringsSep ", " escapeNixString note.mods} }, "${note.key}" }'') chord.notes}
450 }, ${chord.action}) 451 }, ${chord.action})
451 '') 452 '')
452 cfg.chords 453 cfg.chords