diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc index 2b3783b2..ad873bf8 100644 --- a/config/waybar/config.jsonc +++ b/config/waybar/config.jsonc @@ -1,19 +1,12 @@ { "reload_style_on_change": true, "layer": "top", - "position": "top", + "position": "left", "spacing": 0, "height": 26, - "modules-left": ["custom/omarchy", "hyprland/workspaces"], - "modules-center": ["clock", "custom/weather", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"], - "modules-right": [ - "group/tray-expander", - "bluetooth", - "network", - "pulseaudio", - "cpu", - "battery" - ], + "modules-left": ["custom/clock", "custom/weather", "cpu", "memory"], + "modules-center": ["custom/update", "hyprland/workspaces", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"], + "modules-right": ["group/tray-expander", "bluetooth", "network", "pulseaudio", "battery"], "hyprland/workspaces": { "on-click": "activate", "format": "{icon}", @@ -36,15 +29,14 @@ "2": [], "3": [], "4": [], - "5": [] + "5": [], + "6": [], + "7": [], + "8": [], + "9": [], + "10": [] } }, - "custom/omarchy": { - "format": "\ue900", - "on-click": "omarchy-menu", - "on-click-right": "xdg-terminal-exec", - "tooltip-format": "Omarchy Menu\n\nSuper + Alt + Space" - }, "custom/update": { "format": "", "exec": "omarchy-update-available", @@ -53,18 +45,23 @@ "signal": 7, "interval": 21600 }, - "cpu": { - "interval": 5, - "format": "󰍛", - "on-click": "omarchy-launch-or-focus-tui btop", - "on-click-right": "alacritty" + "interval": 2, + "format": "{icon} ", + "format-icons": ["󰪞", "󰪟", "󰪠", "󰪡", "󰪢", "󰪣", "󰪤", "󰪥"], + "on-click": "omarchy-launch-or-focus-tui btop" }, - "clock": { - "format": "{:L%A %H:%M}", - "format-alt": "{:L%d %B W%V %Y}", - "tooltip": false, - "on-click-right": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select" + "memory": { + "interval": 2, + "format": "{icon} ", + "format-icons": ["󰪞", "󰪟", "󰪠", "󰪡", "󰪢", "󰪣", "󰪤", "󰪥"], + "on-click": "omarchy-launch-or-focus-tui btop" + }, + "custom/clock": { + "exec": "$OMARCHY_PATH/default/waybar/clock.sh", + "return-type": "json", + "on-click": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select", + "tooltip": true }, "custom/weather": { "exec": "$OMARCHY_PATH/default/waybar/weather.sh", @@ -73,6 +70,15 @@ "tooltip": false, "on-click": "notify-send -u low \"$(omarchy-weather-status)\"" }, + "custom/media": { + "exec": "$OMARCHY_PATH/default/waybar/media.sh", + "return-type": "json", + "interval": 1, + "on-click": "$OMARCHY_PATH/default/waybar/media_click.sh", + "on-click-right": "playerctl -p subtui next", + "on-click-middle": "playerctl -p subtui previous", + "tooltip": true + }, "network": { "format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], "format": "{icon}", diff --git a/config/waybar/style.css b/config/waybar/style.css index 63302efa..f56abaf5 100644 --- a/config/waybar/style.css +++ b/config/waybar/style.css @@ -3,7 +3,6 @@ * { background-color: @background; color: @foreground; - border: none; border-radius: 0; min-height: 0; @@ -12,18 +11,18 @@ } .modules-left { - margin-left: 8px; + margin-bottom: 8px; } .modules-right { - margin-right: 8px; + margin-top: 8px; } #workspaces button { all: initial; - padding: 0 6px; - margin: 0 1.5px; - min-width: 9px; + padding: 6px 0; + margin: 1.5px 0; + min-height: 9px; } #workspaces button.empty { @@ -31,28 +30,29 @@ } #cpu, +#memory, +#custom-media, #battery, #pulseaudio, -#custom-omarchy, #custom-update { - min-width: 12px; - margin: 0 7.5px; + min-height: 12px; + margin: 7.5px 0; } #tray { - margin-right: 16px; + margin-top: 16px; } #bluetooth { - margin-right: 17px; + margin-top: 17px; } #network { - margin-right: 13px; + margin-top: 13px; } #custom-expand-icon { - margin-right: 18px; + margin-top: 18px; } tooltip { @@ -63,17 +63,17 @@ tooltip { font-size: 10px; } -#clock { - margin-left: 8.75px; +#custom-clock { + margin-bottom: 8.75px; } #custom-weather { - margin-left: 7.5px; - margin-right: 7.5px; + margin-bottom: 7.5px; + margin-top: 7.5px; } #custom-weather.unavailable { - min-width: 0; + min-height: 0; margin: 0; padding: 0; } @@ -85,11 +85,11 @@ tooltip { #custom-screenrecording-indicator, #custom-idle-indicator, #custom-notification-silencing-indicator { - min-width: 12px; - margin-left: 5px; - margin-right: 0; + min-height: 12px; + margin-bottom: 5px; + margin-top: 0; font-size: 10px; - padding-bottom: 1px; + padding-right: 1px; } #custom-screenrecording-indicator.active { @@ -102,8 +102,8 @@ tooltip { } #custom-voxtype { - min-width: 12px; - margin: 0 0 0 7.5px; + min-height: 12px; + margin: 0 0 7.5px 0; } #custom-voxtype.recording { diff --git a/default/waybar/clock.sh b/default/waybar/clock.sh new file mode 100644 index 00000000..48729c13 --- /dev/null +++ b/default/waybar/clock.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +print_status() { + time=$(date +"%H:%M") + date=$(date +"%d/%m") + + # tooltip complet + full_date=$(date +"%A %d %B %Y %H:%M:%S") + calendar=$(cal -m) + esc_calendar=$(sed 's/&/&/g; s//>/g' <<< "$calendar") + + text="$time +$date" + + tooltip="$full_date + +$esc_calendar" + + jq -nc \ + --arg text "$text" \ + --arg tooltip "$tooltip" \ + '{ text: $text, tooltip: $tooltip }' +} + +print_status + +last="" + +while true; do + current=$(date +"%H%M%S%Y%m%d") + + if [[ "$current" != "$last" ]]; then + print_status + last="$current" + fi + + sleep 1 +done diff --git a/default/waybar/media.sh b/default/waybar/media.sh new file mode 100644 index 00000000..e6dbafd3 --- /dev/null +++ b/default/waybar/media.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +PLAYER="subtui" + +# Vérifie si Subtui est lancé +if ! playerctl -l 2>/dev/null | grep -q "^${PLAYER}$"; then + echo '{"text":"󰝚","tooltip":"Subtui non lancé"}' + exit 0 +fi + +# Métadonnées +title=$(playerctl -p "$PLAYER" metadata title 2>/dev/null) +artist=$(playerctl -p "$PLAYER" metadata artist 2>/dev/null) +album=$(playerctl -p "$PLAYER" metadata album 2>/dev/null) +status=$(playerctl -p "$PLAYER" status 2>/dev/null) + +# Valeurs par défaut +[ -z "$title" ] && title="Titre inconnu" +[ -z "$artist" ] && artist="Artiste inconnu" +[ -z "$album" ] && album="Album inconnu" + +# Position actuelle (secondes) +position=$(playerctl -p "$PLAYER" position 2>/dev/null) +[ -z "$position" ] && position=0 + +# Durée totale (microsecondes) +length=$(playerctl -p "$PLAYER" metadata mpris:length 2>/dev/null) +[ -z "$length" ] && length=0 + +# Conversion sûre +position_sec=$(awk -v p="$position" 'BEGIN { printf("%d", p+0.5) }') +length_sec=$((length / 1000000)) + +# Format temps +elapsed=$(printf "%02d:%02d" $((position_sec/60)) $((position_sec%60))) + +if [ "$length_sec" -gt 0 ]; then + duration=$(printf "%02d:%02d" $((length_sec/60)) $((length_sec%60))) +else + duration="--:--" +fi + +# Icône +if [ "$status" = "Playing" ]; then + icon="󰏤" +else + icon="󰐊" +fi + +# Échapper les guillemets pour JSON +title=${title//\"/\\\"} +artist=${artist//\"/\\\"} +album=${album//\"/\\\"} + +# Tooltip +tooltip="$artist +$title + +Album : $album + +$elapsed / $duration + +Clic gauche : Lecture/Pause +Clic droit : Suivant +Clic milieu : Précédent" + +# Convertir les retours à la ligne pour JSON +tooltip=$(echo "$tooltip" | sed ':a;N;$!ba;s/\n/\\n/g') + +# JSON final +printf '{"text":"%s","tooltip":"%s"}\n' "$icon" "$tooltip" diff --git a/default/waybar/media_click.sh b/default/waybar/media_click.sh new file mode 100644 index 00000000..a3fd1d50 --- /dev/null +++ b/default/waybar/media_click.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +PLAYER="subtui" + +if playerctl -l 2>/dev/null | grep -q "^${PLAYER}$"; then + playerctl -p "$PLAYER" play-pause +else + ghostty -e subtui & +fi \ No newline at end of file