Created
February 25, 2014 11:32
-
-
Save kindly/9207276 to your computer and use it in GitHub Desktop.
Rotate all in workspace.
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
bindsym $mod+j exec python ~/.i3/rotate_i3.py next | |
bindsym $mod+k exec python ~/.i3/rotate_i3.py prev |
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
sudo apt-get install python-pip | |
sudo pip install i3-py |
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
#! /usr/bin/python | |
import i3 | |
import sys | |
current_node = i3.filter(focused=True)[0] | |
node = current_node | |
while node.get('type') <> 4: | |
node = i3.parent(node['id']) | |
all_windows = i3.filter(type=2, tree=node, nodes=[]) | |
if not all_windows: | |
sys.exit(0) | |
for num, window in enumerate(all_windows): | |
if window['id'] == current_node['id']: | |
break | |
if sys.argv[1] == 'next': | |
try: | |
new_focus = all_windows[num + 1] | |
except IndexError: | |
new_focus = all_windows[0] | |
elif sys.argv[1] == 'prev': | |
try: | |
new_focus = all_windows[num - 1] | |
except IndexError: | |
new_focus = all_windows[-1] | |
else: | |
sys.exit(1) | |
i3.focus(con_id=new_focus['id']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment