This commit is contained in:
2025-08-13 21:46:48 +02:00
commit c3e2e6509b
818 changed files with 54187 additions and 0 deletions

3
waybar/.github/README.md vendored Normal file
View File

@@ -0,0 +1,3 @@
<div align="center">
<a href=""><img src="./title.png"></a>
</div>

BIN
waybar/.github/title.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

30
waybar/bars/bar-1.jsonc Normal file
View File

@@ -0,0 +1,30 @@
{
"include": [
"~/.config/waybar/modules/custom-cava.jsonc",
"~/.config/waybar/modules/custom-wf-recorder.jsonc",
"~/.config/waybar/modules/custom-updates.jsonc",
"~/.config/waybar/modules/custom-music.jsonc",
"~/.config/waybar/modules/custom-logo.jsonc",
"~/.config/waybar/modules/custom-notifications.jsonc",
"~/.config/waybar/modules/custom-weather.jsonc",
"~/.config/waybar/modules/hyprland-language.jsonc",
"~/.config/waybar/modules/hyprland-workspaces.jsonc",
"~/.config/waybar/modules/clock-1.jsonc",
"~/.config/waybar/modules/pulseaudio.jsonc",
],
"modules-left": [
"custom/arch",
"hyprland/workspaces",
"custom/cava",
"custom/wf-recorder",
],
"modules-center": ["custom/music"],
"modules-right": [
"custom/updates",
"hyprland/language",
"custom/weather",
"clock#cl1",
"pulseaudio",
"custom/notifications",
],
}

25
waybar/bars/bar-2.jsonc Normal file
View File

@@ -0,0 +1,25 @@
{
"include": [
"~/.config/waybar/modules/cpu.jsonc",
"~/.config/waybar/modules/memory.jsonc",
"~/.config/waybar/modules/custom-gpu-usage.jsonc",
"~/.config/waybar/modules/temperature-gpu.jsonc",
"~/.config/waybar/modules/temperature-cpu.jsonc",
"~/.config/waybar/modules/custom-logo.jsonc",
"~/.config/waybar/modules/custom-notifications.jsonc",
"~/.config/waybar/modules/hyprland-window.jsonc",
"~/.config/waybar/modules/hyprland-workspaces.jsonc",
"~/.config/waybar/modules/network.jsonc",
],
"modules-left": ["custom/arch", "hyprland/workspaces"],
"modules-center": ["hyprland/window"],
"modules-right": [
"network",
"memory",
"cpu",
"temperature#cpu",
"custom/gpu-usage",
"temperature#gpu",
"custom/notifications",
],
}

12
waybar/bars/bar-3.jsonc Normal file
View File

@@ -0,0 +1,12 @@
{
"include": [
"~/.config/waybar/modules/clock-2.jsonc",
"~/.config/waybar/modules/custom-logo.jsonc",
"~/.config/waybar/modules/custom-notifications.jsonc",
"~/.config/waybar/modules/hyprland-workspaces.jsonc",
"~/.config/waybar/modules/tray.jsonc",
],
"modules-left": ["custom/arch", "hyprland/workspaces"],
"modules-center": ["clock#cl2"],
"modules-right": ["tray", "custom/notifications"],
}

33
waybar/bars/main.jsonc Normal file
View File

@@ -0,0 +1,33 @@
{
"include": [
"~/.config/waybar/modules/custom-logo.jsonc",
"~/.config/waybar/modules/custom-notifications.jsonc",
"~/.config/waybar/modules/clock-1.jsonc",
"~/.config/waybar/modules/pulseaudio.jsonc",
"~/.config/waybar/modules/cpu.jsonc",
"~/.config/waybar/modules/memory.jsonc",
"~/.config/waybar/modules/temperature.cpu.jsonc",
"~/.config/waybar/modules/battery.jsonc",
"~/.config/waybar/modules/network.jsonc",
"~/.config/waybar/modules/wireguard.jsonc",
"~/.config/waybar/modules/docker.jsonc",
],
"modules-left": [
"custom/arch",
"clock#cl1",
],
"modules-center": [
"cpu",
"memory",
"temperature#cpu",
"battery",
],
"modules-right": [
"custom/docker",
"custom/wireguard",
"network",
"pulseaudio",
"custom/notifications",
],
}

16
waybar/config.jsonc Normal file
View File

@@ -0,0 +1,16 @@
[
{
"include": "~/.config/waybar/bars/main.jsonc",
"height": 50,
"layer": "top",
"output": "eDP-1",
"mode": "dock",
"exclusive": true,
"passtrough": false,
"gtk-layer-shell": true,
"margin-top": 5,
"margin-left": 5,
"margin-bottom": 0,
"margin-right": 5,
},
]

View File

@@ -0,0 +1,9 @@
{
"backlight": {
"device": "intel_backlight",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""],
"on-scroll-up": "swayosd-client --brightness +10",
"on-scroll-down": "swayosd-client --brightness -10",
},
}

View File

@@ -0,0 +1,15 @@
{
"battery": {
"format": "{capacity}% {icon}",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{time} {icon}",
"format-icons": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"],
"interval": 5,
"states": {
"warning": 30,
"critical": 10,
},
"tooltip": false,
},
}

View File

@@ -0,0 +1,14 @@
{
"bluetooth": {
"format": "",
"format-disabled": "",
"format-connected": " {num_connections}",
"format-connected-battery": "{icon} {num_connections}",
"format-icons": ["󰥇", "󰤾", "󰤿", "󰥀", "󰥁", "󰥂", "󰥃", "󰥄", "󰥅", "󰥆", "󰥈"],
"tooltip-format": "{controller_alias}\n{num_connections} connected",
"tooltip-format-connected": "{controller_alias}\n{num_connections} connected\n\n{device_enumerate}",
"tooltip-format-enumerate-connected": "{device_alias}",
"tooltip-format-enumerate-connected-battery": "{device_alias}\t{icon} {device_battery_percentage}%",
"on-click": "pypr toggle bluetooth",
},
}

View File

@@ -0,0 +1,30 @@
{
"clock#cl1": {
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"calendar": {
"mode": "month",
"mode-mon-col": 3,
"weeks-pos": "right",
"on-scroll": 1,
"on-click-right": "mode",
"format": {
"months": "<span color='#eed49f'><b>{}</b></span>",
"days": "<span color='#cad3f5'><b>{}</b></span>",
"weeks": "<span color='#8aadf4'><b>W{}</b></span>",
"weekdays": "<span color='#8bd5ca'><b>{}</b></span>",
"today": "<span color='#ed8796'><b><u>{}</u></b></span>",
},
},
"interval": 1,
"format": "{:%H:%M:%OS}  ",
"format-alt": "{:%A, %B %d, %Y}  ",
"actions": {
"on-click-right": "mode",
"on-click-forward": "tz_up",
"on-click-backward": "tz_down",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down",
},
"on-click-middle": "thunderbird -calendar && hyprctl dispatch workspace 23",
},
}

View File

@@ -0,0 +1,28 @@
{
"clock#cl2": {
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"calendar": {
"mode": "year",
"mode-mon-col": 3,
"weeks-pos": "right",
"on-scroll": 1,
"on-click-right": "mode",
"format": {
"months": "<span color='#eed49f'><b>{}</b></span>",
"days": "<span color='#cad3f5'><b>{}</b></span>",
"weeks": "<span color='#8aadf4'><b>W{}</b></span>",
"weekdays": "<span color='#8bd5ca'><b>{}</b></span>",
"today": "<span color='#ed8796'><b><u>{}</u></b></span>",
},
},
"format": "{:%H:%M  - %A, %B %d, %Y  }",
"actions": {
"on-click-right": "mode",
"on-click-forward": "tz_up",
"on-click-backward": "tz_down",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down",
},
"on-click-middle": "thunderbird -calendar && hyprctl dispatch workspace 23",
},
}

8
waybar/modules/cpu.jsonc Normal file
View File

@@ -0,0 +1,8 @@
{
"cpu": {
"on-click": "pypr toggle btop",
"format": "CPU: {usage}%",
"tooltip": false,
"interval": 2,
},
}

View File

@@ -0,0 +1,19 @@
{
"custom/cava": {
"exec": "~/.config/waybar/scripts/cava.sh",
"format": "{}",
"format-icons": [
"<span foreground='#cba6f7'>▁</span>",
"<span foreground='#cba6f7'>▂</span>",
"<span foreground='#cba6f7'>▃</span>",
"<span foreground='#cba6f7'>▄</span>",
"<span foreground='#89b4fa'>▅</span>",
"<span foreground='#89b4fa'>▆</span>",
"<span foreground='#89b4fa'>▇</span>",
"<span foreground='#89b4fa'>█</span>",
],
"on-click": "kitty --class center-float-mini cava",
"on-click-right": "qpwgraph",
"on-click-middle": "easyeffects",
},
}

View File

@@ -0,0 +1,9 @@
{
"custom/gpu-usage": {
"exec": "cat /sys/class/hwmon/hwmon4/device/gpu_busy_percent",
"on-click": "pypr toggle nvtop",
"format": "GPU: {}%",
"return-type": "",
"interval": 2,
},
}

View File

@@ -0,0 +1,8 @@
{
"custom/arch": {
"format": "  ",
"tooltip": false,
"on-click": "sleep 0.1 && rofi -show drun",
"on-click-right": "~/.config/rofi/scripts/powermenu/powermenu",
},
}

View File

@@ -0,0 +1,13 @@
{
"custom/music": {
"format": "{0}",
"return-type": "json",
"max-length": 100,
"escape": true,
"tooltip": true,
"exec": "~/.config/waybar/scripts/mediaplayer.py --player spotify",
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous",
},
}

View File

@@ -0,0 +1,22 @@
{
"custom/notifications": {
"tooltip": false,
"format": "{} {icon}",
"format-icons": {
"notification": "<span foreground='red'><sup></sup></span>",
"none": "",
"dnd-notification": "<span foreground='red'><sup></sup></span>",
"dnd-none": "",
"inhibited-notification": "<span foreground='red'><sup></sup></span>",
"inhibited-none": "",
"dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>",
"dnd-inhibited-none": "",
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "sleep 0.1 && swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true,
},
}

View File

@@ -0,0 +1,15 @@
{
"custom/updates": {
"format": "{} {icon}",
"return-type": "json",
"tooltip": true,
"format-icons": {
"pending-updates": " ",
"updated": " ",
},
"exec-if": "which waybar-updates",
"exec": "waybar-updates",
"on-click": "pypr toggle topgrade-system",
"on-click-right": "pypr toggle topgrade-all",
},
}

View File

@@ -0,0 +1,13 @@
{
"custom/weather": {
"exec-if": "which wttrbar",
"exec": "wttrbar --location Alicante",
"restart-interval": 300,
"tooltip": true,
"format": "{}°",
"return-type": "json",
"on-click": "kitty --hold --class center-float fish -c 'wttr Alicante'",
"on-click-right": "kitty --hold --class center-float fish -c 'wttr -v2 Alicante'",
"on-click-middle": "xdg-open https://wttr.in/alicante",
},
}

View File

@@ -0,0 +1,11 @@
{
"custom/wf-recorder": {
"format": "{}",
"interval": "once",
"exec": "echo ''",
"tooltip": "false",
"exec-if": "pgrep 'wf-recorder'",
"on-click": "exec $HOME/.config/hypr/scripts/rofi/recording",
"signal": 8,
},
}

View File

@@ -0,0 +1,12 @@
{
"custom/docker": {
//"exec-if": "which wg",
"exec": "/home/timo/.config/waybar/scripts/get_docker_status.sh",
"return-type": "json",
"format": " {}",
"interval": 5,
"tooltip": "true",
//"on-click": "pypr toggle network",
//"on-click-right": "pypr toggle wifi",
},
}

View File

@@ -0,0 +1,8 @@
{
"hyprland/language": {
"format": "{}",
"format-en": " US",
"format-es": " ES",
"on-click": "hyprctl switchxkblayout evision-usb-device next",
},
}

View File

@@ -0,0 +1,14 @@
{
"hyprland/window": {
"format": "{}",
"max-length": 80,
"rewrite": {
"(.*) — Mozilla Firefox": "$1 󰇧",
"(.*) — Ablaze Floorp": "$1 󰇧",
"(.*)VSCodium": "Codium 󰨞",
"(.*)Spotify": "Spotify 󰓇",
"(.*)Steam": "Steam 󰓓",
},
"separate-outputs": false,
},
}

View File

@@ -0,0 +1,42 @@
{
"hyprland/workspaces": {
"disable-scroll": true,
"active-only": false,
"all-outputs": false,
"enable-bar-scroll": true,
"format": "{icon}",
"format-icons": {
"1": "󰇧",
"2": "",
"3": "",
"4": "",
"5": "🎜",
"6": "",
"7": "",
"8": "",
"9": "",
"10": "󰇧",
"11": "",
"12": "",
"13": "",
"14": "🎜",
"15": "",
"16": "",
"17": "",
"18": "",
"19": "",
"20": "󰍨",
"21": "✉",
"22": "🖵",
"23": "󰇧",
"24": "",
"25": "",
"26": "",
"27": "",
},
"on-scroll-up": "hyprctl dispatch workspace r-1",
"on-scroll-down": "hyprctl dispatch workspace r+1",
"on-click": "activate",
"sort-by-number": true,
},
}

View File

@@ -0,0 +1,8 @@
{
"memory": {
"format": "{}%  ",
"on-click": "pypr toggle btop",
"tooltip": true,
"interval": 2,
},
}

View File

@@ -0,0 +1,14 @@
{
"network": {
"format-wifi": " {essid}",
"format-ethernet": "󰈀 {ifname}",
"tooltip-format-wifi": "Network: <b>{essid}</b>\nSignal strength: <b>{signaldBm}dBm ({signalStrength}%)</b>\nFrequency: <b>{frequency}MHz</b>\nInterface: <b>{ifname}</b>\nIP: <b>{ipaddr}/{cidr}</b>\nGateway: <b>{gwaddr}</b>\nNetmask: <b>{netmask}</b>\n<span foreground='#eed49f'> {bandwidthDownBytes}</span> <span foreground='#b7bdf8'> {bandwidthUpBytes}</span>",
"tooltip-format-ethernet": "Network: <b>{essid}</b>\nInterface: <b>{ifname}</b>\nIP: <b>{ipaddr}/{cidr}</b>\nGateway: <b>{gwaddr}</b>\nNetmask: <b>{netmask}</b>\n<span foreground='#eed49f'> {bandwidthDownBytes}</span> <span foreground='#b7bdf8'> {bandwidthUpBytes}</span>",
"format-linked": "󰈀 {ifname} (No IP)",
"format-disconnected": "󰖪 ",
"tooltip": true,
"interval": 2,
//"on-click": "pypr toggle network",
//"on-click-right": "pypr toggle wifi",
},
}

View File

@@ -0,0 +1,25 @@
{
"pulseaudio": {
"format": "{icon} {volume}% {format_source}",
"format-bluetooth": "{icon} {volume}% {format_source}",
"format-bluetooth-muted": "  {volume}% {format_source}",
"format-muted": " {format_source}",
"format-source": " ",
"format-source-muted": " ",
"format-icons": {
"headphone": " ",
"hands-free": " ",
"headset": " ",
"phone": " ",
"portable": " ",
"car": " ",
"default": [" ", " ", " "],
},
"tooltip-format": "{desc}, {volume}%",
"on-click": "swayosd-client --output-volume mute-toggle",
"on-click-right": "swayosd-client --input-volume mute-toggle",
"on-click-middle": "pypr toggle volume",
"on-scroll-up": "swayosd-client --output-volume +1",
"on-scroll-down": "swayosd-client --output-volume -1",
},
}

View File

@@ -0,0 +1,12 @@
{
"temperature#cpu": {
"critical-threshold": 90,
"on-click": "pypr toggle btop",
"hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"format-critical": "{icon} {temperatureC}°C",
"format": "{icon} {temperatureC}°C",
"format-icons": ["", "", ""],
"tooltip": true,
"interval": 2,
},
}

View File

@@ -0,0 +1,12 @@
{
"temperature#gpu": {
"critical-threshold": 80,
"on-click": "pypr toggle nvtop",
"hwmon-path": "/sys/class/hwmon/hwmon4/temp1_input",
"format-critical": "{icon} {temperatureC}°C",
"format": "{icon} {temperatureC}°C",
"format-icons": ["", "", ""],
"tooltip": true,
"interval": 2,
},
}

View File

@@ -0,0 +1,5 @@
{
"tray": {
"spacing": 10,
},
}

View File

@@ -0,0 +1,12 @@
{
"custom/wireguard": {
//"exec-if": "which wg",
"exec": "/home/timo/.config/waybar/scripts/get_wg_status.sh",
"return-type": "json",
"format": "󰒄 {}",
"interval": 5,
"tooltip": "true",
//"on-click": "pypr toggle network",
//"on-click-right": "pypr toggle wifi",
},
}

42
waybar/scripts/cava.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
bar="▁▂▃▄▅▆▇█"
dict="s/;//g"
bar_length=${#bar}
for ((i = 0; i < bar_length; i++)); do
dict+=";s/$i/${bar:$i:1}/g"
done
config_file="/tmp/bar_cava_config"
cat >"$config_file" <<EOF
[general]
bars = 15
[input]
method = pulse
source = auto
[output]
method = raw
raw_target = /dev/stdout
data_format = ascii
ascii_max_range = 7
[color]
gradient = 1
gradient_color_1 = '#8bd5ca'
gradient_color_2 = '#91d7e3'
gradient_color_3 = '#7dc4e4'
gradient_color_4 = '#8aadf4'
gradient_color_5 = '#c6a0f6'
gradient_color_6 = '#f5bde6'
gradient_color_7 = '#ee99a0'
gradient_color_8 = '#ed8796'
EOF
pkill -f "cava -p $config_file"
cava -p "$config_file" | sed -u "$dict"

View File

@@ -0,0 +1,7 @@
#!/bin/bash
# Read docker ps output and format
docker_ps_output=$(docker ps --format '{{.Names}}: <b>{{.Image}}</b>\n' | column -t -o ' ' | sed ':a;N;$!ba;s/\n/\\n/g')
active_container_cnt=$(echo -e $docker_ps_output | grep -c "<b>")
echo "{ \"text\": \"$active_container_cnt\", \"tooltip\": \"$docker_ps_output\", \"class\": \"\", \"percentage\": 0 }"

56
waybar/scripts/get_wg_status.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
# Function to format output as JSON
function format {
local tooltip=""
local first=true
while IFS= read -r line; do
if [[ -z "$line" ]]; then
continue
fi
# Check if the line starts with "interface" or "peer"
if [[ "$line" == interface:* ]]; then
if [ "$first" = false ]; then
tooltip+="\n"
fi
tooltip+="Interface: <b>${line#*: }</b>"
first=false
elif [[ "$line" == peer:* ]]; then
if [ "$first" = false ]; then
tooltip+="\n"
fi
tooltip+="Peer: <b>${line#*: }</b>"
first=false
elif [[ "$line" == *"received,"* ]]; then
# Extract received and sent data
received=$(echo "$line" | grep -oP '\d+\.\d+ (B|KiB|MiB|GiB) received' | awk '{print $1 " " $2}')
sent=$(echo "$line" | grep -oP '\d+\.\d+ (B|KiB|MiB|GiB) sent' | awk '{print $1 " " $2}')
tooltip+="\n<span foreground='#eed49f'> $received</span> <span foreground='#b7bdf8'> $sent</span>"
else
# For other lines
if [ "$first" = false ]; then
tooltip+="\n"
fi
key=$(echo "$line" | sed "s/ //" | awk -F ': ' '{print $1}')
value=$(echo "$line" | awk -F ': ' '{print $2}')
tooltip+="$key: <b>$value</b>"
first=false
fi
done
echo "$tooltip"
}
# Read wg show output and format
wg_show_output=$(sudo wg show)
if [[ -z $wg_show_output ]]; then
echo "{ \"text\": \"---\", \"tooltip\": \"disconnected\", \"class\": \"\", \"percentage\": 0 }"
else
tooltip=$(echo "$wg_show_output" | format)
echo "{ \"text\": \"$(echo $wg_show_output | grep -o 'wg[0-9]*')\", \"tooltip\": \"$tooltip\", \"class\": \"\", \"percentage\": 0 }"
fi

218
waybar/scripts/mediaplayer.py Executable file
View File

@@ -0,0 +1,218 @@
#!/usr/bin/env python3
import gi
gi.require_version("Playerctl", "2.0")
from gi.repository import Playerctl, GLib
from gi.repository.Playerctl import Player
import argparse
import logging
import sys
import signal
import gi
import json
import os
from typing import List
logger = logging.getLogger(__name__)
def signal_handler(sig, frame):
logger.info("Received signal to stop, exiting")
sys.stdout.write("\n")
sys.stdout.flush()
# loop.quit()
sys.exit(0)
class PlayerManager:
def __init__(self, selected_player=None, excluded_player=[]):
self.manager = Playerctl.PlayerManager()
self.loop = GLib.MainLoop()
self.manager.connect(
"name-appeared", lambda *args: self.on_player_appeared(*args)
)
self.manager.connect(
"player-vanished", lambda *args: self.on_player_vanished(*args)
)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
self.selected_player = selected_player
self.excluded_player = excluded_player.split(",") if excluded_player else []
self.init_players()
def init_players(self):
for player in self.manager.props.player_names:
if player.name in self.excluded_player:
continue
if self.selected_player is not None and self.selected_player != player.name:
logger.debug(f"{player.name} is not the filtered player, skipping it")
continue
self.init_player(player)
def run(self):
logger.info("Starting main loop")
self.loop.run()
def init_player(self, player):
logger.info(f"Initialize new player: {player.name}")
player = Playerctl.Player.new_from_name(player)
player.connect("playback-status", self.on_playback_status_changed, None)
player.connect("metadata", self.on_metadata_changed, None)
self.manager.manage_player(player)
self.on_metadata_changed(player, player.props.metadata)
def get_players(self) -> List[Player]:
return self.manager.props.players
def write_output(self, text, player):
logger.debug(f"Writing output: {text}")
output = {
"text": text,
"class": "custom-" + player.props.player_name,
"alt": player.props.player_name,
}
sys.stdout.write(json.dumps(output) + "\n")
sys.stdout.flush()
def clear_output(self):
sys.stdout.write("\n")
sys.stdout.flush()
def on_playback_status_changed(self, player, status, _=None):
logger.debug(
f"Playback status changed for player {player.props.player_name}: {status}"
)
self.on_metadata_changed(player, player.props.metadata)
def get_first_playing_player(self):
players = self.get_players()
logger.debug(f"Getting first playing player from {len(players)} players")
if len(players) > 0:
# if any are playing, show the first one that is playing
# reverse order, so that the most recently added ones are preferred
for player in players[::-1]:
if player.props.status == "Playing":
return player
# if none are playing, show the first one
return players[0]
else:
logger.debug("No players found")
return None
def show_most_important_player(self):
logger.debug("Showing most important player")
# show the currently playing player
# or else show the first paused player
# or else show nothing
current_player = self.get_first_playing_player()
if current_player is not None:
self.on_metadata_changed(current_player, current_player.props.metadata)
else:
self.clear_output()
def on_metadata_changed(self, player, metadata, _=None):
logger.debug(f"Metadata changed for player {player.props.player_name}")
player_name = player.props.player_name
artist = player.get_artist()
title = player.get_title()
title = title.replace("&", "&amp;")
track_info = ""
if (
player_name == "spotify"
and "mpris:trackid" in metadata.keys()
and ":ad:" in player.props.metadata["mpris:trackid"]
):
track_info = "Advertisement"
elif artist is not None and title is not None:
track_info = f"{artist} - {title}"
else:
track_info = title
if track_info:
if player.props.status != "Playing":
track_info = "" + track_info
# only print output if no other player is playing
current_playing = self.get_first_playing_player()
if (
current_playing is None
or current_playing.props.player_name == player.props.player_name
):
self.write_output(track_info, player)
else:
logger.debug(
f"Other player {current_playing.props.player_name} is playing, skipping"
)
def on_player_appeared(self, _, player):
logger.info(f"Player has appeared: {player.name}")
if player.name in self.excluded_player:
logger.debug(
"New player appeared, but it's in exclude player list, skipping"
)
return
if player is not None and (
self.selected_player is None or player.name == self.selected_player
):
self.init_player(player)
else:
logger.debug(
"New player appeared, but it's not the selected player, skipping"
)
def on_player_vanished(self, _, player):
logger.info(f"Player {player.props.player_name} has vanished")
self.show_most_important_player()
def parse_arguments():
parser = argparse.ArgumentParser()
# Increase verbosity with every occurrence of -v
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-x", "--exclude", "- Comma-separated list of excluded player")
# Define for which player we"re listening
parser.add_argument("--player")
parser.add_argument("--enable-logging", action="store_true")
return parser.parse_args()
def main():
arguments = parse_arguments()
# Initialize logging
if arguments.enable_logging:
logfile = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "media-player.log"
)
logging.basicConfig(
filename=logfile,
level=logging.DEBUG,
format="%(asctime)s %(name)s %(levelname)s:%(lineno)d %(message)s",
)
# Logging is set by default to WARN and higher.
# With every occurrence of -v it's lowered by one
logger.setLevel(max((3 - arguments.verbose) * 10, 0))
logger.info("Creating player manager")
if arguments.player:
logger.info(f"Filtering for player: {arguments.player}")
if arguments.exclude:
logger.info(f"Exclude player {arguments.exclude}")
player = PlayerManager(arguments.player, arguments.exclude)
player.run()
if __name__ == "__main__":
main()

403
waybar/style.css Normal file
View File

@@ -0,0 +1,403 @@
/* Variables */
@define-color mantle #1e2030;
@define-color base rgb(36, 39, 58);
@define-color text #cad3f5;
@define-color surface0 #363a4f;
@define-color surface2 #5b6078;
@define-color blue #8aadf4;
@define-color green #a6da95;
@define-color peach #f5a97f;
@define-color rosewater #f4dbd6;
@define-color lavender #b7bdf8;
@define-color yellow #eed49f;
@define-color red #ed8796;
@define-color maroon #ee99a0;
@define-color teal #8bd5ca;
@define-color sky #91d7e3;
@define-color sapphire #7dc4e4;
@define-color mauve #c6a0f6;
@define-color pink #f5bde6;
@define-color border rgba(183, 189, 248, 0.4);
@define-color shadow rgb(30, 32, 48);
* {
font-family: JetBrainsMono Nerd Font;
font-size: 13px;
min-height: 0;
}
/* General Settings */
#battery,
#cava,
#custom-cava,
#custom-clipboard,
#custom-notifications,
#custom-arch,
#custom-gpu-usage,
#custom-updates,
#mode,
#cpu,
#memory,
#temperature,
#custom-music,
#custom-fans,
#clock,
#idle_inhibitor,
#bluetooth,
#custom-wf-recorder,
#pulseaudio,
#backlight,
#network,
#tray,
#custom-power-menu,
#language,
#window,
#custom-weather,
#custom-weather.severe,
#custom-weather.sunnyDay,
#custom-weather.clearNight,
#custom-weather.cloudyFoggyDay,
#custom-weather.cloudyFoggyNight,
#custom-weather.rainyDay,
#custom-weather.rainyNight,
#custom-weather.showyIcyDay,
#custom-weather.snowyIcyNight,
#custom-weather.default,
#custom-wireguard,
#custom-docker {
background-color: alpha(@base, 0.9);
padding: 0 10px;
margin: 2px 4px 5px 4px;
border-radius: 10px;
box-shadow: 3px 3px 1px 1px alpha(@shadow, 0.7);
border: 2px solid @border;
background-clip: padding-box;
}
window#waybar {
color: @text;
background: transparent;
}
window#waybar.hidden {
opacity: 0;
}
#workspaces * {
font-size: 14px;
}
#workspaces button label {
color: @lavender;
font-weight: bolder;
transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.68);
}
#workspaces button.active label {
color: @base;
font-weight: bolder;
}
#workspaces button.urgent {
background-color: @red;
}
#workspaces button.urgent label {
color: @base;
font-weight: bolder;
}
#workspaces {
background-color: alpha(@base, 0.9);
border: 2px solid @border;
padding: 0 10px;
margin: 2px 4px 5px 4px;
box-shadow: 3px 3px 1px 1px alpha(@shadow, 0.7);
border-radius: 10px;
background-clip: padding-box;
}
#workspaces button {
border-radius: 15px;
margin-right: 3px;
margin-left: 3px;
margin-top: 3px;
margin-bottom: 3px;
padding: 0 5px;
font-weight: bolder;
min-width: 20px;
color: @base;
transition: all 0.3s cubic-bezier(0.55, -0.68, 0.48, 1.682);
}
#workspaces button.active {
padding-right: 6px;
padding-left: 6px;
box-shadow: 3px 3px 1px 1px alpha(@shadow, 0.7);
padding-bottom: 3px;
margin-top: 5px;
margin-bottom: 5px;
background: linear-gradient(
52deg,
rgba(139, 213, 202, 1) 0%,
rgba(138, 173, 244, 1) 30%,
rgba(183, 189, 248, 1) 48%,
rgba(198, 160, 246, 1) 77%,
rgba(238, 153, 160, 1) 100%
);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
transition: all 0.3s cubic-bezier(0.55, -0.68, 0.48, 1.682);
color: @mauve;
border-radius: 12px;
}
#workspaces button:hover {
background-color: @surface0;
}
#workspaces button.focused:hover {
background-color: alpha(@base, 0.9);
}
#workspaces button.focused:hover label {
color: @text;
}
/* Individual Modules */
#battery {
color: @mauve;
}
#battery.warning {
color: @yellow;
}
#battery.critical {
color: @peach;
}
#battery.urgent {
color: @red;
}
#custom-cava {
color: @lavender;
border-radius: 12px;
}
#cpu,
#custom-docker {
color: @blue;
transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.68);
}
#memory {
color: @green;
transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.68);
}
#custom-notifications {
color: @yellow;
}
#custom-weather {
color: @red;
}
#custom-updates {
color: @teal;
}
#custom-wf-recorder {
color: @red;
}
#custom-gpu-temp {
color: @peach;
}
#custom-gpu-usage {
color: @teal;
}
#custom-power-menu,
#custom-wireguard {
color: @red;
}
#temperature {
color: @peach;
}
#bluetooth {
color: @blue;
}
#window {
background: linear-gradient(
52deg,
rgba(139, 213, 202, 1) 0%,
rgba(138, 173, 244, 1) 30%,
rgba(183, 189, 248, 1) 48%,
rgba(198, 160, 246, 1) 77%,
rgba(238, 153, 160, 1) 100%
);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
text-shadow: 0px 0px 5px @lavender;
font-weight: bold;
color: @mantle;
transition: all 0.3s cubic-bezier(0.55, -0.68, 0.48, 1.682);
border: none;
}
#temperature.critical {
background-color: @red;
color: @mantle;
}
#custom-music {
background: @lavender;
background: linear-gradient(
52deg,
rgba(139, 213, 202, 1) 0%,
rgba(138, 173, 244, 1) 30%,
rgba(183, 189, 248, 1) 48%,
rgba(198, 160, 246, 1) 77%,
rgba(238, 153, 160, 1) 100%
);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
text-shadow: 0px 0px 5px @border;
font-weight: bold;
color: @mantle;
transition: all 0.3s cubic-bezier(0.55, -0.68, 0.48, 1.682);
border: none;
}
#custom-fans {
color: @green;
}
#clock {
color: @lavender;
}
#language {
color: @blue;
}
#pulseaudio {
color: @pink;
}
#pulseaudio.muted {
background-color: @red;
color: @mantle;
}
#pulseaudio.source-muted {
background-color: @peach;
color: @mantle;
}
#backlight {
color: @blue;
}
#battery {
color: @green;
}
#battery.charging,
#battery.plugged {
background-color: @green;
color: @mantle;
}
#battery.critical:not(.charging) {
background-color: @red;
color: @mantle;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#network {
color: @sky;
}
#network.disconnected {
background-color: @red;
color: @mantle;
}
#network.linked {
background-color: @peach;
color: @mantle;
}
#clock.cl2 {
background: @lavender;
background: linear-gradient(
52deg,
rgba(139, 213, 202, 1) 0%,
rgba(138, 173, 244, 1) 30%,
rgba(183, 189, 248, 1) 48%,
rgba(198, 160, 246, 1) 77%,
rgba(238, 153, 160, 1) 100%
);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
text-shadow: 0px 0px 5px @border;
font-weight: bold;
color: @mantle;
transition: all 0.3s cubic-bezier(0.55, -0.68, 0.48, 1.682);
border: none;
}
/* Animation Keyframes */
@keyframes blink {
to {
background-color: alpha(@base, 0.9);
color: @red;
}
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@keyframes gradient_f {
0% {
background-position: 0% 200%;
}
50% {
background-position: 200% 0%;
}
100% {
background-position: 400% 200%;
}
}
@keyframes gradient_f_nh {
0% {
background-position: 0% 200%;
}
100% {
background-position: 200% 200%;
}
}