From bbff5d6535689add2e9ac0549a96261fcda30215 Mon Sep 17 00:00:00 2001 From: winston Date: Wed, 8 Nov 2023 13:35:49 +0100 Subject: [PATCH] feat(sway): waybar -> i3status-rs (again) --- home/apps/rice.nix | 188 ++++++++++++++++----------------------------- home/apps/sway.nix | 59 +++++++------- 2 files changed, 93 insertions(+), 154 deletions(-) diff --git a/home/apps/rice.nix b/home/apps/rice.nix index 00249fb..7d7b489 100644 --- a/home/apps/rice.nix +++ b/home/apps/rice.nix @@ -1,133 +1,75 @@ { - config, lib, pkgs, ... }: let inherit (pkgs.stdenv.hostPlatform) isLinux; -in { - home.packages = lib.mkIf isLinux [pkgs.playerctl]; - - programs.waybar = lib.mkIf isLinux { - enable = true; - settings = [ - { - bar_id = "bar-0"; - ipc = true; - layer = "top"; - position = "top"; - margin-left = 7; - margin-right = 7; - margin-top = 7; - height = 32; - modules-left = ["sway/workspaces" "sway/mode"]; - modules-center = ["mpris"]; - modules-right = ["tray" "pulseaudio" "clock" "custom/notification"]; - "sway/workspaces" = { - disable-scroll = true; - format = "{name}"; - }; - "sway/mode" = { - format = "{}"; - }; - "custom/notification" = { - tooltip = false; - 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; - }; - - pulseaudio = { - format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}% 󰂯 "; - format-muted = "󰝟 "; - format-icons = { - headphone = "󰋋 "; - hands-free = "󰋎 "; - headset = "󰋎 "; - phone = " "; - portable = " "; - car = " "; - default = ["󰕿 " "󰖀 " "󰕾 "]; - }; - on-click = "pavucontrol"; - }; - mpris = { - format = "{dynamic}"; - format-paused = ""; - interval = 10; - }; - tray = { - reverse-direction = true; - spacing = 5; - }; - spacing = 4; - } - ]; - style = '' - @define-color red #f38ba8; - @define-color mauve #cba6f7; - @define-color pink #f5c2e7; - @define-color crust #11111c; - @define-color base #1e1e2e; - @define-color text #cdd6f4; - - * { - font-family: IBM Plex Sans; - font-size: 16px; - } - - window#waybar { - background-color: @base; - border: 2px solid @crust; - border-radius: 5px; - color: @text; - } - - #workspaces button { - padding: 0 5px; - color: alpha(@mauve, 0.5); - } - - #workspaces button.focused { - color: @pink; - } - - #workspaces button.urgent { - color: @crust; - background-color: @red; - } - - #clock, - #mpris, - #pulseaudio, - #tray { - padding: 0 5px; - } - ''; + ctp = { + base = "#1e1e2e"; + crust = "#11111b"; + text = "#cdd6f4"; + pink = "#f5c2e7"; + red = "#f38ba8"; + mauve = "#cba6f7"; + }; +in { + programs.i3status-rust = lib.mkIf isLinux { + enable = true; + bars.top = { + blocks = [ + { + block = "vpn"; + driver = "mullvad"; + format_connected = ""; + format_disconnected = ""; + state_connected = "good"; + state_disconnected = "critical"; + } + { + block = "tea_timer"; + done_cmd = "notify-send 'Timer Finished'"; + } + { + block = "time"; + interval = 60; + format = " $timestamp.datetime(f:'%d/%m %R') "; + } + { + block = "notify"; + format = " $icon {($notification_count.eng(w:1)) |}"; + driver = "swaync"; + click = [ + { + button = "left"; + action = "show"; + } + { + button = "right"; + action = "toggle_paused"; + } + ]; + } + ]; + settings = { + icons.icons = "material-nf"; + theme.overrides = { + idle_fg = ctp.text; + idle_bg = "#00000000"; + info_fg = "#89b4fa"; + info_bg = "#00000000"; + good_fg = "#a6e3a1"; + good_bg = "#00000000"; + warning_fg = "#fab387"; + warning_bg = "#00000000"; + critical_fg = "#f38ba8"; + critical_bg = "#00000000"; + separator = " "; + separator_bg = "auto"; + separator_fg = "auto"; + }; + }; + }; }; - - wayland.windowManager.sway.config.bars = [ - { - position = "top"; - command = "${config.programs.waybar.package}/bin/waybar"; - mode = "hide"; - } - ]; programs.rofi = lib.mkIf isLinux { enable = true; diff --git a/home/apps/sway.nix b/home/apps/sway.nix index 1a9df57..575fbdb 100644 --- a/home/apps/sway.nix +++ b/home/apps/sway.nix @@ -164,27 +164,27 @@ in { "${mod}+m" = "[class=\"discord\"] scratchpad show"; # switch to workspace - "${modFocus}+1" = "workspace $ws1"; - "${modFocus}+2" = "workspace $ws2"; - "${modFocus}+3" = "workspace $ws3"; - "${modFocus}+4" = "workspace $ws4"; - "${modFocus}+5" = "workspace $ws5"; - "${modFocus}+6" = "workspace $ws6"; - "${modFocus}+7" = "workspace $ws7"; - "${modFocus}+8" = "workspace $ws8"; - "${modFocus}+9" = "workspace $ws9"; - "${modFocus}+0" = "workspace $ws10"; + "${modFocus}+1" = "workspace 1"; + "${modFocus}+2" = "workspace 2"; + "${modFocus}+3" = "workspace 3"; + "${modFocus}+4" = "workspace 4"; + "${modFocus}+5" = "workspace 5"; + "${modFocus}+6" = "workspace 6"; + "${modFocus}+7" = "workspace 7"; + "${modFocus}+8" = "workspace 8"; + "${modFocus}+9" = "workspace 9"; + "${modFocus}+0" = "workspace 10"; # Move to workspace with focused container - "${modMove}+1" = "move container to workspace $ws1; workspace $ws1"; - "${modMove}+2" = "move container to workspace $ws2; workspace $ws2"; - "${modMove}+3" = "move container to workspace $ws3; workspace $ws3"; - "${modMove}+4" = "move container to workspace $ws4; workspace $ws4"; - "${modMove}+5" = "move container to workspace $ws5; workspace $ws5"; - "${modMove}+6" = "move container to workspace $ws6; workspace $ws6"; - "${modMove}+7" = "move container to workspace $ws7; workspace $ws7"; - "${modMove}+8" = "move container to workspace $ws8; workspace $ws8"; - "${modMove}+9" = "move container to workspace $ws9; workspace $ws9"; - "${modMove}+0" = "move container to workspace $ws10; workspace $ws10"; + "${modMove}+1" = "move container to workspace 1; workspace 1"; + "${modMove}+2" = "move container to workspace 2; workspace 2"; + "${modMove}+3" = "move container to workspace 3; workspace 3"; + "${modMove}+4" = "move container to workspace 4; workspace 4"; + "${modMove}+5" = "move container to workspace 5; workspace 5"; + "${modMove}+6" = "move container to workspace 6; workspace 6"; + "${modMove}+7" = "move container to workspace 7; workspace 7"; + "${modMove}+8" = "move container to workspace 8; workspace 8"; + "${modMove}+9" = "move container to workspace 9; workspace 9"; + "${modMove}+0" = "move container to workspace 10; workspace 10"; # rofi instead of drun "${mod}+space" = "exec --no-startup-id ${menu} -show drun -dpi $dpi"; # 1password @@ -258,20 +258,17 @@ in { inner = 5; outer = 2; }; + bars = [ + { + inherit fonts; + mode = "hide"; + position = "top"; + statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs ~/.config/i3status-rust/config-top.toml"; + } + ]; }; extraConfig = '' - set $ws1 1:Ⅰ - set $ws2 2:Ⅱ - set $ws3 3:Ⅲ - set $ws4 4:Ⅳ - set $ws5 5:Ⅴ - set $ws6 6:Ⅵ - set $ws7 7:Ⅶ - set $ws8 8:Ⅷ - set $ws9 9:Ⅸ - set $ws10 10:Ⅹ - for_window [floating] border pixel 2 # floating sticky