Sway : Add borders.

This commit is contained in:
Dmitry Voronin 2024-05-07 03:22:01 +03:00
parent c57798e085
commit 6b5d6a81db
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
13 changed files with 67 additions and 93 deletions

View file

@ -1,11 +1,14 @@
{ setting, ... }: { { setting, style, ... }: {
text = '' text = ''
// -*- mode: jsonc -*- // -*- mode: jsonc -*-
{ {
"layer": "top", // Waybar at top layer "layer": "top",
"position": "top", // Waybar position (top|bottom|left|right) "position": "top",
"height": 30, // Waybar height (to be removed for auto height) "height": 30,
"spacing": 4, // Gaps between modules (4px) "spacing": 4,
"margin-top": ${toString(style.window.gap)},
"margin-left": ${toString(style.window.gap)},
"margin-right": ${toString(style.window.gap)},
"mode": "dock", "mode": "dock",
// "exclusive": false, // "exclusive": false,
"start_hidden": true, "start_hidden": true,
@ -103,7 +106,8 @@
"hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input",
"format": "{temperatureC}°C", "format": "{temperatureC}°C",
"on-click": "foot -e bash -c btop", "on-click": "foot -e bash -c btop",
"on-click-right": "powersave toggle" "on-click-right": "powersave toggle",
"interval": 1
}, },
"custom/powersave": { "custom/powersave": {
"exec": "powersave waybar", "exec": "powersave waybar",

View file

@ -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;
}
'';
}

View file

@ -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;
}
'';
}

View file

@ -1,12 +0,0 @@
{ ... }: {
text = ''
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
'';
}

View file

@ -2,7 +2,16 @@
text = '' text = ''
window#waybar { window#waybar {
background-color: rgba(${style.color.bg-r},${style.color.bg-g},${style.color.bg-b},${toString(style.opacity.desktop)}); 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;
} }
''; '';
} }

View file

@ -2,11 +2,11 @@
text = '' text = ''
#workspaces button { #workspaces button {
padding: 0 4px; padding: 0 4px;
border-top: 2px solid transparent; border-top: ${toString(style.window.border)}px solid transparent;
} }
#workspaces button.focused { #workspaces button.focused {
border-top: 2px solid #${style.color.accent}; border-top: ${toString(style.window.border)}px solid #${style.color.accent};
} }
''; '';
} }

View file

@ -1,17 +1,16 @@
{ wallpaper, style, ... }: let { wallpaper, style, ... }: let
accent = style.color.accent; alpha = style.opacity.inactive.hex;
bg = style.color.bg.dark; accent = style.color.accent + alpha;
bg_alt = style.color.bg.regular; bg = style.color.bg.dark + alpha;
fg = style.color.fg.light; border = style.color.border + alpha;
fg_alt = style.color.fg.regular; fg = style.color.fg.light;
negative = style.color.negative;
in { in {
text = '' text = ''
output * bg ${wallpaper.path} fill output * bg ${wallpaper.path} fill
client.focused #${accent} #${accent} #${fg} #${accent} #${accent} client.focused "#${accent}" "#${bg}" "#${fg}" "#${accent}" "#${accent}"
client.focused_inactive #${bg_alt} #${bg_alt} #${fg} #${bg_alt} #${bg_alt} client.focused_inactive "#${border}" "#${bg}" "#${fg}" "#${border}" "#${border}"
client.unfocused #${bg_alt} #${bg_alt} #${fg_alt} #${bg_alt} #${bg_alt} client.unfocused "#${border}" "#${bg}" "#${fg}" "#${border}" "#${border}"
client.urgent #${bg_alt} #${negative} #${fg_alt} #${negative} #${negative} client.urgent "#${border}" "#${bg}" "#${fg}" "#${border}" "#${border}"
client.placeholder #${bg} #${bg} #${fg} #${bg} #${bg} client.placeholder "#${bg}" "#${bg}" "#${fg}" "#${bg}" "#${bg}"
''; '';
} }

View file

@ -1,4 +1,4 @@
{ key, setting, ... }: { { key, style, ... }: {
text = '' text = ''
# Toggle tiling. # Toggle tiling.
bindsym $mod+${key.sway.window.floating.toggle} floating toggle bindsym $mod+${key.sway.window.floating.toggle} floating toggle
@ -20,7 +20,7 @@
bindsym $mod+${key.sway.window.fullscreen} fullscreen bindsym $mod+${key.sway.window.fullscreen} fullscreen
# Dim inactive windows. # 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. # Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod. # Resize them with right mouse button + $mod.
@ -33,7 +33,7 @@
bindsym $mod+${key.action.close} kill bindsym $mod+${key.action.close} kill
# Add gaps. # Add gaps.
gaps inner ${toString(setting.sway.window.gap)} gaps inner ${toString(style.window.gap)}
# Launch everything tiled. # Launch everything tiled.
# for_window [all] floating disable # for_window [all] floating disable

View file

@ -1,8 +1,10 @@
{ ... }: { { style, ... }: let
borderSize = toString(style.window.border);
in {
text = '' text = ''
# Disable title bar. # Disable title bar.
default_border none default_border pixel ${borderSize}
default_floating_border none default_floating_border pixel ${borderSize}
titlebar_padding 1 titlebar_padding 1
titlebar_border_thickness 0 titlebar_border_thickness 0
''; '';

View file

@ -38,10 +38,6 @@
vertical = 10; vertical = 10;
horizontal = 10; horizontal = 10;
}; };
window = {
gap = 10;
opacity.inactive = 0.85;
};
}; };
foot = { foot = {

View file

@ -31,19 +31,28 @@ in {
accent-b = config.lib.stylix.colors.base0A-rgb-b; accent-b = config.lib.stylix.colors.base0A-rgb-b;
accent-g = config.lib.stylix.colors.base0A-rgb-g; accent-g = config.lib.stylix.colors.base0A-rgb-g;
accent-r = config.lib.stylix.colors.base0A-rgb-r; accent-r = config.lib.stylix.colors.base0A-rgb-r;
negative-b = config.lib.stylix.colors.base08-rgb-b; negative-b = config.lib.stylix.colors.base08-rgb-b;
negative-g = config.lib.stylix.colors.base08-rgb-g; negative-g = config.lib.stylix.colors.base08-rgb-g;
negative-r = config.lib.stylix.colors.base08-rgb-r; negative-r = config.lib.stylix.colors.base08-rgb-r;
neutral-b = config.lib.stylix.colors.base0C-rgb-b; neutral-b = config.lib.stylix.colors.base0C-rgb-b;
neutral-g = config.lib.stylix.colors.base0C-rgb-g; neutral-g = config.lib.stylix.colors.base0C-rgb-g;
neutral-r = config.lib.stylix.colors.base0C-rgb-r; neutral-r = config.lib.stylix.colors.base0C-rgb-r;
positive-b = config.lib.stylix.colors.base0B-rgb-b; positive-b = config.lib.stylix.colors.base0B-rgb-b;
positive-g = config.lib.stylix.colors.base0B-rgb-g; positive-g = config.lib.stylix.colors.base0B-rgb-g;
positive-r = config.lib.stylix.colors.base0B-rgb-r; positive-r = config.lib.stylix.colors.base0B-rgb-r;
bg-b = config.lib.stylix.colors.base00-rgb-b; bg-b = config.lib.stylix.colors.base00-rgb-b;
bg-g = config.lib.stylix.colors.base00-rgb-g; bg-g = config.lib.stylix.colors.base00-rgb-g;
bg-r = config.lib.stylix.colors.base00-rgb-r; 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-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-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; fg-r = if forceWhiteText then 255 else config.lib.stylix.colors.base06-rgb-r;
@ -67,5 +76,14 @@ in {
desktop = config.stylix.opacity.desktop; desktop = config.stylix.opacity.desktop;
popup = config.stylix.opacity.popups; popup = config.stylix.opacity.popups;
terminal = config.stylix.opacity.terminal; terminal = config.stylix.opacity.terminal;
inactive = {
int = 0.85;
hex = "D9";
};
};
window = {
gap = 8;
border = 4;
}; };
} }

View file

@ -20,18 +20,27 @@
base0A-rgb-b = "38"; base0A-rgb-b = "38";
base0A-rgb-g = "187"; base0A-rgb-g = "187";
base0A-rgb-r = "184"; base0A-rgb-r = "184";
base08-rgb-b = "29"; base08-rgb-b = "29";
base08-rgb-g = "36"; base08-rgb-g = "36";
base08-rgb-r = "204"; base08-rgb-r = "204";
base0C-rgb-b = "136"; base0C-rgb-b = "136";
base0C-rgb-g = "133"; base0C-rgb-g = "133";
base0C-rgb-r = "69"; base0C-rgb-r = "69";
base0B-rgb-b = "135"; base0B-rgb-b = "135";
base0B-rgb-g = "175"; base0B-rgb-g = "175";
base0B-rgb-r = "135"; base0B-rgb-r = "135";
base00-rgb-b = "33"; base00-rgb-b = "33";
base00-rgb-g = "32"; base00-rgb-g = "32";
base00-rgb-r = "29"; base00-rgb-r = "29";
base01-rgb-b = "54";
base01-rgb-g = "56";
base01-rgb-r = "60";
base06-rgb-b = "199"; base06-rgb-b = "199";
base06-rgb-g = "241"; base06-rgb-g = "241";
base06-rgb-r = "251"; base06-rgb-r = "251";