32 lines
		
	
	
		
			491 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			491 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
SOUND=/usr/local/share/sounds/static.ogg
 | 
						|
 | 
						|
if [ ! -f "$SOUND" ]; then
 | 
						|
    echo "File '$SOUND' not found." >&2
 | 
						|
    exit 1
 | 
						|
fi
 | 
						|
 | 
						|
function events() {
 | 
						|
    swaymsg -m -t subscribe "['workspace']"
 | 
						|
}
 | 
						|
 | 
						|
function daemon() {
 | 
						|
    printf "p" # PAUSE
 | 
						|
    while [[ true ]]; do
 | 
						|
        read
 | 
						|
        printf " " # PLAY
 | 
						|
        while read -t 0.1; do
 | 
						|
            sleep 0.1
 | 
						|
        done
 | 
						|
        printf "p" # PAUSE
 | 
						|
    done
 | 
						|
}
 | 
						|
 | 
						|
function static() {
 | 
						|
    mplayer -loop 0 $SOUND
 | 
						|
}
 | 
						|
 | 
						|
events | daemon | static
 | 
						|
 |