Exemplo n.º 1
0
def set_layout():
    """
        Set the layout/split for the currently
        focused window to either vertical or
        horizontal, depending on its width/height
    """
    current_win = i3.filter(nodes=[], focused=True)
    for win in current_win:
        parent = find_parent(win["id"])

        if (
            parent
            and "rect" in parent
            and parent["layout"] != "tabbed"
            and parent["layout"] != "stacked"
        ):
            height = parent["rect"]["height"]
            width = parent["rect"]["width"]

            if height > width:
                new_layout = "vertical"
            else:
                new_layout = "horizontal"

            i3.split(new_layout)
Exemplo n.º 2
0
def doOrientation(layout):
    if layout == "horizontal":
        i3.split("h")
    elif layout == "vertical":
        i3.split("v")
    else:
        print "WARNING: Unsupported orientation option %s." % layout
Exemplo n.º 3
0
def main():
    i3.workspace(str(first_free()))
    i3.layout('default')
    i3.exec(browser)
    time.sleep(1)   # give browser window time to spawn
    i3.exec(term)
    time.sleep(0.5) # give terminal window time to spawn
    i3.split('v')
    i3.layout('stacking')
    i3.focus('left')
    i3.split('v')
    i3.layout('stacking')
Exemplo n.º 4
0
def fibonacci(num):
    i3.exec(term)
    time.sleep(0.5)
    if num % 2 == 0:
        if num % 4 == 0:
            i3.focus('up')
        i3.split('h')
    else:
        if num % 4 == 1:
            i3.focus('left')
        i3.split('v')
    if num > 1:
        fibonacci(num - 1)
Exemplo n.º 5
0
def fibonacci(num):
    i3.exec(term)
    time.sleep(0.5)
    if num % 2 == 0:
        if num % 4 == 0:
            i3.focus("up")
        i3.split("h")
    else:
        if num % 4 == 1:
            i3.focus("left")
        i3.split("v")
    if num > 1:
        fibonacci(num - 1)
Exemplo n.º 6
0
def set_layout():
    """
        Set the layout/split for the currently
        focused window to either vertical or
        horizontal, depending on its width/height
    """
    current_win = i3.filter(nodes=[], focused=True)
    for win in current_win:
        parent = find_parent(win['id'])

        if (parent and "rect" in parent
                   and parent['layout'] != 'tabbed'
                   and parent['layout'] != 'stacked'):
            height = win['rect']['height']
            width = win['rect']['width']

            if height > width and parent['orientation'] != 'vertical':
                i3.split('vertical')
Exemplo n.º 7
0
def fibonacci(num):
    i3.exec(prog)
    i3.border('1pixel')
    time.sleep(0.5)
    if num % 2 == 0:
        i3.border('1pixel')
        if num % 4 == 0:
            i3.focus('up')
            i3.border('1pixel')
        i3.split('h')
        i3.border('1pixel')
    else:
        i3.border('1pixel')
        if num % 4 == 1:
            i3.focus('left')
        i3.split('v')
    if num > 1:
        fibonacci(num - 1)
Exemplo n.º 8
0
def fibonacci(num):
    i3.exec(prog)
    i3.border('none')
    i3.gaps('inner', 'all', 'set', '15')
    time.sleep(0.5)
    if num % 2 == 0:
        i3.border('none')
        if num % 4 == 0:
            i3.focus('up')
            i3.border('none')
        i3.split('h')
        i3.border('none')
    else:
        i3.border('none')
        if num % 4 == 1:
            i3.focus('left')
        i3.split('v')
    if num > 1:
        fibonacci(num - 1)
def set_layout():
    """
        Set the layout/split for the currently
        focused window to either vertical or
        horizontal, depending on its width/height
    """
    current_win = i3.filter(nodes=[], focused=True)
    for win in current_win:
        parent = find_parent(win['id'])

        if parent and "rect" in parent:
            height = parent['rect']['height']
            width = parent['rect']['width']

            if height > width:
                new_layout = 'vertical'
            else:
                new_layout = 'horizontal'

            i3.split(new_layout)
Exemplo n.º 10
0
 def run(self, root=None):
     if self.command:
         command = self.command.format(container=self, root=root)
         i3exec(command, root=root, sleep=self.delay)
     elif self.run_in_term:
         self.run_in_term = self.run_in_term.format(container=self, root=root)
         command = 'i3-sensible-terminal -title {container.title} -e $SHELL -i -c "{container.run_in_term}"'.format(container=self, root=root)
         i3exec(command, root=root, sleep=self.delay)
     else:
         raise Exception("no command")
     self.layout and i3.layout(self.layout)
     self.split and i3.split(self.split)
Exemplo n.º 11
0
def create_tmp(current_id):
    i3.focus(con_id=current_id)
    i3.split('vertical')
    i3.open()
Exemplo n.º 12
0

for leaf in leaves:
    i3.focus(con_id=leaf['id'])
    i3.move('scratchpad')

i3.focus(con_id=workspace['id'])
i3.layout('splitv')

# base is the horizontal "ceiling" with N windows
# base descends as layers of windows are visualized
base = cssh[:column_count]
stack = cssh[column_count:]

revisualize(base[0], workspace['name'])
i3.split('v')
for leaf in base[1:]:
    revisualize(leaf, workspace['name'])
    i3.move('right')
    i3.split('v')

for idx in range(0,len(stack)):
    abscissa = idx % len(base)
    i3.focus(con_id=base[abscissa]['id'])
    revisualize(stack[idx], workspace['name'])
    base[abscissa] = stack[idx]


for leaf in extra:
    revisualize(leaf, workspace['name'])
    i3.move('down')
Exemplo n.º 13
0
def create_tmp(current_id):
    i3.focus(con_id=current_id)
    i3.split('vertical')
    i3.open()
Exemplo n.º 14
0
        # start playing
        while len(playing_videos)<max_play and len(to_play)>0:
            video=to_play.pop()
            print "Going to play %s" % (video)
            cmd = list(video_commands)
            cmd.append(video)
            print "cmd=%s" % (cmd)

            i3.workspace('videowall')
            w = find_player_to_split(args.split)
            if w:
                print "Found: %s" % (w)
                print "focusing: %s " % (i3.focus(con_id=w.id))
                if w.container.is_wider():
                    i3.split("h")
                else:
                    i3.split("v")

            else:
                print "No window to split"

            player = Popen(cmd, stdout=dev_null, stderr=dev_null)
            playing_videos.append(player)
            print "playing_videos now: %d, %s" % (len(playing_videos), playing_videos)
            sleep(0.5)

        print "starting poll cycle"
        for p in playing_videos:
            x=p.poll()
            print "poll of %s gave %s" % (p, x)
Exemplo n.º 15
0
def create_tmp(current_id):
    i3.focus(con_id=current_id)
    i3.split('vertical')
    tmp_id = check_output(['i3-msg', 'open']).decode('UTF-8')
    tmp_id = json.loads(tmp_id)[0]['id']