Example #1
0
    def init_layouts(self) -> list:
        """Creates and returns the layouts used."""

        if not self.layouts:
            self.layouts = [
                # Bsp(**self.theme_config.layouts["default"]),
                Columns(
                    **{
                        **self.theme_config.layouts["default"],
                        **self.theme_config.layouts["columns"],
                    }, ),
                Floating(**self.theme_config.layouts["floating"]),
                Max(**self.theme_config.layouts["default"]),
                # Matrix(**self.theme_config.layouts["default"]),
                MonadTall(**self.theme_config.layouts["default"]),
                # MonadWide(**self.theme_config.layouts["default"]),
                # RatioTile(**self.theme_config.layouts["default"]),
                Stack(**self.theme_config.layouts["default"]),
                Tile(**self.theme_config.layouts["default"]),
                # TreeTab(**self.theme_config.layouts["default"]),
                # VerticalTile(**self.theme_config.layouts["default"]),
                # Zoomy(**self.theme_config.layouts["default"]),
            ]

        return self.layouts
Example #2
0
 def __init__(self,
              side,
              width,
              wname=None,
              wmclass=None,
              role=None,
              fallback=Stack(stacks=1),
              **config):
     if wname is None and wmclass is None and role is None:
         wname = 'slice'
     self.match = {
         'wname': wname,
         'wmclass': wmclass,
         'role': role,
     }
     Delegate.__init__(self, width=width, side=side, **config)
     self.add_defaults(MySlice.defaults)
     self._slice = Max()
     self._fallback = fallback
Example #3
0
class ShConfig(Config):
    keys = []
    mouse = []
    groups = [
        config.Group("a"),
        config.Group("b"),
    ]
    layouts = [
        Max(),
    ]
    floating_layout = resources.default_config.floating_layout
    screens = [config.Screen()]
Example #4
0
class ShConfig:
    keys = []
    mouse = []
    groups = [
        config.Group("a"),
        config.Group("b"),
    ]
    layouts = [
        Max(),
    ]
    floating_layout = floating.Floating()
    screens = [config.Screen()]
Example #5
0
 def __init__(self, side, width,
              wname=None, wmclass=None, role=None,
              fallback=Stack(stacks=1), **config):
     if wname is None and wmclass is None and role is None:
         wname = 'slice'
     self.match = {
         'wname': wname,
         'wmclass': wmclass,
         'role': role,
     }
     Delegate.__init__(self, width=width, side=side, **config)
     self.add_defaults(MySlice.defaults)
     self._slice = Max()
     self._fallback = fallback
Example #6
0
single_margin = 10

# layouts
layouts = [
    MonadTall(
        border_focus=border_focus,
        border_width=border_width,
        margin=margin,
        single_border_width=single_border_width,
        single_margin=single_margin,
        name="Tall",
    ),
    Max(
        border_focus=border_focus,
        border_width=border_width,
        margin=single_margin,
        single_border_width=0,
        single_margin=0,
        name="Full",
    ),
    MonadWide(
        border_focus=border_focus,
        border_width=border_width,
        margin=margin,
        single_border_width=single_border_width,
        single_margin=single_margin,
        name="wide",
    ),
]

dgroups_key_binder = None
dgroups_app_rules = []  # type: List
Example #7
0
class MySlice(Delegate):
    """Slice layout

    This layout cuts piece of screen and places a single window on that piece,
    and delegates other window placement to other layout
    """

    defaults = [
        ("width", 256, "Slice width"),
        ("side", "left", "Side of the slice (left, right, top, bottom)"),
        ("name", "max", "Name of this layout."),
    ]

    def __init__(self,
                 side,
                 width,
                 wname=None,
                 wmclass=None,
                 role=None,
                 fallback=Stack(stacks=1),
                 **config):
        if wname is None and wmclass is None and role is None:
            wname = 'slice'
        self.match = {
            'wname': wname,
            'wmclass': wmclass,
            'role': role,
        }
        Delegate.__init__(self, width=width, side=side, **config)
        self.add_defaults(MySlice.defaults)
        self._slice = Max()
        self._fallback = fallback

    def clone(self, group):
        res = Layout.clone(self, group)
        res._slice = self._slice.clone(group)
        res._fallback = self._fallback.clone(group)
        res._window = None
        return res

    def layout(self, windows, screen):
        if self._slice not in self.layouts.values():
            self.delegate_layout(windows, {self._fallback: screen})
        else:
            w = self.width if "dmitry.golovchen - Skype" in self._slice._get_window().info()['name']\
                else 600
            if self.side == 'left':
                win, sub = screen.hsplit(w)
            elif self.side == 'right':
                sub, win = screen.hsplit(screen.width - w)
            elif self.side == 'top':
                win, sub = screen.vsplit(w)
            elif self.side == 'bottom':
                sub, win = screen.vsplit(screen.height - w)
            else:
                raise NotImplementedError(self.side)
            self.delegate_layout(windows, {
                self._slice: win,
                self._fallback: sub,
            })

    def configure(self, win, screen):
        raise NotImplementedError("Should not be called")

    def _get_layouts(self):
        return (self._slice, self._fallback)

    def _get_active_layout(self):
        return self._fallback  # always

    def add(self, win):
        if win.match(**self.match):
            self._slice.add(win)
            self.layouts[win] = self._slice
        else:
            self._fallback.add(win)
            self.layouts[win] = self._fallback
Example #8
0
my_layout = {
    "border_focus": bar_colors["magenta"],
    "border_width": 2,
    "margin": 0,
    "single_border_width": 0,
    "single_margin": 0,
}

layouts = [
    MonadTall(
        **my_layout,
        name="Tall",
    ),
    MonadWide(**my_layout, name="wide"),
    Max(**my_layout, name="Full"),
]

floating_layout = Floating(**my_layout,
                           name="Float",
                           float_rules=[
                               *layout.Floating.default_float_rules,
                               Match(title='mpv'),
                               Match(title='gimp'),
                               Match(title='virt-manager'),
                               Match(title='mpv'),
                           ])


@hook.subscribe.client_new
def floating_dialogs(window):
Example #9
0
class MySlice(Delegate):
    """Slice layout

    This layout cuts piece of screen and places a single window on that piece,
    and delegates other window placement to other layout
    """

    defaults = [
        ("width", 256, "Slice width"),
        ("side", "left", "Side of the slice (left, right, top, bottom)"),
        ("name", "max", "Name of this layout."),
    ]

    def __init__(self, side, width,
                 wname=None, wmclass=None, role=None,
                 fallback=Stack(stacks=1), **config):
        if wname is None and wmclass is None and role is None:
            wname = 'slice'
        self.match = {
            'wname': wname,
            'wmclass': wmclass,
            'role': role,
        }
        Delegate.__init__(self, width=width, side=side, **config)
        self.add_defaults(MySlice.defaults)
        self._slice = Max()
        self._fallback = fallback

    def clone(self, group):
        res = Layout.clone(self, group)
        res._slice = self._slice.clone(group)
        res._fallback = self._fallback.clone(group)
        res._window = None
        return res

    def layout(self, windows, screen):
        if self._slice not in self.layouts.values():
            self.delegate_layout(windows, {self._fallback: screen})
        else:
            w = self.width if "dmitry.golovchen - Skype" in self._slice._get_window().info()['name']\
                else 600
            if self.side == 'left':
                win, sub = screen.hsplit(w)
            elif self.side == 'right':
                sub, win = screen.hsplit(screen.width - w)
            elif self.side == 'top':
                win, sub = screen.vsplit(w)
            elif self.side == 'bottom':
                sub, win = screen.vsplit(screen.height - w)
            else:
                raise NotImplementedError(self.side)
            self.delegate_layout(
                windows,
                {
                    self._slice: win,
                    self._fallback: sub,
                }
            )

    def configure(self, win, screen):
        raise NotImplementedError("Should not be called")

    def _get_layouts(self):
        return (self._slice, self._fallback)

    def _get_active_layout(self):
        return self._fallback  # always

    def add(self, win):
        if win.match(**self.match):
            self._slice.add(win)
            self.layouts[win] = self._slice
        else:
            self._fallback.add(win)
            self.layouts[win] = self._fallback