From fadcccd3bfd7b61aceed1b8ca034e5c849d00509 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 1 Nov 2021 13:19:29 +0100 Subject: Play around with Qtile as an alternative to Xmonad --- gui/conf/qtile.py | 173 +++++++++++++++++++++++++++--------------------------- 1 file changed, 87 insertions(+), 86 deletions(-) (limited to 'gui/conf/qtile.py') diff --git a/gui/conf/qtile.py b/gui/conf/qtile.py index bfda21f..3b2927d 100644 --- a/gui/conf/qtile.py +++ b/gui/conf/qtile.py @@ -1,49 +1,60 @@ -from libqtile.config import Key, Screen, Group, Drag, Click, ScratchPad, DropDown -from libqtile.command import lazy -from libqtile import layout, bar, widget - from typing import List -mod = "mod4" +from libqtile import layout, widget, hook +from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown, KeyChord +from libqtile.lazy import lazy -def hide_show_bar(qtile): - bar = qtile.currentScreen.top - if bar.is_show(): - bar.show(is_show=False) - else: - bar.show(is_show=True) - qtile.currentGroup.layoutAll() +mod = "mod4" keys = [ - Key([mod], "k", lazy.layout.down()), - Key([mod], "j", lazy.layout.up()), + Key([mod], "j", lazy.layout.down()), + Key([mod], "k", lazy.layout.up()), - Key([mod, "shift"], "k", lazy.layout.shuffle_down()), - Key([mod, "shift"], "j", lazy.layout.shuffle_up()), + Key([mod, "shift"], "j", lazy.layout.shuffle_down()), + Key([mod, "shift"], "k", lazy.layout.shuffle_up()), Key([mod], "l", lazy.layout.next()), Key([mod], "h", lazy.layout.previous()), - Key([mod], "s", lazy.layout.toggle_split()), + Key([mod, "shift"], "Up", lazy.layout.grow_up()), + Key([mod, "shift"], "Down", lazy.layout.grow_down()), + Key([mod, "shift"], "Left", lazy.layout.grow_left()), + Key([mod, "shift"], "Right", lazy.layout.grow_right()), + Key([mod], "Return", lazy.spawn("kitty")), - Key([mod, "shift"], "Return", lazy.spawn("nvim-qt --no-ext-tabline")), + Key([mod, "shift"], "Return", lazy.spawn("emacsclient --create-frame")), - Key([mod], "v", lazy.next_layout()), + KeyChord([mod], "s", [ + Key([], "s", lazy.layout.toggle_split()), + Key([], "j", lazy.next_layout()), + ]), Key([mod, "shift"], "q", lazy.window.kill()), Key(["control", "mod1"], "Escape", lazy.shutdown()), Key(["control", "mod1"], "BackSpace", lazy.restart()), - Key([mod], "space", lazy.spawn("rofi -show combi")), - - Key([mod, "shift"], "b", lazy.function(hide_show_bar)), + Key(["control", "mod1"], "l", lazy.spawn("i3lock -c 000000")), + Key([], "Print", lazy.spawn("flameshot gui")), - Key([], "Menu", lazy.group['scratchpad'].dropdown_toggle('term')) + Key([mod], "space", lazy.spawn("rofi -show combi")), + Key([mod], "p", lazy.spawn("passrofi")), + + Key([], "Menu", lazy.group['scratch'].dropdown_toggle('term')), + Key([mod], "b", lazy.group['scratch'].dropdown_toggle('browser')), + Key([mod], "m", lazy.group['scratch'].dropdown_toggle('telegram')), + + KeyChord([mod], "c", [ + Key([], "m", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")), + Key([], "Up", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +10%")), + Key([], "Down", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -10%")), + Key([], "s", lazy.spawn("systemctl suspend")), + Key([], "h", lazy.spawn("systemctl hibernate")), + ]), ] -groups = [ Group(i) for i in "1234567890" ] +groups = [Group(i) for i in "1234567890"] for i in groups: keys.extend([ @@ -51,58 +62,44 @@ for i in groups: Key([mod, "shift"], i.name, lazy.window.togroup(i.name)), ]) -groups += [ScratchPad("scratchpad", [ - DropDown("term", "kitty") -])] - -layouts = [ - layout.Max(), - layout.Stack( - num_stacks=2, - border_focus="#909636", - border_normal="#161616", - border_width=4 - ), - layout.Stack( - num_stacks=3, - border_focus="#909636", - border_normal="#161616", - border_width=4 - ) +scratchpad_defaults = { + "height": 0.8, + "width": 0.9, + "x": 0.05, + "y": 0.0, + "on_focus_lost_hide": False, +} + +scratchpad_rhs = { + "height": 0.8, + "width": 0.3, + "x": 0.7, + "y": 0.1, + "on_focus_lost_hide": False, +} + +groups += [ + ScratchPad('scratch', [ + DropDown("term", "kitty", **scratchpad_defaults), + DropDown("browser", "firefox", **scratchpad_defaults), + DropDown("telegram", "telegram-desktop", **scratchpad_rhs) + ]), ] -widget_defaults = dict( - font='Iosevka', - fontsize=12, - padding=2, -) -extension_defaults = widget_defaults.copy() +border_default = { + "border_focus" : "#909636", + "border_normal": "#161616", + "border_width" : 2, +} -screens = [ - Screen( - top=bar.Bar( - [ - widget.GroupBox( - foreground = '#161616', - active = '#161616', - inactive = '#161616', - disable_drag = True, - this_current_screen_border = '#161616', - ), - widget.WindowName( - foreground = '#161616', - ), - widget.Clock( - foreground = '#161616', - format = '%Y-%m-%d %R' - ), - ], - 24, - background = "#909636", - ), - ), +layouts = [ + layout.Max(), + layout.MonadTall(**border_default), + layout.Stack(num_stacks=2, **border_default), + layout.Stack(num_stacks=3, **border_default), ] +# Drag floating layouts. mouse = [ Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), @@ -111,23 +108,27 @@ mouse = [ Click([mod], "Button2", lazy.window.bring_to_front()) ] +screens = [ + Screen() +] + +floating_layout = layout.Floating( + border_focus="#aadb0f", + border_normal="#161616", + border_width=4, + float_rules=[ + *layout.Floating.default_float_rules, + Match(wm_class='ssh-askpass'), # ssh-askpass + Match(title='pinentry'), # GPG key password entry + ]) + dgroups_key_binder = None -dgroups_app_rules = [] # type: List -main = None +dgroups_app_rules = [] follow_mouse_focus = True bring_front_click = False -cursor_warp = True -floating_layout = layout.Floating(float_rules=[ - {'wmclass': 'confirm'}, - {'wmclass': 'dialog'}, - {'wmclass': 'download'}, - {'wmclass': 'error'}, - {'wmclass': 'file_progress'}, - {'wmclass': 'notification'}, - {'wmclass': 'splash'}, - {'wmclass': 'toolbar'}, - {'wname': 'pinentry'}, - {'wmclass': 'ssh-askpass'}, -]) +cursor_warp = False auto_fullscreen = True focus_on_window_activation = "smart" +reconfigure_screens = True + +wmname = "LG3D" -- cgit v1.2.3