Created
September 14, 2015 01:05
-
-
Save rsdy/c54888514d41ca592784 to your computer and use it in GitHub Desktop.
Stops a process by name if switched away from workspace
This file contains hidden or 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
#!/usr/bin/env python3 | |
import i3ipc | |
from sh import pkill | |
WNAME='browser' | |
PNAME='firefox' | |
def on_workspace(i3, e): | |
if e.current.props.name == WNAME: | |
pkill('-CONT', PNAME) | |
else: | |
pkill('-STOP', PNAME) | |
i3 = i3ipc.Connection() | |
i3.on('workspace::focus', on_workspace) | |
i3.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment