from libqtile import bar, layout, qtile from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown from libqtile.lazy import lazy from libqtile.utils import guess_terminal from qtile_extras import widget from qtile_extras.widget.decorations import PowerLineDecoration mod = "mod4" terminal = guess_terminal("ghostty") keys = [ Key([mod], "h", lazy.layout.left(), desc="Move focus to left"), Key([mod], "l", lazy.layout.right(), desc="Move focus to right"), Key([mod], "j", lazy.layout.down(), desc="Move focus down"), Key([mod], "k", lazy.layout.up(), desc="Move focus up"), Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"), Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"), Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"), Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"), Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"), Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"), Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"), Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), Key([mod, "shift"], "Return",lazy.layout.toggle_split(),desc="Toggle between split and unsplit sides of stack",), Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), Key([mod, "shift"], "q", lazy.window.kill(), desc="Kill focused window"), Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window",), Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"), Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), Key([mod], "d", lazy.spawn("rofi -show drun"), desc="Spawn rofi"), ] # Add key bindings to switch VTs in Wayland. for vt in range(1, 8): keys.append( Key( ["control", "mod1"], f"f{vt}", lazy.core.change_vt(vt).when(func=lambda: qtile.core.name == "wayland"), desc=f"Switch to VT{vt}", ) ) # Add groups group_names = "αβγδεζηθικ" group_keys = "1234567890" groups = [Group(name) for name in group_names] for key, group in zip(group_keys, groups): keys.extend([ # mod + group number = switch desktop Key([mod], key, lazy.group[group.name].toscreen(), desc=f"Switch to group {group.name}"), # mod + shift + group number = switch to & move focused window to group Key([mod, "shift"], key, lazy.window.togroup(group.name, switch_group=True), desc=f"Switch to & move focused window to group {group.name}") ]) # nord color theme nord = { "polar_night_0": "#2E3440", "polar_night_1": "#3B4252", "polar_night_2": "#434C5E", "polar_night_3": "#4C566A", "snow_storm_0": "#D8DEE9", "snow_storm_1": "#E5E9F0", "snow_storm_2": "#ECEFF4", "frost_0": "#8FBCBB", "frost_1": "#88C0D0", "frost_2": "#81A1C1", "frost_3": "#5E81AC", "aurora_red": "#BF616A", "aurora_orange": "#D08770", "aurora_yellow": "#EBCB8B", "aurora_green": "#A3BE8C", "aurora_purple": "#B48EAD", } # define layouts layouts = [ layout.MonadTall( margin=10, border_width=2, border_focus=nord["frost_0"], border_normal=nord["polar_night_3"], ), layout.Spiral( margin=10, border_width=2, border_focus=nord["frost_0"], border_normal=nord["polar_night_3"], main_pane="left", new_client_position="after_current", ), layout.Bsp( margin=10, border_width=2, border_focus=nord["frost_0"], border_normal=nord["polar_night_3"], lower_right=True, ), ] widget_defaults = dict( font="Source Code Pro for Powerline", fontsize=16, padding=3, ) extension_defaults = widget_defaults.copy() powerline = { "decorations": [ PowerLineDecoration(path="arrow_right") ] } # configure widgets screens = [ Screen( wallpaper="~/.local/share/wallpaper/wp.png", wallpaper_mode="fill", top=bar.Bar( [ # Groups widget.GroupBox( background=nord["polar_night_1"], highlight_method='line', inactive=nord["snow_storm_0"], active=nord["snow_storm_2"], this_current_screen_border=nord["frost_2"], this_screen_border=nord["frost_3"], hide_unused=True, **powerline ), # Window Name widget.WindowName( background=nord["polar_night_2"], foreground=nord["snow_storm_2"], max_chars=60, **powerline ), # WLAN (click opens nm-applet) widget.Wlan( background=nord["polar_night_3"], foreground=nord["frost_0"], format=" {essid} {percent:2.0%}", interface="wlp0s20f3", mouse_callbacks={"Button1": lambda: qtile.spawn("nm-connection-editor")}, **powerline ), # Volume (click opens pavucontrol) widget.Volume( background=nord["polar_night_1"], foreground=nord["frost_1"], fmt=" {}", mouse_callbacks={"Button1": lambda: qtile.spawn("pavucontrol")}, **powerline ), # Battery with condition-based icons widget.Battery( background=nord["polar_night_0"], foreground=nord["aurora_yellow"], format="{char} {percent:2.0%}", charge_char="", discharge_char="", full_char="", empty_char="", update_interval=10, show_short_text=False, #mouse_callbacks={"Button1": lambda: qtile.spawn("xfce4-power-manager-settings")}, **powerline ), # Date + Time widget.Clock( background=nord["polar_night_1"], foreground=nord["snow_storm_1"], format="󰃭 %a %d %b", **powerline ), widget.Clock( background=nord["polar_night_2"], foreground=nord["snow_storm_2"], format=" %H:%M", **powerline ), # System Tray widget.StatusNotifier( background=nord["polar_night_3"], icon_size=16, padding=10, **powerline ), # Quick Exit with style widget.QuickExit( background=nord["aurora_red"], foreground=nord["snow_storm_2"], default_text=" Power ", countdown_format="{}s ", countdown_start=3, mouse_callbacks={ # Left: open wlogout GUI (recommended) "Button1": lambda: qtile.spawn("wlogout"), # Right: open a simple lock (see lock below) "Button3": lambda: qtile.spawn("bash -lc \"$(which wlogout) || { echo 'wlogout missing'; }\""), }, ), # Layout widget.CurrentLayout( background=nord["polar_night_0"], foreground=nord["frost_2"], mode="icon", ), ], 30, margin=[5, 10, 0, 5], # nice subtle spacing opacity=0.9, ), ), ] # 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 = [] # type: list follow_mouse_focus = True bring_front_click = False floats_kept_above = True cursor_warp = False floating_layout = 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" reconfigure_screens = True auto_minimize = True wl_input_rules = None wl_xcursor_theme = None wl_xcursor_size = 24 wmname = "qtile"