{ pkgs, lib, config, options, ... }: { options.mods.i3.enable = lib.mkEnableOption "enables i3"; config = lib.mkIf config.mods.i3.enable { programs.rofi.enable = true; programs.i3status = { enable = true; general.interval = 1; modules = { "volume master" = { position = 1; settings = { format = "🔊 %volume"; format_muted = "🔇 %volume"; device = "default"; mixer = "Master"; mixer_idx = 0; }; }; "tztime local".settings = { format = "🗓 %Y-%m-%d %a %H:%M:%S "; }; ipv6.enable = false; "wireless _first_".enable = false; "ethernet _first_".enable = false; "battery all".enable = false; "disk /".enable = false; load.enable = false; memory.enable = false; }; }; xsession.windowManager.i3 = let modifier = "Mod4"; wsAmount = 10; genSpaces = f: map builtins.toString ( builtins.genList f wsAmount ); workspaces = genSpaces (x: x+1); in { enable = true; config = { modifier = modifier; terminal = "alacritty"; menu = "rofi -show drun"; window = { titlebar = false; hideEdgeBorders = "smart"; }; defaultWorkspace = "workspace number 1"; workspaceAutoBackAndForth = true; focus.wrapping = "yes"; keybindings = let # modKeyComb: string -> valueAction: string # -> keys: [string] -> values: [string] # -> keybindings: attrSet { string -> string } zipBinds = comb: action: keys: values: ( builtins.listToAttrs (lib.zipListsWith (k: v: { name = "${modifier}${comb}${k}"; value = "${action} ${v}"; }) keys values) ); moveKeys = ["h" "j" "k" "l"]; moveDirs = ["left" "down" "up" "right"]; workspKeys = genSpaces (x: x); in lib.mkOptionDefault ( (zipBinds "+" "focus" moveKeys moveDirs) // (zipBinds "+Shift+" "move" moveKeys moveDirs) // (zipBinds "+" "workspace number" workspKeys workspaces) // (zipBinds "+Shift+" "move container to workspace number" workspKeys workspaces) ); bars = let stylix_bar = { mode = "dock"; hiddenState = "hide"; position = "bottom"; statusCommand = "${lib.getExe pkgs.i3status}"; command = "${pkgs.i3}/bin/i3bar"; workspaceButtons = true; workspaceNumbers = true; trayOutput = "primary"; } // config.lib.stylix.i3.bar; in [ stylix_bar ]; # bars = [ # options.xsession.windowManager.i3.config.default # config.lib.stylix.i3.bar # ]; }; }; }; }