from libqtile import layout as libqtile_layout, layout, bar, widget from libqtile.command import lazy from libqtile.config import Key, Group, Screen, Drag, Click, Match class BaseConfig: @classmethod def get(cls, key, default): if hasattr(cls, key): return cls.__dict__[key] else: return default class BaseTheme: # Changing variables initialized by function keys = None groups = None layouts = None widget_defaults = None screens = None qtile = None # 'Static' variables dgroups_key_binder = None dgroups_app_rules = [] main = None follow_mouse_focus = True bring_front_click = False cursor_warp = False floating_layout = libqtile_layout.Floating(float_rules=[ # Run the utility of `xprop` to see the wm class and name of an X client. *layout.Floating.default_float_rules, Match(wm_class='confirmreset'), # gitk Match(wm_class='makebranch'), # gitk Match(wm_class='maketag'), # gitk Match(wm_class='ssh-askpass'), # ssh-askpass Match(title='branchdialog'), # gitk Match(title='pinentry'), # GPG key password entry ]) auto_fullscreen = True focus_on_window_activation = "smart" extensions = [] # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this # string besides java UI toolkits; you can see several discussions on the # mailing lists, github issues, and other WM documentation that suggest setting # this string if your java app doesn't work correctly. We may as well just lie # and say that we're a working one by default. # # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in # java that happens to be on java's whitelist. # # Alternatively, you could add this to .xinitrc: # 'export _JAVA_AWT_WM_NONREPARENTING=1' wmname = "LG3D" def initialize(self): self.widget_defaults = self.init_widget_defaults() self.keys = self.init_keys() self.groups = self.init_groups() self.layouts = self.init_layouts() self.screens = self.init_screens() self.mouse = self.init_mouse() def init_keys(self): return [ # Switch between windows in current stack pane Key(["mod4"], "k", lazy.layout.down()), Key(["mod4"], "j", lazy.layout.up()), # Move windows up or down in current stack Key(["mod4", "control"], "k", lazy.layout.shuffle_down()), Key(["mod4", "control"], "j", lazy.layout.shuffle_up()), # Switch window focus to other pane(s) of stack Key(["mod4"], "space", lazy.layout.next()), # Swap panes of split stack Key(["mod4", "shift"], "space", lazy.layout.rotate()), # Toggle between split and unsplit sides of stack. # Split = all windows displayed # Unsplit = 1 window displayed, like Max layout, but still with # multiple stack panes Key(["mod4", "shift"], "Return", lazy.layout.toggle_split()), Key(["mod4"], "Return", lazy.spawn("xterm")), # Toggle between different layouts as defined below Key(["mod4"], "Tab", lazy.next_layout()), Key(["mod4"], "w", lazy.window.kill()), Key(["mod4", "control"], "r", lazy.restart()), Key(["mod4", "control"], "q", lazy.shutdown()), Key(["mod4"], "r", lazy.spawncmd()), ] def init_groups(self): groups = [Group(i) for i in "asdfuiop"] for i in groups: self.keys.extend([ # mod1 + letter of group = switch to group Key(["mod4"], i.name, lazy.group[i.name].toscreen()), # mod1 + shift + letter of group = switch to & move focused window to group Key(["mod4", "shift"], i.name, lazy.window.togroup(i.name)), ]) return groups def init_layouts(self): return [ layout.Max(), layout.Stack(num_stacks=2) ] def init_widget_defaults(self): return dict( font='sans', fontsize=12, padding=3, ) def init_screens(self): # noinspection PyUnresolvedReferences return [ Screen( bottom=bar.Bar( [ widget.GroupBox(), widget.Prompt(), widget.WindowName(), widget.TextBox("Kuro BaseConfig", foreground="#ff0000", name="default"), widget.Systray(), widget.Clock(format='%Y-%m-%d %a %I:%M %p'), ], 24, ), ), ] def init_mouse(self): return [ Drag(["mod4"], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), Drag(["mod4"], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), Click(["mod4"], "Button2", lazy.window.bring_to_front()) ] # Callbacks def callback_startup_once(self, *args, **kwargs): pass def callback_startup(self, *args, **kwargs): pass def callback_startup_complete(self, *args, **kwargs): pass def callback_setgroup(self, *args, **kwargs): pass def callback_addgroup(self, *args, **kwargs): pass def callback_delgroup(self, *args, **kwargs): pass def callback_changegroup(self, *args, **kwargs): pass def callback_focus_change(self, *args, **kwargs): pass def callback_float_change(self, *args, **kwargs): pass def callback_group_window_add(self, *args, **kwargs): pass def callback_client_new(self, *args, **kwargs): pass def callback_client_managed(self, *args, **kwargs): pass def callback_client_killed(self, *args, **kwargs): pass def callback_client_state_changed(self, *args, **kwargs): pass def callback_client_type_changed(self, *args, **kwargs): pass def callback_client_focus(self, *args, **kwargs): pass def callback_client_mouse_enter(self, *args, **kwargs): pass def callback_client_name_updated(self, *args, **kwargs): pass def callback_client_urgent_hint_changed(self, *args, **kwargs): pass def callback_layout_change(self, *args, **kwargs): pass def callback_net_wm_icon_change(self, *args, **kwargs): pass def callback_selection_notify(self, *args, **kwargs): pass def callback_selection_change(self, *args, **kwargs): pass def callback_screen_change(self, *args, **kwargs): pass def callback_current_screen_change(self, *args, **kwargs): pass