default.nix (3649B)
1 { 2 lib, 3 options, 4 config, 5 pkgs, 6 ... 7 }: 8 { 9 options.fs.programs.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.fs.programs.sway) bar colors; 20 in 21 lib.mkIf (bar.enable && config.fs.programs.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 = [ config.fs.programs.sway.fonts.monospace ]; 36 style = "Regular"; 37 size = 12.0; 38 }; 39 40 colors = { 41 activeWorkspace = { 42 inherit (colors) background; 43 border = colors.foreground; 44 text = colors.foreground; 45 }; 46 inherit (colors) background; 47 focusedWorkspace = { 48 background = colors.foreground; 49 border = colors.foreground; 50 text = colors.background; 51 }; 52 inactiveWorkspace = { 53 inherit (colors) background; 54 border = colors.background; 55 text = colors.foreground; 56 }; 57 separator = colors.background; 58 statusline = colors.foreground; 59 urgentWorkspace = { 60 inherit (colors) background; 61 border = colors.red; 62 text = colors.foreground; 63 }; 64 }; 65 } 66 ]; 67 68 programs.i3status = { 69 enable = true; 70 package = pkgs.i3status; 71 72 enableDefault = false; 73 general = { 74 output_format = "i3bar"; 75 colors = true; 76 color_good = colors.green; 77 color_degraded = colors.red; 78 color_bad = colors.darkRed; 79 }; 80 modules = { 81 "wireless _first_" = { 82 enable = true; 83 position = 0; 84 settings = { 85 format_up = "📡 %essid"; 86 format_down = "📡 None"; 87 }; 88 }; 89 "battery all" = { 90 enable = true; 91 position = 1; 92 settings = { 93 format = "🔋 %percentage %status"; 94 format_down = "🔋 None"; 95 format_percentage = "%.01f%s"; 96 status_chr = "⚡"; 97 status_bat = ""; 98 status_unk = ""; 99 status_full = "✅"; 100 status_idle = ""; 101 low_threshold = 15; 102 threshold_type = "percentage"; 103 last_full_capacity = false; 104 path = "/sys/class/power_supply/BAT%d/uevent"; 105 }; 106 }; 107 "cpu_temperature 0" = { 108 enable = true; 109 position = 2; 110 settings = { 111 format = "🌡️ %degrees°C"; 112 max_threshold = 75; 113 }; 114 }; 115 "memory" = { 116 enable = true; 117 position = 3; 118 settings = { 119 format = "🧠 %percentage_used"; 120 threshold_degraded = "10%"; 121 threshold_critical = "5%"; 122 unit = "auto"; 123 decimals = 1; 124 }; 125 }; 126 "time" = { 127 enable = true; 128 position = 4; 129 settings = { 130 format = "%Y-%m-%d %H:%M:%S %Z "; 131 }; 132 }; 133 }; 134 }; 135 }; 136 }