i3: remove smart resize
This commit is contained in:
parent
f61220f737
commit
a8eb053860
|
@ -1,65 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2016 Damien Riegel <damien.riegel@gmail.com>
|
||||
#
|
||||
# Licensed under the terms of the GNU GPL v3, or any later version.
|
||||
#
|
||||
# Resize the focused window depending on its position in the layout
|
||||
# Example: bindsym Left exec i3-smart-resize "Left"
|
||||
|
||||
import sys
|
||||
import i3ipc
|
||||
|
||||
DEFAULT_INCREMENT = "5 px or 5 ppt"
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit(-1)
|
||||
key = sys.argv[1].lower()
|
||||
|
||||
if len(sys.argv) == 3:
|
||||
inc = sys.argv[2]
|
||||
else:
|
||||
inc = DEFAULT_INCREMENT
|
||||
|
||||
def is_at_top_edge(focused):
|
||||
workspace = focused.workspace()
|
||||
return focused.rect.y - focused.deco_rect.height == workspace.rect.y
|
||||
|
||||
def is_at_bottom_edge(focused):
|
||||
workspace = focused.workspace()
|
||||
return focused.rect.y + focused.rect.height == workspace.rect.y + workspace.rect.height
|
||||
|
||||
def is_at_left_edge(focused):
|
||||
workspace = focused.workspace()
|
||||
return focused.rect.x == workspace.rect.x
|
||||
|
||||
def is_at_right_edge(focused):
|
||||
workspace = focused.workspace()
|
||||
return focused.rect.x + focused.rect.width == workspace.rect.x + workspace.rect.width
|
||||
|
||||
|
||||
i3 = i3ipc.Connection()
|
||||
focused = i3.get_tree().find_focused()
|
||||
|
||||
if key == "up":
|
||||
if is_at_top_edge(focused):
|
||||
i3.command("resize shrink down %s" % (inc))
|
||||
else:
|
||||
i3.command("resize grow up %s" % (inc))
|
||||
elif key == "down":
|
||||
if is_at_bottom_edge(focused):
|
||||
i3.command("resize shrink up %s" % (inc))
|
||||
else:
|
||||
i3.command("resize grow down %s" % (inc))
|
||||
elif key == "right":
|
||||
if is_at_right_edge(focused):
|
||||
i3.command("resize shrink left %s" % (inc))
|
||||
else:
|
||||
i3.command("resize grow right %s" % (inc))
|
||||
elif key == "left":
|
||||
if is_at_left_edge(focused):
|
||||
i3.command("resize shrink right %s" % (inc))
|
||||
else:
|
||||
i3.command("resize grow left %s" % (inc))
|
||||
else:
|
||||
sys.exit(-1)
|
|
@ -20,7 +20,6 @@
|
|||
~/.gitconfig: config/git/gitconfig
|
||||
~/.gitignore: config/git/gitignore
|
||||
~/.ssh/config: config/ssh/config
|
||||
~/.local/bin/i3-smart-resize: config/i3/smart-resize
|
||||
~/.config/picom.conf: config/picom/picom.conf
|
||||
~/.config/i3-scrot.conf: config/i3/i3-scrot
|
||||
~/.config/i3/config: config/i3/config
|
||||
|
|
Loading…
Reference in New Issue