from libqtile.config import Key, Screen, Group, Drag, Click from libqtile.command import lazy from libqtile import layout, bar, widget, hook mod = "mod4" keys = [ # Switch between windows in current stack pane Key([mod], "h", lazy.layout.left()), Key([mod], "l", lazy.layout.right()), Key([mod], "j", lazy.layout.down()), Key([mod], "k", lazy.layout.up()), Key([mod, "shift"], "h", lazy.layout.swap_left()), Key([mod, "shift"], "l", lazy.layout.swap_right()), Key([mod, "shift"], "j", lazy.layout.shuffle_down()), Key([mod, "shift"], "k", lazy.layout.shuffle_up()), Key([mod], "i", lazy.layout.grow()), Key([mod], "m", lazy.layout.shrink()), Key([mod], "n", lazy.layout.normalize()), Key([mod], "o", lazy.layout.maximize()), Key([mod, "shift"], "space", lazy.layout.flip()), # Toggle floating Key([mod], "space", lazy.window.toggle_floating()), # Toggle fullscreen Key([mod], "f", lazy.window.toggle_fullscreen()), # Launch programs Key([mod], "Return", lazy.spawn("urxvt")), Key([mod], "d", lazy.spawn("rofi -show run")), Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute 1 toggle")), Key([], "XF86AudioMicMute", lazy.spawn("amixer -c 1 set Capture toggle")), Key([], "XF86Display", lazy.spawn("arandr")), Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 5")), Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 5")), Key(["shift"], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 1")), Key(["shift"], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 1")), Key([], "XF86Tools", lazy.spawn("rofi -show ssh")), Key([], "XF86Search", lazy.spawn("rofi -show fm -switchers 'fm:fmenu-rofi'")), Key([], "XF86LaunchA", lazy.spawn("rofi -show window")), Key([], "XF86Explorer", lazy.spawn("rofi -show run")), Key([], "Print", lazy.spawn("teiler")), # Toggle between different layouts as defined below Key([mod], "Tab", lazy.next_layout()), # Close current window Key([mod], "q", lazy.window.kill()), Key([mod, "shift"], "r", lazy.restart()), Key([mod, "control"], "q", lazy.shutdown()), Key([mod], "r", lazy.spawncmd()), ] labels = list("1234567890") groups = [Group(i) for i in labels] for group in groups: # mod1 + letter of group = switch to group keys.append( Key([mod], group.name, lazy.group[group.name].toscreen()) ) # mod1 + shift + letter of group = switch to & move focused window to group keys.append( Key([mod, "shift"], group.name, lazy.window.togroup(group.name)) ) layout_theme = { 'border_focus': "#215578", 'border_normal': "#252525", 'ratio': 0.618, 'border_width': 1, 'margin': 0, } layouts = [ layout.MonadTall(**layout_theme), layout.Max(**layout_theme), layout.RatioTile(**layout_theme), ] widget_defaults = dict( rounded=False, font='Meslo LG S DZ', fontsize=12, padding=3, borderwidth=2, opacity=0.2, ) class Battery(widget.Battery): low_percentage = 0.1 not_charging_format = "{percent:2.01%}{char}" format = not_charging_format + " @{power:.1f}W ({hour:d}:{min:02d})" full_char = '=' charge_char = '↑' discharge_char = '↓' def _get_text(self): info = self._get_info() if info is False: return 'Error' percent = info['now'] / info['full'] # Set the charging character try: # hide the text when it's higher than threshold, but still # display `full` when the battery is fully charged. if self.hide_threshold and \ info['now'] / info['full'] * 100.0 >= \ self.hide_threshold and \ info['stat'] != 'Full': return '' elif info['stat'] == 'Discharging': char = self.discharge_char time = info['now'] / info['power'] elif info['stat'] == 'Charging': char = self.charge_char time = (info['full'] - info['now']) / info['power'] else: char = self.full_char return self.not_charging_format.format( percent=percent, char=char) except ZeroDivisionError: time = -1 # Calculate the battery percentage and time left if time >= 0: hour = int(time) min = int(time * 60) % 60 else: hour = -1 min = -1 if info['stat'] == 'Discharging' and percent < self.low_percentage: self.layout.colour = self.low_foreground else: self.layout.colour = self.foreground return self.format.format( power=info['power'] / 1000000, char=char, percent=percent, hour=hour, min=min ) sep = lambda: widget.Sep(linewidth=0, padding=8) screens = [ Screen( top=bar.Bar( [ widget.GroupBox(), widget.Prompt(), widget.TaskList(max_title_width=1920), widget.TextBox("♪"), widget.Volume(), sep(), widget.TextBox("⚡"), Battery(battery_name="BAT0"), sep(), widget.TextBox("⚡"), Battery(battery_name="BAT1"), sep(), widget.CPUGraph(), widget.MemoryGraph(), sep(), widget.TextBox(""), widget.Clock(format='%a %Y-%m-%d %H:%M:%S'), sep(), widget.Systray(), ], 26, background="#252525" ), ), ] # Drag floating layouts. mouse = [ Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), Click([mod], "Button2", lazy.window.bring_to_front()) ] dgroups_key_binder = None dgroups_app_rules = [] main = None follow_mouse_focus = True bring_front_click = True cursor_warp = False floating_layout = layout.Floating(border_focus="#215578") auto_fullscreen = True # 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. wmname = "LG3D"