Skip to content

Commit

Permalink
examples/scratcher: a script that cycles through scratchpad windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ziberna committed Jun 20, 2012
1 parent 7a6e43e commit 319f491
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/scratcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
"""
Cycling through scratchpad windows...
Add this to your i3 config file:
bindsym <key-combo> exec python /path/to/this/script.py
"""

import i3

def scratchpad_windows():
# get containers with appropriate scratchpad state
containers = i3.filter(scratchpad_state='changed')
# filter out windows (leaf nodes of the above containers)
return i3.filter(containers, nodes=[])

def main():
windows = scratchpad_windows()
# search for focused window among scratchpad windows
if i3.filter(windows, focused=True):
# move that window back to scratchpad
i3.move('scratchpad')
# show the next scratchpad window
i3.scratchpad('show')

if __name__ == '__main__':
main()

0 comments on commit 319f491

Please sign in to comment.