On my new laptop, I have decided to keep the f keys as f keys which
requires hitting the fn key to get additional functions such as
play/pause etc. I did this because I often found myself hitting mute
(for example) by mistake. However, I don't use f10 for anything else so
rather than pushing fn+f10 (prt sc on my keyboard), I just want to push
f10. The shift / ctrl modifiers were implemented.
This involved the patch from here:
https://lists.suckless.org/dev/1104/7590.html
I use this on the pinephone with win+left and win+right bound to a swipe
left or right on the bottom edge of the screen
A single push will turn off the screen
A double push or a push and hold will open the power menu, allowing you
to turn off, restart, logout or suspend (CRUST)
This allows me to have the same key do different things based on the
number of times it is pushed.
This is going to be useful on the pinephone so I can have double click
or click and hold on the limited number of physical buttons
I'm going to be using dwm on my new pinephone and need the ability to
type.
Almost all the code for this has come from minego:
https://github.com/minego/dwm-customized
Many users new to dwm find themselves caught out by being kicked out to the login manager (dwm crashing) when they open 50+ clients for demonstration purposes. The number of clients reported varies depending on the resolution of the monitor.
The cause of this is due to how the default tile layout calculates the height of the next client based on the position of the previous client. Because clients have a minimum size the (ty) position can exceed that of the window height, resulting in (m->wh - ty) becoming negative. The negative height stored as an unsigned int results in a very large height ultimately resulting in dwm crashing.
This patch adds safeguards to prevent the ty and my positions from exceeding that of the window height.
This jarred me a bit while reading the code, since "sw" usually refers
to the global screen geometry, but in drawbar() only it refers to
text-related geometry. Renaming it makes it more obvious that these are
not related.
There are two places that mfact can be set:
- In the mfact global, which is defined at compile time and passed
into m->mfact during monitor setup. No bounds checks are performed,
but the comment alongside it says that valid values are [0.05..0.95]:
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
- By setmfact, which adjusts m->mfact at runtime. It also does some
minimum and maximum bounds checks, allowing [0.1..0.9]. Values outside
of that range are ignored, and mfact is not adjusted.
These different thresholds mean that one cannot setmfact 0.95 or 0.05,
despite the comment above that lists the legal range for mfact.
Clarify this by enforcing the same bounds in setmfact at runtime as
those listed for mfact at compile time.