Guest User

my qtile config

a guest
Jul 12th, 2022
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.83 KB | None | 0 0
  1. # Imports
  2. import os
  3. import subprocess
  4. from libqtile import bar, layout, widget, hook
  5. from libqtile import qtile
  6. from libqtile.config import Click, Drag, Group, Key, Match, Screen
  7. from libqtile.lazy import lazy
  8.  
  9. # Apps
  10. mod = "mod4"
  11. terminal = "alacritty"
  12. browser = "brave-browser"
  13. forcequit = "xkill"
  14.  
  15. # Colors
  16. bg = "#1E1D2F"
  17. blue = "#96CDFB"
  18. cyan = "#89DCEB"
  19. fg = "#d9e0ee"
  20. gray = "#6E6C7E"
  21. magenta = "#F5C2E7"
  22. red = "#F28FAD"
  23. yellow = "#FAE3B0"
  24.  
  25. # Keys
  26. keys = [
  27.     Key([mod], "Return", lazy.spawn(terminal)),
  28.     Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
  29.     Key([mod], "w", lazy.spawn(browser)),
  30.     Key([mod], "q", lazy.spawn(forcequit)),
  31.     Key([mod], "f", lazy.window.toggle_floating()),
  32.     Key([mod], "n", lazy.layout.normalize()),
  33.     Key([mod], "o", lazy.layout.maximize()),
  34.     Key([mod], "h", lazy.layout.left()),
  35.     Key([mod], "l", lazy.layout.right()),
  36.     Key([mod], "j", lazy.layout.down()),
  37.     Key([mod], "k", lazy.layout.up()),
  38.     Key([mod], "space", lazy.layout.next()),
  39.     Key([mod], "Tab", lazy.next_layout()),
  40.     Key([mod, "control"], "space", lazy.layout.flip()),
  41.     Key([mod, "shift"], "space", lazy.window.toggle_fullscreen()),
  42.     Key([mod, "shift"], "c", lazy.window.kill()),
  43.     Key([mod, "shift"], "l", lazy.layout.grow()),
  44.     Key([mod, "shift"], "h", lazy.layout.shrink()),
  45.     Key([mod, "shift"], "r", lazy.reload_config()),
  46.     Key([mod, "shift"], "q", lazy.shutdown()),
  47.     Key([mod, "shift"], "h", lazy.layout.shuffle_left()),
  48.     Key([mod, "shift"], "l", lazy.layout.shuffle_right()),
  49.     Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
  50.     Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
  51.     Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set +10%")),
  52.     Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 10%-")),
  53.     Key([], "XF86AudioLowerVolume", lazy.spawn("amixer sset -q Master,0 5%-")),
  54.     Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer sset -q Master,0 5%+")),
  55.     Key([], "XF86AudioMute", lazy.spawn("amixer -q set Master toggle")),
  56. ]
  57.  
  58. # Groups
  59. groups = [Group(i) for i in ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]]
  60. group_hotkeys = "1234567890"
  61. for i, k in zip(groups, group_hotkeys):
  62.     keys.extend(
  63.         [
  64.             Key(
  65.                 [mod],
  66.                 k,
  67.                 lazy.group[i.name].toscreen(),
  68.                 desc="Switch to group {}".format(i.name),
  69.             ),
  70.             Key(
  71.                 [mod, "shift"],
  72.                 k,
  73.                 lazy.window.togroup(i.name, switch_group=True),
  74.                 desc="Switch to & move focused window to group {}".format(i.name),
  75.             ),
  76.         ]
  77.     )
  78.  
  79. # Layouts
  80. layout_theme = {
  81.     "border_width": 2,
  82.     "margin": 8,
  83.     "border_focus": blue,
  84.     "border_normal": bg,
  85. }
  86. layouts = [
  87.     layout.MonadTall(**layout_theme),
  88.     layout.MonadWide(**layout_theme),
  89.     layout.Max(),
  90.     layout.Floating(
  91.         border_focus=gray,
  92.         border_normal=bg,
  93.         border_width=4,
  94.     ),
  95. ]
  96.  
  97. widget_defaults = dict(
  98.     font="Anonymous Pro Bold",
  99.     fontsize=18,
  100.     padding=9,
  101. )
  102. extension_defaults = widget_defaults.copy()
  103.  
  104. screens = [
  105.     Screen(
  106.         top=bar.Bar(
  107.             [
  108.                 widget.TextBox(
  109.                     text="  ",
  110.                     background=bg,
  111.                     foreground=fg,
  112.                     padding=0,
  113.                     fontsize=25,
  114.                     mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn("xfce4-appfinder")}
  115.                 ),
  116.                 widget.Sep(
  117.                     foreground=gray,
  118.                     line_width=9,
  119.                     size_percent=70,
  120.                 ),
  121.                 widget.GroupBox(
  122.                     fontsize=18,
  123.                     active=cyan,
  124.                     inactive=gray,
  125.                     foreground=cyan,
  126.                     rounded=False,
  127.                     borderwidth=2,
  128.                     margin=4,
  129.                     highlight_method="line",
  130.                     highlight_color=bg,
  131.                     other_screen_border=gray,
  132.                     other_current_screen_border=cyan,
  133.                     this_current_screen_border=cyan,
  134.                     this_screen_border=gray,
  135.                 ),
  136.                 widget.Sep(
  137.                     foreground=gray,
  138.                     line_width=9,
  139.                     size_percent=70,
  140.                 ),
  141. #                widget.CurrentLayoutIcon(
  142. #                ),
  143.                 widget.CurrentLayout(
  144.                     background=bg,
  145.                     foreground=fg,
  146.                 ),
  147.                 widget.Sep(
  148.                     foreground=gray,
  149.                     line_width=9,
  150.                     size_percent=70,
  151.                 ),
  152.                 widget.WindowName(foreground=fg),
  153.                 widget.Spacer(length=100),
  154.                 # # # #
  155.                 widget.Prompt(),
  156.                 widget.Systray(icon_size=24),
  157.                 widget.Sep(
  158.                     foreground=gray,
  159.                     line_width=9,
  160.                     size_percent=70,
  161.                 ),
  162.                 widget.Battery(
  163.                     foreground=cyan,
  164.                     low_foreground=red,
  165.                     low_percentage=0.3,
  166.                     format="{char} {percent:2.0%}",
  167.                     charge_char="",
  168.                     discharge_char="",
  169.                     full_char="",
  170.                     unknown_char="",
  171.                     empty_char="",
  172.                 ),
  173.                 widget.Sep(
  174.                     foreground=gray,
  175.                     line_width=9,
  176.                     size_percent=70,
  177.                 ),
  178.                 widget.TextBox(
  179.                     text="  ",
  180.                     background=bg,
  181.                     foreground=blue,
  182.                     padding=0,
  183.                     fontsize=22,
  184.                 ),
  185.                 widget.Clock(
  186.                     background=bg,
  187.                     foreground=fg,
  188.                     format="%b %d - %I:%M%p",
  189.                 ),
  190.                 widget.Sep(
  191.                     foreground=gray,
  192.                     line_width=9,
  193.                     size_percent=70,
  194.                 ),
  195.                 widget.QuickExit(
  196.                     background=bg,
  197.                     foreground=red,
  198.                     default_text=" ",
  199.                 ),
  200.             ],
  201.             30,
  202.             background=bg,
  203.             opacity=20,
  204.             margin=[10, 10, 5, 10],
  205.         ),
  206.     ),
  207. ]
  208.  
  209. # Drag floating layouts.
  210. mouse = [
  211.     Drag(
  212.         [mod],
  213.         "Button1",
  214.         lazy.window.set_position_floating(),
  215.         start=lazy.window.get_position(),
  216.     ),
  217.     Drag(
  218.         [mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()
  219.     ),
  220.     Click([mod], "Button2", lazy.window.bring_to_front()),
  221. ]
  222.  
  223. dgroups_key_binder = None
  224. dgroups_app_rules = []  # type: list
  225. follow_mouse_focus = False
  226. bring_front_click = False
  227. cursor_warp = False
  228. floating_layout = layout.Floating(
  229.     border_focus=cyan,
  230.     border_normal=bg,
  231.     border_width=2,
  232.     float_rules=[
  233.         *layout.Floating.default_float_rules,
  234.         Match(wm_class="confirmreset"),  # gitk
  235.         Match(wm_class="makebranch"),  # gitk
  236.         Match(wm_class="maketag"),  # gitk
  237.         Match(wm_class="ssh-askpass"),  # ssh-askpass
  238.         Match(title="branchdialog"),  # gitk
  239.         Match(title="pinentry"),  # GPG key password entry
  240.     ],
  241. )
  242. auto_fullscreen = True
  243. focus_on_window_activation = "smart"
  244. reconfigure_screens = True
  245.  
  246. auto_minimize = True
  247.  
  248. wl_input_rules = None
  249.  
  250.  
  251. @hook.subscribe.startup_once
  252. def autostart():
  253.     home = os.path.expanduser("~/.config/qtile/autostart.sh")
  254.     subprocess.run([home])
  255.  
  256.  
  257. wmname = "LG3D"
  258.  
Advertisement
Add Comment
Please, Sign In to add comment