Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pywal1 config
- from typing import List # noqa: F401
- import os
- import subprocess
- from os import path
- from libqtile import bar, layout, widget, hook, qtile, backend
- from libqtile.config import Click, Drag, Group, ScratchPad, DropDown, Key, Match, Screen
- from libqtile.lazy import lazy
- from settings.path import qtile_path
- from qtile_extras import widget
- from qtile_extras.widget.decorations import PowerLineDecoration
- mod = "mod4"
- terminal = "kitty"
- ########## Powerline from extras ########
- arrow_powerlineRight = {
- "decorations": [
- PowerLineDecoration(
- path="arrow_right",
- size=11,
- )
- ]
- }
- arrow_powerlineLeft = {
- "decorations": [
- PowerLineDecoration(
- path="arrow_left",
- size=11,
- )
- ]
- }
- rounded_powerlineRight = {
- "decorations": [
- PowerLineDecoration(
- path="rounded_right",
- size=11,
- )
- ]
- }
- rounded_powerlineLeft = {
- "decorations": [
- PowerLineDecoration(
- path="rouded_left",
- size=11,
- )
- ]
- }
- slash_powerlineRight = {
- "decorations": [
- PowerLineDecoration(
- path="forward_slash",
- size=11,
- )
- ]
- }
- slash_powerlineLeft = {
- "decorations": [
- PowerLineDecoration(
- path="back_slash",
- size=11,
- )
- ]
- }
- keys = [
- # Open terminal
- Key([mod], "Return", lazy.spawn(terminal)),
- # Qtile System Actions
- Key([mod, "shift"], "r", lazy.restart()),
- Key([mod, "shift"], "x", lazy.shutdown()),
- # Active Window Actions
- Key([mod], "f", lazy.window.toggle_fullscreen()),
- Key([mod], "q", lazy.window.kill()),
- Key([mod, "control"], "h",
- lazy.layout.grow_right(),
- lazy.layout.grow(),
- lazy.layout.increase_ratio(),
- lazy.layout.delete()
- ),
- Key([mod, "control"], "Right",
- lazy.layout.grow_right(),
- lazy.layout.grow(),
- lazy.layout.increase_ratio(),
- lazy.layout.delete()
- ),
- Key([mod, "control"], "l",
- lazy.layout.grow_left(),
- lazy.layout.shrink(),
- lazy.layout.decrease_ratio(),
- lazy.layout.add()
- ),
- Key([mod, "control"], "Left",
- lazy.layout.grow_left(),
- lazy.layout.shrink(),
- lazy.layout.decrease_ratio(),
- lazy.layout.add()
- ),
- Key([mod, "control"], "k",
- lazy.layout.grow_up(),
- lazy.layout.grow(),
- lazy.layout.decrease_nmaster()
- ),
- Key([mod, "control"], "Up",
- lazy.layout.grow_up(),
- lazy.layout.grow(),
- lazy.layout.decrease_nmaster()
- ),
- Key([mod, "control"], "j",
- lazy.layout.grow_down(),
- lazy.layout.shrink(),
- lazy.layout.increase_nmaster()
- ),
- Key([mod, "control"], "Down",
- lazy.layout.grow_down(),
- lazy.layout.shrink(),
- lazy.layout.increase_nmaster()
- ),
- # Window Focus (Arrows and Vim keys)
- Key([mod], "Up", lazy.layout.up()),
- Key([mod], "Down", lazy.layout.down()),
- Key([mod], "Left", lazy.layout.left()),
- Key([mod], "Right", lazy.layout.right()),
- Key([mod], "k", lazy.layout.up()),
- Key([mod], "j", lazy.layout.down()),
- Key([mod], "h", lazy.layout.left()),
- Key([mod], "l", lazy.layout.right()),
- # Qtile Layout Actions
- Key([mod], "r", lazy.layout.reset()),
- Key([mod], "Tab", lazy.next_layout()),
- Key([mod, "shift"], "f", lazy.layout.flip()),
- Key([mod, "shift"], "space", lazy.window.toggle_floating()),
- # Move windows around MonadTall/MonadWide Layouts
- Key([mod, "shift"], "Up", lazy.layout.shuffle_up()),
- Key([mod, "shift"], "Down", lazy.layout.shuffle_down()),
- Key([mod, "shift"], "Left", lazy.layout.swap_left()),
- Key([mod, "shift"], "Right", lazy.layout.swap_right()),
- Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
- Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
- Key([mod, "shift"], "h", lazy.layout.swap_left()),
- Key([mod, "shift"], "l", lazy.layout.swap_right()),
- # Switch focus to specific monitor (out of three)
- Key([mod], "i", lazy.to_screen(0)),
- Key([mod], "o", lazy.to_screen(1)),
- # Switch focus of monitors
- Key([mod], "period", lazy.next_screen()),
- Key([mod], "comma", lazy.prev_screen()),
- ]
- # Create labels for groups and assign them a default layout.
- groups = []
- group_names = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "minus", "equal", "F1", "F2", "F3", "F4", "F5"]
- group_labels = [" ", " ", " ", " ", " ", " ", " ", " ", "ﭮ" , " ", " ", "﨣 ", "F1", "F2", "F3", "F4", "F5"]
- #group_labels = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]
- group_layouts = ["monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall"]
- # Add group names, labels, and default layouts to the groups object.
- for i in range(len(group_names)):
- groups.append(
- Group(
- name=group_names[i],
- layout=group_layouts[i].lower(),
- label=group_labels[i],
- ))
- # Add group specific keybindings
- for i in groups:
- keys.extend([
- Key([mod], i.name, lazy.group[i.name].toscreen(), desc="Mod + number to move to that group."),
- Key(["mod1"], "Tab", lazy.screen.next_group(), desc="Move to next group."),
- Key(["mod1", "shift"], "Tab", lazy.screen.prev_group(), desc="Move to previous group."),
- Key([mod, "shift"], i.name, lazy.window.togroup(i.name), desc="Move focused window to new group."),
- ])
- # Define scratchpads
- groups.append(ScratchPad("scratchpad", [
- DropDown("term", "kitty --class=scratch", width=0.8, height=0.8, x=0.1, y=0.1, opacity=1),
- DropDown("term2", "kitty --class=scratch", width=0.8, height=0.8, x=0.1, y=0.1, opacity=1),
- DropDown("ranger", "kitty --class=ranger -e ranger", width=0.8, height=0.8, x=0.1, y=0.1, opacity=0.9),
- DropDown("volume", "kitty --class=volume -e pulsemixer", width=0.8, height=0.8, x=0.1, y=0.1, opacity=0.9),
- DropDown("mus", "kitty --class=mus -e ncmpcpp", width=0.8, height=0.8, x=0.1, y=0.1, opacity=0.9),
- DropDown("news", "kitty --class=news -e newsboat", width=0.8, height=0.8, x=0.1, y=0.1, opacity=0.9),
- ]))
- # Scratchpad keybindings
- keys.extend([
- Key([mod], "n", lazy.group['scratchpad'].dropdown_toggle('term')),
- Key([mod], "c", lazy.group['scratchpad'].dropdown_toggle('ranger')),
- Key([mod], "v", lazy.group['scratchpad'].dropdown_toggle('volume')),
- Key([mod], "m", lazy.group['scratchpad'].dropdown_toggle('mus')),
- Key([mod], "b", lazy.group['scratchpad'].dropdown_toggle('news')),
- Key([mod, "shift"], "n", lazy.group['scratchpad'].dropdown_toggle('term2')),
- ])
- colors = []
- cache='/home/matt/.cache/wal/colors'
- def load_colors(cache):
- with open(cache, 'r') as file:
- for i in range(8):
- colors.append(file.readline().strip())
- colors.append('#ffffff')
- lazy.reload()
- load_colors(cache)
- # Define layouts and layout themes
- layout_theme = {
- "margin":5,
- "border_width": 4,
- "border_focus": colors[1],
- "border_normal": colors[3]
- }
- layouts = [
- layout.MonadTall(**layout_theme),
- layout.MonadWide(**layout_theme),
- layout.MonadThreeCol(**layout_theme),
- layout.MonadWide(**layout_theme),
- layout.Floating(**layout_theme),
- layout.Spiral(**layout_theme),
- layout.RatioTile(**layout_theme),
- layout.Max(**layout_theme)
- ]
- # Mouse callback functions
- def launch_menu():
- qtile.cmd_spawn("rofi -show drun -show-icons")
- # Define Widgets
- widget_defaults = dict(
- font="JetBrainsMono Nerd Font",
- fontsize = 13,
- padding = 3,
- background=colors[0]
- )
- extension_defaults = widget_defaults.copy()
- def init_widgets_list(monitor_num):
- widgets_list = [
- widget.Image(
- filename="~/.config/qtile/imgs/arch.png",
- background=colors[4],
- margin=3,
- ),
- widget.Spacer(
- length=1,
- background=colors[4],
- **arrow_powerlineLeft,
- ),
- widget.GroupBox(
- fontsize=20,
- padding_x=5,
- padding_y=5,
- rounded=False,
- center_aligned=True,
- disable_drag=True,
- borderwidth=1,
- highlight_method="line",
- hide_unused = True,
- active=colors[3],
- inactive=colors[5],
- highlight_color=colors[0],
- this_current_screen_border=colors[4],
- this_screen_border=colors[7],
- other_screen_border=colors[4],
- other_current_screen_border=colors[3],
- background=colors[0],
- foreground=colors[2],
- **arrow_powerlineLeft,
- ),
- widget.Spacer(
- length=1,
- background=colors[0],
- **arrow_powerlineLeft,
- ),
- widget.TaskList(
- margin=0,
- padding=6,
- icon_size=0,
- fontsize=14,
- borderwidth=1,
- rounded=False,
- highlight_method="block",
- title_width_method="uniform",
- urgent_alert_methond="border",
- foreground=colors[3],
- background=colors[3],
- border=colors[3],
- urgent_border=colors[3],
- txt_floating=" ",
- txt_maximized=" ",
- txt_minimized=" ",
- ),
- widget.Spacer(
- length=1,
- background=colors[0],
- **rounded_powerlineRight,
- ),
- widget.Spacer(
- length=1,
- background=colors[0],
- **arrow_powerlineRight,
- ),
- widget.CPU(
- padding=5,
- format=" {freq_current}GHz {load_percent}%",
- foreground=colors[2],
- background=colors[0],
- **slash_powerlineRight,
- ),
- widget.ThermalSensor(
- padding=5,
- update_interval=1,
- format=" {temp:.0f}{unit}",
- tag_sensor="Tctl",
- foreground=colors[3],
- background=colors[0],
- **slash_powerlineRight,
- ),
- widget.Memory(
- padding=5,
- format=" {MemUsed:.0f}{mm}",
- background=colors[2],
- foreground=colors[0],
- **slash_powerlineRight,
- ),
- widget.Clock(
- padding=5,
- format=" %a %d %b %H:%M:%S",
- foreground=colors[5],
- background=colors[3],
- **slash_powerlineRight,
- ),
- widget.PulseVolume(
- fmt=" {}",
- foreground=colors[1],
- background=colors[4],
- padding=10,
- **slash_powerlineRight,
- ),
- widget.Systray(
- padding=7,
- icon_size=15,
- ),
- widget.CurrentLayoutIcon(
- padding=5,
- scale=0.5,
- ),
- ]
- return widgets_list
- def init_secondary_widgets_list(monitor_num):
- secondary_widgets_list = init_widgets_list(monitor_num)
- del secondary_widgets_list[16:17]
- return secondary_widgets_list
- widgets_list = init_widgets_list("1")
- secondary_widgets_list = init_secondary_widgets_list("2")
- screens = [
- Screen(top=bar.Bar(widgets=widgets_list, size=30, background=colors[0], margin=[9, 19, 6,19],border_width=[0, 0, 0, 0], opacity=0.8),),
- Screen(top=bar.Bar(widgets=secondary_widgets_list, size=30, background=colors[0], mmargin=[9, 19, 6,19],border_width=[0, 0, 0, 0], opacity=0.8),),
- ]
- # 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())
- ]
- @hook.subscribe.startup_once
- def autostart():
- home = os.path.expanduser('~/.config/qtile/scripts/autostart.sh')
- subprocess.run([home])
- dgroups_key_binder = None
- dgroups_app_rules = [] # type: List
- follow_mouse_focus = True
- bring_front_click = False
- cursor_warp = False
- floating_layout = layout.Floating(float_rules=[
- *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
- ], fullscreen_border_width = 0, border_width = 0)
- auto_fullscreen = True
- focus_on_window_activation = "smart"
- reconfigure_screens = True
- auto_minimize = True
- wmname = "Qtile 0.21.0"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement