default.nix (3671B)
1 { 2 lib, 3 options, 4 config, 5 pkgs, 6 ... 7 }: 8 { 9 options.modules.sway.bar = { 10 enable = lib.mkOption { 11 description = "Whether to enable Swaybar."; 12 default = false; 13 type = lib.types.bool; 14 }; 15 }; 16 17 config = 18 let 19 inherit (config.modules.sway) bar colors; 20 in 21 lib.mkIf (bar.enable && config.modules.sway.enable) { 22 wayland.windowManager.sway.config.bars = [ 23 { 24 command = "${pkgs.sway}/bin/swaybar"; 25 26 position = "top"; 27 28 statusCommand = "${pkgs.i3status}/bin/i3status"; 29 mode = "dock"; 30 trayOutput = "none"; 31 workspaceButtons = true; 32 extraConfig = "separator_symbol \" \""; 33 34 fonts = { 35 names = [ 36 config.modules.sway.fonts.monospace 37 ]; 38 style = "Regular"; 39 size = 12.0; 40 }; 41 42 colors = { 43 activeWorkspace = { 44 background = colors.background; 45 border = colors.foreground; 46 text = colors.foreground; 47 }; 48 background = colors.background; 49 focusedWorkspace = { 50 background = colors.foreground; 51 border = colors.foreground; 52 text = colors.background; 53 }; 54 inactiveWorkspace = { 55 background = colors.background; 56 border = colors.background; 57 text = colors.foreground; 58 }; 59 separator = colors.background; 60 statusline = colors.foreground; 61 urgentWorkspace = { 62 background = colors.background; 63 border = colors.red; 64 text = colors.foreground; 65 }; 66 }; 67 } 68 ]; 69 70 programs.i3status = { 71 enable = true; 72 package = pkgs.i3status; 73 74 enableDefault = false; 75 general = { 76 output_format = "i3bar"; 77 colors = true; 78 color_good = colors.green; 79 color_degraded = colors.red; 80 color_bad = colors.darkRed; 81 }; 82 modules = { 83 "wireless _first_" = { 84 enable = true; 85 position = 0; 86 settings = { 87 format_up = "📡 %essid"; 88 format_down = "📡 None"; 89 }; 90 }; 91 "battery all" = { 92 enable = true; 93 position = 1; 94 settings = { 95 format = "🔋 %percentage %status"; 96 format_down = "🔋 None"; 97 format_percentage = "%.01f%s"; 98 status_chr = "⚡"; 99 status_bat = ""; 100 status_unk = ""; 101 status_full = "✅"; 102 status_idle = ""; 103 low_threshold = 15; 104 threshold_type = "percentage"; 105 last_full_capacity = false; 106 path = "/sys/class/power_supply/BAT%d/uevent"; 107 }; 108 }; 109 "cpu_temperature 0" = { 110 enable = true; 111 position = 2; 112 settings = { 113 format = "🌡️ %degrees°C"; 114 max_threshold = 75; 115 }; 116 }; 117 "memory" = { 118 enable = true; 119 position = 3; 120 settings = { 121 format = "🧠 %percentage_used"; 122 threshold_degraded = "10%"; 123 threshold_critical = "5%"; 124 unit = "auto"; 125 decimals = 1; 126 }; 127 }; 128 "time" = { 129 enable = true; 130 position = 4; 131 settings = { 132 format = "%Y-%m-%d %H:%M:%S %Z "; 133 }; 134 }; 135 }; 136 }; 137 }; 138 }