update sounds so modes can have unique exit sounds.
This commit is contained in:
@@ -17,6 +17,8 @@ from os import system
|
||||
#This script allows for sounds in i3
|
||||
i3 = i3ipc.Connection()
|
||||
|
||||
# Track the current mode so we know what we're exiting from
|
||||
currentMode = 'default'
|
||||
|
||||
def on_new_window(self,i3):
|
||||
if i3.container.name == 'xfce4-notifyd':
|
||||
@@ -29,15 +31,29 @@ def on_close_window(self,i3):
|
||||
system('play -nqV0 synth .25 sin 880:440 sin 920:480 remix - norm -3 pitch -500 &')
|
||||
|
||||
def on_mode(self,event):
|
||||
mode= event.change
|
||||
global currentMode
|
||||
mode = event.change
|
||||
if mode == 'ratpoison':
|
||||
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 &')
|
||||
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 &')
|
||||
elif mode == 'bypass':
|
||||
system('play -nqV0 synth .1 saw 700 saw 1200 delay 0 .04 remix - norm -6')
|
||||
elif mode == 'default':
|
||||
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 reverse &')
|
||||
# Play different sounds based on which mode we're exiting
|
||||
if currentMode == 'ratpoison':
|
||||
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 reverse &')
|
||||
elif currentMode == 'panel':
|
||||
system('play -nqV0 synth 0.05 pluck C5 norm -8 : synth 0.05 pluck F4 norm -8 : synth 0.05 pluck C4 norm -8 : synth 0.05 pluck F3 norm -8 &')
|
||||
elif currentMode == 'bypass':
|
||||
system('play -nqV0 synth .1 saw 1200 saw 700 delay 0 .04 remix - norm -6 &')
|
||||
else:
|
||||
# Generic exit sound for any other mode
|
||||
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 reverse &')
|
||||
else:
|
||||
system('play -nqV0 synth 0.05 pluck F3 norm -8 : synth 0.05 pluck C4 norm -8 : synth 0.05 pluck F4 norm -8 : synth 0.05 pluck C5 norm -8')
|
||||
# Entering panel or any other mode
|
||||
system('play -nqV0 synth 0.05 pluck F3 norm -8 : synth 0.05 pluck C4 norm -8 : synth 0.05 pluck F4 norm -8 : synth 0.05 pluck C5 norm -8 &')
|
||||
|
||||
# Update current mode tracker
|
||||
currentMode = mode
|
||||
|
||||
def on_workspace_focus(self,i3):
|
||||
#system('play -qnV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -8 speed 1 &')
|
||||
|
||||
Reference in New Issue
Block a user