From 72eb81dbc843830f7afb29cb2774b31c9f528b69 Mon Sep 17 00:00:00 2001 From: paul-loedige Date: Fri, 27 Nov 2020 00:15:08 +0100 Subject: [PATCH] restructured qtile configs and added gitignore --- .gitignore | 1 + qtile/.config/qtile/bars.py | 37 ++++++++ qtile/.config/qtile/config.py | 162 +-------------------------------- qtile/.config/qtile/defines.py | 4 + qtile/.config/qtile/groups.py | 13 +++ qtile/.config/qtile/keys.py | 75 +++++++++++++++ qtile/.config/qtile/layouts.py | 45 +++++++++ qtile/.config/qtile/screens.py | 12 +++ 8 files changed, 191 insertions(+), 158 deletions(-) create mode 100644 .gitignore create mode 100644 qtile/.config/qtile/bars.py create mode 100644 qtile/.config/qtile/defines.py create mode 100644 qtile/.config/qtile/groups.py create mode 100644 qtile/.config/qtile/keys.py create mode 100644 qtile/.config/qtile/layouts.py create mode 100644 qtile/.config/qtile/screens.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file diff --git a/qtile/.config/qtile/bars.py b/qtile/.config/qtile/bars.py new file mode 100644 index 0000000..987c6bb --- /dev/null +++ b/qtile/.config/qtile/bars.py @@ -0,0 +1,37 @@ +# coding = utf-8 +from libqtile import bar, widget + +widget_defaults = dict( + font='sans', + fontsize=12, + padding=3, +) +extension_defaults = widget_defaults.copy() + + +main_bar = bar.Bar([ + widget.CurrentLayoutIcon(), + widget.GroupBox(), + widget.Prompt(), + widget.WindowName(), + widget.Systray(), + widget.TextBox("Vol:"), + widget.Volume(), + widget.CPU(format='CPU: {load_percent}%'), + widget.Memory(format='RAM: {MemUsed}MB'), + widget.Memory(format='Swap: {SwapUsed}MB'), + widget.NetGraph(), + widget.Clock(format='%Y-%m-%d %H:%M'), +],24) + +left_bar = bar.Bar([ + widget.CurrentLayoutIcon(), + widget.GroupBox(), + widget.WindowName(), +],24) + +top_bar = bar.Bar([ + widget.CurrentLayoutIcon(), + widget.GroupBox(), + widget.WindowName(), +],24) \ No newline at end of file diff --git a/qtile/.config/qtile/config.py b/qtile/.config/qtile/config.py index 87e1fad..9606cd5 100644 --- a/qtile/.config/qtile/config.py +++ b/qtile/.config/qtile/config.py @@ -28,149 +28,12 @@ #endregion -from typing import List # noqa: F401 - import os -import subprocess -from libqtile import bar, layout, widget, hook -from libqtile.config import Click, Drag, Group, Key, Screen -from libqtile.lazy import lazy -mod = "mod4" -terminal = "termite" - -#region key_and_mouse_bindings - -keys = [ - # moving windows around - Key([mod], "h", lazy.layout.left()), - Key([mod], "l", lazy.layout.right()), - Key([mod], "j", lazy.layout.down()), - Key([mod], "k", lazy.layout.up()), - Key([mod, "shift"], "h", lazy.layout.swap_left()), - Key([mod, "shift"], "l", lazy.layout.swap_right()), - Key([mod, "shift"], "j", lazy.layout.shuffle_down()), - Key([mod, "shift"], "k", lazy.layout.shuffle_up()), - - # resize windows - Key([mod], "plus", lazy.layout.grow()), - Key([mod], "minus", lazy.layout.shrink()), - Key([mod], "n", lazy.layout.normalize()), - Key([mod], "o", lazy.layout.maximize()), - Key([mod], "space", lazy.window.toggle_fullscreen()), - - # app hotkeys - Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), - Key([mod],"f", lazy.spawn("firefox"),desc="Launch firefox"), - Key([mod],"e", lazy.spawn("pcmanfm"),desc="Launch pcmanfm"), - Key([mod],"c", lazy.spawn("code"),desc="Launch visual studio code"), - - # Toggle between different layouts as defined below - Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), - Key([mod], "BackSpace", lazy.window.kill(), desc="Kill focused window"), - - # qtile hotkeys - Key([mod, "control"], "r", lazy.restart(), desc="Restart qtile"), - Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown qtile"), - Key([mod], "r", lazy.spawncmd(),desc="Spawn a command using a prompt widget"), - - # Media hotkeys - Key([], 'XF86AudioRaiseVolume', lazy.spawn('pulseaudio-ctl up 1')), - Key([], 'XF86AudioLowerVolume', lazy.spawn('pulseaudio-ctl down 1')), - Key([], 'XF86AudioMute', lazy.spawn('pulseaudio-ctl mute')), -] - - -# 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()) -] -#endregion - -#region groups -groups = [Group(i) for i in "asdfuiop"] - -for i in groups: - keys.extend([ - # mod1 + letter of group = switch to group - Key(["mod1","control"], i.name, lazy.group[i.name].toscreen(), - desc="Switch to group {}".format(i.name)), - - # mod1 + shift + letter of group = switch to & move focused window to group - Key(["mod1","control", "shift"], i.name, lazy.window.togroup(i.name, switch_group=True), - desc="Switch to & move focused window to group {}".format(i.name)), - # Or, use below if you prefer not to switch to that group. - # # mod1 + shift + letter of group = move focused window to group - # Key([mod, "shift"], i.name, lazy.window.togroup(i.name), - # desc="move focused window to group {}".format(i.name)), - ]) -#endregion - -#region layouts -focus_color = '#bd93f9' -layouts = [ - layout.MonadTall( - border_focus = focus_color, - border_width = 2, - new_at_current = True, - ), - layout.Floating( - border_focus = focus_color, - ), - layout.Max(), - layout.MonadWide( - border_focus = focus_color, - border_width = 2, - new_at_current = True, - ), -] -#endregion - -#region widgets_and_screens - -widget_defaults = dict( - font='sans', - fontsize=12, - padding=3, -) -extension_defaults = widget_defaults.copy() - -main_bar = [ - widget.CurrentLayout(), - widget.GroupBox(), - widget.Prompt(), - widget.WindowName(), - widget.Systray(), - widget.TextBox("Vol:"), - widget.Volume(), - widget.CPU(format='CPU: {load_percent}%', - update_interval=2), - widget.Clock(format='%Y-%m-%d %a %H:%M'), -] - -left_bar = [ - widget.CurrentLayout(), - widget.GroupBox(), - widget.WindowName(), -] - -top_bar = [ - widget.CurrentLayout(), - widget.GroupBox(), - widget.WindowName(), -] - -screens = [ - Screen(bottom=bar.Bar(top_bar,24)), - Screen(top=bar.Bar(main_bar,24)), - Screen(top=bar.Bar(left_bar,24)), -] - -#endregion +#import custom files +from keys import keys, mouse +from screens import screens +from layouts import layouts #region miscelanious dgroups_key_binder = None @@ -179,23 +42,6 @@ main = None # WARNING: this is deprecated and will be removed soon follow_mouse_focus = True bring_front_click = False 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. - {'wmclass': 'confirm'}, - {'wmclass': 'dialog'}, - {'wmclass': 'download'}, - {'wmclass': 'error'}, - {'wmclass': 'file_progress'}, - {'wmclass': 'notification'}, - {'wmclass': 'splash'}, - {'wmclass': 'toolbar'}, - {'wmclass': 'confirmreset'}, # gitk - {'wmclass': 'makebranch'}, # gitk - {'wmclass': 'maketag'}, # gitk - {'wname': 'branchdialog'}, # gitk - {'wname': 'pinentry'}, # GPG key password entry - {'wmclass': 'ssh-askpass'}, # ssh-askpass -]) auto_fullscreen = True focus_on_window_activation = "smart" diff --git a/qtile/.config/qtile/defines.py b/qtile/.config/qtile/defines.py new file mode 100644 index 0000000..a489aab --- /dev/null +++ b/qtile/.config/qtile/defines.py @@ -0,0 +1,4 @@ +term = 'termite' +focus_color = '#bd93f9' +border_width = 2 +mod = 'mod4' diff --git a/qtile/.config/qtile/groups.py b/qtile/.config/qtile/groups.py new file mode 100644 index 0000000..5c8da8a --- /dev/null +++ b/qtile/.config/qtile/groups.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +from libqtile.config import Group#, ScratchPad, DropDown + +from defines import term + +groups = [Group(i) for i in "asdfuiop"] +#groups = [ +# Group("code", spawn="code", layout="monadtall", persist=True), +# Group("chat", spawn=["firefox https://web.whatsapp.com/","discord"],layout="monadwide",persist=True), +# Group("spot", spawn="spotify",layout="max", persist=True), +# ScratchPad("scratch",[DropDown('term',term)]) +#] diff --git a/qtile/.config/qtile/keys.py b/qtile/.config/qtile/keys.py new file mode 100644 index 0000000..31ba4dc --- /dev/null +++ b/qtile/.config/qtile/keys.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# coding = utf-8 + +import os +import subprocess + +from libqtile.config import Key, Drag, Click +from libqtile.command import lazy + +from groups import groups +from defines import mod, term + +keys = [ + # moving windows around + Key([mod], "h", lazy.layout.left()), + Key([mod], "l", lazy.layout.right()), + Key([mod], "j", lazy.layout.down()), + Key([mod], "k", lazy.layout.up()), + Key([mod, "shift"], "h", lazy.layout.swap_left()), + Key([mod, "shift"], "l", lazy.layout.swap_right()), + Key([mod, "shift"], "j", lazy.layout.shuffle_down()), + Key([mod, "shift"], "k", lazy.layout.shuffle_up()), + + # resize windows + Key([mod], "plus", lazy.layout.grow()), + Key([mod], "minus", lazy.layout.shrink()), + Key([mod], "n", lazy.layout.normalize()), + Key([mod], "o", lazy.layout.maximize()), + Key([mod], "space", lazy.window.toggle_fullscreen()), + + # app hotkeys + Key([mod], "Return", lazy.spawn(term), desc="Launch terminal"), + Key([mod],"f", lazy.spawn("firefox"),desc="Launch firefox"), + Key([mod],"e", lazy.spawn("pcmanfm"),desc="Launch pcmanfm"), + Key([mod],"c", lazy.spawn("code"),desc="Launch visual studio code"), + + # Toggle between different layouts as defined below + Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), + Key([mod], "BackSpace", lazy.window.kill(), desc="Kill focused window"), + + # qtile hotkeys + Key([mod, "control"], "r", lazy.restart(), desc="Restart qtile"), + Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown qtile"), + Key([mod], "r", lazy.spawncmd(),desc="Spawn a command using a prompt widget"), + + # Media hotkeys + Key([], 'XF86AudioRaiseVolume', lazy.spawn('pulseaudio-ctl up 1')), + Key([], 'XF86AudioLowerVolume', lazy.spawn('pulseaudio-ctl down 1')), + Key([], 'XF86AudioMute', lazy.spawn('pulseaudio-ctl mute')), +] + + +# 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()) +] + +for i in groups: + keys.extend([ + # mod1 + letter of group = switch to group + Key(["mod1","control"], i.name, lazy.group[i.name].toscreen(), + desc="Switch to group {}".format(i.name)), + + # mod1 + shift + letter of group = switch to & move focused window to group + Key(["mod1","control", "shift"], i.name, lazy.window.togroup(i.name, switch_group=True), + desc="Switch to & move focused window to group {}".format(i.name)), + # Or, use below if you prefer not to switch to that group. + # # mod1 + shift + letter of group = move focused window to group + # Key([mod, "shift"], i.name, lazy.window.togroup(i.name), + # desc="move focused window to group {}".format(i.name)), + ]) \ No newline at end of file diff --git a/qtile/.config/qtile/layouts.py b/qtile/.config/qtile/layouts.py new file mode 100644 index 0000000..f401c53 --- /dev/null +++ b/qtile/.config/qtile/layouts.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from libqtile import layout + +from defines import focus_color,border_width + +layouts = [ + layout.MonadTall( + align=1, + border_focus = focus_color, + border_width = border_width, + new_at_current = True, + ), + layout.Floating( + border_focus = focus_color, + border_width = border_width, + ), + layout.Max(), + layout.MonadWide( + border_focus = focus_color, + border_width = border_width, + new_at_current = True, + ), +] + +floating_layout = layout.Floating( + border_focus = focus_color, + border_width = border_width, + float_rules=[ + # Run the utility of `xprop` to see the wm class and name of an X client. + {'wmclass': 'confirm'}, + {'wmclass': 'dialog'}, + {'wmclass': 'download'}, + {'wmclass': 'error'}, + {'wmclass': 'file_progress'}, + {'wmclass': 'notification'}, + {'wmclass': 'splash'}, + {'wmclass': 'toolbar'}, + {'wmclass': 'confirmreset'}, # gitk + {'wmclass': 'makebranch'}, # gitk + {'wmclass': 'maketag'}, # gitk + {'wname': 'branchdialog'}, # gitk + {'wname': 'pinentry'}, # GPG key password entry + {'wmclass': 'ssh-askpass'}, # ssh-askpass +]) \ No newline at end of file diff --git a/qtile/.config/qtile/screens.py b/qtile/.config/qtile/screens.py new file mode 100644 index 0000000..09f3f88 --- /dev/null +++ b/qtile/.config/qtile/screens.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# coding = utf-8 + +from libqtile.config import Screen + +from bars import main_bar, left_bar, top_bar + +screens = [ + Screen(bottom=top_bar), + Screen(top=main_bar), + Screen(top=left_bar), +] \ No newline at end of file