waybar player album cover, timebar, pomodoro timer
This commit is contained in:
parent
0b6cc5a694
commit
fff72d3679
2
.config/waybar/.gitignore
vendored
Normal file
2
.config/waybar/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
custom/cover.cache
|
||||
custom/cover.jpg
|
@ -7,6 +7,7 @@
|
||||
"modules-left": [
|
||||
"custom/appmenuicon",
|
||||
"wlr/taskbar",
|
||||
"custom/pomodoro"
|
||||
],
|
||||
"modules-center": [
|
||||
"hyprland/workspaces",
|
||||
|
BIN
.config/waybar/custom/placeholder.jpg
Normal file
BIN
.config/waybar/custom/placeholder.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
@ -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) }})\"}")
|
||||
|
||||
|
27
.config/waybar/custom/pomodoro.sh
Executable file
27
.config/waybar/custom/pomodoro.sh
Executable file
@ -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}"
|
||||
|
@ -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": "<span color=\"#f53c3c\"></span> ",
|
||||
"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}%",
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user