better swaybar
This commit is contained in:
parent
b363f169ce
commit
221b1f0379
5 changed files with 567 additions and 62 deletions
|
|
@ -1,11 +1,17 @@
|
|||
{ lib, osConfig, ... }:
|
||||
let
|
||||
ccfg = import ../../../config.nix;
|
||||
cfg_path = [ ccfg.custom_config_key "desktopEnvironment" "sway" "waybar" ];
|
||||
cfg_path = [
|
||||
ccfg.custom_config_key
|
||||
"desktopEnvironment"
|
||||
"sway"
|
||||
"waybar"
|
||||
];
|
||||
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
|
|
@ -13,28 +19,125 @@ in
|
|||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
height = 28;
|
||||
spacing = 6;
|
||||
margin-top = 0;
|
||||
margin-bottom = 0;
|
||||
margin-left = 10;
|
||||
margin-right = 10;
|
||||
|
||||
modules-left = [ "sway/workspaces" ];
|
||||
modules-center = [ "clock" "temperature" "cpu" "memory" "disk" ];
|
||||
modules-right = [ "pulseaudio" "network" "bluetooth" "custom/notifications" "sway/language" ];
|
||||
modules-left = [
|
||||
"sway/workspaces"
|
||||
"sway/mode"
|
||||
"sway/scratchpad"
|
||||
];
|
||||
modules-center = [
|
||||
"clock"
|
||||
"temperature"
|
||||
"cpu"
|
||||
"memory"
|
||||
"disk"
|
||||
];
|
||||
modules-right = [
|
||||
"battery"
|
||||
"battery#bat2"
|
||||
"pulseaudio"
|
||||
"network"
|
||||
"bluetooth"
|
||||
"power-profiles-daemon"
|
||||
"backlight"
|
||||
"custom/notifications"
|
||||
"sway/language"
|
||||
"tray"
|
||||
"custom/power"
|
||||
];
|
||||
|
||||
# LEFT
|
||||
"sway/workspaces" = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
"1" = "一"; "2" = "二"; "3" = "三"; "4" = "四"; "5" = "五";
|
||||
"6" = "六"; "7" = "七"; "8" = "八"; "9" = "九"; "10" = "十";
|
||||
"11" = "十一"; "12" = "十二"; "13" = "十三"; "14" = "十四"; "15" = "十五";
|
||||
"16" = "十六"; "17" = "十七"; "18" = "十八"; "19" = "十九"; "20" = "二十";
|
||||
"1" = "一";
|
||||
"2" = "二";
|
||||
"3" = "三";
|
||||
"4" = "四";
|
||||
"5" = "五";
|
||||
"6" = "六";
|
||||
"7" = "七";
|
||||
"8" = "八";
|
||||
"9" = "九";
|
||||
"10" = "十";
|
||||
"11" = "十一";
|
||||
"12" = "十二";
|
||||
"13" = "十三";
|
||||
"14" = "十四";
|
||||
"15" = "十五";
|
||||
"16" = "十六";
|
||||
"17" = "十七";
|
||||
"18" = "十八";
|
||||
"19" = "十九";
|
||||
"20" = "二十";
|
||||
};
|
||||
disable-scroll = false;
|
||||
};
|
||||
|
||||
# CENTER
|
||||
clock = {
|
||||
format = "{:%b %d, %H:%M}";
|
||||
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
|
||||
};
|
||||
|
||||
temperature = {
|
||||
thermal-zone = 2;
|
||||
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
|
||||
critical-threshold = 80;
|
||||
format-critical = " {temperatureC}°C";
|
||||
format = " {temperatureC}°C";
|
||||
};
|
||||
|
||||
cpu = {
|
||||
format = " {usage}%";
|
||||
tooltip = true;
|
||||
on-click = "btop";
|
||||
};
|
||||
|
||||
memory = {
|
||||
format = " {}%";
|
||||
on-click = "btop";
|
||||
};
|
||||
|
||||
disk = {
|
||||
interval = 30;
|
||||
format = " {percentage_used}%";
|
||||
path = "/";
|
||||
on-click = "btop";
|
||||
};
|
||||
|
||||
# RIGHT
|
||||
"battery" = {
|
||||
"states" = {
|
||||
# "good"= 95;
|
||||
"warning" = 30;
|
||||
"critical" = 15;
|
||||
};
|
||||
"format" = "{capacity}% {icon}";
|
||||
"format-full" = "{capacity}% {icon}";
|
||||
"format-charging" = "{capacity}% ";
|
||||
"format-plugged" = "{capacity}% ";
|
||||
"format-alt" = "{time} {icon}";
|
||||
# "format-good"= ""; // An empty format will hide the module
|
||||
# "format-full"= "";
|
||||
"format-icons" = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
"battery#bat2" = {
|
||||
"bat" = "BAT2";
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon} {volume}%";
|
||||
format-bluetooth = " {volume}%";
|
||||
|
|
@ -49,44 +152,17 @@ in
|
|||
phone = "";
|
||||
portable = "";
|
||||
car = "";
|
||||
default = [ "" "" "" ];
|
||||
default = [
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
scroll-step = 5;
|
||||
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
on-click-right = "swaync-client -t -sw";
|
||||
on-click = "pavucontrol";
|
||||
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
};
|
||||
|
||||
"custom/notifications" = {
|
||||
format = "{icon} {}";
|
||||
format-icons = {
|
||||
notification = ""; none = "";
|
||||
dnd-notification = ""; dnd-none = "";
|
||||
inhibited-notification = ""; inhibited-none = "";
|
||||
dnd-inhibited-notification = ""; 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;
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
clock = { format = "{:%b %d, %H:%M}"; };
|
||||
|
||||
temperature = {
|
||||
thermal-zone = 2;
|
||||
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
|
||||
critical-threshold = 80;
|
||||
format-critical = " {temperatureC}°C";
|
||||
format = " {temperatureC}°C";
|
||||
};
|
||||
|
||||
cpu = { format = " {usage}%"; tooltip = false; on-click = "btop"; };
|
||||
memory = { format = " {}%"; on-click = "btop"; };
|
||||
disk = { interval = 30; format = " {percentage_used}%"; path = "/"; on-click = "btop"; };
|
||||
|
||||
network = {
|
||||
format-wifi = " {essid} ({signalStrength}%)";
|
||||
format-ethernet = " {ipaddr}/{cidr}";
|
||||
|
|
@ -109,24 +185,77 @@ in
|
|||
# on-click-right = "bluetoothctl power toggle";
|
||||
};
|
||||
|
||||
"sway/language" = { format = "{}"; }; # simplified
|
||||
"power-profiles-daemon" = {
|
||||
format = "{icon}";
|
||||
"tooltip-format" = "Power profile: {profile}\nDriver: {driver}";
|
||||
tooltip = true;
|
||||
"format-icons" = {
|
||||
default = "";
|
||||
performance = "";
|
||||
balanced = "";
|
||||
"power-saver" = "";
|
||||
};
|
||||
};
|
||||
|
||||
backlight = {
|
||||
format = "{percent}% {icon}";
|
||||
"format-icons" = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
|
||||
"custom/notifications" = {
|
||||
format = "{icon} {}";
|
||||
format-icons = {
|
||||
notification = "";
|
||||
none = "";
|
||||
dnd-notification = "";
|
||||
dnd-none = "";
|
||||
inhibited-notification = "";
|
||||
inhibited-none = "";
|
||||
dnd-inhibited-notification = "";
|
||||
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;
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"sway/language" = {
|
||||
format = "{}";
|
||||
};
|
||||
|
||||
"tray" = {
|
||||
"spacing" = 10;
|
||||
};
|
||||
|
||||
"custom/power" = {
|
||||
format = "⏻ ";
|
||||
tooltip = false;
|
||||
menu = "on-click";
|
||||
"menu-file" = ./waybar/power_menu.xml;
|
||||
"menu-actions" = {
|
||||
shutdown = "shutdown 0";
|
||||
reboot = "reboot";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
style = ''
|
||||
* { font-family: "JetBrainsMonoNL Nerd Font"; font-size: 12px; border: none; border-radius: 0; min-height: 0; }
|
||||
window#waybar { background: transparent; border-radius: 10px; margin: 0px; }
|
||||
.modules-left,.modules-center,.modules-right { background: rgba(26,27,38,.8); border-radius: 10px; margin: 4px; padding: 0 10px; }
|
||||
#workspaces { padding: 0 5px; }
|
||||
#workspaces button { padding: 0 8px; background: transparent; color: #c0caf5; border-radius: 5px; margin: 2px; }
|
||||
#workspaces button:hover { background: rgba(125,196,228,.2); color: #7dcae4; }
|
||||
#workspaces button.active { background: #7dcae4; color: #1a1b26; }
|
||||
#pulseaudio,#custom-notifications,#clock,#temperature,#cpu,#memory,#disk,#network,#bluetooth,#language { padding: 0 8px; color: #c0caf5; margin: 2px; }
|
||||
#temperature.critical { color: #f7768e; }
|
||||
#network.disconnected { color: #f7768e; }
|
||||
#bluetooth.disabled { color: #565f89; }
|
||||
#pulseaudio.muted { color: #565f89; }
|
||||
'';
|
||||
style = builtins.readFile ./waybar/waybar.css;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue