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 4 pkgs,
5 5 ...
6 6 }: let
7 - inherit (lib) mkEnableOption mkOption mkIf types getExe;
7 + inherit (lib) mkEnableOption mkOption mkIf types concatMapStringsSep concatStringsSep concatMapStrings boolToString optional;
8 8 cfg = config.programs.oxwm.settings;
9 9
10 10 # Converts a nix submodule into a single oxwm bar block
@@ -12,7 +12,7 @@
12 12 common = ''
13 13 interval = ${toString block.interval},
14 14 color = "#${block.color}",
15 - underline = ${lib.boolToString block.underline},'';
15 + underline = ${boolToString block.underline},'';
16 16 in
17 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 52 ruleToLua = rule: let
52 - fields = lib.concatStringsSep ", " (
53 - lib.optional (rule.match.class != null) ''class = "${rule.match.class}"''
54 - ++ lib.optional (rule.match.instance != null) ''instance = "${rule.match.instance}"''
55 - ++ lib.optional (rule.match.title != null) ''title = "${rule.match.title}"''
56 - ++ lib.optional (rule.match.role != null) ''role = "${rule.match.role}"''
57 - ++ lib.optional (rule.floating != null) ''floating = ${lib.boolToString rule.floating}''
58 - ++ lib.optional (rule.tag != null) ''tag = ${toString rule.tag}''
59 - ++ lib.optional (rule.fullscreen != null) ''fullscreen = ${lib.boolToString rule.fullscreen}''
60 - ++ lib.optional (rule.focus != null) ''focus = ${lib.boolToString rule.fullscreen}''
53 + fields = concatStringsSep ", " (
54 + optional (rule.match.class != null) ''class = "${rule.match.class}"''
55 + ++ optional (rule.match.instance != null) ''instance = "${rule.match.instance}"''
56 + ++ optional (rule.match.title != null) ''title = "${rule.match.title}"''
57 + ++ optional (rule.match.role != null) ''role = "${rule.match.role}"''
58 + ++ optional (rule.floating != null) ''floating = ${boolToString rule.floating}''
59 + ++ optional (rule.tag != null) ''tag = ${toString rule.tag}''
60 + ++ optional (rule.fullscreen != null) ''fullscreen = ${boolToString rule.fullscreen}''
61 + ++ optional (rule.focus != null) ''focus = ${boolToString rule.fullscreen}''
61 62 );
62 63 in "oxwm.rule.add({ ${fields} })";
63 64 in {
@@ -391,63 +392,55 @@ in {
391 392 };
392 393
393 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 395 xdg.configFile."oxwm/config.lua".text = ''
403 396 @meta
404 397 @module 'oxwm'
405 398
406 399 oxwm.set_terminal("${cfg.terminal}")
407 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 403 local blocks = {
411 - ${lib.concatMapStringsSep ",\n" blockToLua cfg.bar.blocks}
404 + ${concatMapStringsSep ",\n" blockToLua cfg.bar.blocks}
412 405 };
413 406 oxwm.bar.set_blocks(blocks)
414 407 oxwm.bar.set_font("${cfg.bar.font}")
415 - oxwm.bar.set_scheme_normal(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.unoccupiedScheme})
416 - oxwm.bar.set_scheme_occupied(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.occupiedScheme})
417 - oxwm.bar.set_scheme_selected(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.selectedScheme})
418 - oxwm.bar.set_scheme_urgent(${lib.concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.urgentScheme})
419 - oxwm.bar.set_hide_vacant_tags(${lib.boolToString cfg.bar.hideVacantTags})
408 + oxwm.bar.set_scheme_normal(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.unoccupiedScheme})
409 + oxwm.bar.set_scheme_occupied(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.occupiedScheme})
410 + oxwm.bar.set_scheme_selected(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.selectedScheme})
411 + oxwm.bar.set_scheme_urgent(${concatMapStringsSep ", " (c: ''"#${c}"'') cfg.bar.urgentScheme})
412 + oxwm.bar.set_hide_vacant_tags(${boolToString cfg.bar.hideVacantTags})
420 413
421 414 oxwm.border.set_width(${toString cfg.border.width})
422 415 oxwm.border.set_focused_color("#${cfg.border.focusedColor}")
423 416 oxwm.border.set_unfocused_color("#${cfg.border.unfocusedColor}")
424 417
425 418 oxwm.gaps.set_smart(${cfg.gaps.smart})
426 - oxwm.gaps.set_inner(${lib.concatMapStringsSep ", " toString cfg.gaps.inner})
427 - oxwm.gaps.set_outer(${lib.concatMapStringsSep ", " toString cfg.gaps.outer})
419 + oxwm.gaps.set_inner(${concatMapStringsSep ", " toString cfg.gaps.inner})
420 + oxwm.gaps.set_outer(${concatMapStringsSep ", " toString cfg.gaps.outer})
428 421
429 422 oxwm.set_layout_symbol("tiling", "${cfg.layoutSymbol.tiling}")
430 423 oxwm.set_layout_symbol("normie", "${cfg.layoutSymbol.normie}")
431 424 oxwm.set_layout_symbol("tabbed", "${cfg.layoutSymbol.tabbed}")
432 425
433 - ${lib.concatMapStrings (cmd: ''
426 + ${concatMapStrings (cmd: ''
434 427 oxwm.autostart("${cmd}")
435 428 '')
436 429 cfg.autostart}
437 - ${lib.concatMapStrings (bind: ''
438 - oxwm.key.bind({ ${lib.concatMapStringsSep ", " (m: ''"${m}"'') bind.mods} }, "${bind.key}", ${bind.action})
430 + ${concatMapStrings (bind: ''
431 + oxwm.key.bind({ ${concatMapStringsSep ", " (m: ''"${m}"'') bind.mods} }, "${bind.key}", ${bind.action})
439 432 '')
440 433 cfg.binds}
441 - ${lib.concatMapStrings (chord: ''
434 + ${concatMapStrings (chord: ''
442 435 oxwm.key.chord({
443 - ${lib.concatMapStringsSep ",\n " (
444 - note: ''{ { ${lib.concatMapStringsSep ", " (m: ''"${m}"'') note.mods} }, "${note.key}" }''
436 + ${concatMapStringsSep ",\n " (
437 + note: ''{ { ${concatMapStringsSep ", " (m: ''"${m}"'') note.mods} }, "${note.key}" }''
445 438 )
446 439 chord.notes}
447 440 }, ${chord.action})
448 441 '')
449 442 cfg.chords}
450 - ${lib.concatMapStrings (rule: ''
443 + ${concatMapStrings (rule: ''
451 444 ${ruleToLua rule}
452 445 '')
453 446 cfg.rules}