From c9c615a2db3109cb196a7640f2a86d73046717fd Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 21 Jul 2023 21:51:30 -0400 Subject: [PATCH] add waybar --- dot_config/waybar/config | 102 ++++++++++++++++++ .../waybar/literal_executable_mediaplayer.sh | 19 ++++ dot_config/waybar/style.css | 88 +++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 dot_config/waybar/config create mode 100644 dot_config/waybar/literal_executable_mediaplayer.sh create mode 100644 dot_config/waybar/style.css diff --git a/dot_config/waybar/config b/dot_config/waybar/config new file mode 100644 index 0000000..54b2ccc --- /dev/null +++ b/dot_config/waybar/config @@ -0,0 +1,102 @@ +{ + "layer": "top", + "position": "top", + "height": 24, + "modules-left": ["sway/workspaces", "custom/music"], + "modules-center": ["sway/window", "sway/mode"], + "modules-right": ["idle_inhibitor", "pulseaudio", "network", "cpu", "temperature#cpu", "temperature#gpu", "memory", "tray", "clock"], + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": false, + "format": "{name}", + "format-icons": { + "1:web": "www", + "2:code": "", + "3:term": "", + "4:work": "", + "5:music": "", + "6:docs": "", + "urgent": "", + "focused": "", + "default": "" + } + }, + + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + + "sway/mode": { + "format": "{}" + }, + "tray": { + "icon-size": 14, + "spacing": 10 + }, + "clock": { + // 24hr Robot Friendly + "format": "{:%Y-%m-%d - %H:%M}", + // Human Friendly + "format-alt": "{:%A, %B %d at %I:%M %p}" + }, + "cpu": { + "format": "{usage}% " + }, + "temperature#cpu": { + "hwmon-path": "/sys/class/hwmon/hwmon1/temp2_input", + "critical-threshold": 70, + "format": "C: {temperatureC}°C ", + "format-alt": "C: {temperatureF}°F " + }, + "temperature#gpu": { + "hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input", + "critical-threshold": 70, + "format": "G: {temperatureC}°C ", + "format-alt": "G: {temperatureF}°F " + }, + + "memory": { + "interval": 30, + "format": "{used:0.1f}/{total:0.1f}G " + }, + + "network": { + // "interface": "wlp2s0", // (Optional) To force the use of this interface + "format-wifi": "{signalStrength}% ", + "format-ethernet": "{ipaddr} ", + "tooltip-format-wifi": "{essid} ({signalStrength}%)", + "tooltip-format-ethernet": "{ifname}: {ipaddr}/{cidr} ", + "format-disconnected": "" + }, + "pulseaudio": { + //"scroll-step": 1, + "format": "{volume}% {icon}", + "format-bluetooth": "{volume}% {icon}", + "format-muted": "", + "format-icons": { + "headphones": "", + "handsfree": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", ""] + }, + "on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle", + "on-click-right": "pavucontrol" + }, + "custom/music": { + "format": " {}", + "max-length": 60, + "interval": 5, // Remove this if your script is endless and write in loop + "exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder + "tooltip": false, + "on-click": "playerctl play-pause", + "on-scroll-up": "playerctl previous", + "on-scroll-down": "playerctl next" + } +} diff --git a/dot_config/waybar/literal_executable_mediaplayer.sh b/dot_config/waybar/literal_executable_mediaplayer.sh new file mode 100644 index 0000000..c8d61fd --- /dev/null +++ b/dot_config/waybar/literal_executable_mediaplayer.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +player_status=$(playerctl status 2> /dev/null) + +title=$(playerctl metadata title) +if artist=$(playerctl metadata artist); then + song_info="${title} By ${artist}" +else + song_info="${title}" +fi + + +if [ "$player_status" = "Playing" ]; then + output="${song_info}" +elif [ "$player_status" = "Paused" ] ; then + output="⏸️ ${song_info}" +fi + +echo $output diff --git a/dot_config/waybar/style.css b/dot_config/waybar/style.css new file mode 100644 index 0000000..c2b5498 --- /dev/null +++ b/dot_config/waybar/style.css @@ -0,0 +1,88 @@ +* { + border: none; + border-radius: 0; + font-family: 'Ubuntu', 'Font Awesome 5 Free'; + font-size: 13px; + min-height: 0; + color: #ebdbb2; +} + +window#waybar { + border-bottom: 2px solid #689d6a; + background: #1d2021; +} + +#workspaces button { +} + +#workspaces button.focused { + background: #689d6a; + color: #1d2021; +} + +#mode { + background-color: #cc241d; + color: white; +} + +#clock, #cpu, #temperature, #memory, #network, #pulseaudio, #backlight, #tray, #mode, #idle_inhibitor, #network { + padding: 0 4px; + margin: 0 10px; +} + +#idle_inhibitor { + padding: 0 10px; +} + +#idle_inhibitor.activated { + background-color: #689d6a; + color: #1d2021; +} + + +#custom-music { + color: #b8bb26; + margin: 0 15px; + padding: 0 20px; + border-bottom: 2px solid #b8bb26; + +} + +#clock { + margin: 0; + color: #fabd2f; + border-bottom: 2px solid #fabd2f; +} + + +#cpu { +} + +#memory { +} + +#network.disconnected { + background-color: #cc241d; + color: #1d2021; + border-bottom: 2px solid #cc241d; +} + +#pulseaudio { +} + +#pulseaudio.muted { + padding: 0 20px; + color: #cc241d; + border-bottom: 2px solid #cc241d; +} + +#temperature.critical{ + padding: 0 4px; + margin: 0 10px; + color: #cc241d; + border-bottom: 2px solid #cc241d; +} + +#tray { + +}