Intro:
I have used gnome-shell for a very long time until taking tiling widow managers seriously. As a vim user I am already used to suffer a while until creating muscle memory and having my thoughts becoming actions in terminal...
The first attempt:
Bspwm. Using a post from "Terminal root" (Marcos Oliveira), the recipe was quite easy to follow and I started tweaking my shortcuts and so on.
The awesom and dwm
I became curious about other tiling window managers and started using awesome, at this time I already had my suckless terminal build and gradually became more prone to use dwm, of course I miss some desktop features, but in general it's worth paying the price, loosing some desktop features, even because new scripts and tips are appearing all the time.
The PopOS gnome-shell extension
For now I will continue to use my dwm and once in a while I will try the PopOS solution to see if they can convince me to get back to gnome-shell.
See my dotfiles here:
https://bitbucket.org/sergio/dotfiles/src/main/
The st I am using is a copy of st-bonk, there is a copy of it on my dotfiles.
Eventually this article will grow
I am thinking in gradually share some of my ideas, some of them would be considered craziness but some could inspire you (possibly).
The first one is istalling a package called lsd cargo install lsd
it adds icons to folders and files as you type ls, this way it becomes easy to know what whe have in our terminal, even when you are changing your terminal colors at every 5 minutes with a crontab like this:
# crontab -e
# >/dev/null 2>&1 <- used to preven sending e-mail's
# in order to get your DISPLAY run the command below
# env | grep -i display
# If you do not set this variable feh will not change your wallpaper
# source: https://superuser.com/a/1122245/45032
DISPLAY=':0'
SHELL=/bin/sh
HOME=/home/sergio
PATH=/sbin:/bin:/usr/sbin:/usr/bin:$HOME/.local/bin
MAILTO=""
HOME=/home/sergio
*/5 * * * * /home/sergio/.local/bin/wal -qi /home/sergio/.dotfiles/backgrounds >/dev/null 2>&1
* */1 * * * /bin/newsboat -x reload # reload hourly
* * * * * /home/sergio/.dotfiles/bin/checkbattery.sh >/dev/null
You can download the above code (raw) at this link
The lsd
(ls with icons) in action
One of my wallpapers, because I am used to collect good images:
Check battery state:
Notice that we have one line in our crontab that call the bellow script
#!/bin/bash
# File: /home/sergio/.dotfiles/bin/checkbattery.sh
# Last Change: Mon, 26 Sep 2022 16:40:52
#
# https://www.2daygeek.com/linux-low-full-charging-discharging-battery-notification/
# crontab example where you can use this script:
# https://pastebin.com/Jn36y4sW
# battery_status=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk '/state:/ {print $2}')
# battery_level=$(acpi -b | grep -P -o '[0-9]+(?=%)')
battery_status=$(cat /sys/class/power_supply/BAT0/status)
battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
if [ $battery_level -ge 95 ]; then
if [[ "$battery_status" == "Charging" ]]; then
dunstify -i "battery-charging" -r 1245 --urgency=LOW "Battery Full" "Level: ${battery_level}%"
#paplay /usr/share/sounds/freedesktop/stereo/complete.oga
fi
elif [ $battery_level -le 20 ]; then
if [[ "$battery_status" == "Discharging" ]]; then
dunstify -i "alert" -r 1245 --urgency=CRITICAL "Battery Low" "Level: ${battery_level}%"
# paplay /usr/share/sounds/freedesktop/stereo/suspend-error.oga
fi
fi
Notification system
I am using dunst, here on voidlinux I had to uninstall xfce4 so it does not mess things up.
All my dunst configuration is here the only thing you have to do is change /home/sergio
in the dunstrc.
xautolock
During idle time we can activate our lock screen, and xautolock does more than that, it has a -corners
option where you can say:
1 - (0) Do nothing
2 - (-) Do not lock screen while over this corner
3 - (+) After some seconds here we are going to lock your screen
The xautolock corners follows this order: Top left, top right, bottom left, bottom right.
My corners option is this: -corners "++--"
and my entire xautolock command is this:
pgrep -x xautolock >/dev/null || xautolock -time 5 -locker slock -nowlocker slock -detectsleep -corners ++-- -cornerdelay 3 -notify 5 -notifier "/home/sergio/.dotfiles/bin/lockscreen-notify.sh" &
The lockscreen-notify.sh below:
#!/bin/sh
# File: /home/sergio/.dotfiles/bin/lockscreen-notify.sh
# Last Change: Thu, 06 Oct 2022 13:33:31
# References:
# https://dev.to/ccoveille/lock-screen-notifier-4o1h
# https://stackoverflow.com/a/8743103/2571881
# tags: [screensaver, dunst, dunstify, notification, xautolock, x11]
set -e
# gets mouse x coordinate
mousex (){
echo "$(xdotool getmouselocation --shell | awk -F= 'NR==1 {print $2}')"
}
pos=$( mousex )
for p in $(seq 0 2 100); do
dunstify --icon screensaver \
-h int:value:"$p" \
-h 'string:hlcolor:#ff4444' \
-h string:x-dunst-stack-tag:progress-lock \
--timeout=500 "about to lock screen ..." "move or use corners"
sleep 0.05
if [ "$pos" != "$(mousex )" ] ; then
dunstctl close
exit 1
fi
done
dmenu record script
In this link at paste.bin
The st-bonk build
I have added transparency to the st-bonk, in my dotfiles I have a copy of it with the mentioned patch applyed, hence it will be easy for you to remap your gnome-terminal in gnome-shell, for instance, and have a decent transparent terminal.
Patches list on my dwm:
These are the patches I am using:
dwm-alwayscenter
dwm-attachbottom
dwm-autostart
dwm-cfacts
dwm-pertag
dwm-rotatestack
dwm-scratchpad
dwm-switchtotag
dwm-uselessgap
Of course this is the hardest part, figuring out what patches attend better your needs but at the end you will get the hang of it. Some chages do not even need the patch command, for example the "shiftview.c", the c
file we map to jump to the next tag like MODKEY + ]
/* add this line before keys[] */
#include "shiftview.c"
/* the shiftview.c file */
/** Function to shift the current view to the left/right
*
* @param: "arg->i" stores the number of tags to shift right (positive value)
* or left (negative value)
*/
void
shiftview(const Arg *arg) {
Arg shifted;
if(arg->i > 0) // left circular shift
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
else // right circular shift
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
view(&shifted);
}
Now at the key table put these lines:
{ MODKEY, XK_bracketleft, shiftview, {.i = -1} },
{ MODKEY, XK_bracketright, shiftview, {.i = +1} },
Rules to tame your windows:
Specially for firefox download windows I figured out a solution (I have the switchtotag patch installed):
For scratchpad terminals I have a patch and of course the rules also are listed here.
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask switchtotag isfloating monitor */
{ "Gimp", NULL, NULL, 0, 0, 1, -1 },
{ "Firefox", NULL, NULL, 2 << 0, 1, 0, -1 },
{ "TelegramDesktop", NULL, NULL, 1 << 4, 1, 0, -1 },
{ "ranger", NULL, NULL, 4 << 0, 1, 0, -1 },
{ "pulse", NULL, NULL, 0, 0, 1, -1 },
{ "St", NULL, NULL, 1 << 0, 1, 0, -1 },
{ "term2", NULL, NULL, 0, 0, 0, -1 },
{ "htop", NULL, NULL, 0, 0, 1, -1 },
{ "scratchpad", NULL, NULL, 0, 0, 1, -1 },
{ "scratchy", NULL, NULL, 0, 0, 1, -1 },
{ "nvim", NULL, NULL, 1 << 8, 1, 0, -1 },
{ "newsboat", NULL, NULL, 1 << 5, 1, 1, -1 },
{ "Nemo", NULL, NULL, 1 << 7, 1, 0, -1 },
{ "Firefox", "Places", "Library", 0, 0, 1, -1 },
};
The last line has the solution for the problem
The terminal font:
My wallpapers
If you want to create thumbnails easily read this article
Tweking rofi to get awesome dialogs:
I have discovered an amazing rofi setting collection here
https://github.com/adi1090x/rofi
Top comments (6)
As I mentioned in the article I am still adding tips and code to it, and I will keep reading the comments, that's why good platforms like dev.to are important. Almost every post I make I get some idea to improve my stuff. By the way, I could not find your dwmblocks, so I can steal some icons from it :)
It worked now, I was interested in the separator you are using. Currently I am using slstatus.
Tiling WM are usable on macOS as well. I’m using Amethyst and it works great. I also use Hammerspoon to do the things Amethyst doesn’t.
I have got the message: 401 Unauthorized when I tried viewing your files
Hey bro, What are you using that moment? What do you think about the new cosmic pop os?
I have never used PopOS, actually I have no computer righ now