more work on neovim config, added keyboard sound thing for kitty
This commit is contained in:
36
assets/scripts/keyboard_sound_thing.py
Normal file
36
assets/scripts/keyboard_sound_thing.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import evdev, random, subprocess, os, threading, socket
|
||||
|
||||
active_class = ""
|
||||
|
||||
def watch_hyprland():
|
||||
global active_class
|
||||
sig = os.environ["HYPRLAND_INSTANCE_SIGNATURE"]
|
||||
sock_path = f"{os.environ['XDG_RUNTIME_DIR']}/hypr/{sig}/.socket2.sock"
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
s.connect(sock_path)
|
||||
for line in s.makefile():
|
||||
if line.startswith("activewindow>>"):
|
||||
active_class = line.split(">>")[1].split(",")[0]
|
||||
|
||||
threading.Thread(target=watch_hyprland, daemon=True).start()
|
||||
|
||||
for path in evdev.list_devices():
|
||||
d = evdev.InputDevice(path)
|
||||
if 'keyd virtual keyboard' in d.name:
|
||||
dev = d
|
||||
break
|
||||
d.close()
|
||||
|
||||
print(dev)
|
||||
|
||||
for event in dev.read_loop():
|
||||
if event.type == 1 and event.value == 1 and active_class == "kitty":
|
||||
if event.code == 28:
|
||||
subprocess.Popen(['pw-play', '/home/pagedmov/.sysflake/assets/sound/msg_finish.wav'])
|
||||
elif event.code == 14:
|
||||
subprocess.Popen(['pw-cat', '--playback', '--volume=0.5', '/home/pagedmov/.sysflake/assets/sound/low_hp.wav'])
|
||||
elif event.code == 1:
|
||||
subprocess.Popen(['pw-play', '/home/pagedmov/.sysflake/assets/sound/menu_close.wav'])
|
||||
else:
|
||||
pitch = random.randint(-50,50)
|
||||
subprocess.Popen(['play', '-q', '/home/pagedmov/.sysflake/assets/sound/msg.wav', 'pitch', str(pitch)])
|
||||
BIN
assets/sound/1_select.ogg
Normal file
BIN
assets/sound/1_select.ogg
Normal file
Binary file not shown.
BIN
assets/sound/2_accept.ogg
Normal file
BIN
assets/sound/2_accept.ogg
Normal file
Binary file not shown.
BIN
assets/sound/3_delete.ogg
Normal file
BIN
assets/sound/3_delete.ogg
Normal file
Binary file not shown.
BIN
assets/sound/4_select2.ogg
Normal file
BIN
assets/sound/4_select2.ogg
Normal file
Binary file not shown.
BIN
assets/sound/6_select_all.ogg
Normal file
BIN
assets/sound/6_select_all.ogg
Normal file
Binary file not shown.
BIN
assets/sound/7_equip.ogg
Normal file
BIN
assets/sound/7_equip.ogg
Normal file
Binary file not shown.
BIN
assets/sound/button.wav
Normal file
BIN
assets/sound/button.wav
Normal file
Binary file not shown.
BIN
assets/sound/crystal.wav
Normal file
BIN
assets/sound/crystal.wav
Normal file
Binary file not shown.
BIN
assets/sound/cursor.wav
Normal file
BIN
assets/sound/cursor.wav
Normal file
Binary file not shown.
BIN
assets/sound/low_hp.wav
Normal file
BIN
assets/sound/low_hp.wav
Normal file
Binary file not shown.
BIN
assets/sound/menu_close.wav
Normal file
BIN
assets/sound/menu_close.wav
Normal file
Binary file not shown.
BIN
assets/sound/menu_open.wav
Normal file
BIN
assets/sound/menu_open.wav
Normal file
Binary file not shown.
BIN
assets/sound/msg.wav
Normal file
BIN
assets/sound/msg.wav
Normal file
Binary file not shown.
BIN
assets/sound/msg_finish.wav
Normal file
BIN
assets/sound/msg_finish.wav
Normal file
Binary file not shown.
Reference in New Issue
Block a user