2022-11-22 17:53:53 -05:00
|
|
|
#!/usr/bin/env python3
|
2022-11-23 20:25:29 -05:00
|
|
|
# Written by Storm Dragon, Jeremiah, and contributers.
|
|
|
|
# Released under the terms of the WTFPL http://www.wtfpl.net
|
|
|
|
|
2022-11-22 17:53:53 -05:00
|
|
|
import i3ipc
|
2022-11-23 20:06:56 -05:00
|
|
|
from i3ipc import Event
|
2022-11-22 20:37:27 -05:00
|
|
|
from os import system
|
|
|
|
#This script allows for sounds in i3
|
2022-11-23 20:06:56 -05:00
|
|
|
i3 = i3ipc.Connection()
|
2022-11-22 17:53:53 -05:00
|
|
|
|
2022-11-22 18:25:06 -05:00
|
|
|
|
2022-11-22 20:37:27 -05:00
|
|
|
def on_new_window(self,i3):
|
|
|
|
system('play -n synth .25 sin 440:880 sin 480:920 remix - norm -3 pitch -500')
|
2022-11-22 18:25:06 -05:00
|
|
|
|
2022-11-23 20:06:56 -05:00
|
|
|
def on_mode(self,event):
|
|
|
|
mode= event.change
|
2022-11-23 20:15:36 -05:00
|
|
|
if mode == 'default':
|
2022-11-23 20:06:56 -05:00
|
|
|
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 reverse')
|
2022-11-23 20:15:36 -05:00
|
|
|
else:
|
|
|
|
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20')
|
2022-11-22 18:25:06 -05:00
|
|
|
|
2022-11-23 17:13:28 -05:00
|
|
|
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')
|
|
|
|
|
2022-11-23 17:32:32 -05:00
|
|
|
def on_workspace_move(self,i3):
|
|
|
|
system('play -qnV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -8 speed 1 reverse')
|
|
|
|
|
2022-11-23 20:33:23 -05:00
|
|
|
def on_restart(self,i3):
|
|
|
|
system('play -qn synth .25 saw 500:1200 fade .1 .25 .1 norm -8')
|
|
|
|
|
2022-11-22 17:53:53 -05:00
|
|
|
i3 = i3ipc.Connection()
|
|
|
|
|
2022-11-22 20:37:27 -05:00
|
|
|
i3.on('window::new', on_new_window)
|
2022-11-23 20:06:56 -05:00
|
|
|
i3.on(Event.MODE, on_mode)
|
2022-11-23 17:13:28 -05:00
|
|
|
i3.on('workspace::focus', on_workspace_focus)
|
2022-11-23 17:32:32 -05:00
|
|
|
i3.on('window::move', on_workspace_move)
|
2022-11-23 20:33:23 -05:00
|
|
|
i3.on('shutdown::restart', on_restart)
|
2022-11-22 17:53:53 -05:00
|
|
|
i3.main()
|