Tweak waybar config

This commit is contained in:
Nathan McCarty 2023-06-21 01:12:14 -04:00
parent e7b8db9d22
commit ab4eabc1bc
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
1 changed files with 471 additions and 465 deletions

View File

@ -3,479 +3,485 @@ let
fuzzel-command = config.nathan.config.desktop.fuzzel-command; fuzzel-command = config.nathan.config.desktop.fuzzel-command;
targets = config.nathan.config.desktop.targets; targets = config.nathan.config.desktop.targets;
hyprland = config.nathan.programs.hyprland.enable; hyprland = config.nathan.programs.hyprland.enable;
in lib.mkIf hyprland { in lib.mkMerge [
######################### # Hyprland specific configuration
## Waybar (lib.mkIf hyprland {
######################### programs.waybar.settings.mainBar = {
# https://github.com/DN-debug/waybar-examples/tree/main/waybar-examples/sway modules-center = [
programs.waybar = { "custom/launcher"
enable = true; "wlr/workspaces"
package = "custom/media"
(inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waybar.override { # "hyprland/window"
withMediaPlayer = true; "idle_inhibitor"
}).overrideAttrs "pulseaudio"
(old: { mesonFlags = old.mesonFlags ++ [ "-Dexperimental=true" ]; }); "network"
systemd = { enable = false; }; "cpu"
settings = { "memory"
mainBar = { # "temperature"
layer = "top"; "tray"
position = "top"; "custom/notification"
height = 30; "clock"
spacing = 0; # "custom/power"
margin-top = 5; ];
margin-bottom = 0; };
# modules-left = [ "wlr/workspaces" "hyprland/submap" ]; })
# modules-center = [ "hyprland/window" ]; # General configuration
# modules-right = [ "mpd" "clock" "tray" ]; (lib.mkIf hyprland {
modules-center = [ #########################
"custom/launcher" ## Waybar
"wlr/workspaces" #########################
"custom/media" # https://github.com/DN-debug/waybar-examples/tree/main/waybar-examples/sway
# "hyprland/window" programs.waybar = {
"idle_inhibitor" enable = true;
"pulseaudio" package =
"network" (inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waybar.override {
"cpu" withMediaPlayer = true;
"memory" }).overrideAttrs
# "temperature" (old: { mesonFlags = old.mesonFlags ++ [ "-Dexperimental=true" ]; });
"tray" systemd = { enable = false; };
"custom/notification" settings = {
"clock" mainBar = {
# "custom/power" layer = "top";
]; position = "top";
"custom/launcher" = { height = 30;
format = ""; spacing = 0;
on-click = fuzzel-command + " --prompt=' ' "; margin-top = 5;
on-click-right = "killall fuzzel"; margin-bottom = 0;
}; "custom/launcher" = {
"idle_inhibitor" = { format = "";
format = "{icon}"; on-click = fuzzel-command + " --prompt=' ' ";
format-icons = { on-click-right = "killall fuzzel";
activated = "";
deactivated = "";
}; };
}; "idle_inhibitor" = {
pulseaudio = { format = "{icon}";
scroll-step = 1; format-icons = {
format = "{volume}% {icon}"; activated = "";
format-bluetooth = "{volume}% {icon}"; deactivated = "";
format-bluetooth-muted = "{icon} {format_source}"; };
format-muted = "{format_source}";
format-source = "";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [ "" "" "" ];
}; };
on-click = "pavucontrol"; pulseaudio = {
ignored-sinks = [ "Easy Effects Sink" ]; scroll-step = 1;
}; format = "{volume}% {icon}";
network = { format-bluetooth = "{volume}% {icon}";
# // "interface": "wlp2*", // (Optional) To force the use of this interface format-bluetooth-muted = "{icon} {format_source}";
format-wifi = "{essid} ({signalStrength}%) "; format-muted = "{format_source}";
format-ethernet = "Connected "; format-source = "";
tooltip-format = "{ifname} via {gwaddr} "; format-source-muted = "";
format-linked = "{ifname} (No IP) "; format-icons = {
format-disconnected = "Disconnected "; headphone = "";
format-alt = "{ifname}: {ipaddr}/{cidr}"; hands-free = "";
on-click-right = "bash ~/.config/rofi/wifi_menu/rofi_wifi_menu"; headset = "";
}; phone = "";
cpu = { portable = "";
format = "{usage}% "; car = "";
tooltip = false; default = [ "" "" "" ];
}; };
memory = { format = "{}% ({used}GB/{total}GB) "; }; on-click = "pavucontrol";
"tray" = { ignored-sinks = [ "Easy Effects Sink" ];
icon-size = 20;
spacing = 10;
};
"clock" = { format = "{:%I:%M%p %Y-%m-%d}"; };
"custom/media" = {
format = "{icon} {}";
return-type = "json";
max-length = 50;
format-icons = {
spotify = " ";
firefox = " ";
mopidy = " ";
default = " ";
}; };
escape = true; network = {
exec = "waybar-mediaplayer.py 2> /dev/null"; # // "interface": "wlp2*", // (Optional) To force the use of this interface
on-click = "playerctl play-pause"; format-wifi = "{essid} ({signalStrength}%) ";
}; format-ethernet = "Connected ";
"custom/notification" = { tooltip-format = "{ifname} via {gwaddr} ";
tooltip = false; format-linked = "{ifname} (No IP) ";
format = "{icon}"; format-disconnected = "Disconnected ";
format-icons = { format-alt = "{ifname}: {ipaddr}/{cidr}";
notification = " <span foreground='red'><sup></sup></span> "; on-click-right = "bash ~/.config/rofi/wifi_menu/rofi_wifi_menu";
none = " "; };
dnd-notification = " <span foreground='red'><sup></sup></span> "; cpu = {
dnd-none = ""; format = "{usage}% ";
inhibited-notification = tooltip = false;
" <span foreground='red'><sup></sup></span> "; };
inhibited-none = " "; memory = { format = "{}% ({used}GB/{total}GB) "; };
dnd-inhibited-notification = "tray" = {
" <span foreground='red'><sup></sup></span> "; icon-size = 20;
dnd-inhibited-none = " "; spacing = 10;
};
"clock" = { format = "{:%I:%M%p %Y-%m-%d}"; };
"custom/media" = {
format = "{icon} {}";
return-type = "json";
max-length = 50;
format-icons = {
spotify = " ";
firefox = " ";
mopidy = " ";
default = " ";
};
escape = true;
exec = "waybar-mediaplayer.py 2> /dev/null";
on-click = "playerctl play-pause";
};
"custom/notification" = {
tooltip = false;
format = "{icon}";
format-icons = {
notification = " <span foreground='red'><sup></sup></span> ";
none = " ";
dnd-notification =
" <span foreground='red'><sup></sup></span> ";
dnd-none = "";
inhibited-notification =
" <span foreground='red'><sup></sup></span> ";
inhibited-none = " ";
dnd-inhibited-notification =
" <span foreground='red'><sup></sup></span> ";
dnd-inhibited-none = " ";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
}; };
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
}; };
}; };
style = ''
* {
border: none;
border-radius: 0px;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 12px;
min-height: 0;
}
window#waybar {
background-color: transparent;
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces button {
background: #1f1f1f;
color: #ffffff;
border-radius: 20px;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
}
#workspaces button.active {
background: #3f3f3f;
}
#workspaces button.active:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#custom-launcher,
#custom-power,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 10px;
color: black;
}
#mpd {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#window,
#workspaces {
margin: 0px 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0px;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0px;
}
#clock {
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
border-radius: 0px 20px 20px 0px;
margin-right: 4px;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#custom-notification {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#memory {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#disk {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#backlight {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
}
#network {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#network.disconnected {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: red;
}
#pulseaudio {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#pulseaudio.muted {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: red;
}
#custom-media {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-media {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-media.custom-spotify {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-media.custom-vlc {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-power{
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
font-size: 16px;
border-radius: 19px;
}
#custom-launcher{
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
font-size: 18px;
border-radius: 20px;
}
#custom-updater {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#temperature {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#tray > .passive {
-gtk-icon-effect: dim;
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#idle_inhibitor {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
border-radius: 20px 0px 0px 20px;
}
#idle_inhibitor.activated {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
border-radius: 20px 0px 0px 20px;
}
#language {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
min-width: 16px;
}
#keyboard-state > label {
padding: 0px 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
'';
}; };
style = '' # Override the service to run during graphical-session-pre.target
* { systemd.user.services.waybar = {
border: none; Unit = {
border-radius: 0px; Description =
font-family: Roboto, Helvetica, Arial, sans-serif; "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
font-size: 12px; Documentation = "https://github.com/Alexays/Waybar/wiki";
min-height: 0; Before = [ "tray.target" ];
} };
window#waybar { Service = {
background-color: transparent; ExecStart = "${config.programs.waybar.package}/bin/waybar";
color: #ffffff; ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
transition-property: background-color; ExecStartPost = "${pkgs.coreutils}/bin/sleep 1";
transition-duration: .5s; Restart = "on-failure";
} KillMode = "mixed";
};
window#waybar.hidden { Install = { WantedBy = targets; };
opacity: 0.2; };
} #########################
## Create tray target to fix some things
#########################
#workspaces button { systemd.user.targets.tray = {
background: #1f1f1f; Unit = {
color: #ffffff; Description = "Home Manager System Tray";
border-radius: 20px; Requires = [ "graphical-session-pre.target" "waybar.service" ];
After = [ "waybar.service" ];
} };
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
}
#workspaces button.active {
background: #3f3f3f;
}
#workspaces button.active:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#custom-launcher,
#custom-power,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 10px;
color: black;
}
#mpd {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#window,
#workspaces {
margin: 0px 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0px;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0px;
}
#clock {
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
border-radius: 0px 20px 20px 0px;
margin-right: 4px;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#custom-notification {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#memory {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#disk {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#backlight {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
}
#network {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#network.disconnected {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: red;
}
#pulseaudio {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#pulseaudio.muted {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: red;
}
#custom-media {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-media {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-media.custom-spotify {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-media.custom-vlc {
background-color: #8EC5FC;
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
color: black;
border-radius: 20px;
margin-right: 5px;
}
#custom-power{
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
font-size: 16px;
border-radius: 19px;
}
#custom-launcher{
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
font-size: 18px;
border-radius: 20px;
}
#custom-updater {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#temperature {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#tray > .passive {
-gtk-icon-effect: dim;
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #FA8BFF;
background-image: linear-gradient(-45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
}
#idle_inhibitor {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
border-radius: 20px 0px 0px 20px;
}
#idle_inhibitor.activated {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
border-radius: 20px 0px 0px 20px;
}
#language {
background-color: #FA8BFF;
background-image: linear-gradient(45deg, #2BD2FF 0%, #2BD2FF 52%, #2BD2FF 90%);
color: black;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
min-width: 16px;
}
#keyboard-state > label {
padding: 0px 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
'';
};
# Override the service to run during graphical-session-pre.target
systemd.user.services.waybar = {
Unit = {
Description =
"Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki";
Before = [ "tray.target" ];
}; };
Service = { })
ExecStart = "${config.programs.waybar.package}/bin/waybar"; ]
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
ExecStartPost = "${pkgs.coreutils}/bin/sleep 1";
Restart = "on-failure";
KillMode = "mixed";
};
Install = { WantedBy = targets; };
};
#########################
## Create tray target to fix some things
#########################
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" "waybar.service" ];
After = [ "waybar.service" ];
};
};
}