sway: simplify waybar

This commit is contained in:
Marco Thomas
2022-08-01 23:48:02 +02:00
parent 23cfca2f10
commit c776fc1589
3 changed files with 65 additions and 82 deletions

View File

@@ -63,11 +63,12 @@ exec_always echo $lock > ~/.local/bin/lock.sh
exec_always chmod +x ~/.local/bin/lock.sh exec_always chmod +x ~/.local/bin/lock.sh
# Lock after 20 minutes # Lock after 20 minutes
# Suspend after 22 minutes # Lock before suspend
exec swayidle -w \ exec swayidle -w \
timeout 1200 ~/.local/bin/lock.sh \ timeout 1200 ~/.local/bin/lock.sh \
timeout 1320 'systemctl suspend' \
before-sleep ~/.local/bin/lock.sh before-sleep ~/.local/bin/lock.sh
#timeout 1320 'systemctl suspend' \
# Input configuration # Input configuration
input type:pointer { input type:pointer {
@@ -228,8 +229,6 @@ input type:keyboard {
# Status Bar # Status Bar
bar { bar {
position top
tray_output none
swaybar_command waybar swaybar_command waybar
} }
@@ -237,8 +236,6 @@ bar {
exec syncthing exec syncthing
exec swaync exec swaync
exec fcitx5 exec fcitx5
exec nm-applet --indicator
exec blueman-applet
# Include some defaults # Include some defaults
include /etc/sway/config.d/* include /etc/sway/config.d/*

View File

@@ -1,16 +1,4 @@
// =============================================================================
//
// Waybar configuration
//
// Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
//
// =============================================================================
{ {
// -------------------------------------------------------------------------
// Global configuration
// -------------------------------------------------------------------------
"layer": "bottom", "layer": "bottom",
"position": "left", "position": "left",
@@ -21,19 +9,13 @@
"modules-center": [ "modules-center": [
], ],
"modules-right": [ "modules-right": [
"backlight",
"battery", "battery",
"pulseaudio",
"clock#date",
"clock#time", "clock#time",
"idle_inhibitor", "clock#date"
"tray"
], ],
// ------------------------------------------------------------------------- // MODULES
// Modules
// -------------------------------------------------------------------------
"idle_inhibitor": { "idle_inhibitor": {
"format": "{icon}", "format": "{icon}",
@@ -46,22 +28,20 @@
"backlight": { "backlight": {
// "device": "acpi_video1", // "device": "acpi_video1",
//"format": "{icon} {percent}%", //"format": "{icon} {percent}%",
"format": "BRT\n{percent}%", "format": "{percent}",
"format-icons": ["", "", "", "", "", "", "", "", ""] "format-icons": ["", "", "", "", "", "", "", "", ""]
}, },
"battery": { "battery": {
"interval": 10, "interval": 5,
"states": { "states": {
"good": 100,
"ok": 50,
"warning": 30, "warning": 30,
"critical": 15 "critical": 15
}, },
// Connected to AC "format": "{capacity} ",
//"format": "{capacity}%", // Icon: bolt "format-discharging": "{capacity}",
"format": "CHR\n{capacity}%", // Icon: bolt
// Not connected to AC
//"format-discharging": "{icon} {capacity}%",
"format-discharging": "BAT\n{capacity}%",
"format-icons": [ "format-icons": [
"", // Icon: battery-full "", // Icon: battery-full
"", // Icon: battery-three-quarters "", // Icon: battery-three-quarters
@@ -80,7 +60,7 @@
"clock#date": { "clock#date": {
"interval": 10, "interval": 10,
"format": "{:%a\n%e}", "format": "{:%a, %e}",
"tooltip-format": "{:%A, %e %B %Y}" "tooltip-format": "{:%A, %e %B %Y}"
}, },
@@ -93,16 +73,6 @@
} }
}, },
"custom/keyboard-layout": {
"exec": "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4",
// Interval set only as a fallback, as the value is updated by signal
"interval": 30,
"format": " {}", // Icon: keyboard
// Signal sent by Sway key binding (~/.config/sway/key-bindings)
"signal": 1, // SIGHUP
"tooltip": false
},
"memory": { "memory": {
"interval": 5, "interval": 5,
"format": " {percentage}% ({used:0.1f})", // Icon: memory "format": " {percentage}% ({used:0.1f})", // Icon: memory
@@ -150,10 +120,10 @@
"pulseaudio": { "pulseaudio": {
//"scroll-step": 1, //"scroll-step": 1,
//"format": "{icon} {volume}%", //"format": "{icon} {volume}%",
"format": "VOL\n{volume}%", //"format": "{volume}%",
//"format-bluetooth": "{icon} {volume}% ", //"format-bluetooth": "{icon} {volume}% ",
"format-bluetooth": "BLT\n{volume}% ", "format-bluetooth": "{volume}% ",
"format-muted": "MUT\n 0%", "format-muted": "Mute",
"format-icons": { "format-icons": {
"headphones": "", "headphones": "",
"handsfree": "", "handsfree": "",

View File

@@ -1,14 +1,15 @@
/* ============================================================================= /*
* * Colors
* Waybar configuration */
*
* Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
*
* =========================================================================== */
/* ----------------------------------------------------------------------------- @define-color bg rgb (50, 50, 50);
* Keyframes @define-color green rgb (147, 178, 89);
* -------------------------------------------------------------------------- */ @define-color red rgb (248, 85, 81);
@define-color blue rgb (58, 148, 197);
/*
* Keyframe functions
*/
@keyframes blink-warning { @keyframes blink-warning {
70% { 70% {
@@ -32,10 +33,9 @@
} }
} }
/*
/* ----------------------------------------------------------------------------- * Base config
* Base styles */
* -------------------------------------------------------------------------- */
/* Reset all styles */ /* Reset all styles */
* { * {
@@ -48,13 +48,13 @@
/* The whole bar */ /* The whole bar */
#waybar { #waybar {
background: #323232; background: @bg;
color: white; color: white;
font-family: SFMono Nerd Font; font-family: SFMono Nerd Font;
font-size: 13px; font-size: 13px;
} }
/* Each module */ /* All modules */
#idle_inhibitor, #idle_inhibitor,
#battery, #battery,
#backlight, #backlight,
@@ -69,16 +69,16 @@
#window, #window,
#workspaces button, #workspaces button,
#tray { #tray {
border-radius: 5px;
background-color: #282828;
margin: 5px;
padding: 10px padding: 10px
} }
/*
* Modules
*/
/* ----------------------------------------------------------------------------- #workspaces {
* Module styles font-size: 14px;
* -------------------------------------------------------------------------- */ }
#battery { #battery {
animation-timing-function: linear; animation-timing-function: linear;
@@ -86,6 +86,14 @@
animation-direction: alternate; animation-direction: alternate;
} }
#battery.good {
color: @green;
}
#battery.ok{
color: yellow;
}
#battery.warning { #battery.warning {
color: orange; color: orange;
} }
@@ -104,8 +112,16 @@
animation-duration: 2s; animation-duration: 2s;
} }
#clock { #battery.charging {
/*font-weight: bold; */ }
#clock.date {
font-size: 9px;
}
#clock.time {
font-size: 14px;
font-weight: bold;
} }
#cpu { #cpu {
@@ -177,17 +193,12 @@
} }
#workspaces button.focused { #workspaces button.focused {
background-color: #93b259; border-left: 2px solid @green;
color: #282828; color: #ffffff;
border-bottom: none;
} }
#workspaces button.urgent { #workspaces button.urgent {
background-color: #f85551; border-left: 2px solid @red;
}
#workspaces button.urgent:hover {
background-color: #ff5569;
} }
/* remove weird GTK hover effect */ /* remove weird GTK hover effect */
@@ -199,6 +210,11 @@
} }
#workspaces button.focused:hover { #workspaces button.focused:hover {
background: #a1b259; border-left: 2px solid @green;
border: #a1b259; background: #383838;
}
#workspaces button.urgent:hover {
border-left: 2px solid @red;
background: #383838;
} }