From ff30ff05e56bdd3986f51c4e97ee9f8762ed46e4 Mon Sep 17 00:00:00 2001 From: Tobias Maier Date: Sun, 7 Aug 2022 19:47:29 +0200 Subject: [PATCH] Added new waybar --- waybar.old/style.css | 173 ++++++++++++++++++++++++++++ waybar.old/waybar.config | 65 +++++++++++ waybar/modules/cpu.sh | 9 ++ waybar/modules/datetime.sh | 2 + waybar/modules/powermenu.sh | 10 ++ waybar/waybar.config | 221 +++++++++++++++++++++++++----------- 6 files changed, 416 insertions(+), 64 deletions(-) create mode 100644 waybar.old/style.css create mode 100644 waybar.old/waybar.config create mode 100644 waybar/modules/cpu.sh create mode 100644 waybar/modules/datetime.sh create mode 100644 waybar/modules/powermenu.sh diff --git a/waybar.old/style.css b/waybar.old/style.css new file mode 100644 index 0000000..52abe87 --- /dev/null +++ b/waybar.old/style.css @@ -0,0 +1,173 @@ +@keyframes blink-warning { + 70% { + color: @light; + } + + to { + color: @light; + background-color: @warning; + } +} + +@keyframes blink-critical { + 70% { + color: @light; + } + + to { + color: @light; + background-color: @critical; + } +} + + +/* ----------------------------------------------------------------------------- + * Styles + * -------------------------------------------------------------------------- */ + +/* COLORS */ + +/* Nord */ +@define-color bg #000000; +@define-color light #eceff4; +@define-color warning #ffb726; +@define-color critical #ff3d00; +@define-color mode #4c566a; +@define-color workspaces @bg; +@define-color workspacesfocused #5c5c5c; +@define-color tray @bg; + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: @bg; + color: @light; + font-family: Noto Sans; + font-size: 11px; + font-weight: bold; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#custom-layout, +#memory, +#network, +#pulseaudio, +#temperature, +#custom-alsa, +#tray, +#backlight { + padding-left: 10px; + padding-right: 10px; + border-right: 1px solid @light; +} + +/* Each module that should blink */ +#memory, +#temperature, +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +/* Each critical module */ +#memory.critical, +#cpu.critical, +#temperature.critical, +#battery.critical { + color: @critical; +} + +/* Each critical that should blink */ +#mode, +#memory.critical, +#temperature.critical, +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +/* Each warning */ +#network.disconnected, +#memory.warning, +#cpu.warning, +#temperature.warning, +#battery.warning { + color: @warning; +} + +/* Each warning that should blink */ +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + + +/* Workspaces stuff */ + +#workspaces { + margin-right: 10px; +} + + +#workspaces button { + font-weight: bold; /* Somewhy the bar-wide setting is ignored*/ + padding-left: 5px; + padding-right: 5px; + color: @light; + background: @bg; +} + +#workspaces button.focused { + background: @workspacesfocused; +} + +#workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; +} + +#window { + margin-right: 40px; + margin-left: 40px; +} + +#network { + background: @bg; +} + +#memory { + background: @bg; +} + +#cpu { + background: @bg; +} + +#battery { + background: @bg; +} + + +#clock.date { + background: @bg; +} + +#clock.time { + background: @bg; +} + +#tray { + background: @bg; +} diff --git a/waybar.old/waybar.config b/waybar.old/waybar.config new file mode 100644 index 0000000..6aa4980 --- /dev/null +++ b/waybar.old/waybar.config @@ -0,0 +1,65 @@ + +{ + "height": 25, // Waybar height (to be removed for auto height) + "modules-left": ["sway/workspaces"], + "modules-center": ["sway/window"], + "modules-right": ["network", "cpu", "memory", "pulseaudio","battery", "tray", "clock"], + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": true, + "format": "{name}", + }, + "tray": { + "spacing": 10 + }, + "clock": { + "timezone": "Europe/Berlin", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format": "{:%d/%m %H:%M:%S}" + }, + "cpu": { + "format": "{usage}% ", + "tooltip": false + }, + "memory": { + "format": "{}% " + }, + "battery": { + "states": { + "good": 80, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""] + }, + "network": { + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol" + } +} diff --git a/waybar/modules/cpu.sh b/waybar/modules/cpu.sh new file mode 100644 index 0000000..aa8fa1d --- /dev/null +++ b/waybar/modules/cpu.sh @@ -0,0 +1,9 @@ +read cpu a b c previdle rest < /proc/stat +prevtotal=$((a+b+c+previdle)) +sleep 3.0 +read cpu a b c idle rest < /proc/stat +sleep 3.0 +total=$((a+b+c+idle)) +cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + +echo  $cpu% \ No newline at end of file diff --git a/waybar/modules/datetime.sh b/waybar/modules/datetime.sh new file mode 100644 index 0000000..0c6ae07 --- /dev/null +++ b/waybar/modules/datetime.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo " $(date '+%H:%M')" \ No newline at end of file diff --git a/waybar/modules/powermenu.sh b/waybar/modules/powermenu.sh new file mode 100644 index 0000000..99dedc5 --- /dev/null +++ b/waybar/modules/powermenu.sh @@ -0,0 +1,10 @@ +rofiopt="Shut down\nReboot\nLock" +rofi=$(printf "$rofiopt" | rofi -dmenu -i -p "Powermenu") +[ -z "$rofi" ] && exit + +case $rofi in + "Shut down") shutdown now;; + "Reboot") reboot;; + "Lock") swaylock;; + *) +esac \ No newline at end of file diff --git a/waybar/waybar.config b/waybar/waybar.config index 6aa4980..ca21b82 100644 --- a/waybar/waybar.config +++ b/waybar/waybar.config @@ -1,65 +1,158 @@ - -{ - "height": 25, // Waybar height (to be removed for auto height) - "modules-left": ["sway/workspaces"], - "modules-center": ["sway/window"], - "modules-right": ["network", "cpu", "memory", "pulseaudio","battery", "tray", "clock"], - "sway/workspaces": { - "disable-scroll": true, - "all-outputs": true, - "format": "{name}", - }, - "tray": { - "spacing": 10 - }, - "clock": { - "timezone": "Europe/Berlin", - "tooltip-format": "{:%Y %B}\n{calendar}", - "format": "{:%d/%m %H:%M:%S}" - }, - "cpu": { - "format": "{usage}% ", - "tooltip": false - }, - "memory": { - "format": "{}% " - }, - "battery": { - "states": { - "good": 80, - "warning": 30, - "critical": 15 - }, - "format": "{capacity}% {icon}", - "format-charging": "{capacity}% ", - "format-plugged": "{capacity}% ", - "format-alt": "{time} {icon}", - "format-icons": ["", "", "", "", ""] - }, - "network": { - "format-wifi": "{essid} ({signalStrength}%) ", - "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", - "format-linked": "{ifname} (No IP) ", - "format-disconnected": "Disconnected ⚠", - "format-alt": "{ifname}: {ipaddr}/{cidr}" - }, - "pulseaudio": { - // "scroll-step": 1, // %, can be a float - "format": "{volume}% {icon} {format_source}", - "format-bluetooth": "{volume}% {icon} {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": " {format_source}", - "format-source": "{volume}% ", - "format-source-muted": "", - "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["", "", ""] - }, - "on-click": "pavucontrol" - } +* { + border: none; + border-radius: 0; + font-family: "JetbrainsMono Nerd Font"; + font-size: 14px; } + +window#waybar { + background: none; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#window { + margin-top: 6px; + padding-left: 10px; + padding-right: 10px; + border-radius: 5px; + transition: none; + background: #2e3440; + color: #d8dee9; +} + +#custom-powermenu { + margin-top: 6px; + margin-left: 12px; + margin-right: 12px; + padding-left: 15px; + padding-right: 20px; + border-radius: 5px; + transition: none; + background: #2e3440; +} + +#tags { + margin-top: 6px; + margin-right: 12px; + font-size: 4px; + border-radius: 5px; + transition: none; + background: #2e3440; +} + +#tags button { + transition: none; + color: #4c566a; + background: transparent; + border-radius: 0px; +} + +#tags button.occupied { + transition: none; + color: #a3be8c; + background: transparent; + font-size: 4px; +} + +#tags button.focused { + color: #81a1c1; + border-bottom: 2px solid #81a1c1; +} + +#tags button:hover { + transition: none; + box-shadow: inherit; + text-shadow: inherit; + color: #81a1c1; +} + +#temperature { + margin-top: 6px; + margin-right: 12px; + border-radius: 5px; + transition: none; + padding: 0 10px; + color: #a3be8c; + background: #2e3440; +} + +#pulseaudio { + margin-top: 6px; + margin-left: 12px; + border-radius: 5px; + transition: none; + padding: 0 10px; + color: #a3be8c; + background: #2e3440; +} + +#battery { + margin-top: 6px; + margin-left: 12px; + border-radius: 5px; + transition: none; + padding: 10px 10px; + color: #a3be8c; + background: #2e3440; +} + +#battery.critical:not(.charging) { + background-color: #d8dee9; + color: #2e3440; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +@keyframes blink { + to { + background-color: #bf616a; + color: #d8dee9; + } +} + +#backlight { + margin-top: 6px; + margin-left: 12px; + border-radius: 5px; + transition: none; + padding: 10px 10px; + color: #88c0d0; + background: #2e3440; +} + +#custom-cpu { + margin-top: 6px; + margin-left: 12px; + border-radius: 5px; + transition: none; + padding: 10px 10px; + color: #88c0d0; + background: #2e3440; +} + +#custom-clock { + margin-top: 6px; + margin-left: 12px; + margin-right: 12px; + border-radius: 5px; + transition: none; + padding: 10px 10px; + color: #a3be8c; + background: #2e3440; +} + +#tray { + margin-top: 6px; + margin-right: 12px; + border-radius: 5px; + padding-left: 10px; + padding-right: 10px; + color: #d8dee9; + background: #2e3440; +} \ No newline at end of file