diff --git a/dot_config/waybar/config b/dot_config/waybar/config new file mode 100644 index 0000000..14b6e75 --- /dev/null +++ b/dot_config/waybar/config @@ -0,0 +1,218 @@ +// Global +{ + "layer": "top", + "position": "top", + + // If height property would be not present, it'd be calculated dynamically + "height": 30, + + "modules-left": [ + "custom/launcher", + "sway/workspaces", + "sway/mode", + ], + + "modules-center": [ + ], + + "modules-right": [ + "network", + "idle_inhibitor", + "memory", + "cpu", + "pulseaudio", + "custom/keyboard-layout", + "battery", + //"custom/PBPbattery", + "backlight#icon", + "backlight#value", + "clock", + "tray", + //"custom/weather", + "custom/power", + ], + + // Modules + + "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-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + + "custom/PBPbattery": { + "exec": "~/.config/waybar/scripts/PBPbattery.sh", + "format": "{}", + }, + + "clock": { + "interval": 10, + "format-alt": " {:%e %b %Y}", // Icon: calendar-alt + "format": "{:%H:%M}", + "tooltip-format": "{:%e %B %Y}" + }, + + "cpu": { + "interval": 5, + "format": " {usage}% ({load})", // Icon: microchip + "states": { + "warning": 70, + "critical": 90, + }, + "on-click": "xfce4-terminal -e 'htop'", + }, + + "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, + "on-click": "~/.config/waybar/scripts/keyhint.sh", + }, + + "memory": { + "interval": 5, + "format": " {}%", // Icon: memory + "on-click": "xfce4-terminal -e 'htop'", + "states": { + "warning": 70, + "critical": 90 + } + }, + + "network": { + "interval": 5, + "format-wifi": " {essid} ({signalStrength}%)", // Icon: wifi + "format-ethernet": " {ifname}: {ipaddr}/{cidr}", // Icon: ethernet + "format-disconnected": "⚠ Disconnected", + "tooltip-format": "{ifname}: {ipaddr}", + "on-click": "xfce4-terminal -e 'nmtui'", + }, + "network#vpn": { + "interface": "tun0", + "format": " {essid} ({signalStrength}%)", + "format-disconnected": "⚠ Disconnected", + "tooltip-format": "{ifname}: {ipaddr}/{cidr}", + }, + + "sway/mode": { + "format": "{}", + "tooltip": false + }, + + "sway/window": { + "format": "{}", + "max-length": 120 + }, + + "sway/workspaces": { + "disable-scroll": true, + "disable-markup" : false, + "all-outputs": true, + "format": " {icon} ", + //"format":"{icon}", + "format-icons": { + "1": "", + "2": "", + "3": "", + "4": "", + } + }, + + "pulseaudio": { + "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon}", + "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", + "on-scroll-up": "pactl set-sink-volume @DEFAULT_SINK@ +2%", + "on-scroll-down": "pactl set-sink-volume @DEFAULT_SINK@ -2%", + }, + + // to use the weather module replace with your city or town + // note: do not use spaces: new york would be newyork + "custom/weather": { + "exec": "~/.config/waybar/scripts/weather.sh ", + "return-type": "json", + "interval": 600, + }, + + "tray": { + "icon-size": 18, + "spacing":10, + }, + + "backlight#icon": { + "format": "{icon}", + "format-icons": [""], + "on-scroll-down": "brightnessctl -c backlight set 1%-", + "on-scroll-up": "brightnessctl -c backlight set +1%" + }, + + "backlight#value" :{ + "format": "{percent}%", + "on-scroll-down": "brightnessctl -c backlight set 1%-", + "on-scroll-up": "brightnessctl -c backlight set +1%" + }, + + "custom/firefox": { + "format": " ", + "on-click": "exec firefox", + "tooltip": false + }, + + "custom/terminal": { + "format": " ", + "on-click": "exec xfce4-terminal", + "tooltip": false + }, + + "custom/files": { + "format": " ", + "on-click": "exec thunar", + "tooltip": false + }, + + "custom/launcher": { + "format":" ", + "on-click": "exec wofi -c ~/.config/wofi/config -I", + "tooltip": false, + }, + + "custom/power": { + "format":"⏻", + "on-click": "exec ~/.config/waybar/scripts/power-menu.sh", + "tooltip": false, + }, +} diff --git a/dot_config/waybar/scripts/executable_PBPbattery.sh b/dot_config/waybar/scripts/executable_PBPbattery.sh new file mode 100644 index 0000000..1cf34da --- /dev/null +++ b/dot_config/waybar/scripts/executable_PBPbattery.sh @@ -0,0 +1,21 @@ + +#!/bin/bash +#simple Shellscript for waybar/i3blocks/polybar on Pinebook pro +#05012020 geri123@gmx.net Gerhard S. + +PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity) +STATUS=$(cat /sys/class/power_supply/cw2015-battery/status) +case $(( + $PERCENT >= 0 && $PERCENT <= 20 ? 1 : + $PERCENT > 20 && $PERCENT <= 40 ? 2 : + $PERCENT > 40 && $PERCENT <= 60 ? 3 : + $PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in +# + (1) echo $STATUS:"":$PERCENT%;; + (2) echo $STATUS:"":$PERCENT%;; + (3) echo $STATUS:"":$PERCENT%;; + (4) echo $STATUS:"":$PERCENT%;; + (5) echo $STATUS:"":$PERCENT%;; +esac + + diff --git a/dot_config/waybar/scripts/executable_keyhint.sh b/dot_config/waybar/scripts/executable_keyhint.sh new file mode 100644 index 0000000..01f3396 --- /dev/null +++ b/dot_config/waybar/scripts/executable_keyhint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +yad --title="EndeavourOS Sway-WM keybindings:" --no-buttons --geometry=400x345-15-400 --list --column=key: --column=description: --column=command: "ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" "+enter" "Terminal" "(xfce4-terminal)" "+d" "Application Menu" "(wofi)" "+p" "Activities" "(wofi)" "+o" "" "Open Broswer" "+n" "" "Open Files" "+q" "close focused app" "(kill)" "[Shift]+Print-key" "screenshot" "(grim)" "+Shift+e" "power-menu" "(wofi)" "+t" "open keybinding helper" "full list" diff --git a/dot_config/waybar/scripts/executable_power-menu.sh b/dot_config/waybar/scripts/executable_power-menu.sh new file mode 100644 index 0000000..edaa5d6 --- /dev/null +++ b/dot_config/waybar/scripts/executable_power-menu.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +entries="Logout Suspend Reboot Shutdown" + +selected=$(printf '%s\n' $entries | wofi --conf=$HOME/.config/wofi/config.power --style=$HOME/.config/wofi/style.widgets.css | awk '{print tolower($1)}') + +case $selected in + logout) + swaymsg exit;; + suspend) + exec systemctl suspend;; + reboot) + exec systemctl reboot;; + shutdown) + exec systemctl poweroff -i;; +esac diff --git a/dot_config/waybar/scripts/executable_weather.sh b/dot_config/waybar/scripts/executable_weather.sh new file mode 100644 index 0000000..b03cd1c --- /dev/null +++ b/dot_config/waybar/scripts/executable_weather.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +LOC="$1" +# HTML encode string as %20 +LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC") +content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=$LOCATION°=C") +ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' ) +# echo $ICON +TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g') +TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g') +CLASS=$(echo $content | jq .skytext) +echo '{"text": "'$TEMP'", "tooltip": "'$ICON $TOOLTIP $LOC'", "class": '$CLASS' }' + diff --git a/dot_config/waybar/style.css b/dot_config/waybar/style.css new file mode 100644 index 0000000..938ff1f --- /dev/null +++ b/dot_config/waybar/style.css @@ -0,0 +1,200 @@ +/* ============================================================================= + * + * Waybar configuration + * + * Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration + * + * =========================================================================== */ + +/* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + +/* +Arc-Dark Color Scheme +*/ +@define-color highlight #5294e2 ; +@define-color base1 #404552 ; + +@keyframes blink-warning { + 70% { + color: white; + } + + to { + color: white; + background-color: orange; + } +} + +@keyframes blink-critical { + 70% { + color: white; + } + + to { + color: white; + background-color: red; + } +} + +/* ----------------------------------------------------------------------------- + * Base styles + * -------------------------------------------------------------------------- */ + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 1px; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: transparent; + color: #bebebe; + background-color: @base1; + font-family: UbuntuMono; + font-size: 14px; +} + +/* Every modules */ +#battery, +#clock, +#backlight, +#cpu, +#custom-keyboard-layout, +#memory, +#mode, +#custom-weather, +#network, +#pulseaudio, +#temperature, +#tray, +#idle_inhibitor, +#custom-PBPbattery { + padding:0.5rem 0.6rem; + margin: 1px 0px; +} + +/* ----------------------------------------------------------------------------- + * Modules styles + * -------------------------------------------------------------------------- */ + +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#battery.warning { + color: orange; +} + +#battery.critical { + color: red; +} + +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +#cpu.warning { + color: orange; +} + +#cpu.critical { + color: red; +} + +#memory { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#memory.warning { + color: orange; + } + +#memory.critical { + color: red; + animation-name: blink-critical; + animation-duration: 2s; + padding-left:5px; + padding-right:5px; +} + +#mode { + background: @highlight; + border-bottom: 3px transparent; + color:white; + margin-left: 5px; + padding: 7px; +} + +#network.disconnected { + color: orange; +} + +#pulseaudio { + padding-top:6px; +} + +#pulseaudio.muted { + color: @highlight; +} + +#temperature.critical { + color: red; +} + +#window { + font-weight: bold; +} + +#workspaces { + font-size:13px; +} + +#workspaces button { + border-bottom: 3px solid transparent; + margin-bottom: 0px; + padding:0px; +} + +#workspaces button.focused { + border-bottom: 3px solid @highlight; + margin-bottom: 1px; + padding-left:0; +} + +#workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; +} + +#custom-power { + margin-left:15px; + margin-right:15px; + font-size:15px; +} + +#custom-launcher { + font-size:15px; + margin-left:15px; + margin-right:10px; +} + +#backlight.icon { + padding-right:1px; + font-size: 13px; +}