···
1
-
{ config, lib, pkgs, ... }:
3
-
package = pkgs.waybar;
5
-
# the fonts that will be included with the waybar package
6
-
fontPackages = [ pkgs.ubuntu_font_family pkgs.material-design-icons ];
8
-
# patch those fonts in
9
-
package' = let super = package;
10
-
in pkgs.symlinkJoin {
11
-
inherit (super) name pname version meta;
12
-
paths = [ super ] ++ fontPackages;
15
-
compileSCSS = name: source:
17
-
pkgs.runCommandLocal name { } ''
19
-
${lib.getExe pkgs.sassc} -t expanded '${source}' > $out/${name}.css
23
-
# TODO when using store paths to executables, they do not inherit the user's
24
-
# environment (at least with systemd) and therefore GUIs use the default theme
26
-
slight = "${lib.getExe pkgs.slight}";
27
-
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
28
-
# TODO this is duplicated from the hyprland config, make it a module
29
-
kbFns = lib.getExe config.utilities.osd-functions.package;
30
-
pavucontrol = lib.getExe pkgs.lxqt.pavucontrol-qt;
31
-
blueman-manager = "${pkgs.blueman}/bin/blueman-manager";
32
-
bluetoothctl = "${pkgs.bluez}/bin/bluetoothctl";
33
-
systemctl = "${pkgs.systemd}/bin/systemctl";
34
-
iwgtk = lib.getExe pkgs.iwgtk;
36
-
backlightUp = "${slight} inc 5% -t 150ms";
37
-
backlightDown = "${slight} dec 5% -t 150ms";
38
-
# TODO --tab no longer works, what is the identifier to use?
39
-
outputSoundSettings = "${pavucontrol} --tab 'Output Devices'";
40
-
outputVolumeMute = "${kbFns} output mute";
41
-
outputVolumeUp = "${kbFns} output +0.05";
42
-
outputVolumeDown = "${kbFns} output -0.05";
43
-
# TODO --tab no longer works, what is the identifier to use?
44
-
inputSoundSettings = "${pavucontrol} --tab 'Input Devices'";
45
-
inputVolumeMute = "${kbFns} input mute";
46
-
# inputVolumeUp = "${kbFns} input +0.05";
47
-
# inputVolumeDown = "${kbFns} input -0.05";
48
-
bluetoothSettings = (pkgs.writeShellScript "waybar-bluetooth-settings" ''
52
-
(with pkgs; [ coreutils gawk util-linux bluez nettools blueman ])
55
-
bluetoothctl show | \
56
-
awk '/Name: '"$(hostname)"'$/{p=1} p && /Powered: yes/{print "true"; exit} END{if(!NR || !p) print "false"}'
58
-
if [[ $is_powered_on == 'true' ]]; then
61
-
rfkill unblock bluetooth && sleep 1 || true
62
-
bluetoothctl power on
67
-
bluetoothToggle = (pkgs.writeShellScript "waybar-bluetooth-toggle" ''
71
-
(with pkgs; [ coreutils gawk util-linux bluez nettools ])
74
-
bluetoothctl show | \
75
-
awk '/Name: '"$(hostname)"'$/{p=1} p && /Powered: yes/{print "true"; exit} END{if(!NR || !p) print "false"}'
77
-
if [[ $is_powered_on == 'true' ]]; then
78
-
bluetoothctl power off
80
-
rfkill unblock bluetooth && sleep 1 || true
81
-
bluetoothctl power on
85
-
"rfkill block bluetooth && ${systemctl} restart bluetooth.service";
86
-
bluetoothOff = "${bluetoothctl} power off";
87
-
wirelessSettings = iwgtk;
88
-
workspaceSwitchPrev = "${hyprctl} dispatch workspace m-1";
89
-
workspaceSwitchNext = "${hyprctl} dispatch workspace m+1";
92
-
programs.waybar.enable = true;
93
-
programs.waybar.package = package';
95
-
programs.waybar.systemd.enable = true;
97
-
programs.waybar.style =
98
-
builtins.readFile (compileSCSS "waybar-style" ./waybar.scss);
100
-
programs.waybar.settings = {
104
-
# Causes tooltips to be shown behind windows.
108
-
modules-left = [ # #
116
-
modules-center = [ # #
117
-
"hyprland/workspaces"
122
-
"pulseaudio#output"
136
-
# Hyprland dropped support unfortunately.
138
-
# "wlr/workspaces" = {
139
-
# sort-by-number = true;
141
-
# on-click = "activate";
142
-
# on-scroll-up = commands.workspaceSwitchPrev;
143
-
# on-scroll-down = commands.workspaceSwitchNext;
146
-
"hyprland/workspaces" = {
148
-
# sort-by-number = true;
150
-
# on-click = "activate";
151
-
on-scroll-up = commands.workspaceSwitchPrev;
152
-
on-scroll-down = commands.workspaceSwitchNext;
156
-
show-passive-items = true;
162
-
player = "playerctld";
165
-
format = "{status_icon} {dynamic}";
167
-
dynamic-separator = " — ";
168
-
dynamic-order = [ "title" "artist" "position" "length" ];
169
-
dynamic-importance = [ "position" "title" "artist" ];
176
-
tooltip-format = lib.trim ''
177
-
<b>Player:</b> {player} ({status})
178
-
<b>Title:</b> {title}
179
-
<b>Artist:</b> {artist}
180
-
<b>Album:</b> {album}
181
-
<b>Length:</b> {position}/{length}
185
-
"hyprland/submap" = {
190
-
"hyprland/window" = { max-length = 50; };
192
-
## MODULES-CENTER ##
194
-
"clock#time" = { format = "{:%I:%M %p}"; };
196
-
"clock#date" = { format = "{:%A, %B %d}"; };
198
-
## MODULES-RIGHT ##
200
-
"pulseaudio#output" = {
201
-
format = "{icon} {volume}%";
202
-
format-muted = " {volume}%";
208
-
# hands-free = "";
213
-
default = [ "" "" "" ];
216
-
# anything below 100% is "safe" volume levels,
217
-
# the default style will be used,
218
-
# anything higher than this will have no CSS class,
219
-
# that will be considered "warning" state
220
-
# `#pulseaudio.output:not(.safe)`
221
-
states = { safe = 100; };
223
-
ignored-sinks = [ "Easy Effects Sink" ];
225
-
on-click = commands.outputSoundSettings;
226
-
on-click-right = commands.outputVolumeMute;
227
-
on-scroll-up = commands.outputVolumeUp;
228
-
on-scroll-down = commands.outputVolumeDown;
232
-
"pulseaudio#input" = {
233
-
format = "{format_source}";
234
-
# format-source = " {volume}%";
235
-
# format-source-muted = " {volume}%";
236
-
format-source = "";
237
-
format-source-muted = "";
239
-
on-click = commands.inputSoundSettings;
240
-
on-click-right = commands.inputVolumeMute;
241
-
# on-scroll-up = commands.inputVolumeUp;
242
-
# on-scroll-down = commands.inputVolumeDown;
246
-
device = "amdgpu_bl0";
247
-
format = "{icon} {percent}%";
248
-
# format-icons = ["" "" "" "" ""];
249
-
format-icons = [ "" "" "" "" "" "" "" "" "" "" ];
251
-
on-scroll-up = commands.backlightUp;
252
-
on-scroll-down = commands.backlightDown;
257
-
format = " {used:.2g}/{total:.2g}GiB";
262
-
format = " {usage}%";
267
-
hwmon-path-abs = "/sys/devices/pci0000:00/0000:00:18.3/hwmon";
268
-
input-filename = "temp1_input";
269
-
critical-threshold =
270
-
90; # 15C lower than Tjmax <https://www.amd.com/en/product/9686>
271
-
format = "{icon} {temperatureC}°C";
272
-
format-critical = " {temperatureC}°C";
273
-
# 4x low, 2x mid, 3x high, for 0-90
274
-
format-icons = [ "" "" "" "" "" "" "" "" "" ];
279
-
<b>Address:</b> {ipaddr}
280
-
<b>Netmask:</b> {netmask}
281
-
<b>Gateway:</b> {gwaddr}
282
-
<b>Speeds:</b> {bandwidthUpBytes} UL, {bandwidthDownBytes} DL
285
-
format-ethernet = " {bandwidthDownBytes}";
286
-
format-wifi = "{icon} {bandwidthDownBytes}";
287
-
format-linked = " {bandwidthDownBytes}";
288
-
format-disconnected = "";
289
-
format-icons = [ "" "" "" "" ];
291
-
tooltip-format = lib.trim ''
292
-
<b>Interface</b>: {ifname}
295
-
tooltip-format-wifi = lib.trim ''
296
-
<b>SSID:</b> {essid}
297
-
<b>Strength:</b> {signaldBm} dBmW ({signalStrength}%)
298
-
<b>Frequency:</b> {frequency} GHz
301
-
tooltip-format-disconnected = "Network disconnected.";
303
-
on-click = commands.wirelessSettings;
307
-
controller = "C0:3C:59:02:25:C3";
310
-
format-disabled = "";
311
-
format-connected = " {num_connections}";
312
-
format-connected-battery =
313
-
" {device_alias} ({device_battery_percentage}%) ({num_connections})";
315
-
on-click = commands.bluetoothSettings;
316
-
on-click-middle = commands.bluetoothKill;
317
-
on-click-right = commands.bluetoothToggle;
324
-
format = "{icon} {capacity}%";
325
-
format-icons = [ "" "" "" "" "" "" "" "" "" "" ];
338
-
# <https://github.com/Alexays/Waybar/issues/1938>
339
-
# the wiki lies about this, does not match
340
-
# /sys/class/power_supply/BAT0/status
341
-
format-plugged = " AC";
342
-
format-charging-battery-10 = " {capacity}%";
343
-
format-charging-battery-20 = " {capacity}%";
344
-
format-charging-battery-30 = " {capacity}%";
345
-
format-charging-battery-40 = " {capacity}%";
346
-
format-charging-battery-50 = " {capacity}%";
347
-
format-charging-battery-60 = " {capacity}%";
348
-
format-charging-battery-70 = " {capacity}%";
349
-
format-charging-battery-80 = " {capacity}%";
350
-
format-charging-battery-90 = " {capacity}%";
351
-
format-charging-battery-100 = " {capacity}%";
360
-
tooltip-format-activated =
361
-
"Idle timer inhibited, device will not sleep.";
362
-
tooltip-format-deactivated =
363
-
"Idle timer enabled, device will sleep when not in use.";
369
-
(lib.mkIf config.programs.waybar.systemd.enable {
370
-
xdg.configFile."waybar/config".onChange = lib.mkOverride 90 ''
371
-
if [ -z "''${_reloaded_waybar-}" ]; then
373
-
${pkgs.systemd}/bin/systemctl --user restart waybar.service
376
-
xdg.configFile."waybar/style.css".onChange = lib.mkOverride 90 ''
377
-
if [ -z "''${_reloaded_waybar-}" ]; then
379
-
${pkgs.systemd}/bin/systemctl --user restart waybar.service