Browse Source

Added fibonacci script for i3

pull/2/head
Josh Wolfe 5 years ago
parent
commit
d774071100
  1. 1
      i3/.config/i3/config
  2. 39
      i3/.config/i3/fibonacci.py

1
i3/.config/i3/config

@ -8,6 +8,7 @@ exec --no-startup-id ~/bin/battery_notify @@ -8,6 +8,7 @@ exec --no-startup-id ~/bin/battery_notify
exec --no-startup-id powertop --auto-tune
exec --no-startup-id tlp start
exec --no-startup-id xset r rate 225 30
exec --no-startup-id ~/.config/i3/fibonacci.py
# Disable window borders
for_window [class="^.*"] border pixel 2

39
i3/.config/i3/fibonacci.py

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
#!/usr/bin/env python3
import i3ipc
counts = {}
i3 = i3ipc.Connection()
def fibonacci(con, num):
print(num)
if num % 2 == 0:
i3.command('split h')
else:
i3.command('split v')
def on_window_open(i3, e):
con = i3.get_tree().find_focused()
ws = con.workspace().name
if ws in counts.keys():
counts[ws] += 1
else:
counts[ws] = 0
fibonacci(con, counts[ws])
def on_window_close(i3, e):
con = i3.get_tree().find_focused()
ws = con.workspace().name
counts[ws] -= 1
def on_window_move(i3, e):
print('halo?')
i3.on('window::new', on_window_open)
i3.on('window::move', on_window_move)
i3.on('window::close', on_window_close)
i3.main()
Loading…
Cancel
Save