Exemplo n.º 1
0
    def cmd_tile(self):
        AutoTile.cmd_tile(self)

        m_size = len(self.store.masters)
        s_size = len(self.store.slaves)

        if not m_size and not s_size:
            return

        rows = int(math.ceil(float(s_size) / float(self.columns)))
        lastrow_columns = s_size % self.columns or self.columns

        m_width = int(self.monitor.wa_width * self.hsplit)
        m_height = int(self.monitor.wa_height * self.vsplit)
        m_x = self.monitor.wa_x + int((self.monitor.wa_width - m_width) / 2)
        m_y = self.monitor.wa_y + int((self.monitor.wa_height - m_height) / 2)

        s_width = int(self.monitor.wa_width / self.columns)
        if not rows:
            s_height = 1
        else:
            s_height = int(self.monitor.wa_height / rows)
        s_x = self.monitor.wa_x
        s_y = self.monitor.wa_y

        if (
            m_width <= 0 or m_width > self.monitor.wa_width or
            s_width <= 0 or s_width > self.monitor.wa_width or
            m_height <= 0 or m_height > self.monitor.wa_height or
            s_height <= 0 or s_height > self.monitor.wa_height
        ):
            self.error_exec_callbacks()
            return

        for i, cont in enumerate(self.store.masters):
            cont.moveresize(
                m_x,
                m_y,
                m_width,
                m_height
            )

        for i, cont in enumerate(self.store.slaves):
            if i / self.columns == rows - 1:
                s_width = self.monitor.wa_width / lastrow_columns

            cont.moveresize(
                s_x + (i % self.columns) * s_width,
                s_y + (i / self.columns) * s_height,
                s_width,
                s_height
            )

        # If we've made it this far, then we've supposedly tiled correctly
        self.error_clear()
Exemplo n.º 2
0
    def cmd_tile(self):
        AutoTile.cmd_tile(self)

        m_size = len(self.store.masters)
        s_size = len(self.store.slaves)

        if not m_size and not s_size:
            return

        m_width = int(self.monitor.wa_width * self.hsplit)
        s_width = self.monitor.wa_width - m_width

        m_x = self.monitor.wa_x
        s_x = m_x + m_width

        if (
            m_width <= 0 or m_width > self.monitor.wa_width or
            s_width <= 0 or s_width > self.monitor.wa_width
        ):
            self.error_exec_callbacks()
            return

        if m_size:
            m_height = self.monitor.wa_height / m_size

            if not s_size:
                m_width = self.monitor.wa_width

            for i, cont in enumerate(self.store.masters):
                cont.moveresize(
                    m_x,
                    self.monitor.wa_y + i * m_height,
                    m_width,
                    m_height
                )

        if s_size:
            s_height = self.monitor.wa_height / s_size

            if not m_size:
                s_width = self.monitor.wa_width
                s_x = self.monitor.wa_x

            for i, cont in enumerate(self.store.slaves):
                cont.moveresize(
                    s_x,
                    self.monitor.wa_y + i * s_height,
                    s_width,
                    s_height
                )

        # If we've made it this far, then we've supposedly tiled correctly
        self.error_clear()
Exemplo n.º 3
0
    def cmd_tile(self):
        AutoTile.cmd_tile(self)

        m_size = len(self.store.masters)
        s_size = len(self.store.slaves)

        if not m_size and not s_size:
            return

        m_height = int(self.monitor.wa_height * self.vsplit)
        s_height = self.monitor.wa_height - m_height

        m_y = self.monitor.wa_y
        s_y = m_y + m_height

        if (
            m_height <= 0 or m_height > self.monitor.wa_height or
            s_height <= 0 or s_height > self.monitor.wa_height
        ):
            self.error_exec_callbacks()
            return

        if m_size:
            m_width = self.monitor.wa_width / m_size

            if not s_size:
                m_height = self.monitor.wa_height

            for i, cont in enumerate(self.store.masters):
                cont.moveresize(
                    self.monitor.wa_x + i * m_width,
                    m_y,
                    m_width,
                    m_height
                )

        if s_size:
            s_width = self.monitor.wa_width / s_size

            if not m_size:
                s_height = self.monitor.wa_height
                s_y = self.monitor.wa_y

            for i, cont in enumerate(self.store.slaves):
                cont.moveresize(
                    self.monitor.wa_x + i * s_width,
                    s_y,
                    s_width,
                    s_height
                )

        # If we've made it this far, then we've supposedly tiled correctly
        self.error_clear()
Exemplo n.º 4
0
    def cmd_tile(self):
        AutoTile.cmd_tile(self)

        if not self.store.all():
            return

        # Do master last, in case decorations are disabled
        # and we need to draw the "active" border (so it
        # over laps the "inactive" borders).
        for cont in sorted(self.store.all(), reverse=True):
            cont.moveresize(
                self.monitor.wa_x,
                self.monitor.wa_y,
                self.monitor.wa_width,
                self.monitor.wa_height
            )

        # If we've made it this far, then we've supposedly tiled correctly
        self.error_clear()
Exemplo n.º 5
0
    def cmd_tile(self):
        AutoTile.cmd_tile(self)

        m_size = len(self.store.masters)
        s_size = len(self.store.slaves)

        if not m_size and not s_size:
            return

        push_down = self.get_option('push_down')
        push_over = self.get_option('push_over')
        if self.get_option('horz_align') == 'right':
            push_over = -push_over

        m_width = int(
            self.monitor.wa_width * self.hsplit - push_over * s_size
        )
        m_height = int(
            self.monitor.wa_height * self.vsplit - push_down * s_size
        )
        m_y = self.monitor.wa_y + push_down * s_size

        s_width = int(self.monitor.wa_width * self.hsplit)
        s_height = int(self.monitor.wa_height * self.vsplit)
        s_y = self.monitor.wa_y

        if (
            m_width <= 0 or m_width > self.monitor.wa_width or
            s_width <= 0 or s_width > self.monitor.wa_width or
            m_height <= 0 or m_height > self.monitor.wa_height or
            s_height <= 0 or s_height > self.monitor.wa_height
        ):
            self.error_exec_callbacks()
            return

        if self.get_option('horz_align') == 'right':
            m_x = (
                self.monitor.wa_x +
                (self.monitor.wa_width - m_width) +
                (push_over * s_size)
            )
            s_x = self.monitor.wa_x + (self.monitor.wa_width - s_width)
        else:
            m_x = self.monitor.wa_x + (push_over * s_size)
            s_x = self.monitor.wa_x

        for i, cont in enumerate(self.store.slaves):
            cont.moveresize(
                s_x + (i * push_over),
                s_y + (i * push_down),
                s_width - (i * push_over),
                s_height - (i * push_down)
            )
            cont.window_raise()

        for i, cont in enumerate(self.store.masters):
            cont.moveresize(
                m_x,
                m_y,
                m_width,
                m_height
            )
            cont.window_raise()

        self.raise_active()

        # If we've made it this far, then we've supposedly tiled correctly
        self.error_clear()
Exemplo n.º 6
0
 def cmd_switch_previous(self):
     AutoTile.cmd_switch_previous(self)
     self.restack()
     self.raise_active()
Exemplo n.º 7
0
 def cmd_switch_next(self):
     AutoTile.cmd_switch_next(self)
     self.restack()
     self.raise_active()
Exemplo n.º 8
0
 def cmd_previous(self):
     self.restack()
     AutoTile.cmd_previous(self)
Exemplo n.º 9
0
    def __init__(self, monitor):
        AutoTile.__init__(self, monitor)

        self.vsplit = self.get_option('height_factor')
Exemplo n.º 10
0
 def cmd_focus_master(self):
     self.restack()
     AutoTile.cmd_focus_master(self)
Exemplo n.º 11
0
 def cmd_cycle(self):
     AutoTile.cmd_cycle(self)
     self.restack()
Exemplo n.º 12
0
    def __init__(self, monitor):
        AutoTile.__init__(self, monitor)

        self.hsplit = self.get_option('width_factor')
        self.vsplit = self.get_option('height_factor')
        self.columns = self.get_option('columns')
Exemplo n.º 13
0
 def cmd_previous(self):
     self.lower_master()
     AutoTile.cmd_previous(self)
Exemplo n.º 14
0
 def cmd_next(self):
     self.lower_master()
     AutoTile.cmd_next(self)
Exemplo n.º 15
0
 def __init__(self, monitor):
     AutoTile.__init__(self, monitor)
Exemplo n.º 16
0
    def cmd_tile(self):
        AutoTile.cmd_tile(self)

        m_size = len(self.store.masters)
        s_size = len(self.store.slaves)

        if not m_size and not s_size:
            return

        columns = int(math.ceil(float(s_size) / float(self.rows)))
        lastcolumn_rows = s_size % self.rows or self.rows

        m_width = int(self.monitor.wa_width * self.hsplit)

        if not columns:
            s_width = 1
        else:
            s_width = (self.monitor.wa_width - m_width) / columns

        m_x = self.monitor.wa_x
        s_x = m_x + m_width

        if (
            m_width <= 0 or m_width > self.monitor.wa_width or
            s_width <= 0 or s_width > self.monitor.wa_width
        ):
            self.error_exec_callbacks()
            return

        if m_size:
            m_height = self.monitor.wa_height / m_size

            if not s_size:
                m_width = self.monitor.wa_width

            for i, cont in enumerate(self.store.masters):
                cont.moveresize(
                    m_x,
                    self.monitor.wa_y + i * m_height,
                    m_width,
                    m_height
                )

        if s_size:
            s_height = self.monitor.wa_height / self.rows

            if not m_size:
                s_width = self.monitor.wa_width / columns
                s_x = self.monitor.wa_x

            column = 0
            for i, cont in enumerate(self.store.slaves):
                if column == columns - 1:
                    s_height = self.monitor.wa_height / lastcolumn_rows

                cont.moveresize(
                    s_x + column * s_width,
                    self.monitor.wa_y + (i % self.rows) * s_height,
                    s_width,
                    s_height
                )

                if not (i + 1) % self.rows:
                    column += 1

        # If we've made it this far, then we've supposedly tiled correctly
        self.error_clear()
Exemplo n.º 17
0
 def cmd_make_active_master(self):
     AutoTile.cmd_make_active_master(self)
     self.restack()
     self.raise_active()
Exemplo n.º 18
0
    def __init__(self, monitor):
        AutoTile.__init__(self, monitor)

        self.hsplit = self.get_option('width_factor')
Exemplo n.º 19
0
 def cmd_next(self):
     self.restack()
     AutoTile.cmd_next(self)