From b83ae8f2c02c5b02e7519afbf1aacf0cfff32f55 Mon Sep 17 00:00:00 2001 From: Stefan Ellmauthaler Date: Wed, 17 Aug 2022 14:27:33 +0200 Subject: [PATCH] Fix waybar error in config, update styles, mako and sway * swayconfig keybindings for special multimedia keys * waybar base stylefile + basic modules * mako timeout, so notifications are not hovering there all the time --- users/ellmau/conf/waybar/style.css | 313 +++++++++++++++++++++++++++++ users/ellmau/mako.nix | 4 +- users/ellmau/sway.nix | 12 ++ users/ellmau/waybar.nix | 95 ++++++--- 4 files changed, 393 insertions(+), 31 deletions(-) create mode 100644 users/ellmau/conf/waybar/style.css diff --git a/users/ellmau/conf/waybar/style.css b/users/ellmau/conf/waybar/style.css new file mode 100644 index 0000000..b767501 --- /dev/null +++ b/users/ellmau/conf/waybar/style.css @@ -0,0 +1,313 @@ +/* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + +@keyframes blink-warning { + 70% { + color: @light; + } + + to { + color: @light; + background-color: @warning; + } +} + +@keyframes blink-critical { + 70% { + color: @light; + } + + to { + color: @light; + background-color: @critical; + } +} + +@define-color critical #cc241d; +@define-color warning #fabd2f; + +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; + font-size: 13px; + border: none; + border-radius: 0; +} + +window#waybar { + background-color: rgba(43, 48, 59, 0.5); + border-bottom: 3px solid rgba(100, 114, 125, 0.5); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +/* +window#waybar.hidden { + opacity: 0.2; +}*/ + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + + +/* Each module that should blink */ +#mode, +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + + +/* Each critical that should blink */ +#mode, +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +/* Each warning */ +#network.disconnected, +#battery.warning { + background-color: @warning; + color: #000000; +} + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +#network.wifi { + background-color: #C9CBFF; + color: #000000; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each workspace name */ + border: none; + border-radius: 5; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + box-shadow: inset 0 -2px #ecf0f1; +} + +#workspaces button.focused { + background-color: #64727D; + box-shadow: inset 0 -2px #ecf0f1; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727D; + border-bottom: 2px solid #ecf0f1; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#mpd { + margin-left: 2px; + margin-right: 2px; + padding: 0 10px; + color: #ffffff; +} + +#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; +} + +#clock { + background-color: #64727D; +} + +#battery { + background-color: #ffffff; + color: #000000; +} + +#battery.charging, #battery.plugged { + color: #ffffff; + background-color: #26A65B; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #2ecc71; + color: #000000; +} + +#memory { + background-color: #9b59b6; +} + +#disk { + background-color: #964B00; +} + +#backlight { + background-color: #90b1b1; +} + +#network { + background-color: #2980b9; +} + +#pulseaudio { + background-color: #f1c40f; + color: #000000; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #66cc99; +} + +#custom-media.custom-vlc { + background-color: #ffa000; +} + +#temperature { + background-color: #f0932b; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray { + background-color: #2980b9; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#idle_inhibitor { + background-color: #2d3436; +} + +#idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; +} + +#mpd { + background-color: #66cc99; + color: #2a5c45; +} + +#mpd.disconnected { + background-color: #f53c3c; +} + +#mpd.stopped { + background-color: #90b1b1; +} + +#mpd.paused { + background-color: #51a37a; +} + +#language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state > label { + padding: 0 5px; +} + +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); +} diff --git a/users/ellmau/mako.nix b/users/ellmau/mako.nix index 30d1a58..bcc6cf7 100644 --- a/users/ellmau/mako.nix +++ b/users/ellmau/mako.nix @@ -5,7 +5,9 @@ enable = true; iconPath = "${pkgs.numix-icon-theme}"; font = "Hasklug Nerd Font 10"; - defaultTimeout = 50003; + defaultTimeout = 50000; + ignoreTimeout = true; + }; home.packages = [ pkgs.numix-icon-theme ]; diff --git a/users/ellmau/sway.nix b/users/ellmau/sway.nix index c328939..7ca00c5 100644 --- a/users/ellmau/sway.nix +++ b/users/ellmau/sway.nix @@ -22,6 +22,7 @@ home.packages = [ pkgs.gnome-icon-theme pkgs.swaylock + pkgs.pulseaudioFull ]; wayland.windowManager.sway = { @@ -37,12 +38,19 @@ keybindings = let modifier = config.wayland.windowManager.sway.config.modifier; + bctl = "${pkgs.brightnessctl}/bin/brightnessctl"; in lib.mkOptionDefault { "${modifier}+Shift+q" = "kill"; "${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun"; "${modifier}+Tab" = "exec ${pkgs.rofi}/bin/rofi -show window"; "${modifier}+BackSpace" = ''mode "$mode_system"''; + XF86MonBrightnessDown = "exec ${bctl} s 2%-"; + XF86MonBrightnessUp = "exec ${bctl} s 2%+"; + XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer -t"; + XF86AudioLowerVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ -10%"; + XF86AudioRaiseVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ +10%"; + }; keycodebindings = let @@ -66,6 +74,10 @@ { command = "--no-startup-id .config/i3/keepassxc.sh"; } + { + command = ''--no-startup-id swaymsg output "*" bg .background-image fill''; + always = true; + } ]; terminal = "alacritty"; window = { diff --git a/users/ellmau/waybar.nix b/users/ellmau/waybar.nix index 0f26ef8..3c4408e 100644 --- a/users/ellmau/waybar.nix +++ b/users/ellmau/waybar.nix @@ -1,5 +1,8 @@ { config, pkgs, llib, ... }: { + xdg.configFile."waybar/style.css" = { + source = conf/waybar/style.css; + }; programs.waybar = { enable = true; systemd.enable = true; @@ -7,44 +10,76 @@ mainBar = { modules-left = [ "sway/workspaces" "sway/mode" ]; modules-center = [ "sway/window" ]; - modules-right = [ "idle_inhibitor" "sway/language" "battery" "pulseaudio" "clock" "tray" ]; + modules-right = [ "idle_inhibitor" "sway/language" "network#wifi" "network#base" "battery" "pulseaudio" "clock" "tray" ]; - idle_inhibitor = { + "idle_inhibitor" = { format = "{icon}"; format-icons = { activated = ""; deactivated = ""; }; - battery = { - states = { - good = 95; - warning = 30; - critical = 15; - }; - format = "{capacity}% {icon}"; - format-charging = "{capacity}% "; - format-plugged = "{capacity}% "; - format-alt = "{time} {icon}"; - format-icons = [ "" "" "" "" "" ]; - }; - - pulseaudio = { - format = "{icon} {volume:2}%"; - format-bluetooth = "{icon} {volume}%"; - format-muted = "MUTE"; - format-icons = { - headphones = ""; - default = [ - "" - "" - ]; - }; - scroll-step = 5; - on-click = "${pkgs.pamixer}/bin/pamixer -t"; - on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol &"; - }; }; + + battery = { + states = { + good = 95; + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-icons = [ "" "" "" "" "" ]; + }; + "clock" = { + format-alt = "{:%a, %d. %b %H:%M}"; + }; + + "network#wifi" = { + interface = "wlp2s0"; + format = "{ifname}"; + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + format-disconnected = "wifi:"; + tooltip-format = "{ifname} via {gwaddr} "; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; + }; + + "network#base" = { + format = "{ifname}"; + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + format-disconnected = ""; + tooltip-format = "{ifname} via {gwaddr} "; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; + }; + + pulseaudio = { + format = "{icon} {volume:2}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = "🔇"; + format-icons = { + headphones = ""; + default = [ + "🔈" + "🔉" + "🔊" + ]; + }; + scroll-step = 5; + on-click = "${pkgs.pamixer}/bin/pamixer -t"; + on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol &"; + }; + }; }; }; } +