|
# Inspirations: aron |
|
|
|
# Copyright (c) 2010 Aldo Cortesi |
|
# Copyright (c) 2010, 2014 dequis |
|
# Copyright (c) 2012 Randall Ma |
|
# Copyright (c) 2012-2014 Tycho Andersen |
|
# Copyright (c) 2012 Craig Barnes |
|
# Copyright (c) 2013 horsik |
|
# Copyright (c) 2013 Tao Sauvage |
|
# |
|
# Permission is hereby granted, free of charge, to any person obtaining a copy |
|
# of this software and associated documentation files (the "Software"), to deal |
|
# in the Software without restriction, including without limitation the rights |
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
# copies of the Software, and to permit persons to whom the Software is |
|
# furnished to do so, subject to the following conditions: |
|
# |
|
# The above copyright notice and this permission notice shall be included in |
|
# all copies or substantial portions of the Software. |
|
# |
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
# SOFTWARE. |
|
|
|
from libqtile import bar, layout, qtile, widget, hook |
|
from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown |
|
from libqtile.lazy import lazy |
|
from libqtile.utils import guess_terminal |
|
|
|
# Import FPDF module for generating a PDF of key bindings |
|
from fpdf import FPDF |
|
|
|
import os |
|
import subprocess |
|
import random |
|
import shutil |
|
|
|
import pc_spec |
|
|
|
# @hook.subscribe.startup |
|
# def dbus_register(): |
|
# id = os.environ.get('DESKTOP_AUTOSTART_ID') |
|
# if not id: |
|
# return |
|
# subprocess.Popen(['dbus-send', |
|
# '--session', |
|
# '--print-reply', |
|
# '--dest=org.gnome.SessionManager', |
|
# '/org/gnome/SessionManager', |
|
# 'org.gnome.SessionManager.RegisterClient', |
|
# 'string:qtile', |
|
# 'string:' + id]) |
|
|
|
home = os.path.expanduser("~") |
|
|
|
floating_window_index = 0 |
|
|
|
|
|
def float_cycle(qtile, forward: bool): |
|
global floating_window_index |
|
floating_windows = [] |
|
for window in qtile.current_group.windows: |
|
if window.floating: |
|
floating_windows.append(window) |
|
if not floating_windows: |
|
return |
|
floating_window_index = min(floating_window_index, len(floating_windows) - 1) |
|
if forward: |
|
floating_window_index += 1 |
|
else: |
|
floating_window_index -= 1 |
|
if floating_window_index >= len(floating_windows): |
|
floating_window_index = 0 |
|
if floating_window_index < 0: |
|
floating_window_index = len(floating_windows) - 1 |
|
win = floating_windows[floating_window_index] |
|
win.bring_to_front() |
|
win.cmd_focus() |
|
|
|
|
|
@lazy.function |
|
def float_cycle_backward(qtile): |
|
float_cycle(qtile, False) |
|
|
|
|
|
@lazy.function |
|
def float_cycle_forward(qtile): |
|
float_cycle(qtile, True) |
|
|
|
|
|
@lazy.function |
|
def float_to_front(qtile): |
|
""" |
|
Bring all floating windows of the group to front |
|
""" |
|
for window in qtile.current_group.windows: |
|
if window.floating: |
|
window.move_to_top() |
|
|
|
|
|
@lazy.function |
|
def float_to_back(qtile): |
|
""" |
|
Bring all floating windows of the group to front |
|
""" |
|
for window in qtile.current_group.windows: |
|
if window.floating: |
|
window.move_to_bottom() |
|
|
|
|
|
# Function to run at startup once. It is used to run commands specified in the 'autostart.sh' |
|
@hook.subscribe.startup_once |
|
def start_once(): |
|
subprocess.call([home + "/.config/qtile/autostart.sh"]) |
|
|
|
|
|
def open_group_on_given_screen(group_name: str, screen: float): |
|
def _inner(qtile): |
|
if len(qtile.screens) == 1: |
|
qtile.groups_map[group_name].toscreen() |
|
return |
|
qtile.focus_screen(screen) |
|
qtile.groups_map[group_name].toscreen() |
|
|
|
return _inner |
|
|
|
|
|
def close_current_group(qtile): |
|
current_group_name = qtile.current_group.name |
|
# Remove the current group (only if not default) |
|
if current_group_name not in "1234qwer": |
|
qtile.delete_group(current_group_name) |
|
qtile.groups_map["q"].toscreen() |
|
|
|
|
|
mod = "mod4" |
|
# terminal = guess_terminal() |
|
# Make sure alacritty is installed (https://github.com/alacritty/alacritty/blob/master/INSTALL.md) |
|
terminal = "alacritty" |
|
|
|
keys = [ |
|
# A list of available commands that can be bound to keys can be found |
|
# at https://docs.qtile.org/en/latest/manual/config/lazy.html |
|
# Switch between windows |
|
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"), |
|
# Move windows between left/right columns or move up/down in current stack. |
|
# Moving out of range in Columns layout will create new column. |
|
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"), |
|
# Grow windows. If current window is on the edge of screen and direction |
|
# will be to screen edge - window would shrink. |
|
Key( |
|
[mod, "control"], |
|
"h", |
|
lazy.layout.grow_left(), |
|
lazy.layout.shrink_main(), |
|
desc="Grow window to the left", |
|
), |
|
Key( |
|
[mod, "control"], |
|
"l", |
|
lazy.layout.grow_right(), |
|
lazy.layout.grow_main(), |
|
desc="Grow window to the right", |
|
), |
|
Key( |
|
[mod, "control"], |
|
"j", |
|
lazy.layout.grow_down(), |
|
lazy.layout.shrink(), |
|
desc="Grow window down", |
|
), |
|
Key( |
|
[mod, "control"], |
|
"k", |
|
lazy.layout.grow_up(), |
|
lazy.layout.grow(), |
|
desc="Grow window up", |
|
), |
|
Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), |
|
# Move to the next group |
|
Key([mod], "Right", lazy.screen.next_group(), desc="Move to next group"), |
|
# Move to the previous group |
|
Key([mod], "Left", lazy.screen.prev_group(), desc="Move to previous group"), |
|
# Launches Zathura with a specific PDF file |
|
Key( |
|
[mod, "shift"], |
|
"i", |
|
lazy.spawn("setsid zathura ~/Mqtile.pdf"), |
|
desc="Info system keybindings", |
|
), |
|
# Launch different rofi menus for application, commands, windows, and ssh |
|
Key( |
|
[mod], |
|
"d", |
|
lazy.spawn("rofi -show run"), |
|
desc="Launch rofi window (commands)", |
|
), |
|
Key( |
|
[mod], |
|
"a", |
|
lazy.spawn("rofi -show drun"), |
|
desc="Launch rofi window (applications)", |
|
), |
|
Key( |
|
[mod], |
|
"c", |
|
lazy.spawn("rofi -show window"), |
|
desc="Launch rofi windows (active windows)", |
|
), |
|
Key([mod], "s", lazy.spawn("rofi -show ssh"), desc="Launch rofi ssh"), |
|
# Volume control bindings (using function keys and XF86Audio keys) |
|
Key([mod], "f10", lazy.spawn("amixer -q sset Master 5%-"), desc="Lower volume"), |
|
Key([mod], "f11", lazy.spawn("amixer -q sset Master 5%+"), desc="Raise volume"), |
|
Key( |
|
[mod], |
|
"f9", |
|
lazy.spawn("amixer -q sset Master toggle"), |
|
desc="Mute volume toggle", |
|
), |
|
Key( |
|
[], |
|
"XF86AudioLowerVolume", |
|
lazy.spawn("amixer -q sset Master 5%-"), |
|
desc="Lower volume", |
|
), |
|
Key( |
|
[], |
|
"XF86AudioRaiseVolume", |
|
lazy.spawn("amixer -q sset Master 5%+"), |
|
desc="Raise volume", |
|
), |
|
Key( |
|
[], |
|
"XF86AudioMute", |
|
lazy.spawn("amixer -q sset Master toggle"), |
|
desc="Mute volume toggle", |
|
), |
|
Key( |
|
[], |
|
"XF86AudioPlay", |
|
lazy.spawn("playerctl play-pause"), |
|
desc="Play/Pause player", |
|
), |
|
Key([], "XF86AudioNext", lazy.spawn("playerctl next"), desc="Skip to next"), |
|
Key([], "XF86AudioPrev", lazy.spawn("playerctl previous"), desc="Skip to previous"), |
|
# Screen light |
|
Key( |
|
[], |
|
"XF86MonBrightnessUp", |
|
lazy.spawn('brightnessctl -d "intel_backlight" set 10%+'), |
|
desc="Increase brightness", |
|
), |
|
Key( |
|
[], |
|
"XF86MonBrightnessDown", |
|
lazy.spawn('brightnessctl -d "intel_backlight" set 10%-'), |
|
desc="Decrease brightness", |
|
), |
|
# SCREENSHOTS |
|
Key([mod, "shift"], "s", lazy.spawn("gnome-screenshot -i"), desc="Screenshot"), |
|
# Toggle between split and unsplit sides of stack. |
|
# Split = all windows displayed |
|
# Unsplit = 1 window displayed, like Max layout, but still with |
|
# multiple stack panes |
|
Key( |
|
[mod], |
|
"o", |
|
lazy.layout.toggle_split(), |
|
desc="Toggle between split and unsplit sides of stack", |
|
), |
|
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), |
|
# Toggle between different layouts as defined below |
|
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), |
|
Key([mod], "Escape", lazy.window.kill(), desc="Kill focused window"), |
|
Key( |
|
[mod], |
|
"f", |
|
lazy.window.toggle_fullscreen(), |
|
desc="Toggle fullscreen on the focused window", |
|
), |
|
# Floating windows to front and back |
|
Key([mod, "shift"], "t", float_to_front, desc="Floating windows to front"), |
|
Key([mod, "control"], "t", float_to_back, desc="Floating windows to back"), |
|
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, "control"], |
|
"Delete", |
|
lazy.function(close_current_group), |
|
desc="Close current group (only if not default)", |
|
), |
|
] |
|
|
|
blue_pastel = "#add8e6" |
|
green_pastel = "#98fb98" |
|
orange_pastel = "#ffb347" |
|
gray_pastel = "#d3d3d3" |
|
|
|
layout_dct = { |
|
"col": layout.Columns( |
|
border_focus=["#326632", "#326632"], |
|
border_normal=["#333333", "#333333"], |
|
border_width=2, |
|
margin=1, |
|
num_columns=2, |
|
fair=True, |
|
insert_position=1, |
|
grow_amount=2, |
|
), |
|
"mon_tall": layout.MonadTall( |
|
ratio=0.78, |
|
change_ratio=0.01, |
|
max_ratio=0.85, |
|
margin=1, |
|
border_width=2, |
|
border_focus=["#326632", "#326632"], |
|
border_normal=["#333333", "#333333"], |
|
), |
|
"max": layout.Max(), |
|
} |
|
|
|
layouts = list(layout_dct.values()) |
|
|
|
discord_cmd = "Discord" if shutil.which("Discord") else "discord" |
|
|
|
groups = [ |
|
Group( |
|
"q", |
|
label="q-Home", |
|
screen_affinity=1, |
|
layouts=list(layout_dct.values()), |
|
), |
|
Group( |
|
"1", |
|
label="1-Code", |
|
matches=[ |
|
Match(wm_class="code"), |
|
Match(wm_class="nvim"), |
|
Match(wm_class="vim"), |
|
], |
|
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]], |
|
screen_affinity=0, |
|
), |
|
Group( |
|
"2", |
|
label="2-Web", |
|
matches=[ |
|
Match(role="browser"), |
|
Match(wm_class="firefox"), |
|
Match(wm_class="brave-browser"), |
|
], |
|
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]], |
|
screen_affinity=0, |
|
), |
|
Group( |
|
"3", |
|
label="3-Obsidian", |
|
matches=[Match(wm_class="obsidian")], |
|
layouts=[layout_dct[k] for k in ["max", "col", "mon_tall"]], |
|
screen_affinity=0, |
|
), |
|
Group( |
|
"4", |
|
label="4-View", |
|
matches=[ |
|
Match(wm_class="paraview"), |
|
Match(wm_class="paraview_build"), |
|
], |
|
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]], |
|
screen_affinity=0, |
|
), |
|
ScratchPad( |
|
name="scratchpad", |
|
dropdowns=[ |
|
# define a drop down terminal. |
|
# it is placed in the upper third of screen by default. |
|
DropDown( |
|
"spotify", |
|
match=Match(wm_class="spotify"), |
|
# Make sure spotify is installed through flatpak |
|
# Found in /var/lib/flatpak/exports/share/applications/com.spotify.Client.desktop |
|
cmd="flatpak run com.spotify.Client", |
|
opacity=0.95, |
|
x=0.025, |
|
y=0.025, |
|
height=0.95, |
|
width=0.95, |
|
), |
|
DropDown( |
|
"steam", |
|
match=Match(wm_class="steam"), |
|
cmd="steam", |
|
opacity=0.98, |
|
x=0.025, |
|
y=0.025, |
|
height=0.95, |
|
width=0.95, |
|
), |
|
DropDown( |
|
"Discord", |
|
match=Match(wm_class="discord"), |
|
cmd=f"{discord_cmd}", |
|
opacity=0.98, |
|
x=0.025, |
|
y=0.025, |
|
height=0.95, |
|
width=0.95, |
|
), |
|
], |
|
single=False, |
|
), |
|
] |
|
|
|
if pc_spec.add_video_screens: |
|
groups.extend( |
|
[ |
|
Group( |
|
"w", |
|
label="w-OBS", |
|
matches=[ |
|
Match(wm_class="obs"), |
|
], |
|
screen_affinity=0, |
|
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]], |
|
), |
|
Group( |
|
"e", |
|
label="E-Resolve", |
|
matches=[ |
|
Match(wm_class="resolve"), |
|
], |
|
screen_affinity=0, |
|
layouts=list(layout_dct.values()), |
|
), |
|
Group( |
|
"r", |
|
label="r-Capture", |
|
matches=[ |
|
Match(wm_class="scrpy"), |
|
Match(wm_class="easyeffects"), |
|
], |
|
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]], |
|
screen_affinity=0, |
|
), |
|
] |
|
) |
|
|
|
keys.extend( |
|
[ |
|
# toggle visibiliy of above defined DropDown named "term" |
|
Key([mod], "8", lazy.group["scratchpad"].dropdown_toggle("Discord")), |
|
Key([mod], "9", lazy.group["scratchpad"].dropdown_toggle("spotify")), |
|
Key([mod], "0", lazy.group["scratchpad"].dropdown_toggle("steam")), |
|
] |
|
) |
|
|
|
for grp in groups: |
|
if isinstance(grp, ScratchPad): |
|
continue |
|
keys.extend( |
|
[ |
|
# mod + group number = switch to group |
|
Key( |
|
[mod], |
|
grp.name, |
|
lazy.function(open_group_on_given_screen(grp.name, 1)), |
|
desc=f"Switch to group {grp.name} at screen 1", |
|
), |
|
Key( |
|
[mod, "mod1"], |
|
grp.name, |
|
lazy.function(open_group_on_given_screen(grp.name, 0)), |
|
desc=f"Switch to group {grp.name} at screen 0", |
|
), |
|
# mod + shift + group number = switch to & move focused window to group |
|
Key( |
|
[mod, "shift"], |
|
grp.name, |
|
lazy.window.togroup(grp.name, switch_group=True), |
|
desc="Switch to & move focused window to group {}".format(grp.name), |
|
), |
|
# Or, use below if you prefer not to switch to that group. |
|
# # mod + shift + group number = move focused window to group |
|
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name), |
|
# desc="move focused window to group {}".format(i.name)), |
|
] |
|
) |
|
|
|
|
|
# We call the function after we have defined the key bindings for the groups |
|
def Mqtile_info(keys): |
|
""" |
|
Description: |
|
This function takes a list of key bindings and creates a text file ('Mqtile.txt') |
|
and a PDF file ('Mqtile.pdf') containing a formatted representation of the key bindings. |
|
The generated files will contain the key modifiers, key, and description for each key binding. |
|
""" |
|
# Create the 'Mqtile.txt' file |
|
with open("Mqtile.txt", "w") as file: |
|
ascii_art = """WAINE CONFIG""" |
|
file.write(ascii_art) |
|
for key in keys: |
|
mainK = "" |
|
for k in key.modifiers: |
|
p = k # the text that is simple for the user that we're putting |
|
if k == "mod4": |
|
p = "Super" |
|
elif k == "mod1": |
|
p = "Alt" |
|
mainK += f" {p} +" |
|
keyk = key.key |
|
if keyk.startswith("XF86"): |
|
keyk = keyk[4:] |
|
add = mainK + "\t" + str(keyk) + "\t - \t\t" + str(key.desc) + "\n" |
|
file.write(add) |
|
file.write(ascii_art) |
|
|
|
# Convert the 'Mqtile.txt' file to a PDF file |
|
pdf = FPDF() # Save FPDF() class into a variable 'pdf' |
|
pdf.add_page() # Add a page |
|
pdf.set_font("Courier", size=13) # Set style and size of font |
|
f = open("Mqtile.txt", "r") # Open the text file in read mode |
|
for x in f: # Insert the texts in to the PDF |
|
pdf.cell(200, 10, txt=x, ln=1, align="L") |
|
pdf.output("Mqtile.pdf") # Save the PDF with name 'Mqtile.pdf' |
|
|
|
|
|
# Call the function to generate the files with the provided keys |
|
Mqtile_info(keys) |
|
|
|
widget_defaults = dict( |
|
font="Lilex Nerd Font Mono Regular", |
|
fontsize=15, |
|
padding=3, |
|
) |
|
extension_defaults = widget_defaults.copy() |
|
|
|
|
|
font_size = pc_spec.font_size |
|
|
|
sc_sep = widget.Sep( |
|
linewidth=2, |
|
padding=10, |
|
foreground="#fcf8c0", |
|
size_percent=65, |
|
) |
|
|
|
|
|
def def_screen(img_number: int): |
|
return Screen( |
|
top=bar.Bar( |
|
[ |
|
# GroupBox widget to display group names and windows |
|
widget.GroupBox( |
|
foreground="00FF00", |
|
highlight_method="line", |
|
disable_drag=True, |
|
highlight_color=[ |
|
"345763", |
|
"004000", |
|
], # Set the text color when selected and not selected |
|
inactive="458b74", |
|
fontsize=font_size + 1, |
|
font="Noto Sans", |
|
), |
|
sc_sep, |
|
# Widget to display the name of the currently focused window |
|
widget.WindowName( |
|
foreground="#fcf8c0", |
|
fontsize=font_size, |
|
font="Noto Sans", |
|
), |
|
widget.Spacer(), |
|
# Clock widget to display date and time and launch Zathura on click -> open the file Mqtile.pdf -> key bindings map |
|
widget.Clock( |
|
format="%Y-%m-%d %a %H:%M", |
|
foreground="#ffffff", |
|
font="Noto Sans Bold", |
|
mouse_callbacks={"Button1": lazy.spawn("gnome-calendar")}, |
|
fontsize=font_size, |
|
), |
|
widget.Spacer(), |
|
# # Custom TextBox widget for 'Lay' (Layout) text display |
|
# widget.TextBox( |
|
# font="Noto Sans", text="Lay:", padding=0, fontsize=font_size |
|
# ), |
|
# # CurrentLayout widget to display the current layout |
|
# widget.CurrentLayout( |
|
# font="Noto Sans Bold", |
|
# fontsize=font_size, |
|
# ), |
|
# sc_sep, |
|
] |
|
+ ( |
|
[ |
|
# Custom TextBox widget for 'Mem' (Memory) text display |
|
widget.TextBox( |
|
font="Noto Sans", text="CPU:", padding=0, fontsize=font_size |
|
), |
|
# Memory widget to display memory usage and launch htop on click |
|
widget.CPU( |
|
font="Noto Sans Bold", |
|
format="{freq_current}GHz {load_percent:4.1f}%", |
|
update_interval=1, |
|
fontsize=font_size, |
|
measure_mem="G", |
|
), |
|
sc_sep, |
|
] |
|
if pc_spec.show_cpu |
|
else [] |
|
) |
|
+ [ |
|
# Custom TextBox widget for 'Mem' (Memory) text display |
|
widget.TextBox( |
|
font="Noto Sans", text="Mem:", padding=0, fontsize=font_size |
|
), |
|
# Memory widget to display memory usage and launch htop on click |
|
widget.Memory( |
|
font="Noto Sans Bold", |
|
format="{MemUsed:4.1f}G / {MemTotal:.1f}G", |
|
update_interval=1, |
|
fontsize=font_size, |
|
measure_mem="G", |
|
mouse_callbacks={ |
|
"Button1": lazy.spawn(f"{terminal} -e zsh -c 'htop'") |
|
}, |
|
), |
|
sc_sep, |
|
] |
|
+ ( |
|
[ |
|
# Custom TextBox widget for 'Net' (Network) text display |
|
widget.TextBox( |
|
font="Noto Sans", text="Net:", padding=2, fontsize=font_size |
|
), |
|
# Net widget to display network interface information and launch connection editor on click |
|
widget.Net( |
|
font="Noto Sans Bold", |
|
interface=pc_spec.NET_INTERFACE, |
|
format="{down:5.2f} {down_suffix} ↓↑ {up:5.2f} {up_suffix}", |
|
mouse_callbacks={"Button1": lazy.spawn("nm-connection-editor")}, |
|
prefix="M", |
|
fontsize=font_size, |
|
padding=2, |
|
scroll_fixed_width=True, |
|
), |
|
sc_sep, |
|
] |
|
if pc_spec.show_net |
|
else [] |
|
) |
|
+ [ |
|
# Custom TextBox widget for 'Vol' (Volume) text display |
|
widget.TextBox( |
|
font="Noto Sans", |
|
text="Vol:", |
|
padding=2, |
|
fontsize=font_size, |
|
mouse_callbacks={"Button1": lazy.spawn("pavucontrol")}, |
|
), |
|
# Volume widget to display volume level and control with mouse scroll and click |
|
widget.Volume(font="Noto Sans Bold", padding=2, fontsize=font_size), |
|
widget.Volume(emoji=True, padding=2, fontsize=font_size), |
|
] |
|
+ ( |
|
[ |
|
sc_sep, |
|
# Commented out Battery widget (uncomment to use in a laptop) |
|
widget.TextBox( # Widget to display text |
|
font="Noto Sans", text="Batt:", padding=1, fontsize=font_size |
|
), |
|
widget.Battery( # Battery widget to display battery status |
|
format="{percent:2.0%}", |
|
font="Noto Sans Bold", |
|
update_interval=5, |
|
fontsize=font_size, |
|
padding=2, |
|
), |
|
] |
|
if pc_spec.show_battery |
|
else [] |
|
) |
|
+ [ |
|
# Sep widget to add a separator between widgets |
|
sc_sep, |
|
# Do not disturb |
|
widget.DoNotDisturb( |
|
fontsize=font_size, |
|
fmt="<b>{}</b>", |
|
disabled_icon="notif ON", |
|
enabled_icon="notif OFF", |
|
padding=2, |
|
), |
|
sc_sep, |
|
widget.QuickExit( |
|
fontsize=font_size, |
|
fmt="<b>{}</b>", |
|
default_text="[X]", |
|
countdown_format="[{}]", |
|
padding=2, |
|
), |
|
sc_sep, |
|
], |
|
24, |
|
background="#333333", # Set the background color of the bar |
|
opacity=1, # Set the opacity of the bar (optional) |
|
), |
|
# Set the wallpaper path |
|
wallpaper=f"{home}/.config/qtile/wallpapers/4k-3840-x-2160-wallpapers-themefoxx({img_number}).jpg", |
|
wallpaper_mode="fill", # Set the wallpaper mode |
|
) |
|
|
|
|
|
img_numbers = [ |
|
10, |
|
1000, |
|
1011, |
|
1016, |
|
1018, |
|
1024, |
|
1027, |
|
1032, |
|
1054, |
|
1069, |
|
1071, |
|
1072, |
|
1078, |
|
] |
|
screens = [ |
|
def_screen(random.choice(img_numbers)), |
|
def_screen(random.choice(img_numbers)), |
|
] |
|
|
|
# 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()), |
|
] |
|
|
|
# Key bindings for dynamic groups are not used in this configuration |
|
dgroups_key_binder = None |
|
|
|
# Application rules for dynamic groups (currently empty) |
|
dgroups_app_rules = [] # type: list |
|
|
|
# When enabled, the focus will follow the mouse pointer |
|
follow_mouse_focus = False |
|
|
|
# Determines if windows should be brought to the front on click |
|
bring_front_click = True |
|
|
|
floats_kept_above = True |
|
|
|
# When set to True, the cursor will warp to the center of the focused window. |
|
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 |
|
Match(wm_class="veracrypt"), |
|
Match(wm_class="nautilus"), |
|
] |
|
) |
|
# Automatically set windows to fullscreen when they are created |
|
auto_fullscreen = True |
|
|
|
# Choose how to focus on windows when they are activated |
|
focus_on_window_activation = "smart" |
|
|
|
# When enabled, the screens will be reconfigured automatically |
|
reconfigure_screens = True |
|
|
|
# If things like steam games want to auto-minimize themselves when losing |
|
# focus, should we respect this or not? |
|
auto_minimize = True |
|
|
|
# When using the Wayland backend, this can be used to configure input devices. |
|
wl_input_rules = None |
|
|
|
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this |
|
# string besides java UI toolkits; you can see several discussions on the |
|
# mailing lists, GitHub issues, and other WM documentation that suggest setting |
|
# this string if your java app doesn't work correctly. We may as well just lie |
|
# and say that we're a working one by default. |
|
# |
|
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in |
|
# java that happens to be on java's whitelist. |
|
wmname = "LG3D" |