dotfiles/.config/scripts/media.sh
Sarthak f341989335 Sakura Line: retheme the whole desktop from the wallpaper
Palette sampled from bspwm/wallpaper/wallpaper.jpg and applied per-role
(not per-hex, so terminal green stays green and nvim's LineNr/Comment
stay recessive) across st, kitty, polybar, rofi, dunst, nvim, qt5ct/qt6ct
and GTK 2/3/4.

Also:
- rofi drun centred, icons enabled
- polybar translucent (true ARGB) and rounded; picom corner-radius, with
  the desktop layer and fullscreen windows excluded
- fix qt5ct color_scheme_path pointing at a nonexistent /home/carrie
- export QT_QPA_PLATFORMTHEME so qt6ct is actually consulted
- point GTK at an icon theme that exists on this system
- add .config/rice: one-shot install.sh (--dry-run supported), package
  list, vendored st config.h (gitignored upstream) and the particles
  wallpaper-layer source, so a clone reproduces the rice

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cn3dHfbgNYdbZvzb1b3GQt
2026-09-04 00:19:36 +05:30

43 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# Colors
GREEN="%{F#8fae74}"
BLUE="%{F#92b9ea}"
DIM="%{F#7f7796}"
RESET="%{F-}"
STATE_FILE="/tmp/polybar-toggle-state"
# --- CLICK DETECTION ---
if [ -f "$STATE_FILE" ]; then
LAST_MOD=$(stat -c %Y "$STATE_FILE" 2>/dev/null || echo 0)
CURRENT_TIME=$(date +%s)
if [ $((CURRENT_TIME - LAST_MOD)) -lt 2 ]; then
rm "$STATE_FILE"
FORCE_TOGGLE=1
fi
fi
# --- WINDOW (ALWAYS IMMEDIATE) ---
WINDOW=$(xdotool getactivewindow getwindowname 2>/dev/null || echo "Desktop")
WINDOW="${WINDOW:0:50}"
# --- MEDIA INFO ---
MEDIA_STATUS=$(playerctl status 2>/dev/null)
MEDIA=$(playerctl metadata --format "{{ artist }} - {{ title }}" 2>/dev/null)
MEDIA="${MEDIA:0:50}"
# --- ROTATION TIMER (MEDIA ONLY) ---
CURRENT_SECOND=$(date +%s)
SHOW_MEDIA=$(((CURRENT_SECOND / 2) % 2))
# Manual toggle flips media visibility only
if [ -n "$FORCE_TOGGLE" ]; then
SHOW_MEDIA=$((1 - SHOW_MEDIA))
fi
# --- DISPLAY LOGIC ---
if [ -n "$MEDIA" ] && [ "$MEDIA_STATUS" = "Playing" ] && [ $SHOW_MEDIA -eq 1 ]; then
echo "${GREEN}${RESET} ${MEDIA}"
else
echo "${BLUE}${RESET} ${WINDOW}"
fi