diff --git a/.config/waybar/.gitignore b/.config/waybar/.gitignore new file mode 100644 index 0000000..d195669 --- /dev/null +++ b/.config/waybar/.gitignore @@ -0,0 +1,2 @@ +custom/cover.cache +custom/cover.jpg diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index 2ab8cdb..e0686a2 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -7,6 +7,7 @@ "modules-left": [ "custom/appmenuicon", "wlr/taskbar", + "custom/pomodoro" ], "modules-center": [ "hyprland/workspaces", diff --git a/.config/waybar/custom/placeholder.jpg b/.config/waybar/custom/placeholder.jpg new file mode 100644 index 0000000..e0ae243 Binary files /dev/null and b/.config/waybar/custom/placeholder.jpg differ diff --git a/.config/waybar/custom/playerctl.sh b/.config/waybar/custom/playerctl.sh index 93cd58f..60fc0e4 100755 --- a/.config/waybar/custom/playerctl.sh +++ b/.config/waybar/custom/playerctl.sh @@ -1,6 +1,20 @@ -title=$(playerctl metadata --format '{{markup_escape(artist)}} {{markup_escape(title)}}') +title=$(playerctl metadata --format '{{markup_escape(artist)}} - {{markup_escape(title)}}') position=$(playerctl metadata --format '{{position}}') length=$(playerctl metadata --format '{{mpris:length}}') +artUrl=$(playerctl metadata --format "{{mpris:artUrl}}") + +if [[ -n "$artUrl" ]]; then + cover=$(echo "$artUrl" | sed "s/file:\/\///g") +else + cover="$HOME/.config/waybar/custom/placeholder.jpg" +fi + +if [[ "$cover" != $(cat ~/.config/waybar/custom/cover.cache) ]]; then + echo "$cover" > ~/.config/waybar/custom/cover.cache + cp $cover ~/.config/waybar/custom/cover.jpg + killall waybar && waybar & + exit +fi # Check if both position and length are not empty if [[ -n "$position" && -n "$length" && -n "$title" ]]; then @@ -24,4 +38,9 @@ if [[ -n "$position" && -n "$length" && -n "$title" ]]; then done fi -echo $(playerctl metadata --format "{\"text\": \"$title\r$progress_string\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}}") +if [[ -n "$progress_string" ]]; then + title+="\r$progress_string" +fi + +echo $(playerctl metadata --format "{\"text\": \"$title\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\", \"tooltip\": \"$title ({{ duration(position) }}/{{ duration(mpris:length) }})\"}") + diff --git a/.config/waybar/custom/pomodoro.sh b/.config/waybar/custom/pomodoro.sh new file mode 100755 index 0000000..365b3d4 --- /dev/null +++ b/.config/waybar/custom/pomodoro.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Get the output of the pomodoro command +output=$(pomodoro -g) + +# Extract the timer name and remaining time +timer_name=$(echo $output | awk '{print $1}') +remaining_time=$(echo $output | awk '{print $2}') + +# Convert remaining time to seconds +remaining_seconds=$(( $(echo $remaining_time | awk -F: '{print $1 * 60 + $2}') )) + +# Read the configuration file and get the total time for the current timer +config_file=~/.config/pomodoro/config +total_time=$(grep "^$timer_name" $config_file | awk '{print $2}') + +# Convert total time to MM:SS format +total_minutes=$(( total_time / 60 )) +total_seconds=$(( total_time % 60 )) +total_time_formatted=$(printf "%02d:%02d" $total_minutes $total_seconds) + +# Calculate the progress percentage +progress=$(( (total_time - remaining_seconds) * 100 / total_time )) + +# Echo the timer name and progress +echo "{\"text\": \"$timer_name\", \"tooltip\": \"$timer_name ($remaining_time/$total_time_formatted)\", \"percentage\": $progress}" + diff --git a/.config/waybar/modules.json b/.config/waybar/modules.json index bc1f195..a51000a 100644 --- a/.config/waybar/modules.json +++ b/.config/waybar/modules.json @@ -1,5 +1,4 @@ { - // Workspaces "hyprland/workspaces": { "on-scroll-up": "hyprctl dispatch workspace r-1", "on-scroll-down": "hyprctl dispatch workspace r+1", @@ -11,7 +10,7 @@ "2": "ο„ ", "1": "", "3": "", - "4": "ο†Ό", + "4": "π„ž", "urgent": "οͺ", "focused": "ο†’", "default": "ο„‘" @@ -20,47 +19,15 @@ "*": 5 } }, - "mpd": { - "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) βΈ¨{songPosition}|{queueLength}βΈ© {volume}% ", - "format-disconnected": "Disconnected ", - "format-stopped": "no music", - "unknown-tag": "N/A", - "interval": 5, - "consume-icons": { - "on": " " - }, - "random-icons": { - "off": " ", - "on": " " - }, - "repeat-icons": { - "on": "ο€ž " - }, - "single-icons": { - "on": "ο€ž1 " - }, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - }, - "custom/playerctl": { - "interval": 1, - "tooltip": false, - "return-type": "json", - "format": "", - "format-icons": { - "Playing": "|>", - "Paused": "||" - }, - "exec": "~/.config/waybar/custom/playerctl.sh", - "on-click-right": "playerctl next", - "on-click": "playerctl play-pause", - "on-scroll-up": "playerctl position 1+", - "on-scroll-down": "playerctl position 1-", - "signal": 5 + "custom/pomodoro": { + "format-icons": ["πŸ•›", "πŸ•", "πŸ•‘", "πŸ•’", "πŸ•“", "πŸ•”", "πŸ••", "πŸ•–", "πŸ•—", "πŸ•˜", "πŸ•™", "πŸ•š"], + "return-type": "json", + "tooltip": true, + "format": "{icon} {}", + "on-click": "pomodoro", + "on-click-right": "pomodoro -k", + "exec": "~/.config/waybar/custom/pomodoro.sh", + "interval": 1 }, "group/playerctl": { "orientation": "inherit", @@ -71,36 +38,31 @@ "custom/playerctl-next", "custom/playerctl-title" ] - - }, - "custom/playerctl-artist": { - "interval": 1, - "format": "{}", - "return-type": "json", - "exec": "playerctl metadata --format '{\"text\": \"{{markup_escape(artist)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}}'", - "on-click": "playerctl play-pause", }, "custom/playerctl-title": { - "interval": 1, + "interval": 2, "format": "{}", + "hide-empty-text": true, "return-type": "json", "exec": "~/.config/waybar/custom/playerctl.sh", "on-click": "playerctl play-pause", - "on-scroll-up": "playerctl position 1+", - "on-scroll-down": "playerctl position 1-", + "on-scroll-up": "playerctl position 1+", + "on-scroll-down": "playerctl position 1-", }, "custom/playerctl-prev": { "interval": 1, "format": "", + "tooltip-format": "previous track", "return-type": "json", "exec": "playerctl metadata --format '{\"alt\": \"{{status}}\", \"class\": \"{{status}}\"}}'", "on-click": "playerctl previous", - "on-scroll-up": "playerctl position 1+", - "on-scroll-down": "playerctl position 1-", + "on-scroll-up": "playerctl position 1+", + "on-scroll-down": "playerctl position 1-", }, "custom/playerctl-pause-play": { "interval": 1, - "format": "{icon}", + "format": "{icon}", + "tooltip-format": "pause/play", "format-icons": { "Playing": "", "Paused": "" @@ -108,21 +70,19 @@ "return-type": "json", "exec": "playerctl metadata --format '{\"alt\": \"{{status}}\", \"class\": \"{{status}}\"}}'", "on-click": "playerctl play-pause", - "on-scroll-up": "playerctl position 1+", - "on-scroll-down": "playerctl position 1-", + "on-scroll-up": "playerctl position 1+", + "on-scroll-down": "playerctl position 1-", }, "custom/playerctl-next": { "interval": 1, "format": "", + "tooltip-format": "next track", "return-type": "json", "exec": "playerctl metadata --format '{\"alt\": \"{{status}}\", \"class\": \"{{status}}\"}}'", "on-click": "playerctl next", - "on-scroll-up": "playerctl position 1+", - "on-scroll-down": "playerctl position 1-", + "on-scroll-up": "playerctl position 1+", + "on-scroll-down": "playerctl position 1-", }, - - - // Taskbar "wlr/taskbar": { "format": "{icon}", @@ -139,7 +99,6 @@ "Foot Server": "Terminal" } }, - // Hyprland Window "hyprland/window": { "rewrite": { @@ -158,29 +117,7 @@ "interval": 1 }, - // ML4W Welcome App - // Empty - "custom/empty": { - "format": "" - }, - - // Empty - "custom/tools": { - "format": "ο—½", - "tooltip-format": "Tools" - }, - - // Rofi Application Launcher - "custom/appmenu": { - // START APPS LABEL - "format": "", - // END APPS LABEL - "on-click": "sleep 0.2;rofi -show drun -replace", - "on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh", - "tooltip-format": "Left: Open the application launcher\nRight: Show all keybindings" - }, - - // Rofi Application Launcher + // Wofi Application Launcher "custom/appmenuicon": { "format": "οŒƒ", "on-click": "wofi --show drun", @@ -195,17 +132,6 @@ "tooltip-format": "Power Menu" }, - // Keyboard State - "keyboard-state": { - "numlock": true, - "capslock": true, - "format": "{name} {icon}", - "format-icons": { - "locked": "ο€£", - "unlocked": "ο‚œ" - } - }, - // System tray "tray": { "icon-size": 21, @@ -222,12 +148,6 @@ // END CLOCK FORMAT }, - // System - "custom/system": { - "format": "ξ‘³", - "tooltip": false - }, - // CPU "cpu": { "format": "/ C {usage}% ", @@ -248,10 +168,6 @@ "on-click": "~/dotfiles/.settings/systeminfo.sh" }, - "hyprland/language": { - "format": "/ K {short}" - }, - // Group Hardware "group/hardware": { "orientation": "inherit", @@ -279,45 +195,6 @@ ] }, - // Group Links - "group/links": { - "orientation": "horizontal", - "modules": [ - "custom/chatgpt", - "custom/empty" - ] - }, - - // Group Settings - "group/settings": { - "orientation": "inherit", - "drawer": { - "transition-duration": 300, - "children-class": "not-memory", - "transition-left-to-right": true - }, - "modules": [ - "custom/settings", - "custom/waybarthemes", - "custom/wallpaper" - ] - }, - - // Network - "network": { - "format": "{ifname}", - "format-wifi": " {signalStrength}%", - "format-ethernet": " {ifname}", - "format-disconnected": "Disconnected", - "tooltip-format": " {ifname} via {gwaddri}", - "tooltip-format-wifi": " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}", - "tooltip-format-ethernet": "οž– {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}", - "tooltip-format-disconnected": "Disconnected", - "max-length": 50, - "on-click": "alacritty --class=cursor-float -e nmtui", - "on-click-right": "~/dotfiles/.settings/networkmanager.sh" - }, - // Battery "battery": { "states": { @@ -364,14 +241,6 @@ "on-click": "blueman-manager", "format-no-controller": "" }, - - // Other - "user": { - "format": "{user}", - "interval": 60, - "icon": false - }, - // backlight: "backlight": { "format": "{icon} {percent}%", diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 2513397..51084f2 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -13,7 +13,7 @@ * ----------------------------------------------------- */ * { - font-family: monospace, "Fira", FontAwesome, Roboto, Helvetica, Arial, sans-serif; + font-family: "Fira", FontAwesome, Roboto, Helvetica, Arial, sans-serif; border: none; border-radius: 0px; } @@ -70,6 +70,7 @@ tooltip { opacity: 0.8; padding: 20px; margin: 0px; + font-family: "Fira", FontAwesome, Roboto, Helvetica, Arial, sans-serif; } tooltip label { @@ -440,7 +441,7 @@ window#waybar.empty #window { background-color: rgba(0, 0, 0, .2); margin-top: 2px; margin-right: 20px; - padding: 4px 16px 0px; + padding: 4px 16px 4px; border: 0px; font-family: monospace; font-size: 14px; @@ -470,5 +471,9 @@ window#waybar.empty #window { } #custom-playerctl-title { - margin-left: 20px; + margin-left: 10px; + background: url("file:///home/goodhumored/.config/waybar/custom/cover.jpg?v=1"); + background-size: contain; + background-repeat: no-repeat; + padding-left: 40px; }