Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import re
- import socket
- import subprocess, qtile_mutable_scratch
- from typing import List # noqa: F401
- from libqtile import layout, bar, widget, hook, qtile
- from libqtile.config import Click, Drag, Group, Key, Match, Screen, Rule, DropDown, ScratchPad,KeyChord, EzKey
- from libqtile.command import lazy
- from libqtile.widget import Spacer
- from qtile_extras import widget
- from qtile_extras.widget.decorations import RectDecoration
- from qtile_extras.popup.toolkit import (PopupImage, PopupText,PopupRelativeLayout,PopupWidget)
- #mod4 or mod = super key
- mod = "mod4"
- mod1 = "alt"
- mod2 = "control"
- mod3 = "shift"
- home = os.path.expanduser('~')
- hellacritty = "alacritty -e hx"
- myTerm = "alacritty"
- # def show_graphs(qtile):
- # controls = [
- # PopupWidget(
- # widget=widget.CPUGraph(),
- # width=0.45,
- # height=0.45,
- # pos_x=0.05,
- # pos_y=0.05
- # ),
- # tk.PopupWidget(
- # widget=widget.NetGraph(),
- # width=0.45,
- # height=0.45,
- # pos_x=0.5,
- # pos_y=0.05
- # ),
- # tk.PopupWidget(
- # widget=widget.MemoryGraph(),
- # width=0.9,
- # height=0.45,
- # pos_x=0.05,
- # pos_y=0.5
- # )
- # ]
- # layout = tk.PopupRelativeLayout(
- # qtile,
- # width=1000,
- # height=200,
- # controls=controls,
- # background="00000060",
- # initial_focus=None,
- # close_on_click=False
- # )
- # layout.show(centered=True)
- def show_power_menu(qtile):
- # controls = [
- # PopupImage(
- # filename="~/Pictures/icons/lock.svg",
- # pos_x=0.15,
- # pos_y=0.1,
- # width=0.1,
- # height=0.5,
- # mouse_callbacks={
- # "Button1": lazy.spawn("/path/to/lock_cmd")
- # }
- # ),
- # PopupImage(
- # filename="~/Pictures/icons/sleep.svg",
- # pos_x=0.45,
- # pos_y=0.1,
- # width=0.1,
- # height=0.5,
- # mouse_callbacks={
- # "Button1": lazy.spawn("/path/to/sleep_cmd")
- # }
- # ),
- # PopupImage(
- # filename="~/Pictures/icons/shutdown.svg",
- # pos_x=0.75,
- # pos_y=0.1,
- # width=0.1,
- # height=0.5,
- # highlight="A00000",
- # mouse_callbacks={
- # "Button1": lazy.shutdown()
- # }
- # ),
- # PopupText(
- # text="Lock",
- # pos_x=0.1,
- # pos_y=0.7,
- # width=0.2,
- # height=0.2,
- # h_align="center"
- # ),
- # PopupText(
- # text="Sleep",
- # pos_x=0.4,
- # pos_y=0.7,
- # width=0.2,
- # height=0.2,
- # h_align="center"
- # ),
- # PopupText(
- # text="Shutdown",
- # pos_x=0.7,
- # pos_y=0.7,
- # width=0.2,
- # height=0.2,
- # h_align="center"
- # ),
- # ]
- # layout = PopupRelativeLayout(
- # qtile,
- # width=1000,
- # height=200,
- # controls=controls,
- # background="00000060",
- # initial_focus=None,
- # )
- # layout.show(centered=True)
- @hook.subscribe.startup_once
- # def autostart():
- # home = os.path.expanduser('~/.config/qtile/autostart.sh') # path to my script, under my user directory
- # subprocess.call([home])
- # @hook.subscribe.startup_once
- def autostart():
- home = os.path.expanduser('~/.config/qtile/scripts/autostart.sh') # path to my script, under my user directory
- subprocess.call([home])
- keys = [
- Key([mod, "shift"], "y", lazy.function(show_power_menu)),
- Key([mod, "shift"], "q", lazy.function(show_power_menu)),
- Key([mod, "shift"], "g", lazy.function(show_graphs)),
- Key([mod3], "space", lazy.spawn('rofi -show run')),
- Key([mod2], "tab", lazy.spawn('rofi -show window')),
- Key([mod], "f", lazy.window.toggle_fullscreen()),
- Key([mod], "q", lazy.window.kill()),
- Key([mod], "d", lazy.spawn('nwggrid -p -o 0.4')),
- Key([mod], "Escape", lazy.spawn('xkill')),
- Key([mod], "Return", lazy.spawn('myTerm')),
- Key([mod], "KP_Enter", lazy.spawn('alacritty')),
- Key([mod], "x", lazy.shutdown()),
- Key([mod, "shift"], "Return", lazy.spawn('pcmanfm')),
- Key([mod, "shift"], "d", lazy.spawn("dmenu_run -i -nb '#191919' -nf '#fea63c' -sb '#fea63c' -sf '#191919' -fn 'NotoMonoRegular:bold:pixelsize=14'")),
- Key([mod, "shift"], "q", lazy.window.kill()),
- Key([mod, "shift"], "r", lazy.restart()),
- Key([mod, "control"], "r", lazy.restart()),
- Key([mod, "shift"], "x", lazy.shutdown()),
- Key(["mod1", "control"], "o", lazy.spawn(home + '/.config/qtile/scripts/picom-toggle.sh')),
- Key([mod], "o", lazy.spawn('alacritty -e hx ~/.config/qtile/config.py')),
- Key(["mod1", "control"], "t", lazy.spawn('xterm')),
- Key(["mod1", "control"], "u", lazy.spawn('pavucontrol')),
- Key([], "Print", lazy.spawn('flameshot full -p ' + home + '/Pictures')),
- Key([mod2], "Print", lazy.spawn('flameshot full -p ' + home + '/Pictures')),
- Key([mod], "f", lazy.window.toggle_fullscreen()),
- Key([mod], "q", lazy.window.kill()),
- Key([mod, "shift"], "q", lazy.window.kill()),
- Key([mod, "shift"], "r", lazy.restart()),
- Key([mod], "n", lazy.layout.normalize()),
- Key([mod], "space", lazy.next_layout()),
- 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, "control"], "Right", lazy.layout.increase_ratio(),lazy.layout.delete()),
- Key([mod, "control"], "Left", lazy.layout.grow_left(), lazy.layout.shrink(), lazy.layout.decrease_ratio(), lazy.layout.add()),
- Key([mod, "control"], "Up", lazy.layout.grow(),
- lazy.layout.decrease_nmaster(),
- ),
- Key([mod, "control"], "Down",
- lazy.layout.grow_down(),
- lazy.layout.shrink(),
- lazy.layout.increase_nmaster(),
- ),
- 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"], "space", lazy.window.toggle_floating()),
- ]
- def window_to_previous_screen(qtile, switch_group=False, switch_screen=False):
- i = qtile.screens.index(qtile.current_screen)
- if i != 0:
- group = qtile.screens[i - 1].group.name
- qtile.current_window.togroup(group, switch_group=switch_group)
- if switch_screen == True:
- qtile.cmd_to_screen(i - 1)
- def window_to_next_screen(qtile, switch_group=False, switch_screen=False):
- i = qtile.screens.index(qtile.current_screen)
- if i + 1 != len(qtile.screens):
- group = qtile.screens[i + 1].group.name
- qtile.current_window.togroup(group, switch_group=switch_group)
- if switch_screen == True:
- qtile.cmd_to_screen(i + 1)
- keys.extend([
- # MOVE WINDOW TO NEXT SCREEN
- Key([mod,"shift"], "Right", lazy.function(window_to_next_screen, switch_screen=True)),
- Key([mod,"shift"], "Left", lazy.function(window_to_previous_screen, switch_screen=True)),
- ])
- groups = []
- group_names = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0",]
- group_labels = ["", "", "", "", "", "", "", "", "", "",]
- group_layouts = ["monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall",]
- for i in range(len(group_names)):
- groups.append(
- Group(
- name=group_names[i],
- layout=group_layouts[i].lower(),
- label=group_labels[i],
- ))
- for i in groups:
- keys.extend([
- #CHANGE WORKSPACES
- Key([mod], i.name, lazy.group[i.name].toscreen()),
- Key(["mod1"], "Tab", lazy.screen.next_group()),
- Key([mod], "Tab", lazy.screen.prev_group()),
- Key([mod, "shift"], i.name, lazy.window.togroup(i.name) , lazy.group[i.name].toscreen()),
- ])
- def init_layout_theme():
- return {"margin":10,
- "border_width":2,
- "border_focus": "#202022",
- "border_normal": "#f4c2c2"
- }
- layout_theme = init_layout_theme()
- ayouts = [
- # layout.Columns(border_focus_stack=['#d75f5f', '#8f3d3d'], border_width=4),
- layout.Max(**layout_theme),
- # Try more layouts by unleashing below layouts.
- # layout.Stack(num_stacks=2, **layout_theme),
- layout.Bsp(**layout_theme),
- layout.Matrix(**layout_theme),
- layout.MonadTall(**layout_theme),
- layout.MonadWide(**layout_theme),
- layout.RatioTile(**layout_theme),
- layout.Tile(**layout_theme),
- #layout.TreeTab(
- # sections=['FIRST', 'SECOND'],
- # bg_color='#3b4252',
- # active_bg='#bf616a',
- # inactive_bg='#a3be8c',
- # padding_y=5,
- # section_top=10,
- # panel_width=280
- #),
- # layout.VerticalTile(),
- # layout.Zoomy(),
- ]
- #Colors for the bar
- def init_colors():
- return [["#2F343F", "#2F343F"], # color 0def init_colors():
- ["#000000" "#000000"], # color 0
- ["#cccccc", "#cccccc"], # color 1
- ["#121212", "#121212"], # color 2 #
- ["#2d3640", "#2d3640"], # color 3i t#omarto
- ["#5c6773", "#5c6773"],# color 4 # light red orange
- ["#ff8f40", "#ff8f40"], # color 5 #
- ["#009669", "#009669"], # color 6 orangw
- ["#f7b90c", "#f7b90c"], # color 7 #
- ["#cecd19", "#cecd19"], # color 8 #
- ["#bd5173", "#bd5173"], # color 9 # ["#6790eb", "#6790eb"], # color 10
- ["#32c9fa", "#32c9fa"], #10
- ["#00ff80", "#00ff80"], #11c
- ["#186800", "#186800"], #12cream color
- ["#2B0C02", "#2B0C02"], #13
- ["#c32101", "#c32101"], #14ckground left most rectangle Ein bar
- ["#2aa899", "#2aa899"], #15
- ["#abb2bf", "#abb2bf"],# color 16
- ["#81a1c1", "#81a1c1"], #17
- ["#56b6c2", "#56b6c2"], #18also blue
- ["#00F2F4", "#00F2F4"], #19skyblue
- ["#e06c75", "#e06c75"], #20
- ["#fb9f7f", "#fb9f7f"], #21
- ["#ffd47e", "#ffd47e"]] #22ci
- colors = init_colors()
- prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
- widget_defaults = dict(
- font='Ubuntu Nerd Font',
- fontsize=34,
- padding=3,
- background=colors[1],
- foreground=colors[15]
- )
- # return dict(font="Noto Sans",
- # fontsize = 24,
- # padding = 6,
- # background=colors[6])
- # widget_defaults = init_widgets_defaults()
- screens = [
- Screen(
- top=bar.Bar(
- [
- widget.Sep(
- background=colors[1], #2e3440
- foreground=colors[8], #d8dee9
- linewidth=1,
- padding=10
- ),
- widget.Image(
- filename = "~/.config/qtile/icons/garuda-red.png",
- iconsize = 22,
- background = colors[1],
- mouse_callbacks = {'Button1': lambda : qtile.spawn('jgmenu_run')}
- ),
- widget.Sep(
- linewidth = 1,
- padding = 10,
- foreground = colors[1],
- background = colors[1]
- ),
- widget.Image(
- filename="~/.config/qtile/icons/qtilelogo.png",
- iconsize=22,
- background=colors[14],
- mouse_callbacks={'Button1': lambda : qtile.cmd_spawn('rofi -show run')}
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[14],
- linewidth=1,
- padding=10
- ),
- widget.GroupBox(
- active=colors[14], #b48ead
- borderwidth=2,
- disable_drag=True,
- font='Ubuntu Nerd Font',
- fontsize=30,
- hide_unused=False,
- highlight_method='line',
- inactive=colors[9], #e5e9f0
- margin_x=0,
- margin_y=3,
- padding_x=5,
- padding_y=8,
- rounded=False,
- this_current_screen_border=colors[14], #ebcb8b
- urgent_alert_method='line'
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.CurrentLayoutIcon(
- background=colors[1],
- custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")],
- foreground=colors[14], #e5e9f0
- padding=0,
- scale=0.65
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.CurrentLayout(
- background=colors[21],
- font='Ubuntu Bold',
- foreground=colors[21]
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.Prompt(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[14]
- ),
- widget.Spacer(),
- widget.TextBox(
- background=colors[11],
- font='Ubuntu Nerd Font',
- fontsize=22,
- foreground=colors[14],
- padding=0,
- text=' '
- ),
- widget.Clock(
- foreground = colors[1],
- background = colors[14],
- fontsize = 22,
- format='%I:%M %p'
- ),
- widget.Sep(
- linewidth = 2,
- padding = 10,
- foreground = colors[1],
- background = colors[1]
- ),
- widget.Image(
- filename = "~/.config/qtile/icons/2e8601f1eea99a2c.png",
- iconsize = 9,
- background = colors[22],
- mouse_callbacks = {'Button1': lambda: alacritty}
- ),
- widget.KeyboardLayout(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[4]
- ),
- widget.CapsNumLockIndicator(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[14]
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.TextBox(
- background=colors[1],
- font='Ubuntu Nerd Font',
- fontsize=22,
- foreground=colors[6],
- padding=0,
- text=' '
- ),
- widget.Clock(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[6],
- format='%a %d, (%B) %H:%M:%S '
- ),
- ],
- 38,
- opacity=0.9
- ),
- bottom=bar.Bar(
- [
- widget.WindowName(
- background=colors[1],
- foreground=colors[1],
- font='Ubuntu',
- fontsize = 22,
- max_chars=60
- ),
- widget.Spacer(),
- widget.Systray(
- background=colors[1],
- icon_size=20,
- padding=4
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.TextBox(
- background=colors[1],
- font='Ubuntu Nerd Font',
- fontsize=22,
- foreground=colors[6],
- padding=0,
- text=' '
- ),
- widget.ThermalSensor(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[14],
- update_interval=2
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.TextBox(
- background=colors[1],
- font='Ubuntu Nerd Font',
- fontsize=22,
- foreground=colors[6],
- padding=0,
- text=' '
- ),
- widget.Memory(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[14],
- format="{MemUsed: .0f}{mm}",
- update_interval=1.0
- ),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.TextBox(
- background=colors[1],
- font='Ubuntu Nerd Font',
- fontsize=22,
- foreground=colors[6],
- padding=0,
- text=' '
- ),
- widget.CPU(
- background=colors[14],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[1],
- format='CPU {load_percent}%',
- update_interval=1
- ),
- #widget.CPUGraph(
- # background=colors[1],
- # border_color=colors[5],
- # border_width=0,
- # core='all',
- # fill_color=colors[10], #81a1c1
- # foreground=colors[5],
- # graph_color=colors[10],
- # line_width=1,
- # type='linefill'
- #),
- widget.Sep(
- background=colors[1],
- foreground=colors[5],
- linewidth=1,
- padding=10
- ),
- widget.TextBox(
- background=colors[21],
- font='Ubuntu Nerd Font',
- fontsize=22,
- foreground=colors[6],
- padding=0,
- text=' '
- ),
- widget.Net(
- background=colors[1],
- font='Ubuntu',
- fontsize=22,
- foreground=colors[5],
- format='{interface}: {down} ↓ ',
- interface='all',
- padding=0
- ),
- #widget.NetGraph(
- # background=colors[1],
- # bandwidth="down",
- # border_color=colors[5],
- # border_width=0,
- # fill_color=colors[9], #88c0d0
- # foreground=colors[5],
- # graph_color=colors[9],
- # interface="auto",
- # line_width=1,
- # padding=0,
- # type='linefill'
- #),
- ],
- 38,
- opacity=0.9
- ),
- ),
- ]
- # def init_widgets_screen1():
- # widgets_screen1 = init_widgets_list()
- # return widgets_screen1
- # def init_widgets_screen2():
- # widgets_screen2 = init_widgets_list()
- # return widgets_screen2
- #
- # MOUSE CONFIGURATION
- 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())
- ]
- dgroups_key_binder = None
- dgroups_app_rules = []
- main = None
- @hook.subscribe.startup_once
- def start_once():
- home = os.path.expanduser('~')
- subprocess.call([home + '/.config/qtile/scripts/autostart.sh'])
- @hook.subscribe.startup
- def start_always():
- # Set the cursor to something sane in X
- subprocess.Popen(['xsetroot', '-cursor_name'])
- @hook.subscribe.client_new
- def set_floating(window):
- if (window.window.get_wm_transient_for()
- or window.window.get_wm_type() in floating_types):
- window.floating = True
- floating_types = ["notification", "toolbar", "splash", "dialog"]
- 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='confirm'),
- Match(wm_class='dialog'),
- Match(wm_class='download'),
- Match(wm_class='error'),
- Match(wm_class='file_progress'),
- Match(wm_class='notification'),
- Match(wm_class='splash'),
- Match(wm_class='toolbar'),
- Match(wm_class='confirmreset'),
- Match(wm_class='makebranch'),
- Match(wm_class='maketag'),
- Match(wm_class='Arandr'),
- Match(wm_class='feh'),
- Match(wm_class='Galculator'),
- Match(title='branchdialog'),
- Match(title='Open File'),
- Match(title='pinentry'),
- Match(wm_class='ssh-askpass'),
- Match(wm_class='lxpolkit'),
- Match(wm_class='Lxpolkit'),
- Match(wm_class='yad'),
- Match(wm_class='Yad'),
- Match(wm_class='Cairo-dock'),
- Match(wm_class='cairo-dock'),
- ], fullscreen_border_width = 0, border_width = 0)
- auto_fullscreen = True
- focus_on_window_activation = "focus" # or smart
- @lazy.function
- def window_to_prev_group(qtile):
- if qtile.currentWindow is not None:
- i = qtile.groups.index(qtile.currentGroup)
- qtile.currentWindow.togroup(qtile.groups[i - 1].name)
- @lazy.function
- def window_to_next_group(qtile):
- if qtile.currentWindow is not None:
- i = qtile.groups.index(qtile.currentGroup)
- qtile.currentWindow.togroup(qtile.groups[i + 1].name)
- wmname = "LG3D"
- mutscr = qtile_mutable_scratch.MutableScratch()
- groups.append(Group('')) # Must be after `groups` is created
- keys.extend( [
- EzKey('M-S-<minus>', mutscr.add_current_window()),
- EzKey('M-C-<minus>', mutscr.remove_current_window()),
- EzKey('M-<minus>', mutscr.toggle()),
- ] )
- hook.subscribe.startup_complete(mutscr.qtile_startup)
- # keys.extend( [
- # EzKey('M-S-<minus>', mutscr.add_current_window()),
- # EzKey('M-C-<minus>', mutscr.remove_current_window()),
- # EzKey('M-<minus>', mutscr.toggle()),
- # ] )
Advertisement
Add Comment
Please, Sign In to add comment