Compare commits
7 Commits
554a831af2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| dd0546309e | |||
| 59a7dc3d74 | |||
| 5542c53a39 | |||
| 064362bfb1 | |||
| ecdedf9df5 | |||
| ecf0c6ddf5 | |||
| cde6e39cec |
@@ -123,7 +123,37 @@ riverctl map normal Mod1 F11 enter-mode passthrough
|
|||||||
riverctl map passthrough Mod1 F11 enter-mode normal
|
riverctl map passthrough Mod1 F11 enter-mode normal
|
||||||
|
|
||||||
# Lock screen
|
# Lock screen
|
||||||
riverctl map normal Mod1+Shift L spawn waylock
|
#riverctl map normal Mod1+Shift L spawn waylock
|
||||||
|
riverctl map normal Mod1+Shift L spawn 'swaylock \
|
||||||
|
--clock \
|
||||||
|
--indicator-idle-visible \
|
||||||
|
--indicator-radius 100 \
|
||||||
|
--indicator-thickness 7 \
|
||||||
|
--ring-color 2D464D \
|
||||||
|
--key-hl-color be5046 \
|
||||||
|
--text-color ffffff \
|
||||||
|
--line-color 00000000 \
|
||||||
|
--inside-color 00000088 \
|
||||||
|
--separator-color 00000000 \
|
||||||
|
--fade-in 0.2 \
|
||||||
|
--effect-blur 7x1 \
|
||||||
|
--image ~/Pictures/bg-astronaut.jpg'
|
||||||
|
|
||||||
|
swayidle \
|
||||||
|
timeout 300 'swaylock \
|
||||||
|
--clock \
|
||||||
|
--indicator-idle-visible \
|
||||||
|
--indicator-radius 100 \
|
||||||
|
--indicator-thickness 7 \
|
||||||
|
--ring-color 2D464D \
|
||||||
|
--key-hl-color be5046 \
|
||||||
|
--text-color ffffff \
|
||||||
|
--line-color 00000000 \
|
||||||
|
--inside-color 00000088 \
|
||||||
|
--separator-color 00000000 \
|
||||||
|
--fade-in 0.2 \
|
||||||
|
--effect-blur 7x1 \
|
||||||
|
--image ~/Pictures/bg-astronaut.jpg' &
|
||||||
|
|
||||||
# Various media key mapping examples for both normal and locked mode which do
|
# Various media key mapping examples for both normal and locked mode which do
|
||||||
# not have a modifier
|
# not have a modifier
|
||||||
@@ -201,6 +231,9 @@ riverctl spawn "wlclock --layer background --background-colour '#00000000' --clo
|
|||||||
#riverctl spawn "$HOME/.config/river/bar"
|
#riverctl spawn "$HOME/.config/river/bar"
|
||||||
riverctl spawn waybar
|
riverctl spawn waybar
|
||||||
|
|
||||||
|
# Start waybar audio listener
|
||||||
|
~/.local/bin/waybar_audio_event_bridge.sh &
|
||||||
|
|
||||||
# Idle configuration
|
# Idle configuration
|
||||||
riverctl spawn "swayidle -w timeout 1200 'wlopm --off \"*\"' resume 'wlopm --on \"*\"' before-sleep 'waylock -fork-on-lock'"
|
riverctl spawn "swayidle -w timeout 1200 'wlopm --off \"*\"' resume 'wlopm --on \"*\"' before-sleep 'waylock -fork-on-lock'"
|
||||||
|
|
||||||
|
|||||||
@@ -69,23 +69,9 @@
|
|||||||
// "format-icons": ["", "", ""]
|
// "format-icons": ["", "", ""]
|
||||||
//},
|
//},
|
||||||
|
|
||||||
"custom/audio": {
|
|
||||||
"exec": "~/.local/bin/waybar_audio.sh",
|
|
||||||
"return-type": "json",
|
|
||||||
"format": "{icon} {text}",
|
|
||||||
"format-icons": {
|
|
||||||
"speaker": " ",
|
|
||||||
"speaker-muted": "",
|
|
||||||
"headphones": "",
|
|
||||||
"headphones-muted": ""
|
|
||||||
},
|
|
||||||
"interval": 2,
|
|
||||||
"on-click": "~/.local/bin/toggle_audio",
|
|
||||||
"on-click-right": "pamixer --toggle-mute"
|
|
||||||
},
|
|
||||||
|
|
||||||
"custom/audio": {
|
"custom/audio": {
|
||||||
"exec": "~/.local/bin/waybar_audio.sh",
|
"exec": "~/.local/bin/waybar_audio.sh",
|
||||||
|
"signal": 8,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"format": "{icon} {text}",
|
"format": "{icon} {text}",
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
@@ -95,8 +81,8 @@
|
|||||||
"headphones-muted": ""
|
"headphones-muted": ""
|
||||||
},
|
},
|
||||||
"interval": 2,
|
"interval": 2,
|
||||||
"on-click": "~/.local/bin/toggle_audio",
|
"on-click": "pamixer --toggle-mute",
|
||||||
"on-click-right": "pamixer --toggle-mute",
|
"on-click-right": "~/.local/bin/toggle_audio",
|
||||||
"on-scroll-up": "pamixer --increase 5",
|
"on-scroll-up": "pamixer --increase 5",
|
||||||
"on-scroll-down": "pamixer --decrease 5"
|
"on-scroll-down": "pamixer --decrease 5"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ window#waybar {
|
|||||||
background-color: @bg;
|
background-color: @bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-audio, #custom-test {
|
|
||||||
font-family: "JetBrainsMono Nerd Font";
|
|
||||||
}
|
|
||||||
|
|
||||||
#tags {
|
#tags {
|
||||||
font-family: "Source Han Sans HW,源ノ角ゴシック HW";
|
font-family: "Source Han Sans HW,源ノ角ゴシック HW";
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|||||||
33
.local/bin/toggle_audio
Executable file
33
.local/bin/toggle_audio
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Toggle default PipeWire sink between Steinberg UR22mkII and Starship/Matisse
|
||||||
|
|
||||||
|
# sinks
|
||||||
|
#STEINBERG_ID=60
|
||||||
|
#STARSHIP_ID=59
|
||||||
|
SINKS=$(wpctl status | sed -n '/Sinks:/,/Sources:/p')
|
||||||
|
|
||||||
|
# Extract IDs (ignore default *) and match specific names
|
||||||
|
STARSHIP_ID=$(echo "$SINKS" | tr -d '*' | grep -i "Starship" | grep -v "Easy Effects" | awk '{print $2}' | tr -d '.')
|
||||||
|
STEINBERG_ID=$(echo "$SINKS" | tr -d '*' | grep -i "Steinberg" | grep -v "Easy Effects" | awk '{print $2}' | tr -d '.')
|
||||||
|
|
||||||
|
# Get current default sink name (not just the ID)
|
||||||
|
CURRENT_SINK=$(wpctl status | awk '/Audio\/Sink/ {print $3}')
|
||||||
|
|
||||||
|
# Detect which sink is active and toggle
|
||||||
|
if [[ "$CURRENT_SINK" == *"Steinberg"* ]]; then
|
||||||
|
echo "Switching to Starship/Matisse output..."
|
||||||
|
wpctl set-default "$STARSHIP_ID"
|
||||||
|
else
|
||||||
|
echo "Switching to Steinberg UR22mkII output..."
|
||||||
|
wpctl set-default "$STEINBERG_ID"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Optionally move active streams
|
||||||
|
echo "Moving active streams to new sink..."
|
||||||
|
for stream in $(wpctl status | awk '/\. Stream/{print $1}'); do
|
||||||
|
wpctl move-stream "$stream" @DEFAULT_AUDIO_SINK@ 2>/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
# Confirm new default
|
||||||
|
echo "New default sink:"
|
||||||
|
wpctl status | grep "Audio/Sink"
|
||||||
25
.local/bin/waybar_audio.sh
Executable file
25
.local/bin/waybar_audio.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Get default sink name and volume
|
||||||
|
sink_info=$(pamixer --get-default-sink)
|
||||||
|
sink_name=$(echo "$sink_info" | awk '{print $3}')
|
||||||
|
volume=$(pamixer --get-volume)
|
||||||
|
muted=$(pamixer --get-mute)
|
||||||
|
|
||||||
|
# Determine alt value for Waybar
|
||||||
|
if [ "$muted" = "true" ]; then
|
||||||
|
case "$sink_name" in
|
||||||
|
*Steinberg*) alt="headphones-muted" ;;
|
||||||
|
*) alt="speaker-muted" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case "$sink_name" in
|
||||||
|
*Steinberg*) alt="headphones" ;;
|
||||||
|
*) alt="speaker" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Output JSON for Waybar
|
||||||
|
printf '{"text": "%s%%", "alt": "%s", "class": "%s", "percentage": %s }\n' \
|
||||||
|
"$volume" "$alt" "$alt" "$volume"
|
||||||
|
|
||||||
26
.local/bin/waybar_audio_event_bridge.sh
Executable file
26
.local/bin/waybar_audio_event_bridge.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
SIG=8
|
||||||
|
|
||||||
|
get_waybar_pid() { pgrep -u "$USER" -x waybar | head -n1 || true; }
|
||||||
|
log() { echo "[waybar-audio-bridge] $*" >&2; }
|
||||||
|
|
||||||
|
WAYBAR_PID=""
|
||||||
|
while [[ -z "$WAYBAR_PID" ]]; do
|
||||||
|
WAYBAR_PID="$(get_waybar_pid)"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
log "connected to Waybar PID $WAYBAR_PID"
|
||||||
|
|
||||||
|
# read pw-mon output, but only care about Audio nodes
|
||||||
|
pw-mon 2>/dev/null | grep --line-buffered -E "Audio|Sink|Source|Stream|Node" | while read -r _; do
|
||||||
|
# small debounce to avoid spamming CPU when multiple updates arrive fast
|
||||||
|
sleep 0.2
|
||||||
|
if ! kill -0 "$WAYBAR_PID" 2>/dev/null; then
|
||||||
|
WAYBAR_PID="$(get_waybar_pid)"
|
||||||
|
[[ -z "$WAYBAR_PID" ]] && continue
|
||||||
|
log "reconnected to Waybar PID $WAYBAR_PID"
|
||||||
|
fi
|
||||||
|
kill -RTMIN+"$SIG" "$WAYBAR_PID" 2>/dev/null || true
|
||||||
|
done
|
||||||
|
|
||||||
Reference in New Issue
Block a user