From c30ab2e0f09e93e03b746ea9b4ce2b9a6101891b Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 7 Aug 2024 07:21:32 -0700 Subject: [PATCH] feat: add laptop config for waybar --- users/youwen/linux/desktop/default.nix | 2 +- users/youwen/linux/laptop/default.nix | 2 +- .../linux/waybar/{ => desktop}/default.nix | 0 .../linux/waybar/{ => desktop}/waybar.css | 0 users/youwen/linux/waybar/laptop/default.nix | 91 ++++++++++++++++ users/youwen/linux/waybar/laptop/waybar.css | 101 ++++++++++++++++++ 6 files changed, 194 insertions(+), 2 deletions(-) rename users/youwen/linux/waybar/{ => desktop}/default.nix (100%) rename users/youwen/linux/waybar/{ => desktop}/waybar.css (100%) create mode 100644 users/youwen/linux/waybar/laptop/default.nix create mode 100755 users/youwen/linux/waybar/laptop/waybar.css diff --git a/users/youwen/linux/desktop/default.nix b/users/youwen/linux/desktop/default.nix index 9635892..e082da2 100644 --- a/users/youwen/linux/desktop/default.nix +++ b/users/youwen/linux/desktop/default.nix @@ -1,4 +1,4 @@ { - imports = [ ../theming ../home.nix ../programs ../hyprland/desktop ../waybar ]; + imports = [ ../theming ../home.nix ../programs ../hyprland/desktop ../waybar/desktop ]; } diff --git a/users/youwen/linux/laptop/default.nix b/users/youwen/linux/laptop/default.nix index 3c7666f..ef8616c 100644 --- a/users/youwen/linux/laptop/default.nix +++ b/users/youwen/linux/laptop/default.nix @@ -1,4 +1,4 @@ { - imports = [ ../theming ../home.nix ../programs ../hyprland/laptop ../waybar ]; + imports = [ ../theming ../home.nix ../programs ../hyprland/laptop ../waybar/laptop ]; } diff --git a/users/youwen/linux/waybar/default.nix b/users/youwen/linux/waybar/desktop/default.nix similarity index 100% rename from users/youwen/linux/waybar/default.nix rename to users/youwen/linux/waybar/desktop/default.nix diff --git a/users/youwen/linux/waybar/waybar.css b/users/youwen/linux/waybar/desktop/waybar.css similarity index 100% rename from users/youwen/linux/waybar/waybar.css rename to users/youwen/linux/waybar/desktop/waybar.css diff --git a/users/youwen/linux/waybar/laptop/default.nix b/users/youwen/linux/waybar/laptop/default.nix new file mode 100644 index 0000000..43322b9 --- /dev/null +++ b/users/youwen/linux/waybar/laptop/default.nix @@ -0,0 +1,91 @@ +{ + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 24; + width = 1000; + reload-style-on-change = true; + margin = "10px 0px 0px 0px"; + modules-left = [ "hyprland/window" "hyprland/workspaces" ]; + modules-right = [ "backlight" "group/adjustable" "custom/weather" ]; + modules-center = [ "network" "group/hardware" "clock" ]; + "hyprland/workspaces" = { + active-only = false; + all-outputs = false; + format = "{icon}"; + persistent-workspaces = { + eDP-1 = [ 1 ]; + DP-1 = [ 2 3 4 5 ]; + }; + }; + "group/hardware" = { + orientation = "inherit"; + modules = [ "cpu" "memory" "battery" ]; + }; + "group/adjustable" = { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = true; + }; + modules = [ "pulseaudio" "mpris" ]; + }; + "custom/weather" = { + orientation = "horizontal"; + exec = ''curl wttr.in/?format="%l:%20%t"''; + interval = 10; + }; + cpu = { + interval = 10; + format = "{usage}%  "; + }; + memory = { + interval = 10; + format = "{percentage}%  "; + }; + # mpris = { + # format-playing = "  {title} "; + # format-paused = " 󰏤 {title} "; + # format-stopped = "Nothing Playing"; + # }; + tray = { spacing = 10; }; + clock = { format = "{:%a %b %d, %I:%M %p} "; }; + backlight = { + device = "intel_backlight"; + format = "{percent}% {icon}"; + format-icons = [ "󰃞" "󰃠" ]; + }; + battery = { + states = { + good = 95; + warning = 20; + critical = 10; + }; + format = "{capacity}% {icon}"; + format-icons = [ "󰁻" "󰁽" "󰁿" "󰂀" "󰁹" ]; + }; + "hyprland/window" = { format = "{class}"; }; + network = { + format-wifi = "{essid} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + pulseaudio = { + 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 = { default = [ "" "" "" ]; }; + }; + }; + }; + style = ./waybar.css; + systemd.enable = true; + }; +} diff --git a/users/youwen/linux/waybar/laptop/waybar.css b/users/youwen/linux/waybar/laptop/waybar.css new file mode 100755 index 0000000..0d7dbfc --- /dev/null +++ b/users/youwen/linux/waybar/laptop/waybar.css @@ -0,0 +1,101 @@ +* { + font-size: 10px; +} + +window#waybar { + border-bottom: 0px solid #ffffff; + background: transparent; + transition-property: none; + transition-duration: 0s; +} + +#workspaces { + background: #24273a; + padding: 0px 2px 0px 2px; + margin: 0px 0px 0px 5px; + border-radius: 5px; +} + +#workspaces { + background: #24273a; + padding: 0px 5px 0px 5px; + margin: 0px 0px 0px 5px; + border-radius: 5px; +} + +#workspaces button, +#workspaces button:hover { + padding: 0; + background-color: #24273a; + /* color: @color4; */ +} +#workspaces button.active, +#workspaces button:hover { + /* color: @color8; */ +} + +#clock, +#pulseaudio, +#network, +#battery, +#tray, +#mpris, +#cpu, +#memory, +#temperature, +#custom-weather, +#window, +#backlight { + background-color: #24273a; + /* color: @color4; */ + opacity: 1; + border-radius: 5px; + padding: 1px 10px 1px 10px; + margin: 0px 5px 0px 0px; +} +#backlight { + margin-right: 0px; + padding-right: 3px; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; +} +#mpris { + padding-left: 0px; + margin-left: 0px; + margin-right: 5px; + padding-right: 0px; +} +#pulseaudio { + padding-left: 5px; + padding-right: 5px; + margin-left: 0px; + margin-right: 5px; + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; +} +#memory, +#cpu { + padding-right: 2px; + /* border-top-right-radius: 0px; */ + /* border-bottom-right-radius: 0px; */ + /* border-right-width: 0px; */ +} +#memory, +#battery { + margin-left: 0px; + padding-left: 2px; + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; + border-left-width: 0px; +} +#battery { + padding-right: 13px; +} +#custom-weather { + margin-right: 0px; +} + +#window { + margin-right: 0px; + margin-left: 0px; +}