From fc3a2abb517d608a3df15ed87ef4972382e24ffc Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 6 Dec 2025 19:07:15 -0500 Subject: [PATCH] update sounds so modes can have unique exit sounds. --- scripts/sound.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/sound.py b/scripts/sound.py index 15b79fb..a360fb8 100755 --- a/scripts/sound.py +++ b/scripts/sound.py @@ -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 &')