diff --git a/module/desktop/waybar/config/default.nix b/module/desktop/waybar/config/default.nix index 22f20c4..2e6e5c8 100644 --- a/module/desktop/waybar/config/default.nix +++ b/module/desktop/waybar/config/default.nix @@ -1,11 +1,14 @@ -{ setting, ... }: { +{ setting, style, ... }: { text = '' // -*- mode: jsonc -*- { - "layer": "top", // Waybar at top layer - "position": "top", // Waybar position (top|bottom|left|right) - "height": 30, // Waybar height (to be removed for auto height) - "spacing": 4, // Gaps between modules (4px) + "layer": "top", + "position": "top", + "height": 30, + "spacing": 4, + "margin-top": ${toString(style.window.gap)}, + "margin-left": ${toString(style.window.gap)}, + "margin-right": ${toString(style.window.gap)}, "mode": "dock", // "exclusive": false, "start_hidden": true, @@ -103,7 +106,8 @@ "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input", "format": "{temperatureC}°C", "on-click": "foot -e bash -c btop", - "on-click-right": "powersave toggle" + "on-click-right": "powersave toggle", + "interval": 1 }, "custom/powersave": { "exec": "powersave waybar", diff --git a/module/desktop/waybar/style/Default.nix b/module/desktop/waybar/style/Font.nix similarity index 100% rename from module/desktop/waybar/style/Default.nix rename to module/desktop/waybar/style/Font.nix diff --git a/module/desktop/waybar/style/Margin.nix b/module/desktop/waybar/style/Margin.nix deleted file mode 100644 index 3bb243c..0000000 --- a/module/desktop/waybar/style/Margin.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ ... }: { - text = '' - #window, - #workspaces { - margin: 0 4px; - } - - /* If workspaces is the leftmost module, omit left margin */ - .modules-left > widget:first-child > #workspaces { - margin-left: 0; - } - - /* If workspaces is the rightmost module, omit right margin */ - .modules-right > widget:last-child > #workspaces { - margin-right: 0; - } - ''; -} diff --git a/module/desktop/waybar/style/Power.nix b/module/desktop/waybar/style/Power.nix deleted file mode 100644 index 0f2d69a..0000000 --- a/module/desktop/waybar/style/Power.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ ... }: { - text = '' - /* Using steps() instead of linear as a timing function to limit cpu usage */ - #battery.critical:not(.charging) { - background-color: #f53c3c; - color: #ffffff; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: steps(12); - animation-iteration-count: infinite; - animation-direction: alternate; - } - - #power-profiles-daemon { - padding-right: 15px; - } - - #power-profiles-daemon.performance { - background-color: #f53c3c; - color: #ffffff; - } - - #power-profiles-daemon.balanced { - background-color: #2980b9; - color: #ffffff; - } - - #power-profiles-daemon.power-saver { - background-color: #2ecc71; - color: #000000; - } - ''; -} diff --git a/module/desktop/waybar/style/Tray.nix b/module/desktop/waybar/style/Tray.nix deleted file mode 100644 index 2dd1a7d..0000000 --- a/module/desktop/waybar/style/Tray.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: { - text = '' - #tray > .passive { - -gtk-icon-effect: dim; - } - - #tray > .needs-attention { - -gtk-icon-effect: highlight; - background-color: #eb4d4b; - } - ''; -} diff --git a/module/desktop/waybar/style/Window.nix b/module/desktop/waybar/style/Window.nix index 4b848a5..4f0b220 100644 --- a/module/desktop/waybar/style/Window.nix +++ b/module/desktop/waybar/style/Window.nix @@ -2,7 +2,16 @@ text = '' window#waybar { background-color: rgba(${style.color.bg-r},${style.color.bg-g},${style.color.bg-b},${toString(style.opacity.desktop)}); - color: #${style.color.fg.light} + color: #${style.color.fg.light}; + border: ${toString(style.window.border)}px solid rgba(${style.color.border-r},${style.color.border-g},${style.color.border-b},${toString(style.opacity.desktop)}); + } + + .modules-left > widget:first-child > #workspaces { + margin-left: ${toString(style.window.border)}px; + } + + .modules-right > widget:last-child > #workspaces { + margin-right: ${toString(style.window.border)}px; } ''; } diff --git a/module/desktop/waybar/style/Workspace.nix b/module/desktop/waybar/style/Workspace.nix index 4c66fdb..5f715eb 100644 --- a/module/desktop/waybar/style/Workspace.nix +++ b/module/desktop/waybar/style/Workspace.nix @@ -2,11 +2,11 @@ text = '' #workspaces button { padding: 0 4px; - border-top: 2px solid transparent; + border-top: ${toString(style.window.border)}px solid transparent; } #workspaces button.focused { - border-top: 2px solid #${style.color.accent}; + border-top: ${toString(style.window.border)}px solid #${style.color.accent}; } ''; } diff --git a/module/sway/module/Style.nix b/module/sway/module/Style.nix index 8fa9cfe..c448e43 100644 --- a/module/sway/module/Style.nix +++ b/module/sway/module/Style.nix @@ -1,17 +1,16 @@ { wallpaper, style, ... }: let - accent = style.color.accent; - bg = style.color.bg.dark; - bg_alt = style.color.bg.regular; - fg = style.color.fg.light; - fg_alt = style.color.fg.regular; - negative = style.color.negative; + alpha = style.opacity.inactive.hex; + accent = style.color.accent + alpha; + bg = style.color.bg.dark + alpha; + border = style.color.border + alpha; + fg = style.color.fg.light; in { text = '' output * bg ${wallpaper.path} fill - client.focused #${accent} #${accent} #${fg} #${accent} #${accent} - client.focused_inactive #${bg_alt} #${bg_alt} #${fg} #${bg_alt} #${bg_alt} - client.unfocused #${bg_alt} #${bg_alt} #${fg_alt} #${bg_alt} #${bg_alt} - client.urgent #${bg_alt} #${negative} #${fg_alt} #${negative} #${negative} - client.placeholder #${bg} #${bg} #${fg} #${bg} #${bg} + client.focused "#${accent}" "#${bg}" "#${fg}" "#${accent}" "#${accent}" + client.focused_inactive "#${border}" "#${bg}" "#${fg}" "#${border}" "#${border}" + client.unfocused "#${border}" "#${bg}" "#${fg}" "#${border}" "#${border}" + client.urgent "#${border}" "#${bg}" "#${fg}" "#${border}" "#${border}" + client.placeholder "#${bg}" "#${bg}" "#${fg}" "#${bg}" "#${bg}" ''; } diff --git a/module/sway/module/Tiling.nix b/module/sway/module/Tiling.nix index 79dd8ca..a0a22d4 100644 --- a/module/sway/module/Tiling.nix +++ b/module/sway/module/Tiling.nix @@ -1,4 +1,4 @@ -{ key, setting, ... }: { +{ key, style, ... }: { text = '' # Toggle tiling. bindsym $mod+${key.sway.window.floating.toggle} floating toggle @@ -20,7 +20,7 @@ bindsym $mod+${key.sway.window.fullscreen} fullscreen # Dim inactive windows. - exec $SWAY_IWT_PATH --opacity ${toString(setting.sway.window.opacity.inactive)} + exec $SWAY_IWT_PATH --opacity ${toString(style.opacity.inactive.int)} # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. @@ -33,7 +33,7 @@ bindsym $mod+${key.action.close} kill # Add gaps. - gaps inner ${toString(setting.sway.window.gap)} + gaps inner ${toString(style.window.gap)} # Launch everything tiled. # for_window [all] floating disable diff --git a/module/sway/module/TitleBar.nix b/module/sway/module/TitleBar.nix index 6cb1d96..a9dae98 100644 --- a/module/sway/module/TitleBar.nix +++ b/module/sway/module/TitleBar.nix @@ -1,8 +1,10 @@ -{ ... }: { +{ style, ... }: let + borderSize = toString(style.window.border); +in { text = '' # Disable title bar. - default_border none - default_floating_border none + default_border pixel ${borderSize} + default_floating_border pixel ${borderSize} titlebar_padding 1 titlebar_border_thickness 0 ''; diff --git a/part/Setting.nix b/part/Setting.nix index d28e1dc..9a1bd90 100644 --- a/part/Setting.nix +++ b/part/Setting.nix @@ -38,10 +38,6 @@ vertical = 10; horizontal = 10; }; - window = { - gap = 10; - opacity.inactive = 0.85; - }; }; foot = { diff --git a/part/Style.nix b/part/Style.nix index 90f75d2..0a5ad54 100644 --- a/part/Style.nix +++ b/part/Style.nix @@ -31,19 +31,28 @@ in { accent-b = config.lib.stylix.colors.base0A-rgb-b; accent-g = config.lib.stylix.colors.base0A-rgb-g; accent-r = config.lib.stylix.colors.base0A-rgb-r; + negative-b = config.lib.stylix.colors.base08-rgb-b; negative-g = config.lib.stylix.colors.base08-rgb-g; negative-r = config.lib.stylix.colors.base08-rgb-r; + neutral-b = config.lib.stylix.colors.base0C-rgb-b; neutral-g = config.lib.stylix.colors.base0C-rgb-g; neutral-r = config.lib.stylix.colors.base0C-rgb-r; + positive-b = config.lib.stylix.colors.base0B-rgb-b; positive-g = config.lib.stylix.colors.base0B-rgb-g; positive-r = config.lib.stylix.colors.base0B-rgb-r; + bg-b = config.lib.stylix.colors.base00-rgb-b; bg-g = config.lib.stylix.colors.base00-rgb-g; bg-r = config.lib.stylix.colors.base00-rgb-r; + border = config.lib.stylix.colors.base01; + border-b = config.lib.stylix.colors.base01-rgb-b; + border-g = config.lib.stylix.colors.base01-rgb-g; + border-r = config.lib.stylix.colors.base01-rgb-r; + fg-b = if forceWhiteText then 255 else config.lib.stylix.colors.base06-rgb-b; fg-g = if forceWhiteText then 255 else config.lib.stylix.colors.base06-rgb-g; fg-r = if forceWhiteText then 255 else config.lib.stylix.colors.base06-rgb-r; @@ -67,5 +76,14 @@ in { desktop = config.stylix.opacity.desktop; popup = config.stylix.opacity.popups; terminal = config.stylix.opacity.terminal; + inactive = { + int = 0.85; + hex = "D9"; + }; + }; + + window = { + gap = 8; + border = 4; }; } diff --git a/part/style/Gruvbox.nix b/part/style/Gruvbox.nix index d88cab7..d9918c0 100644 --- a/part/style/Gruvbox.nix +++ b/part/style/Gruvbox.nix @@ -20,18 +20,27 @@ base0A-rgb-b = "38"; base0A-rgb-g = "187"; base0A-rgb-r = "184"; + base08-rgb-b = "29"; base08-rgb-g = "36"; base08-rgb-r = "204"; + base0C-rgb-b = "136"; base0C-rgb-g = "133"; base0C-rgb-r = "69"; + base0B-rgb-b = "135"; base0B-rgb-g = "175"; base0B-rgb-r = "135"; + base00-rgb-b = "33"; base00-rgb-g = "32"; base00-rgb-r = "29"; + + base01-rgb-b = "54"; + base01-rgb-g = "56"; + base01-rgb-r = "60"; + base06-rgb-b = "199"; base06-rgb-g = "241"; base06-rgb-r = "251";