default.nix (3542B)
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; 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 = "bottom"; 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 = "#000000"; 45 border = "#ffffff"; 46 text = "#ffffff"; 47 }; 48 background = "#000000"; 49 focusedWorkspace = { 50 background = "#ffffff"; 51 border = "#ffffff"; 52 text = "#000000"; 53 }; 54 inactiveWorkspace = { 55 background = "#000000"; 56 border = "#000000"; 57 text = "#ffffff"; 58 }; 59 separator = "#ffffff"; 60 statusline = "#ffffff"; 61 urgentWorkspace = { 62 background = "#000000"; 63 border = "#da8b8b"; 64 text = "#ffffff"; 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 = "#80ff80"; 79 color_degraded = "#da8b8b"; 80 color_bad = "#c85151"; 81 }; 82 modules = { 83 "wireless _first_" = { 84 enable = true; 85 position = 0; 86 settings = { 87 format_up = "WIR: %essid"; 88 format_down = "WIR: None"; 89 }; 90 }; 91 "battery all" = { 92 enable = true; 93 position = 1; 94 settings = { 95 format = "BAT: %percentage [%status]"; 96 format_down = "BAT: None"; 97 format_percentage = "%.01f%s"; 98 status_chr = "+"; 99 status_bat = "-"; 100 status_unk = "?"; 101 status_full = "F"; 102 status_idle = "I"; 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 = "CPU: %degreesĀ°C"; 114 max_threshold = 75; 115 }; 116 }; 117 "memory" = { 118 enable = true; 119 position = 3; 120 settings = { 121 format = "RAM: %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 }