tony / oxwm

hm.nix: removed unneeded code Browse files
Pascal0577 committed 2026-02-18 parent 0499e00 commit 3d2355c1d966b40cceb88c68f53a717677be8f18
Showing 1 changed file with 28 additions and 35 deletions. UnifiedSplit
+28 −35 hm.nix
@@ -4,7 +4,7 @@
4 pkgs, 4 pkgs,
5 ... 5 ...
6 }: let 6 }: let
7 - inherit (lib) mkEnableOption mkOption mkIf types getExe; 7 + inherit (lib) mkEnableOption mkOption mkIf types concatMapStringsSep concatStringsSep concatMapStrings boolToString optional;
8 cfg = config.programs.oxwm.settings; 8 cfg = config.programs.oxwm.settings;
9 9
10 # Converts a nix submodule into a single oxwm bar block 10 # Converts a nix submodule into a single oxwm bar block
@@ -12,7 +12,7 @@
12 common = '' 12 common = ''
13 interval = ${toString block.interval}, 13 interval = ${toString block.interval},
14 color = "#${block.color}", 14 color = "#${block.color}",
15 - underline = ${lib.boolToString block.underline},''; 15 + underline = ${boolToString block.underline},'';
16 in 16 in
17 "oxwm.bar.block.${block.kind}({\n" 17 "oxwm.bar.block.${block.kind}({\n"
18 + ( 18 + (
@@ -48,16 +48,17 @@
48 ) 48 )
49 + "})"; 49 + "})";
50 50
51 + # Converts a nix submodule into a single oxwm window rule
51 ruleToLua = rule: let 52 ruleToLua = rule: let
52 - fields = lib.concatStringsSep ", " ( 53 + fields = concatStringsSep ", " (
53 - lib.optional (rule.match.class != null) ''class = "${rule.match.class}"'' 54 + optional (rule.match.class != null) ''class = "${rule.match.class}"''
54 - ++ lib.optional (rule.match.instance != null) ''instance = "${rule.match.instance}"'' 55 + ++ optional (rule.match.instance != null) ''instance = "${rule.match.instance}"''
55 - ++ lib.optional (rule.match.title != null) ''title = "${rule.match.title}"'' 56 + ++ optional (rule.match.title != null) ''title = "${rule.match.title}"''
56 - ++ lib.optional (rule.match.role != null) ''role = "${rule.match.role}"'' 57 + ++ optional (rule.match.role != null) ''role = "${rule.match.role}"''
57 - ++ lib.optional (rule.floating != null) ''floating = ${lib.boolToString rule.floating}'' 58 + ++ optional (rule.floating != null) ''floating = ${boolToString rule.floating}''
58 - ++ lib.optional (rule.tag != null) ''tag = ${toString rule.tag}'' 59 + ++ optional (rule.tag != null) ''tag = ${toString rule.tag}''
59 - ++ lib.optional (rule.fullscreen != null) ''fullscreen = ${lib.boolToString rule.fullscreen}'' 60 + ++ optional (rule.fullscreen != null) ''fullscreen = ${boolToString rule.fullscreen}''
60 - ++ lib.optional (rule.focus != null) ''focus = ${lib.boolToString rule.fullscreen}'' 61 + ++ optional (rule.focus != null) ''focus = ${boolToString rule.fullscreen}''
61 ); 62 );
62 in "oxwm.rule.add({ ${fields} })"; 63 in "oxwm.rule.add({ ${fields} })";
63 in { 64 in {
@@ -391,63 +392,55 @@ in {
391 }; 392 };
392 393
393 config = mkIf config.programs.oxwm.enable { 394 config = mkIf config.programs.oxwm.enable {
394 - home.packages = [config.programs.oxwm.package];
395 -
396 - xsession.windowManager.command = ''
397 - ${config.programs.oxwm.extraSessionCommands}
398 - export _JAVA_AWT_WM_NONREPARENTING=1
399 - exec ${getExe config.programs.oxwm.package}
400 - '';
401 -
402 xdg.configFile."oxwm/config.lua".text = '' 395 xdg.configFile."oxwm/config.lua".text = ''
403 @meta 396 @meta
404 @module 'oxwm' 397 @module 'oxwm'
405 398
406 oxwm.set_terminal("${cfg.terminal}") 399 oxwm.set_terminal("${cfg.terminal}")
407 oxwm.set_modkey("${cfg.modkey}") 400 oxwm.set_modkey("${cfg.modkey}")
408 - oxwm.set_tags({${lib.concatMapStringsSep ", " (t: ''"${t}"'') cfg.tags}}) 401 + oxwm.set_tags({${concatMapStringsSep ", " (t: ''"${t}"'') cfg.tags}})
409 402
410 local blocks = { 403 local blocks = {
411 - ${lib.concatMapStringsSep ",\n" blockToLua cfg.bar.blocks} 404 + ${concatMapStringsSep ",\n" blockToLua cfg.bar.blocks}
412 }; 405 };
413 oxwm.bar.set_blocks(blocks) 406 oxwm.bar.set_blocks(blocks)
414 oxwm.bar.set_font("${cfg.bar.font}") 407 oxwm.bar.set_font("${cfg.bar.font}")
415 - oxwm.bar.set_scheme_normal(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.unoccupiedScheme}) 408 + oxwm.bar.set_scheme_normal(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.unoccupiedScheme})
416 - oxwm.bar.set_scheme_occupied(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.occupiedScheme}) 409 + oxwm.bar.set_scheme_occupied(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.occupiedScheme})
417 - oxwm.bar.set_scheme_selected(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.selectedScheme}) 410 + oxwm.bar.set_scheme_selected(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.selectedScheme})
418 - oxwm.bar.set_scheme_urgent(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.urgentScheme}) 411 + oxwm.bar.set_scheme_urgent(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.urgentScheme})
419 - oxwm.bar.set_hide_vacant_tags(${lib.boolToString cfg.bar.hideVacantTags}) 412 + oxwm.bar.set_hide_vacant_tags(${boolToString cfg.bar.hideVacantTags})
420 413
421 oxwm.border.set_width(${toString cfg.border.width}) 414 oxwm.border.set_width(${toString cfg.border.width})
422 oxwm.border.set_focused_color("#${cfg.border.focusedColor}") 415 oxwm.border.set_focused_color("#${cfg.border.focusedColor}")
423 oxwm.border.set_unfocused_color("#${cfg.border.unfocusedColor}") 416 oxwm.border.set_unfocused_color("#${cfg.border.unfocusedColor}")
424 417
425 oxwm.gaps.set_smart(${cfg.gaps.smart}) 418 oxwm.gaps.set_smart(${cfg.gaps.smart})
426 - oxwm.gaps.set_inner(${lib.concatMapStringsSep ", " toString cfg.gaps.inner}) 419 + oxwm.gaps.set_inner(${concatMapStringsSep ", " toString cfg.gaps.inner})
427 - oxwm.gaps.set_outer(${lib.concatMapStringsSep ", " toString cfg.gaps.outer}) 420 + oxwm.gaps.set_outer(${concatMapStringsSep ", " toString cfg.gaps.outer})
428 421
429 oxwm.set_layout_symbol("tiling", "${cfg.layoutSymbol.tiling}") 422 oxwm.set_layout_symbol("tiling", "${cfg.layoutSymbol.tiling}")
430 oxwm.set_layout_symbol("normie", "${cfg.layoutSymbol.normie}") 423 oxwm.set_layout_symbol("normie", "${cfg.layoutSymbol.normie}")
431 oxwm.set_layout_symbol("tabbed", "${cfg.layoutSymbol.tabbed}") 424 oxwm.set_layout_symbol("tabbed", "${cfg.layoutSymbol.tabbed}")
432 425
433 - ${lib.concatMapStrings (cmd: '' 426 + ${concatMapStrings (cmd: ''
434 oxwm.autostart("${cmd}") 427 oxwm.autostart("${cmd}")
435 '') 428 '')
436 cfg.autostart} 429 cfg.autostart}
437 - ${lib.concatMapStrings (bind: '' 430 + ${concatMapStrings (bind: ''
438 - oxwm.key.bind({ ${lib.concatMapStringsSep ", " (m: ''"${m}"'') bind.mods} }, "${bind.key}", ${bind.action}) 431 + oxwm.key.bind({ ${concatMapStringsSep ", " (m: ''"${m}"'') bind.mods} }, "${bind.key}", ${bind.action})
439 '') 432 '')
440 cfg.binds} 433 cfg.binds}
441 - ${lib.concatMapStrings (chord: '' 434 + ${concatMapStrings (chord: ''
442 oxwm.key.chord({ 435 oxwm.key.chord({
443 - ${lib.concatMapStringsSep ",\n " ( 436 + ${concatMapStringsSep ",\n " (
444 - note: ''{ { ${lib.concatMapStringsSep ", " (m: ''"${m}"'') note.mods} }, "${note.key}" }'' 437 + note: ''{ { ${concatMapStringsSep ", " (m: ''"${m}"'') note.mods} }, "${note.key}" }''
445 ) 438 )
446 chord.notes} 439 chord.notes}
447 }, ${chord.action}) 440 }, ${chord.action})
448 '') 441 '')
449 cfg.chords} 442 cfg.chords}
450 - ${lib.concatMapStrings (rule: '' 443 + ${concatMapStrings (rule: ''
451 ${ruleToLua rule} 444 ${ruleToLua rule}
452 '') 445 '')
453 cfg.rules} 446 cfg.rules}