Created
April 27, 2019 08:26
-
-
Save KreerC/d8208c9d81ca937013117ba4080be50c to your computer and use it in GitHub Desktop.
Use text to speech to announce the focused window in i3wm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import i3ipc | |
import pyttsx3 | |
i3 = i3ipc.Connection() | |
tts = pyttsx3.init() | |
def on_window_focus(i3, e): | |
focused = i3.get_tree().find_focused() | |
# Verbose output | |
# tts.say((focused.workspace().num, focused.name)) | |
# Less verbose, just announce application name | |
tts.say((focused.workspace().num, focused.window_class)) | |
tts.setProperty("rate", 350) | |
tts.runAndWait() | |
i3.on("window::focus", on_window_focus) | |
i3.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment