Skip to content

Commit

Permalink
feat: new waybar
Browse files Browse the repository at this point in the history
  • Loading branch information
sioodmy committed May 18, 2024
1 parent 702d21e commit 31212fa
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 118 deletions.
8 changes: 8 additions & 0 deletions home/rice/niri/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
}:
with theme.colors; {
programs.niri.settings = {
spawn-at-startup = [{
command = [
"run-as-service"
"waybar"
];
}];
outputs."eDP-1".position = {
x = 0;
y = 0;
Expand Down Expand Up @@ -162,6 +168,8 @@ with theme.colors; {
"Super+C".action = center-column;

"Mod+Q".action = close-window;

"Mod+Shift+P".action = power-off-monitors;
};

prefer-no-csd = true;
Expand Down
42 changes: 15 additions & 27 deletions home/rice/waybar/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
pkgs,
lib,
theme,
...
}:
with lib; let
Expand All @@ -21,26 +22,25 @@ in {
home.packages = [waybar-wttr];
programs.waybar = {
enable = true;
style = import ./style.nix;
style = import ./style.nix theme;
systemd = {
enable = true;
target = "niri.target";
target = "niri.service";
};
settings = {
mainBar = {
layer = "top";
position = "left";
width = 57;
spacing = 7;
position = "top";
height = 30;
spacing = 5;
modules-left = [
"custom/search"
"custom/lock"
"custom/weather"
"backlight"
"battery"
];
modules-center = [];
modules-right = ["pulseaudio" "network" "clock" "custom/power"];
modules-right = ["pulseaudio" "network" "clock"];
"custom/search" = {
format = " ";
tooltip = false;
Expand All @@ -54,41 +54,29 @@ in {
exec = "waybar-wttr";
return-type = "json";
};
"custom/lock" = {
tooltip = false;
on-click = "sh -c '(sleep 0.5s; hyprlock)' & disown";
format = "";
};
"custom/power" = {
tooltip = false;
on-click = "wlogout &";
format = "";
};
clock = {
format = ''
{:%H
%M}'';
format = "{:%H:%M}";
tooltip-format = ''
<big>{:%Y %B}</big>
<tt><small>{calendar}</small></tt>'';
};
backlight = {
format = "{icon}";
format = "{icon} {percent}%";
format-icons = ["" "" "" "" "" "" "" "" ""];
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "{icon}\n󰚥";
tooltip-format = "{timeTo} {capacity}% 󱐋{power}";
format = "{icon} {capacity}% {power} 󱐋";
format-charging = "{icon} 󰚥 {capacity} %";
tooltip-format = "{timeTo}";
format-icons = ["󰂃" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
network = {
format-wifi = "󰤨";
format-ethernet = "󰤨";
format-wifi = "󰤨 {essid} {signalStrength}";
format-ethernet = "󰈀";
format-alt = "󰤨";
format-disconnected = "󰤭";
tooltip-format = "{ipaddr}/{ifname} via {gwaddr} ({signalStrength}%)";
Expand All @@ -98,7 +86,7 @@ in {
tooltip = true;
tooltip-format = "{volume}% {format_source}";
on-click = "${pkgs.killall}/bin/killall pavucontrol || ${pkgs.pavucontrol}/bin/pavucontrol";
format = " {icon}\n{volume}%";
format = " {icon} {volume}%";
format-bluetooth = "󰂯 {icon} {volume}%";
format-muted = "󰝟 ";
format-icons = {
Expand Down
117 changes: 27 additions & 90 deletions home/rice/waybar/style.nix
Original file line number Diff line number Diff line change
@@ -1,129 +1,66 @@
''
theme: with theme.colors; ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: Material Design Icons, Iosevka Nerd Font;
padding: 0;
margin: 0;
}
.module {
border-radius: 12px;
margin: 5px 1px 5px 1px;
background-color: #414559;
padding: 3px 10px;
}
window#waybar {
background-color: #303446;
background-color: #${base};
border-radius: 0px;
color: #c6d0f5;
font-size: 20px;
color: #${text};
font-size: 16px;
/* transition-property: background-color; */
transition-duration: 0.5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces {
font-size: 15px;
background-color: #414559;
}
#pulseaudio {
color: #a6d189;
color: #${green};
}
#network {
color: #8caaee;
}
#custom-search,
#clock {
background-color: #414559;
}
#workspaces button {
background-color: transparent;
color: #8caaee;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
color: #85c1dc;
}
#custom-power {
color: #e78284;
color: #${blue};
}
#custom-lock {
color: #8caaee;
#backlight {
color: #${yellow};
}
#workspaces button.active {
color: #e5c890;
#battery {
color: #${green};
}
#workspaces button.urgent {
background-color: #e78284;
#battery.warning {
color: #${maroon};
}
#clock,
#network,
#cpu,
#battery,
#backlight,
#memory,
#workspaces,
#custom-search,
#custom-power,
#custom-todo,
#custom-lock,
#custom-weather,
#custom-btc,
#custom-eth,
#volume,
#pulseaudio {
border-radius: 15px;
margin: 0px 7px 0px 7px;
background-color: #414559;
padding: 10px 0px 10px 0px;
#battery.critical:not(.charging) {
color: #${red};
}
#custom-power {
margin-bottom: 7px;
padding-right: 6px;
}
#custom-search {
background-image: url("${./sakura.png}");
background-size: 60%;
margin-left: 6px;
background-position: center;
background-repeat: no-repeat;
margin-top: 7px;
}
#clock {
font-weight: 700;
font-size: 20px;
padding: 5px 0px 5px 0px;
font-family: "Iosevka Term";
}
#backlight {
padding-right: 2px;
color: #e5c890;
}
#battery {
color: #a6d189;
margin-right: 6px;
}
#battery.warning {
color: #ef9f76;
}
#battery.critical:not(.charging) {
color: #e78284;
}
tooltip {
font-family: 'Lato', sans-serif;
font-family: sans-serif;
border-radius: 15px;
padding: 20px;
margin: 30px;
}
tooltip label {
font-family: 'Lato', sans-serif;
font-family: sans-serif;
padding: 20px;
}
''
2 changes: 1 addition & 1 deletion home/rice/waybar/waybar-wttr.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def format_chances(hour):
data["text"] = (
" "
+ WEATHER_CODES[weather["current_condition"][0]["weatherCode"]]
+ "\n "
+ " "
+ extrachar
+ weather["current_condition"][0]["FeelsLikeC"]
+ "°"
Expand Down

0 comments on commit 31212fa

Please sign in to comment.