Add sound file checks for sway
This commit is contained in:
parent
bccad04ea0
commit
c61461af28
|
@ -1,9 +1,11 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Play MacOS system error sound: System Preferences -> Sound -> Sound Effects
|
||||
# Plays sway error sound as well
|
||||
|
||||
if [[ $(uname) == 'Darwin' ]]; then
|
||||
afplay $(defaults read .GlobalPreferences.plist \
|
||||
| awk '/sound.beep.sound"/ { gsub(/(.*= ")|(";)/, ""); print }')
|
||||
declare s="$(defaults read .GlobalPreferences.plist \
|
||||
| awk '/sound.beep.sound"/ { gsub(/(.*= ")|(";)/, ""); print }')"
|
||||
afplay "$s" &>/dev/null &
|
||||
elif [[ -n ${SWAYSOCK+x} ]]; then
|
||||
ffplay -nodisp -autoexit ~/.configs_pointer/sway/error_sound.mp3 &>/dev/null &
|
||||
fi
|
||||
|
||||
# vim: set syntax=bash ff=unix:
|
||||
|
|
|
@ -37,6 +37,7 @@ swayland_checks() {
|
|||
check_sway_wallpaper
|
||||
check_swaylock_wallpaper
|
||||
check_swaytree_compilation
|
||||
check_sway_sounds
|
||||
}
|
||||
|
||||
check_sway_wallpaper() {
|
||||
|
@ -91,6 +92,26 @@ check_swaytree_compilation() {
|
|||
return 0
|
||||
}
|
||||
|
||||
check_sway_sounds() {
|
||||
local return_code=0
|
||||
local -ra a=(\
|
||||
~/.configs_pointer/sway screenshot_sound.mp3 'screenshot sound'
|
||||
~/.configs_pointer/sway volume_change_sound.mp3 'volume change sound'
|
||||
~/.configs_pointer/sway error_sound.mp3 'error sound'
|
||||
)
|
||||
|
||||
for ((i=0; i < ${#a[@]}; i += 3)); do
|
||||
if ! [[ -r "${a[i]}/${a[i+1]}" ]]; then
|
||||
printf "ERR: Missing %s for sway\n" "${a[i+2]}"
|
||||
printf '\tAdd a playable sound file to %s\n' "${a[i]}/${a[i+1]}"
|
||||
printf "\tIt doesn't have to be an mp3 file, just make the extension .mp3\n"
|
||||
return_code=1
|
||||
fi
|
||||
done
|
||||
|
||||
return $return_code
|
||||
}
|
||||
|
||||
####################
|
||||
# Tmux
|
||||
####################
|
||||
|
|
10
sway/config
10
sway/config
|
@ -48,7 +48,7 @@ set $menu fuzzel -fmonospace:size=14 -l10 -w40 \
|
|||
|
||||
# Sound effects and additional features
|
||||
set $volume_command ~/.config/sway/pulse_audio_volume.sh
|
||||
set $volume_notify_sound ~/.config/sway/pop_sound.mp3
|
||||
set $volume_change_sound ~/.config/sway/volume_change_sound.mp3
|
||||
|
||||
set $screenshot_sound ffplay -nodisp -autoexit -v error \
|
||||
~/.config/sway/screenshot_sound.mp3
|
||||
|
@ -247,10 +247,10 @@ default_border pixel 2
|
|||
exec wlsunset -t 6499 -T 6500 -g 0.9
|
||||
|
||||
# Volume controls
|
||||
bindsym XF86AudioRaiseVolume exec $volume_command 4 $volume_notify_sound
|
||||
bindsym XF86AudioLowerVolume exec $volume_command -4 $volume_notify_sound
|
||||
bindsym shift+XF86AudioRaiseVolume exec $volume_command 1 $volume_notify_sound
|
||||
bindsym shift+XF86AudioLowerVolume exec $volume_command -1 $volume_notify_sound
|
||||
bindsym XF86AudioRaiseVolume exec $volume_command 4 $volume_change_sound
|
||||
bindsym XF86AudioLowerVolume exec $volume_command -4 $volume_change_sound
|
||||
bindsym shift+XF86AudioRaiseVolume exec $volume_command 1 $volume_change_sound
|
||||
bindsym shift+XF86AudioLowerVolume exec $volume_command -1 $volume_change_sound
|
||||
bindsym XF86AudioMute exec ~/.config/sway/toggle_mute.sh
|
||||
|
||||
# External brightness control
|
||||
|
|
|
@ -40,4 +40,4 @@ case "$1" in
|
|||
;;
|
||||
esac
|
||||
|
||||
ffplay -nodisp -autoexit -v error ~/.config/sway/pop_sound.mp3
|
||||
ffplay -nodisp -autoexit -v error ~/.config/sway/volume_change_sound.mp3
|
||||
|
|
|
@ -75,7 +75,7 @@ highlight {*.aac,*.anx,*.asf,*.au,*.avi,*.ts,*.axa,*.axv,*.divx,*.flac,*.m2a,
|
|||
\*.m2v,*.m4a,*.m4p,*.m4v,*.mid,*.midi,*.mka,*.mkv,*.mov,*.mp3,*.mp4,
|
||||
\*.flv,*.mp4v,*.mpc,*.mpeg,*.mpg,*.nuv,*.oga,*.ogg,*.ogv,*.ogx,*.pbm,
|
||||
\*.pgm,*.qt,*.ra,*.ram,*.rm,*.spx,*.vob,*.wav,*.wma,*.wmv,*.xvid,
|
||||
\*.ac3,*.webm} cterm=bold
|
||||
\*.ac3,*.webm,*.aiff} cterm=bold
|
||||
\ ctermfg=139 ctermbg=default
|
||||
|
||||
" Same darkish purple for pictures
|
||||
|
|
|
@ -66,7 +66,7 @@ highlight {*.aac,*.anx,*.asf,*.au,*.avi,*.ts,*.axa,*.axv,*.divx,*.flac,*.m2a,
|
|||
\*.m2v,*.m4a,*.m4p,*.m4v,*.mid,*.midi,*.mka,*.mkv,*.mov,*.mp3,*.mp4,
|
||||
\*.flv,*.mp4v,*.mpc,*.mpeg,*.mpg,*.nuv,*.oga,*.ogg,*.ogv,*.ogx,*.pbm,
|
||||
\*.pgm,*.qt,*.ra,*.ram,*.rm,*.spx,*.vob,*.wav,*.wma,*.wmv,*.xvid,
|
||||
\*.ac3,*.webm} cterm=bold
|
||||
\*.ac3,*.webm,*.aiff} cterm=bold
|
||||
\ ctermfg=5 ctermbg=default
|
||||
|
||||
" Same darkish purple for pictures
|
||||
|
|
Loading…
Reference in a new issue