Change waybar styles

This commit is contained in:
Riley Apeldoorn 2023-09-21 20:38:50 +02:00
parent f6a3d89a8a
commit 3107449982
3 changed files with 65 additions and 97 deletions

View file

@ -5,9 +5,8 @@
global = { global = {
font = "Fira Code 9"; font = "Fira Code 9";
origin = "bottom-right"; origin = "bottom-right";
offset = "10x10"; offset = "3x50";
frame_width = "2"; frame_width = "2";
frame_color = "#ffffff";
corner_radius = "4"; corner_radius = "4";
width = "400"; width = "400";
}; };

View file

@ -114,7 +114,8 @@ in with lib; {
"${mod}+Alt+a" = "layout toggle stacking splitv"; "${mod}+Alt+a" = "layout toggle stacking splitv";
"${mod}+Alt+s" = "layout toggle tabbed splith"; "${mod}+Alt+s" = "layout toggle tabbed splith";
"${mod}+Escape" = "exec swaylock"; "${mod}+Escape" = "exec ${pkgs.swaylock}/bin/swaylock";
"${mod}+Space" = "exec pkill -SIGUSR1 waybar";
"${mod}+Return" = "exec ${terminal}"; "${mod}+Return" = "exec ${terminal}";
"${mod}+Alt+Return" = "exec ${pkgs.foot}/bin/foot"; "${mod}+Alt+Return" = "exec ${pkgs.foot}/bin/foot";

View file

@ -36,20 +36,15 @@ in {
target = "sway-session.target"; target = "sway-session.target";
}; };
settings = [{ settings = [{
margin = "3";
position = "bottom";
exclusive = false;
layer = "top"; layer = "top";
modules-left = [ modules-right = with lib; flatten [
"sway/workspaces" "sway/workspaces"
"sway/mode" "sway/mode"
"mpd"
];
modules-right = with lib; flatten [
"cpu"
"disk"
(optional (cfg.battery.name != "") "battery") (optional (cfg.battery.name != "") "battery")
(optional (cfg.bluetooth.enable) "bluetooth") "network"
(optional (cfg.network.wifi != "") "network#wifi")
(optional (cfg.network.eth != "") "network#eth")
(optional (cfg.network.vpn != "") "network#vpn")
(if cfg.audio.wireplumber (if cfg.audio.wireplumber
then "wireplumber" then "wireplumber"
else "pulseaudio") else "pulseaudio")
@ -62,35 +57,28 @@ in {
"format-disconnected" = ""; "format-disconnected" = "";
}; };
"clock#time" = { "clock#time" = {
"format" = "{:%H:%M:%S}"; "format" = "{:%H:%M}";
"interval" = 1; "interval" = 1;
}; };
"clock#date" = { "clock#date" = {
"format" = "{:%Y-%m-%d}"; "format" = "{:%Y-%m-%d}";
"interval" = 60; "interval" = 60;
}; };
"network#wifi" = { "network" = {
"interface" = cfg.network.wifi; "format-wifi" = "{essid}";
"format" = "wifi"; "format-ethernet" = "eth";
}; "format-disconnected" = "";
"network#eth" = {
"interface" = cfg.network.eth;
"format" = "eth";
};
"network#vpn" = {
"interface" = cfg.network.vpn;
"format" = "vpn";
}; };
"pulseaudio" = { "pulseaudio" = {
"format" = "{desc}: {volume}%"; "format" = "{desc} | {volume}%";
}; };
"wireplumber" = { "wireplumber" = {
"format" = "{node_name}: {volume}%"; "format" = "{node_name} | {volume}%";
}; };
"battery" = { "battery" = {
"bat" = cfg.battery.name; "bat" = cfg.battery.name;
"format-discharging" = "{capacity}% (battery)"; "format-discharging" = "{capacity}%";
"format-charging" = "{capacity}% (charging)"; "format-charging" = "{capacity}%";
"format-full" = ""; "format-full" = "";
"states" = { "states" = {
"critical" = 20; "critical" = 20;
@ -101,29 +89,10 @@ in {
"format-on" = ""; "format-on" = "";
"format-connected" = "{device_alias}"; "format-connected" = "{device_alias}";
}; };
"disk" = {
"format" = "{used} :: {free}";
};
"sway/workspaces" = {
"all-outputs" = true;
};
}]; }];
style = let # TODO: make this fancy scss
green = "#27e67a"; style = ''
yellow = "#edd340";
pink = "#ff4787";
teal = "#1bcf9c";
blue = "#3988e3";
violet = "#9063e6";
lime = "#bfed5a";
red = "#eb3b5b";
disabled = ''
color: #ffffff;
background-color: rgba(207, 207, 207, 0.4);
'';
in ''
/* General/shared styles */ /* General/shared styles */
* { * {
@ -133,7 +102,13 @@ in {
} }
window#waybar { window#waybar {
background-color: rgba(0, 0, 0, 0.45); background-color: transparent;
}
.modules-right {
background-color: #424242;
border-radius: 40px;
padding-left: 2px;
} }
#battery, #battery,
@ -147,12 +122,9 @@ in {
#pulseaudio, #pulseaudio,
#wireplumber #wireplumber
{ {
padding: 2px 10px; padding: 5px 10px;
margin: 5px; margin: 5px 2px;
border-radius: 100px; border-radius: 100px;
}
#cpu, #disk, #bluetooth, #mpd {
color: #ffffff; color: #ffffff;
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
} }
@ -161,32 +133,34 @@ in {
/* Sway chips */ /* Sway chips */
#workspaces { #workspaces {
margin-left: 5px;
padding: 0; padding: 0;
margin: 5px; margin: 5px 2px 5px 5px;
border-radius: 200px; border-radius: 200px;
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
} }
#workspaces button { #workspaces button {
margin: 0; border: 2px solid;
padding: 0 5px; border-color: transparent;
border-radius: 100px; border-radius: 100px;
color: #ffffff; color: #ffffff;
background-color: rgba(0, 0, 0, 0.4); font-size: 9px;
margin: 0;
padding: 0 5px;
} }
#workspaces button.visible.focused { #workspaces button.visible.focused {
color: #212121; color: #ffffff;
background-color: ${green}; border-color: #2bdafc;
} }
#workspaces button.visible { #workspaces button.visible {
color: ${green}; color: #2bdafc;
} }
#mode { #mode {
background-color: ${teal}; color: #212121;
background-color: #2bdafc;
} }
@ -194,69 +168,63 @@ in {
#clock { #clock {
color: #ffffff; color: #ffffff;
background-color: transparent; padding: 5px 10px;
background-color: rgba(0, 0, 0, 0.4);
} }
#clock.date { padding-right: 0; } #clock.date {
#clock.time { padding-left: 0; } padding-right: 5px;
margin-right: 0;
border-radius: 14px 0 0 14px;
}
#clock.time {
padding-left: 5px;
margin-left: 0;
border-radius: 0 14px 14px 0;
margin-right: 5px;
}
/* Radio chips */ /* Radio chips */
#network {
background-color: ${green};
}
#network.disconnected { #network.disconnected {
${disabled} color: #ffffff;
background-color: transparent;
} }
#bluetooth.connected { #bluetooth.connected {
background-color: ${blue}; background-color: #3988e3;
} }
/* Audio chip */ /* Audio chip */
#pulseaudio,
#wireplumber
{
background-color: ${yellow};
}
#pulseaudio.muted, #pulseaudio.muted,
#wireplumber.muted #wireplumber.muted
{ {
${disabled} color: rgba(207, 207, 207, 0.9);
} }
/* Battery chip */ /* Battery chip */
#battery.discharging { #battery {
border: 2px solid;
border-color: transparent;
border-radius: 200px;
padding: 5px 8px;
color: #ffffff; color: #ffffff;
background-color: ${violet}; background-color: rgba(0, 0, 0, 0.4);
} }
#battery.charging { #battery.charging {
background-color: ${lime}; border-color: #2bdafc;
} }
#battery.critical { #battery.critical {
background-color: ${red}; border-color: #eb3b5b;
} }
/* MPD chip */
#mpd.playing {
color: #ffffff;
}
#mpd.paused {
${disabled}
}
''; '';
}; };
}; };