From 1bf2b400c7e9b56d9320f61faf9d4db87a787508 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Thu, 15 Aug 2024 18:20:06 -0500 Subject: [PATCH] waybar updates --- .../desktop/hyprland/config/hypr/default.nix | 6 ++ .../hyprland/config/waybar/default.nix | 82 ++++++++++++++----- .../config/waybar/scripts/waybar-wttr.py | 14 ++-- hosts/desktop/hyprland/default.nix | 8 ++ 4 files changed, 84 insertions(+), 26 deletions(-) diff --git a/hosts/desktop/hyprland/config/hypr/default.nix b/hosts/desktop/hyprland/config/hypr/default.nix index a1cf8c8..98e786a 100644 --- a/hosts/desktop/hyprland/config/hypr/default.nix +++ b/hosts/desktop/hyprland/config/hypr/default.nix @@ -30,6 +30,10 @@ "$mainMod SHIFT, Q, exec, hyprlock" ", PRINT, exec, hyprshot -m region --clipboard-only" + # alt-tab between workspaces on active monitor + "ALT, Tab, workspace, m+1" + "ALT SHIFT, Tab, workspace, m-1" + "$mainMod, h, movefocus, l" "$mainMod, l, movefocus, r" "$mainMod, k, movefocus, u" @@ -193,6 +197,8 @@ kb_options = ""; kb_rules = ""; + numlock_by_default = true; + follow_mouse = 1; touchpad = { diff --git a/hosts/desktop/hyprland/config/waybar/default.nix b/hosts/desktop/hyprland/config/waybar/default.nix index 8fb8a53..391f91f 100644 --- a/hosts/desktop/hyprland/config/waybar/default.nix +++ b/hosts/desktop/hyprland/config/waybar/default.nix @@ -21,10 +21,12 @@ modules-right = [ "tray" - "custom/updates" - "hyprland/language" + # "custom/updates" + "keyboard-state#capslock" + "keyboard-state#numlock" "pulseaudio" "pulseaudio#microphone" + "network" "clock" "custom/weather" ]; @@ -42,11 +44,6 @@ }; }; - "hyprland/language" = { - format = {}; - format-en = "US"; - }; - "custom/weather" = { tooltip = true; format = {}; @@ -62,7 +59,7 @@ clock = { format = "{:%I:%M %p}"; - tooltip-format = "{ =%Y %B}\n{calendar}"; + tooltip-format = "{:%Y %B}\n{calendar}"; }; pulseaudio = { @@ -93,9 +90,41 @@ on-scroll-down = "pamixer --default-source -d 5"; scroll-step = 5; }; + + network = { + interface = "wlp9s0"; + format = "{ifname}"; + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ifname} "; + format-disconnected = ""; # An empty format will hide the module. + tooltip-format = "{ifname}"; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; + }; + + "keyboard-state#capslock" = { + capslock = true; + format = "{name} {icon}"; + format-icons = { + locked = ""; + unlocked = ""; + }; + }; + + "keyboard-state#numlock" = { + numlock = true; + format = "{name} {icon}"; + format-icons = { + locked = ""; + unlocked = ""; + }; + }; }; }; + # https://catppuccin.com/palette style = '' * { border: none; @@ -149,7 +178,6 @@ border-radius: 10px; } - #language, #custom-updates, #custom-caffeine, #custom-weather, @@ -159,6 +187,8 @@ #pulseaudio, #network, #workspaces, + #keyboard-state.numlock, + #keyboard-state.capslock, #tray, #backlight { background: #1e1e2e; @@ -188,12 +218,6 @@ margin-left: 10px; } - #custom-language { - color: #f38ba8; - border-left: 0px; - border-right: 0px; - } - #custom-updates { color: #f5c2e7; border-radius: 10px 0px 0px 10px; @@ -208,30 +232,46 @@ } #clock { - color: #fab387; + color: #f5a97f; border-radius: 10px 0px 0px 10px; margin-left: 5px; border-right: 0px; } - #network { - color: #f9e2af; + #keyboard-state.capslock { + color: #91d7e3; + border-left: 0px; + border-right: 0px; + border-radius: 10px 0px 0px 10px; + } + + #keyboard-state.numlock { + color: #7dc4e4; border-left: 0px; border-right: 0px; } + #network { + color: #eed49f; + border-left: 0px; + border-right: 0px; + border-radius: 10px 10px 10px 10px; + margin-left: 5px; + padding-right: 15px; + } + #pulseaudio { - color: #89b4fa; + color: #8aadf4; border-left: 0px; border-right: 0px; } #pulseaudio.microphone { - color: #cba6f7; + color: #c6a0f6; border-radius: 0px 10px 10px 0px; border-left: 0px; border-right: 0px; - margin-right: 5px; + padding-top: 5px; } #battery { diff --git a/hosts/desktop/hyprland/config/waybar/scripts/waybar-wttr.py b/hosts/desktop/hyprland/config/waybar/scripts/waybar-wttr.py index e23f357..a6a87a1 100755 --- a/hosts/desktop/hyprland/config/waybar/scripts/waybar-wttr.py +++ b/hosts/desktop/hyprland/config/waybar/scripts/waybar-wttr.py @@ -63,6 +63,9 @@ weather = requests.get("https://wttr.in/?format=j1").json() def format_time(time): + return datetime.strptime(format_24_time(time), "%H").strftime("%I %p") + +def format_24_time(time): return time.replace("00", "").zfill(2) @@ -105,10 +108,10 @@ data["text"] = ( ) data["tooltip"] = ( - f"{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°\n" + f"{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_F']}°\n" ) data["tooltip"] += f"Feels like: {weather['current_condition'][0]['FeelsLikeF']}°\n" -data["tooltip"] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n" +data["tooltip"] += f"Wind: {weather['current_condition'][0]['windspeedMiles']}mph\n" data["tooltip"] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n" for i, day in enumerate(weather["weather"]): data["tooltip"] += f"\n" @@ -116,14 +119,15 @@ for i, day in enumerate(weather["weather"]): data["tooltip"] += "Today, " if i == 1: data["tooltip"] += "Tomorrow, " - data["tooltip"] += f"{day['date']}\n" + date = datetime.strptime(day['date'], "%Y-%m-%d").strftime("%a %b %d %Y") + data["tooltip"] += f"{date}\n" data["tooltip"] += f"⬆️ {day['maxtempF']}° ⬇️ {day['mintempF']}° " data[ "tooltip" - ] += f"🌅 {day['astronomy'][0]['sunrise']} 🌇 {day['astronomy'][0]['sunset']}\n" + ] += f"☀️ {day['astronomy'][0]['sunrise']} 🌕 {day['astronomy'][0]['sunset']}\n" for hour in day["hourly"]: if i == 0: - if int(format_time(hour["time"])) < datetime.now().hour - 2: + if int(format_24_time(hour["time"])) < datetime.now().hour - 2: continue data[ "tooltip" diff --git a/hosts/desktop/hyprland/default.nix b/hosts/desktop/hyprland/default.nix index b27ab5d..4a5e9ae 100644 --- a/hosts/desktop/hyprland/default.nix +++ b/hosts/desktop/hyprland/default.nix @@ -71,10 +71,18 @@ }; fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-color-emoji nerdfonts meslo-lgs-nf ]; + fonts.fontconfig.defaultFonts = { + emoji = [ + "Noto Color Emoji" + ]; + }; + nixpkgs.overlays = [ (self: super: { waybar = super.waybar.overrideAttrs (oldAttrs: {