yep, more dotfiles
1{ config 2, lib 3, pkgs 4, ... 5}: 6 7let 8 cfg = config.local.fragment.waybar; 9in 10{ 11 options.local.fragment.waybar.enable = lib.mkEnableOption '' 12 Waybar related 13 ''; 14 15 config = lib.mkIf cfg.enable { 16 stylix.targets.waybar = { 17 font = "sansSerif"; 18 addCss = false; 19 }; 20 21 services.playerctld.enable = true; 22 23 programs.waybar = { 24 enable = true; 25 26 settings.main = { 27 mode = "hide"; 28 ipc = true; 29 position = "bottom"; 30 31 modules-left = [ 32 "sway/workspaces" 33 ]; 34 35 modules-center = [ ]; 36 37 modules-right = [ 38 "cava" 39 "mpris" 40 "pulseaudio" 41 "battery" 42 "clock" 43 "tray" 44 ]; 45 46 "sway/workspaces" = { 47 disable-scroll = true; 48 format = "{name} {icon}"; 49 format-icons = { 50 default = ""; 51 52 "1" = ""; 53 "2" = ""; 54 "3" = ""; 55 "4" = ""; 56 "9" = ""; 57 "10" = ""; 58 }; 59 }; 60 61 tray.spacing = 10; 62 63 clock = { 64 format = "{:%d %b %H:%M}"; 65 tooltip = false; 66 }; 67 68 battery = { 69 states = { 70 good = 95; 71 warning = 30; 72 critical = 15; 73 }; 74 75 format = "{capacity}% {icon}"; 76 format-full = "{capacity}% {icon}"; 77 format-charging = "{capacity}% "; 78 format-plugged = "{capacity}% "; 79 format-icons = [ " " " " " " " " " " ]; 80 }; 81 82 pulseaudio = { 83 scroll-step = 5; 84 tooltip = false; 85 86 format = "{volume}% {icon}{format_source}"; 87 format-bluetooth = "{volume}% {icon}{format_source}"; 88 format-bluetooth-muted = " {icon} {format_source}"; 89 format-muted = " {format_source}"; 90 format-source = ""; 91 format-source-muted = " "; 92 93 format-icons = { 94 headset = " "; 95 headphone = " "; 96 hands-free = " "; 97 phone = " "; 98 portable = " "; 99 car = " "; 100 default = [ "" " " " " ]; 101 }; 102 103 on-click = "pavucontrol"; 104 }; 105 106 mpris = { 107 format = "{title:.30} - {artist:.30}"; 108 tooltip-format = "{album} ({player})"; 109 }; 110 111 cava = { 112 bars = 6; 113 format-icons = [ "" "" "" "" "" "" "" "" ]; 114 bar_delimiter = 0; 115 hide_on_silence = true; 116 }; 117 }; 118 119 style = '' 120 #waybar { color: @base00; } 121 tooltip { border-color: @base0D; background-color: @base00; } 122 tooltip label { color: @base05; } 123 124 #workspaces button { border-bottom: 3px solid transparent; } 125 #workspaces button.focused, workspaces button.active { border-bottom: 3px solid @base05; } 126 127 #clock { background-color: @base03; } 128 129 #battery { color: @base00; background-color: @base0D; } 130 #battery.charging { background-color: @base0E; } 131 132 #pulseaudio { color: @base00; background-color: @base09; } 133 #pulseaudio.muted { background-color: @base0C; } 134 135 #mpris { color: @base00; background-color: @base0B; } 136 137 #cava { color: @base00; background-color: @base0D; } 138 '' 139 + '' 140 * { 141 border-radius: 0; 142 } 143 144 /* Apply transparency to the bar (handled above by Stylix) */ 145 #waybar { background: alpha(white, 0); } 146 147 /* Apply margin to all module groups */ 148 .modules-left, .modules-center, .modules-right { 149 /*margin: .5rem .8rem;*/ 150 } 151 152 /* Apply padding to all modules */ 153 .modules-right widget .module { 154 padding: 0 1rem; 155 156 color: @base07; 157 } 158 159 /* Round first and last child of left, right and center modules. Disable rounding on the sides*/ 160 .modules-left widget:last-child .module, 161 .modules-center widget:last-child .module/*, 162 .modules-right widget:last-child .module*/ { 163 border-top-right-radius: 5px; 164 } 165 /*.modules-left widget:first-child .module,*/ 166 .modules-center widget:first-child .module, 167 .modules-right widget:first-child .module { 168 border-top-left-radius: 5px; 169 } 170 171 #tray { 172 background-color: @base03; 173 } 174 175 /* Round first and last child of workspaces. */ 176 #workspaces button:first-child { 177 /*border-top-left-radius: 5px;*/ 178 } 179 #workspaces button:last-child { 180 border-top-right-radius: 5px; 181 } 182 183 #workspaces button { 184 color: @base07; 185 background-color: @base03; 186 } 187 #workspaces button:hover { 188 color: @base07; 189 background-color: @base03; 190 } 191 #workspaces button.urgent { color: @base08; } 192 ''; 193 }; 194 195 wayland.windowManager.sway.config.bars = [{ 196 command = lib.getExe pkgs.waybar; 197 198 mode = "hide"; 199 hiddenState = "hide"; 200 }]; 201 }; 202} 203