diff --git a/home/rice/niri/config.nix b/home/rice/niri/config.nix index 693c7375..e533f08b 100644 --- a/home/rice/niri/config.nix +++ b/home/rice/niri/config.nix @@ -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; @@ -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; diff --git a/home/rice/waybar/default.nix b/home/rice/waybar/default.nix index 2e7d4fcb..9d5345c7 100644 --- a/home/rice/waybar/default.nix +++ b/home/rice/waybar/default.nix @@ -1,6 +1,7 @@ { pkgs, lib, + theme, ... }: with lib; let @@ -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; @@ -54,26 +54,14 @@ 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 = '' {:%Y %B} {calendar}''; }; backlight = { - format = "{icon}"; + format = "{icon} {percent}%"; format-icons = ["" "" "" "" "" "" "" "" ""]; }; battery = { @@ -81,14 +69,14 @@ in { 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}%)"; @@ -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 = { diff --git a/home/rice/waybar/style.nix b/home/rice/waybar/style.nix index 42220acc..88d32139 100644 --- a/home/rice/waybar/style.nix +++ b/home/rice/waybar/style.nix @@ -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; } '' diff --git a/home/rice/waybar/waybar-wttr.py b/home/rice/waybar/waybar-wttr.py index a2821439..383e0491 100644 --- a/home/rice/waybar/waybar-wttr.py +++ b/home/rice/waybar/waybar-wttr.py @@ -97,7 +97,7 @@ def format_chances(hour): data["text"] = ( " " + WEATHER_CODES[weather["current_condition"][0]["weatherCode"]] - + "\n " + + " " + extrachar + weather["current_condition"][0]["FeelsLikeC"] + "°"