Resistance Is Futile, So I'm Back In Qtile

DistroTube
233 followers
Oct 25, 2024
one of my favorite telling window
managers of all time
is q-tile q-tile is a tiling window
manager written and configured entirely
in python
and is just a really comfortable window
manager to live in
i love it because it has the same kind
of function and feel as x monad so it's
really easy to switch between x monet
and q tile the only real difference
again is the configuration in q-tile
everything's configured in python
of course in exmonet everything is
configured in haskell
but one of the things even though i say
q-tile is one of my favorite telling
window managers of all time i also like
x-moned dwm the awesome window manager
you know i'm always hopping between all
these
tiling window managers sometimes i even
go into floating window managers like
open box and live in them for
a few days or even a few weeks and
sometimes
it's several weeks several months
sometimes before i come back to some of
these window managers that i've lived in
before
and when i come back to them my
configuration is not right it's broken
there's been
major updates to these particular tiling
window managers and my config files
no longer work as i left them and that's
really been the case with qtile i've
been getting people opening issues on my
git lab for a while now
telling me hey this little thing in your
qtile config
doesn't work this little thing here
doesn't work and i i've never really
taken them
that seriously as far as i need to drop
everything and go fix my util config
because i was living in other window
managers but i've gotten enough of these
reports and it's not all the same thing
you know there's various parts of my
configuration that are broken that here
in the last two or three days
i've lived in qtile and i've been
working on my configuration cleaning it
up and trying to correct all the errors
and this is not an unusual thing with
tiling window managers
you do have to deal with this is that
you know every few months to every few
years sometimes there are major updates
to these window managers and
things change right some of the syntax
changes as far as the
programming language that the the thing
is written in or whatever it is
and for whatever reason you have to go
in and make usually just very
minor edits to your configuration it's
not like you have to rewrite the whole
thing from scratch
so it's really it's not really a hassle
or anything
it's just something to be expected i've
had to do this many times over the years
i've had to rewrite my awesome window
manager config before because
uh you know syntax has changed with just
the awesome libraries and
the lua language and things like that
i've also rewritten my qtal config
at least one other time because an
update basically made my old config
no longer work i have rewritten my ex
monad config several times
so let me switch over to my desktop here
and show you the updated the corrected
qtile configuration
uh for those of you that use my old
config there are some minor
aesthetic changes i did change some of
the colors in the bar
uh these purples and blues here for the
power line effect i made them a little
darker they were a little too light
because it was tough to read the white
text so i darkened them a little bit so
that white text
kind of pops out a little more also i
have this python
icon that i had in the bar now i used to
use just the traditional python
icon which is what blue and yellow in
color
i made it an all white icon i just
thought that
again for aesthetics it just fit the bar
better
but again these are aesthetic changes
they really
weren't functional in any way as far as
they didn't solve any errors now the
errors i'm talking about
one of the first errors i started
receiving reports of
is the update widget so qtile has this
update widget where it will tell me how
many updates are available on my system
because on arch systems it runs the
check updates command or whatever it was
that it was running
figure out how many updates are
available on your system and it'll print
it out
well that widget it was called i think
it was just called pacman it was
widget.pacman
that pacman widget they removed it
in like one of the latest versions so it
stopped working and anybody that was
using my configuration
it stopped working for them well the
qtal the guys the reason they removed
the pacman widget is because they made
another widget it was just a general
check updates widget and you could use
it for
various linux distributions because not
everybody's running arch right some
people are running
you know debian or ubuntu or whatever it
happens to be so now
they've made a widget that works on
multiple distributions
and and that's the one i needed to
switch this to let me actually open up
my configuration file so i can actually
show you the code here some
let me go to my qtile config.pi
of course my config it's not myqtile.pi
it's actually a readme.org but it writes
out to my config dot pi
so but you guys if you're not using a
literate config
and org mode and emax all you guys need
to do is have
your queue config in your home directory
slash dot config slash qtile slash
config.pi let me zoom in here
so you guys can see a little more of
what is going on in my config so let me
page down
and let me get down here to where the
widgets
start for the bar here so here's uh
defining the init widgets list
and let me get to this widget right here
widget dot check updates is the new one
that i had to change so all i needed to
do
that used to be widget.pacman i changed
it to widget.checkupdates
and then i needed to give it a couple of
different values here first
you need to specify your distro and for
arch arch has a couple of different uh i
think it's three different options
for example i'm using arch underscore
check updates
that's meaning i use archbase distro and
the command i want you to run to find my
updates is the check updates command
because i know that command
is on my system also i can change the
format
as far as what it displays here so
i have it display this squirrely
brackets with the word updates that is
the actual number of updates followed by
the
actual word updates so that's why i have
currently 237
updates now one of the other things that
was also broken in this widget
and in other widgets is the mouse
callback function
so in qtile every widget has the ability
to have a mouse callback
assigned to it or multiple mouse
callbacks so you can you know
have the left mouse the right mouse and
the middle mouse you know actually do
things
when you click on widgets and i had this
one where
if i clicked on the update widget it
would run the command
my terminal which is alacrity and with
these flags dash e and then run the
command sudo pacman
syu it's basically going to open a
terminal and run pacman syu so i can run
an update
so that's what this should be doing
it was broken in my old config because
the way my old config was written
we had this here you had lambda
space qtile colon and then q tile dot
command underscore spawn and then the
command you wanted to spawn
well it turns out they rewrote all of
these widget libraries and you can no
longer
do lambda and then q-tile
it just needs to be lambda without
q-tile and
the other fix you need to do to make
these callback functions work properly
is in your imports you actually need to
import
qtil before you didn't need to import it
you could just call it in the lambda now
import q-tile and then of course in the
actual functions themselves down here
for the mouse callback
just make sure you get rid of that extra
q-tile that was in my config
and now when i click this widget you'll
see
it opens a terminal that's asking for
sudo password because it's trying to run
sudo pacman syu so
if i gave it a password here you see
it's syncing the repositories and it's
going to run update i'm going to
decline this update since it's 237
packages now
most of that is just very small haskell
programs but still i don't want to take
the time to run that update here on
camera
now i had three or four different
widgets that had mouse callbacks the
memory one here i think i had it open a
terminal and then run h-stop
and that one still works and then i
think i had another one
that did something let me scroll down
here
the memory one uh i know what it is it's
the very first widget here
this icon which is just this white uh
python icon
i set that to actually run i can't
remember what i set it to run
actually oh it just opens the terminal
so let me click on it and it just
launches the terminal
i think in my old config i had it
launched some kind of menu
maybe d menu or rophea or something now
living in qtile for
the last couple of days i did notice it
wasn't really an
error but for those of you that are
running multi monitors like i
am i've run a triple monitor system and
the systray here this is a systrace
sitting in the panel
you can only ever have one systray
running
at a time so if you have three monitors
and there's a panel on all monitors the
systray can only be on
one and the problem is it
whichever one it loaded on and it would
load on different ones
you know depending on when i logged into
q tile
i guess it's whichever one loads it the
fastest gets it
and i always wanted this systray to be
on the middle monitor so what i did i
have this widgets list
this very long widgets list this is
every widget
as far as they can be in my panel and
what i did
is i created uh these definitions here
so i'm defining these functions where i
have
this group here these are the widgets
that will appear
on monitors one and three and this group
here are the widgets that appear on
monitor two which is the one we're
currently looking at
you see monitor two i really don't do
anything special with it i just say hey
load the entire
widgets list but this one you notice i
added an extra line i added uh delete
and then the function widgets underscore
screen 1 and then
i'm slicing 7 through 18. what is a
slice
slice means i'm cutting it out so all
the
widgets in this list from 7 to 18
cut out that way it cuts out the spacing
around the systrade the systray itself
and i think i cut off
a few more of the functions that i
didn't need like i really don't need the
price of bitcoin on every screen or
something like that
so that is slicing using python
and because i've sliced out especially
the system tray widget you know it
cannot appear
on monitors one or three anymore it's
forced now to be
on my second monitor some of the other
changes i did i spent some time on my
key bindings because i did need to add a
lot of key bindings and i modified some
key bindings because one of the cool
things
with qtel really in the last couple of
versions
is they now support key chords and
they when they first introduced them it
was kind of a hacky way to get them
but now it's actually fully baked into
qtile and it's really
easy to do key chords and i'm talking
about like emac style
where you know emacs has these weird key
bindings like ctrl c
followed by ctrl f ctrl c followed by
control x
those are key chords and what you need
to do is in your imports
for qtal now you know when you're
importing from qtile lib qtile.config
and you import things like click
drag group and key and screen and all of
that make sure you also
import key chord and then in your key
bindings
you know these are just your standard
key bindings key that's just a normal
key binding which is
mod return it's launching my terminal
now if you want a key chord instead of
key you need to actually type
key chord and i've got that somewhere
down here let me go
to the bottom of my key bindings alright
so here are my key chords to launch
emacs
so instead of key we have key chord and
i have control
e and then in brackets here you know
i've got this
starting bracket the ending bracket and
then
the keys themselves so control e
followed by e
just launches emacs control e followed
by b
launches an i buffer in e max control e
followed by
d launches deer ed and emac so if i did
control e followed by d
right now that's gearhead which is the
file manager that's built into emacs
so that are those are key chords and
then i created another set of key chords
for my d menu scripts which i
i like to do them as super p because
super p
is the default d menu key binding for i
think dwm
and xmonet it may be the default d menu
key binding for qtile too i can't
remember what the default is but
it's typically super p for a run prompt
you know and what i did is i made all of
my d menu scripts
use the key chord super p followed by
another key so
for example super p followed by e runs
my
dm comp uh script which is a it's a list
of all the config files that i like to
edit all the time so
super p followed by e runs that
particular d menu script
and then i have you know all the other
ones like uh super p
followed by p runs past menu for my
password so
there's the password script there and
actually it's interesting
looking at my config fall right now on
camera i'm actually noticing another
thing i need to take care of
it's not really an error but in all of
my standard key bindings i have a
description
you know i'm telling you exactly what
the key binding does and
you put a description is because you do
have the ability
uh at the command line for qtile to tell
you what all your key bindings are and
if you have a description set of course
the description will spit out too
but you see i didn't actually add a
description for any of the
keys and the key chords so i need to go
back and take care of that at some point
one of the other things that was causing
people problems because it was
really erroring out is if i go to the
bottom of my configure
for the window manager rules this used
to be a very long list you notice i only
have
three window manager rules as far as
these are rules for when a window needs
to be floated
i used to have like 15 or 20 things here
and the reason
that was broken is because they changed
the syntax of it they also
changed the fact that now qtile ships
with this here layout dot floating dot
default underscore float underscore
rules
so this particular library default
underscore float underscore rules
that defines windows that are always
floated no matter what you don't have to
go in and specify
because everybody wants these windows
to float they are windows for utility
notifications toolbar splash screens
dialog
boxes confirm boxes download boxes
error messages you know these are all
the standard windows that pop
up that everybody wants to float you
never want those
in a tiling kind of layout so that's why
the the qtile guys
smartly you know defined those as
default float rules
and then i found some things that i
needed to add myself for some programs i
use all the time
for example calculate with a queue now
that is a calculator
and when i pull up a calculator i don't
want it to tile because it makes the
layout all weird the buttons and
everything they're scrunched up or
stretched out wide a calculator just
needs to be floated on the screen so
when i run calculate uh gtk
here you see it floats before it would
have forced it in a
tiling layout where it's taking up half
the screen
and it just looked really odd you know
being in a tiling layout so
now i forced that i've also forced uh
the confirmation box within tastyworks
which is a trading stock trading
platform
also force pine entry for
the the pass command i showed you my
demon use script to run
the the pass menu command before so if i
want to get my password for
i don't know 0ad if i'm doing a
multiplayer
zero ad game you have to log in and this
window
used to be forced into tiling but now
you know i set this
rule here window manager class pine
entry dash gtk
2. so how do you get these rules by the
way how did i know that the calculate
window
is actually titled calculate with an
exclamation
how did i know window manager class for
that that pass menu window was pine
entry gtk2 well you use
the x prop command in the terminal so if
i launch a terminal
and type x prop and hit enter you see my
cursor turned into an x
click on any window for example let me
click on the alacrity window
and it will give me window manager class
and title and
everything and you can see window
manager class for alacrity
is alacrity with a capital a so that's
what i would set here if i needed to
make alacrity
always floating let me close out of
alacrity there i think that's all of the
major changes i made to the config as
far as
uh correcting errors like things that
were going to cause you
real problems if you used my config i
mean i did clean up
some of the key bindings i think used to
i had these key bindings reverse
where for example if i'm focused on my
emacs window here i used to have super
l as a shrink the window and super h as
an expand the window which didn't make
sense
because i think super l should make that
window bigger and super h
should make it smaller that's the way it
is in my xmonet config and my dwm config
it was weird i had it reversed in my
qtile config so i fixed that
but i also doubled that binding because
this this
shrink with super h and super l
that works in the monad tall layout
which is your standard master and stack
layout
but if you're in a different layout for
example let me get into
the tiling layout this is mainly like a
a master and stack but it's it's a
different kind of master and stack
but in this tiling layout i have super h
and super l do something different i
have them increase or decrease
the number of windows in the master
frame so if i do super h right now
i just decrease the number of windows on
the master frame you can't decrease it
less than one so that didn't work but if
i do super l to increase the number of
windows in the master frame
you see i get a second window over there
and then super l one more time i've put
three windows in the master frame if i
do super h
i decrease it super h one more time i
decrease it again back to what it is
out of the box all the other layouts are
the same i had the
full screen the max layout there's the
stack layout which you have two
different stacks and windows just stack
on top of these two windows you and then
i had the tree tab layout which i really
don't use it's in my config mainly just
for
proof of concept just to show you this
this
thing i don't know if i would ever have
much of a use for it and i really
haven't played with it much i
i originally wanted to configure it and
do some neat things with it i've just
never taken the time maybe that's
something i'll do in a future video
is actually see what i can get done with
tree tab
you know flesh it out a little bit more
you can see what i wanted to do is have
two different stacks
of the tree tab you see i have the first
workspace and then the second workspace
but i'm not really doing anything with
the second workspace anyway
that may be a future video we may do
something specifically on the tree tab
layout with q-tile
of course this is a floating layout and
of course back to monad tall which is
the master and stack
so that was just a little bit of the
corrections for my config i know a lot
of people use my q-tile config
you know like those videos i've made on
q-tile have had you know just tens of
thousands of views
and i in a lot of ways i'm responsible
for a lot of the popularity they're
especially the resurgence of popularity
in q-tile
and so many people are using my config
and the fact that there were so many
errors in it
you know i'm kind of ashamed that it
took me so long to go in and correct
those errors but you know i was living
in
other window managers so i didn't see
them you know
you guys were reporting them but a lot
of times you'll report an error should i
drop what i'm doing and go fix that
error
a lot of times i'm recording videos and
everything but i know it's
i'm making excuses but really i should
have fixed these errors before now so
for those of you that were waiting for a
working qtah config it is
up on my gitlab now before i go i need
to thank a few special people i need to
thank
absie dallas gabe blue mitchell allen
akami archbishop 30 chuck david the
other david dilling gregory lewis paul
scott west
willy these guys they are the producers
of this episode they are my highest tier
patrons over on patreon without these
guys
this episode you just watched would not
have been possible
the show is also brought to you by each
and every one of these ladies and
gentlemen as well
these are all my supporters over on
patreon because i couldn't do what i do
without your guys support you guys make
the channel happen
and if you'd like to support my work
consider doing so look for distrotube
over on patreon
alright guys peace python's so much
easier than haskell
