boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.8k stars 433 forks source link

Code mutes my speaker volume for no reason #508

Open haimmm opened 2 years ago

haimmm commented 2 years ago
def key_pressed():
    keyboard.add_hotkey('del', pressed_del)
    keyboard.wait()

def pressed_del():
    keyboard.send('shift')
    time.sleep(0.15)
    keyboard.send('a')
    time.sleep(0.15)
    keyboard.send('shift')
    time.sleep(0.1)
    keyboard.send('s')
    for x in range(0, 10):
        keyboard.send('d')
        time.sleep(0.09)

if __name__ == '__main__':
    key_pressed()

When i press delete the code executes but in addition my speaker gets muted and unmuted rapidly, probably for every loop iteration. tested in both pc and laptop and same happened.

Nikrik commented 9 months ago

Try run the script after switching the layout to English