Fixed some bindings & paths

This commit is contained in:
Rain Clark 2021-09-30 18:54:18 -04:00
parent c1de0b9430
commit 846256b630

View File

@ -40,7 +40,7 @@ from libqtile.widget import Spacer
mod = "mod4"
mod1 = "alt"
mod2 = "control"
home = os.path.expanduser('~')
home = os.path.expanduser("~")
@lazy.function
@ -49,91 +49,83 @@ def window_to_prev_group(qtile):
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)
myTerm = "alacritty" # My terminal of choice
keys = [
# SUPER + FUNCTION KEYS
Key([mod], "f", lazy.window.toggle_fullscreen()),
Key([mod], "q", lazy.window.kill()),
Key([mod], "t", lazy.spawn('xterm')),
Key([mod], "v", lazy.spawn('pavucontrol')),
Key([mod], "d", lazy.spawn('nwggrid -p -o 0.4')),
Key([mod], "Escape", lazy.spawn('xkill')),
Key([mod], "Return", lazy.spawn('kitty')),
Key([mod], "KP_Enter", lazy.spawn('kitty')),
Key([mod], "t", lazy.spawn("xterm")),
Key([mod], "v", lazy.spawn("pavucontrol")),
Key([mod], "s", lazy.spawn("nwggrid -p -o 0.4")),
Key([mod], "Escape", lazy.spawn("xkill")),
Key([mod], "Return", lazy.spawn("kitty")),
Key([mod], "KP_Enter", lazy.spawn("kitty")),
Key([mod], "x", lazy.shutdown()),
# SUPER + SHIFT KEYS
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"], "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"], "d", lazy.spawn(home + '/.config/qtile/scripts/dmenu.sh')),
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()),
# CONTROL + ALT KEYS
Key(["mod1", "control"], "o", lazy.spawn(home + '/.config/qtile/scripts/picom-toggle.sh')),
Key(["mod1", "control"], "t", lazy.spawn('xterm')),
Key(["mod1", "control"], "u", lazy.spawn('pavucontrol')),
Key(
["mod1", "control"],
"o",
lazy.spawn(home + "/.config/qtile/scripts/picom-toggle.sh"),
),
Key(["mod1", "control"], "t", lazy.spawn("xterm")),
Key(["mod1", "control"], "u", lazy.spawn("pavucontrol")),
# ALT + ... KEYS
Key(["mod1"], "p", lazy.spawn('pamac-manager')),
Key(["mod1"], "f", lazy.spawn('waterfox-g3')),
Key(["mod1"], "m", lazy.spawn('pcmanfm')),
Key(["mod1"], "w", lazy.spawn('garuda-welcome')),
Key(["mod1"], "p", lazy.spawn("pamac-manager")),
Key(["mod1"], "f", lazy.spawn("waterfox-g3")),
Key(["mod1"], "m", lazy.spawn("pcmanfm")),
Key(["mod1"], "w", lazy.spawn("garuda-welcome")),
# CONTROL + SHIFT KEYS
Key([mod2, "shift"], "Escape", lazy.spawn('lxtask')),
Key([mod2, "shift"], "Escape", lazy.spawn("lxtask")),
# SCREENSHOTS
Key([], "Print", lazy.spawn('flameshot full -p ' + home + '/Pictures')),
Key([mod2], "Print", lazy.spawn('flameshot full -p ' + home + '/Pictures')),
Key([], "Print", lazy.spawn("flameshot full -p " + home + "/Pictures/Screenshots")),
Key(
[mod2],
"Print",
lazy.spawn("flameshot full -p " + home + "/Pictures/Screenshots"),
),
# Key([mod2, "shift"], "Print", lazy.spawn('gnome-screenshot -i')),
# MULTIMEDIA KEYS
# INCREASE/DECREASE BRIGHTNESS
Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 5")),
Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 5")),
# INCREASE/DECREASE/MUTE VOLUME
Key([], "XF86AudioMute", lazy.spawn("amixer -q set Master toggle")),
Key([], "XF86AudioLowerVolume", lazy.spawn("amixer -q set Master 5%-")),
Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer -q set Master 5%+")),
Key([], "XF86AudioPlay", lazy.spawn("playerctl play-pause")),
Key([], "XF86AudioNext", lazy.spawn("playerctl next")),
Key([], "XF86AudioPrev", lazy.spawn("playerctl previous")),
Key([], "XF86AudioStop", lazy.spawn("playerctl stop")),
# Key([], "XF86AudioPlay", lazy.spawn("mpc toggle")),
# Key([], "XF86AudioNext", lazy.spawn("mpc next")),
# Key([], "XF86AudioPrev", lazy.spawn("mpc prev")),
# Key([], "XF86AudioStop", lazy.spawn("mpc stop")),
# QTILE LAYOUT KEYS
Key([mod], "n", lazy.layout.normalize()),
Key([mod], "space", lazy.next_layout()),
# CHANGE FOCUS
Key([mod], "Up", lazy.layout.up()),
Key([mod], "Down", lazy.layout.down()),
@ -143,105 +135,148 @@ keys = [
Key([mod], "j", lazy.layout.down()),
Key([mod], "h", lazy.layout.left()),
Key([mod], "l", lazy.layout.right()),
# RESIZE UP, DOWN, LEFT, RIGHT
Key([mod, "control"], "l",
Key(
[mod, "control"],
"l",
lazy.layout.grow_right(),
lazy.layout.grow(),
lazy.layout.increase_ratio(),
lazy.layout.delete(),
),
Key([mod, "control"], "Right",
Key(
[mod, "control"],
"Right",
lazy.layout.grow_right(),
lazy.layout.grow(),
lazy.layout.increase_ratio(),
lazy.layout.delete(),
),
Key([mod, "control"], "h",
Key(
[mod, "control"],
"h",
lazy.layout.grow_left(),
lazy.layout.shrink(),
lazy.layout.decrease_ratio(),
lazy.layout.add(),
),
Key([mod, "control"], "Left",
Key(
[mod, "control"],
"Left",
lazy.layout.grow_left(),
lazy.layout.shrink(),
lazy.layout.decrease_ratio(),
lazy.layout.add(),
),
Key([mod, "control"], "k",
Key(
[mod, "control"],
"k",
lazy.layout.grow_up(),
lazy.layout.grow(),
lazy.layout.decrease_nmaster(),
),
Key([mod, "control"], "Up",
Key(
[mod, "control"],
"Up",
lazy.layout.grow_up(),
lazy.layout.grow(),
lazy.layout.decrease_nmaster(),
),
Key([mod, "control"], "j",
Key(
[mod, "control"],
"j",
lazy.layout.grow_down(),
lazy.layout.shrink(),
lazy.layout.increase_nmaster(),
),
Key([mod, "control"], "Down",
Key(
[mod, "control"],
"Down",
lazy.layout.grow_down(),
lazy.layout.shrink(),
lazy.layout.increase_nmaster(),
),
# FLIP LAYOUT FOR MONADTALL/MONADWIDE
Key([mod, "shift"], "f", lazy.layout.flip()),
# FLIP LAYOUT FOR BSP
Key([mod, "mod1"], "k", lazy.layout.flip_up()),
Key([mod, "mod1"], "j", lazy.layout.flip_down()),
Key([mod, "mod1"], "l", lazy.layout.flip_right()),
Key([mod, "mod1"], "h", lazy.layout.flip_left()),
# MOVE WINDOWS UP OR DOWN BSP LAYOUT
Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
Key([mod, "shift"], "h", lazy.layout.shuffle_left()),
Key([mod, "shift"], "l", lazy.layout.shuffle_right()),
### Treetab controls
Key([mod, "control"], "k",
Key(
[mod, "control"],
"k",
lazy.layout.section_up(),
desc='Move up a section in treetab'
desc="Move up a section in treetab",
),
Key([mod, "control"], "j",
Key(
[mod, "control"],
"j",
lazy.layout.section_down(),
desc='Move down a section in treetab'
desc="Move down a section in treetab",
),
# MOVE WINDOWS UP OR DOWN MONADTALL/MONADWIDE LAYOUT
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()),
# TOGGLE FLOATING LAYOUT
Key([mod, "shift"], "space", lazy.window.toggle_floating()),]
Key([mod, "shift"], "space", lazy.window.toggle_floating()),
]
groups = []
# FOR QWERTY KEYBOARDS
group_names = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0",]
group_names = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
]
# FOR AZERTY KEYBOARDS
# group_names = ["ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", "section", "egrave", "exclam", "ccedilla", "agrave",]
# group_labels = ["1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "0",]
group_labels = ["", "", "", "", "", "", "", "", "", "",]
group_labels = [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
]
# group_labels = ["", "", "", "", "",]
# group_labels = ["Web", "Edit/chat", "Image", "Gimp", "Meld", "Video", "Vb", "Files", "Mail", "Music",]
group_layouts = ["monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "treetab", "floating",]
group_layouts = [
"monadtall",
"monadtall",
"monadtall",
"monadtall",
"monadtall",
"monadtall",
"monadtall",
"monadtall",
"treetab",
"floating",
]
# group_layouts = ["monadtall", "matrix", "monadtall", "bsp", "monadtall", "matrix", "monadtall", "bsp", "monadtall", "monadtall",]
for i in range(len(group_names)):
@ -250,38 +285,50 @@ for i in range(len(group_names)):
name=group_names[i],
layout=group_layouts[i].lower(),
label=group_labels[i],
))
)
)
for i in groups:
keys.extend([
keys.extend(
[
# CHANGE WORKSPACES
Key([mod], i.name, lazy.group[i.name].toscreen()),
Key([mod], "Tab", lazy.screen.next_group()),
Key([mod, "shift"], "Tab", lazy.screen.prev_group()),
Key(["mod1"], "Tab", lazy.screen.next_group()),
Key(["mod1", "shift"], "Tab", lazy.screen.prev_group()),
# MOVE WINDOW TO SELECTED WORKSPACE 1-10 AND STAY ON WORKSPACE
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name)),
# MOVE WINDOW TO SELECTED WORKSPACE 1-10 AND FOLLOW MOVED WINDOW TO WORKSPACE
Key([mod, "shift"], i.name, lazy.window.togroup(i.name) , lazy.group[i.name].toscreen()),
])
Key(
[mod, "shift"],
i.name,
lazy.window.togroup(i.name),
lazy.group[i.name].toscreen(),
),
]
)
def init_layout_theme():
return {"margin":10,
return {
"margin": 10,
"border_width": 2,
"border_focus": "#ff00ff",
"border_normal": "#f4c2c2"
"border_normal": "#f4c2c2",
}
layout_theme = init_layout_theme()
layouts = [
layout.MonadTall(margin=16, border_width=2, border_focus="#ff00ff", border_normal="#f4c2c2"),
layout.MonadWide(margin=16, border_width=2, border_focus="#ff00ff", border_normal="#f4c2c2"),
layout.MonadTall(
margin=16, border_width=2, border_focus="#ff00ff", border_normal="#f4c2c2"
),
layout.MonadWide(
margin=16, border_width=2, border_focus="#ff00ff", border_normal="#f4c2c2"
),
layout.Matrix(**layout_theme),
layout.Bsp(**layout_theme),
layout.Floating(**layout_theme),
@ -291,22 +338,24 @@ layouts = [
layout.Stack(**layout_theme),
layout.Tile(**layout_theme),
layout.TreeTab(
sections=['FIRST', 'SECOND'],
bg_color = '#141414',
active_bg = '#0000ff',
inactive_bg = '#1e90ff',
sections=["FIRST", "SECOND"],
bg_color="#141414",
active_bg="#0000ff",
inactive_bg="#1e90ff",
padding_y=5,
section_top=10,
panel_width = 280),
panel_width=280,
),
layout.VerticalTile(**layout_theme),
layout.Zoomy(**layout_theme)
layout.Zoomy(**layout_theme),
]
# COLORS FOR THE BAR
def init_colors():
return [["#2F343F", "#2F343F"], # color 0
return [
["#2F343F", "#2F343F"], # color 0
["#2F343F", "#2F343F"], # color 1
["#c0c5ce", "#c0c5ce"], # color 2
["#e75480", "#e75480"], # color 3
@ -329,69 +378,62 @@ def init_colors():
["#c678dd", "#c678dd"], # 20
["#e06c75", "#e06c75"], # 21
["#fb9f7f", "#fb9f7f"], # 22
["#ffd47e", "#ffd47e"]] #23
["#ffd47e", "#ffd47e"],
] # 23
colors = init_colors()
def base(fg='text', bg='dark'):
return {'foreground': colors[14],'background': colors[15]}
def base(fg="text", bg="dark"):
return {"foreground": colors[14], "background": colors[15]}
# WIDGETS FOR THE BAR
def init_widgets_defaults():
return dict(font="Noto Sans",
fontsize = 9,
padding = 2,
background=colors[1])
return dict(font="Noto Sans", fontsize=9, padding=2, background=colors[1])
widget_defaults = init_widgets_defaults()
def init_widgets_list():
prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
widgets_list = [
widget.Sep(
linewidth = 1,
padding = 10,
foreground = colors[15],
background = colors[15]
linewidth=1, padding=10, foreground=colors[15], background=colors[15]
), #
widget.Image(
filename="~/.config/qtile/icons/garuda-red.png",
iconsize=9,
background=colors[15],
mouse_callbacks = {'Button1': lambda : qtile.cmd_spawn('jgmenu_run')}
mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("jgmenu_run")},
),
widget.GroupBox(
**base(bg=colors[15]),
font='UbuntuMono Nerd Font',
font="UbuntuMono Nerd Font",
fontsize=11,
margin_y=3,
margin_x=2,
padding_y=5,
padding_x=4,
borderwidth=3,
active=colors[5],
inactive=colors[6],
rounded=True,
highlight_method='block',
urgent_alert_method='block',
highlight_method="block",
urgent_alert_method="block",
urgent_border=colors[16],
this_current_screen_border=colors[20],
this_screen_border=colors[17],
other_current_screen_border=colors[13],
other_screen_border=colors[17],
disable_drag=True
),
widget.TaskList(
highlight_method = 'border', # or block
highlight_method="border", # or block
icon_size=17,
max_title_width=150,
rounded=True,
@ -402,40 +444,35 @@ def init_widgets_list():
border=colors[7],
foreground=colors[9],
margin=2,
txt_floating='🗗',
txt_minimized='>_ ',
txt_floating="🗗",
txt_minimized=">_ ",
borderwidth=1,
background=colors[20],
# unfocused_border = 'border'
),
widget.CurrentLayoutIcon(
custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")],
foreground=colors[5],
background=colors[3],
padding=0,
scale = 0.7
scale=0.7,
),
widget.CurrentLayout(
font="Noto Sans Bold",
fontsize=12,
foreground=colors[5],
background = colors[3]
background=colors[3],
),
widget.Net(
font="Noto Sans",
fontsize=12,
# Here enter your network name
interface=["wlp6s0"],
format = '{down} ↓↑ {up}',
format="{down} ↓↑ {up}",
foreground=colors[5],
background=colors[19],
padding=0,
),
widget.CPU(
font="Noto Sans",
# format = '{MemUsed}M/{MemTotal}M',
@ -443,35 +480,29 @@ def init_widgets_list():
fontsize=12,
foreground=colors[5],
background=colors[22],
mouse_callbacks = {'Button1': lambda : qtile.cmd_spawn(myTerm + ' -e htop')},
mouse_callbacks={"Button1": lambda: qtile.cmd_spawn(myTerm + " -e htop")},
),
widget.Memory(
font="Noto Sans",
format = '{MemUsed: .0f}M/{MemTotal: .0f}M',
format="{MemUsed: .0f}M/{MemTotal: .0f}M",
update_interval=1,
fontsize=12,
measure_mem = 'M',
measure_mem="M",
foreground=colors[5],
background=colors[16],
mouse_callbacks = {'Button1': lambda : qtile.cmd_spawn(myTerm + ' -e htop')},
mouse_callbacks={"Button1": lambda: qtile.cmd_spawn(myTerm + " -e htop")},
),
widget.Clock(
foreground=colors[9],
background=colors[23],
fontsize=12,
format="%Y-%m-%d %H:%M"
),
widget.Systray(
background=colors[10],
icon_size=20,
padding = 4
format="%Y-%m-%d %H:%M",
),
widget.Systray(background=colors[10], icon_size=20, padding=4),
]
return widgets_list
widgets_list = init_widgets_list()
@ -479,26 +510,51 @@ def init_widgets_screen1():
widgets_screen1 = init_widgets_list()
return widgets_screen1
def init_widgets_screen2():
widgets_screen2 = init_widgets_list()
return widgets_screen2
widgets_screen1 = init_widgets_screen1()
widgets_screen2 = init_widgets_screen2()
def init_screens():
return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), size=20, opacity=0.85, background= "000000")),
Screen(top=bar.Bar(widgets=init_widgets_screen2(), size=20, opacity=0.85, background= "000000"))]
return [
Screen(
top=bar.Bar(
widgets=init_widgets_screen1(),
size=20,
opacity=0.85,
background="000000",
)
),
Screen(
top=bar.Bar(
widgets=init_widgets_screen2(),
size=20,
opacity=0.85,
background="000000",
)
),
]
screens = init_screens()
# 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())
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
@ -546,60 +602,67 @@ dgroups_app_rules = []
# ASSIGN APPLICATIONS TO A SPECIFIC GROUPNAME
main = None
@hook.subscribe.startup_once
def start_once():
home = os.path.expanduser('~')
subprocess.call([home + '/.config/qtile/scripts/autostart.sh'])
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', 'left_ptr'])
subprocess.Popen(["xsetroot", "-cursor_name", "left_ptr"])
@hook.subscribe.client_new
def set_floating(window):
if (window.window.get_wm_transient_for()
or window.window.get_wm_type() in floating_types):
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=[
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)
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