Skip to content

Instantly share code, notes, and snippets.

@sachinchaudhary1808
Created April 26, 2024 15:45
Show Gist options
  • Save sachinchaudhary1808/98bd30b8a92d95e5eb07a7ff8df9c355 to your computer and use it in GitHub Desktop.
Save sachinchaudhary1808/98bd30b8a92d95e5eb07a7ff8df9c355 to your computer and use it in GitHub Desktop.
{ config, pkgs, userSettings, systemSettings, ... }:
{
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 36;
margin = "7 7 0 7";
spacing = 8;
modules-left = [ "custom/l_end" "cpu" "memory" "custom/spacer1" "pulseaudio" "custom/spacer2""upower#mouse" "upower#headphones" ];
modules-center = [ "hyprland/workspaces" ];
modules-right = [ "tray" "clock" "custom/os" "custom/r_end" ];
"hyprland/workspaces" = {
format = [
"name {}"
"icon {}"
];
tooltip = false;
all-outputs = true;
format-icons = {
active = "";
default = "";
};
};
"custom/os" = {
"format" = "{} ";
"exec" = ''echo "" '';
"interval" = "once";
"on-click" = "wlogout -b 3 -c 50";
};
clock = {
"interval" = 1;
"format" = "{:%d/%m/%Y %R}";
"timezone" = "${systemSettings.timezone}";
"tooltip-format" = ''
<big>{:%Y %B}</big>
<tt><small>{calendar}</small></tt>'';
};
tray = { "spacing" = 10; };
cpu = { "format" = "{usage}%  "; };
memory = { "format" = "{}%  "; };
pulseaudio = {
"scroll-step" = 1;
"format" = "{volume}% {icon} {format_source}";
"format-bluetooth" = "{volume}% {icon}  {format_source}";
"format-bluetooth-muted" = "󰸈 {icon}  {format_source}";
"format-muted" = "󰸈 {format_source}";
"format-source" = "{volume}%  ";
"format-source-muted" = "";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = [ "" "" "" ];
};
"on-click" = "pavucontrol && hyprctl dispatch bringactivetotop";
};
"upower#mouse" = {
"native-path" = "hidpp_battery_0";
"show-icon" = true;
"format" = "{percentage} 󰍽 ";
"icon-size" = 20;
"hide-if-empty" = true;
"tooltip" = true;
"tooltip-spacing" = 20;
};
"upower#headphones" = {
"native-path" = "/org/bluez/hci0/dev_AC_80_0A_72_AA_AF";
"show-icon" = true;
"format" = "{percentage}  ";
"icon-size" = 20;
"hide-if-empty" = true;
"tooltip" = true;
"tooltip-spacing" = 20;
};
"custom/l_end" = {
"format" = " ";
"interval" = "once";
"tooltip" = false;
};
"custom/r_end" = {
"format" = " ";
"interval" = "once";
"tooltip" = false;
};
"custom/spacer1" = {
"format" = " ";
"interval" = "once";
"tooltip" = false;
};
"custom/spacer2" = {
"format" = " ";
"interval" = "once";
"tooltip" = false;
};
};
};
style = ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: '' + userSettings.font + '';
font-size: 20px;
}
window#waybar {
background-color: #'' + config.colorScheme.palette.base00 + '';
opacity: 0.75;
border-radius: 8px;
color: #'' + config.colorScheme.palette.base07 + '';
transition-property: background-color;
transition-duration: .2s;
}
window > box {
border-radius: 8px;
opacity: 0.85;
}
window#waybar.hidden {
opacity: 0.2;
}
button {
border: none;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
}
#workspaces button {
padding: 0 7px;
background-color: transparent;
color: #'' + config.colorScheme.palette.base04 + '';
}
#workspaces button:hover {
color: #'' + config.colorScheme.palette.base07 + '';
}
#workspaces button.active {
color: #'' + config.colorScheme.palette.base08 + '';
}
#workspaces button.focused {
color: #'' + config.colorScheme.palette.base0A + '';
}
#workspaces button.visible {
color: #'' + config.colorScheme.palette.base05 + '';
}
#workspaces button.urgent {
color: #'' + config.colorScheme.palette.base09 + '';
}
#battery,
#disk,
#temperature,
#backlight,
#network,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#mpd {
padding: 5 5px;
color: #'' + config.colorScheme.palette.base07 + '';
border: none;
border-radius: 8px;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 10px;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 10px;
}
#clock {
color: #'' + config.colorScheme.palette.base07 + '';
}
#custom-os {
color: #'' + config.colorScheme.palette.base05 + '';
}
#upower {
color: #'' + config.colorScheme.palette.base0D + '';
}
label:focus {
background-color: #'' + config.colorScheme.palette.base00 + '';
}
#cpu {
color: #'' + config.colorScheme.palette.base06 + '';
}
#memory {
color: #'' + config.colorScheme.palette.base06 + '';
}
#disk {
color: #'' + config.colorScheme.palette.base06 + '';
}
#backlight {
color: #'' + config.colorScheme.palette.base0A + '';
}
#pulseaudio {
color: #'' + config.colorScheme.palette.base07 + '';
}
#pulseaudio.muted {
color: #'' + config.colorScheme.palette.base08 + '';
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
}
#idle_inhibitor {
color: #'' + config.colorScheme.palette.base04 + '';
}
#idle_inhibitor.activated {
color: #'' + config.colorScheme.palette.base0F + '';
}
'';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment