Building DWM and Suckless tools

requirements

dpkg -l | grep dwm # empty
dpkg -l | grep stterm # empty

apt install build-essential libx11-dev libxft-dev libxinerama-dev
    apt install acpi acpid acpi-support
acpi -V

sources

grab the official dwm and st tarballs and some patches

we don’t need to modify dmenu, install it as-is already

apt install suckless-tools
dpkg -L suckless-tools | grep bin

stterm

prepare a customzed terminal

# https://dl.suckless.org/st/
# https://st.suckless.org/patches/
wget https://dl.suckless.org/st/st-0.8.5.tar.gz
wget https://st.suckless.org/patches/scrollback/st-scrollback-0.8.5.diff
wget https://st.suckless.org/patches/scrollback/st-scrollback-mouse-20220127-2c5edf2.diff
wget https://st.suckless.org/patches/clipboard/st-clipboard-0.8.3.diff
tar xzf st-0.8.5.tar.gz 
cd st-0.8.5/
patch -p1 < ../st-scrollback-0.8.5.diff
patch -p1 < ../st-scrollback-mouse-20220127-2c5edf2.diff
patch -p1 < ../st-clipboard-0.8.3.diff

cp -i config.def.h config.h
vi config.h

--- config.def.h        2023-02-27 15:56:31.239850725 +0100
+++ config.h    2023-02-27 15:59:01.838384993 +0100
@@ -34,7 +34,7 @@
  *
  * More advanced example: L" `'\"()[]{}"
  */
-wchar_t *worddelimiters = L" ";
+wchar_t *worddelimiters = L" `'\"()[]{}‘’=";

 /* selection timeouts (in milliseconds) */
 static unsigned int doubleclicktimeout = 300;
@@ -74,7 +74,7 @@
 static int bellvolume = 0;

 /* default TERM value */
-char *termname = "st-256color";
+char *termname = "xterm-256color";

 /*
  * spaces per tab
@@ -178,7 +178,7 @@
    /* mask                 button   function        argument       release */
    { ShiftMask,            Button4, kscrollup,      {.i = 1} },
    { ShiftMask,            Button5, kscrolldown,    {.i = 1} },
-       { XK_ANY_MOD,           Button2, selpaste,       {.i = 0},      1 },
+       { XK_ANY_MOD,           Button3, clippaste,      {.i = 0},      1 },
    { ShiftMask,            Button4, ttysend,        {.s = "\033[5;2~"} },
    { XK_ANY_MOD,           Button4, ttysend,        {.s = "\031"} },
    { ShiftMask,            Button5, ttysend,        {.s = "\033[6;2~"} },

make clean
make install
cd ../

dwm

prepare a customzed window manager

# https://dl.suckless.org/dwm/
# https://dwm.suckless.org/patches/
wget https://dl.suckless.org/dwm/dwm-6.4.tar.gz
wget https://dwm.suckless.org/patches/systray/dwm-systray-6.4.diff # 24K
wget https://dwm.suckless.org/patches/inplacerotate/dwm-inplacerotate-6.2.diff # 3,7K
wget https://dwm.suckless.org/patches/attachaside/dwm-attachaside-6.3.diff # 2,8K
wget https://dwm.suckless.org/patches/pertag/dwm-pertag_with_sel-20231003-9f88553.diff # 6,5K
tar xzf dwm-6.4.tar.gz
cd dwm-6.4/
patch -p1 < ../dwm-systray-6.4.diff
patch -p1 < ../dwm-attachaside-6.3.diff
cat dwm.c.rej
vi dwm.c

/c->mon = mons --or-- :2138

-                                       attach(c);
+                                       attachaside(c);

patch -p1 < ../dwm-inplacerotate-6.2.diff
patch -p1 < ../dwm-pertag_with_sel-20231003-9f88553.diff

notice inplacerotate is missing

diff -bu config.def.h config.h
cp -f config.def.h config.h
vi config.h

below static const char *termcmd add those

// custom
static const char *scrots[]     = { "/home/elge/bin/scrot-select.bash", NULL };
static const char *scrotw[]     = { "/home/elge/bin/scrot-focused.bash", NULL };
static const char *lockcmd[]    = { "xtrlock", NULL };
static const char *downbright[] = { "sudo", "brightnessctl", "-q", "s", "51-", NULL };
static const char *upbright[]   = { "sudo", "brightnessctl", "-q", "s", "+51", NULL };
static const char *mutevol[]    = { "amixer", "-D", "pulse", "set", "Master", "toggle", NULL };
static const char *downvol[]    = { "amixer", "-D", "pulse", "set", "Master", "10%-", NULL };
static const char *upvol[]      = { "amixer", "-D", "pulse", "set", "Master", "10%+", NULL };

within static const Key keys add those

    { MODKEY,                       XK_s,      spawn,          {.v = scrots } },
    { MODKEY,                       XK_f,      spawn,          {.v = scrotw} },
    { MODKEY,                       XK_x,      spawn,          {.v = lockcmd } },
    { MODKEY,                       XK_q,      killclient,     {0} },
    { MODKEY,                       XK_F7,     spawn,          {.v = downbright } },
    { MODKEY,                       XK_F8,     spawn,          {.v = upbright } },
    { MODKEY,                       XK_F9,     spawn,          {.v = mutevol } },
    { MODKEY,                       XK_F11,    spawn,          {.v = downvol } },
    { MODKEY,                       XK_F12,    spawn,          {.v = upvol   } },

and finally build the thing

make clean
make install
cd ../

slstatus

prepare a better upper status bar

which amixer
which brightnessctl

#git clone git://git.suckless.org/slstatus
git clone https://git.suckless.org/slstatus
cd slstatus/
cp -i config.def.h config.h
vi config.h

--- config.def.h        2023-02-24 09:12:44.405096068 +0100
+++ config.h    2023-02-27 18:33:44.106958626 +0100
@@ -65,5 +65,9 @@
  */
 static const struct arg args[] = {
    /* function format          argument */
-       { datetime, "%s",           "%F %T" },
+       { run_command, "%s ", "brightnessctl g" },
+       { battery_state, "%s ", "BAT1" },
+       { battery_perc, "%s%% ", "BAT1" },
+       { run_command, "%s ", "amixer -D pulse sget Master | awk '/Front Left:/ {print $5, $6}'" },
+       { datetime, "%s", "%a %d %b %Y %T %Z" },
 };

make clean
make install
cd ../

Ready go to

see dwm

Additional notes

mouse auto-select

For the record, Terminator’s selection delimiters are

" -,./?%&#:_"

You will still be able to reach the Ubuntu settings as such

gnome-control-center

–or– Mint MATE settings for that matter

mate-control-center

moar on slstatus

Every 5 seconds to ease that iostat call, hence removing seconds from the date

vi config.h

const unsigned int interval = 5000;
static const char unknown_str[] = "n/a";
#define MAXLEN 2048

static const struct arg args[] = {
        /* function format              argument */
        { load_avg, "%s ",              NULL },
        { cpu_perc, "CPU:%2s%% ",       NULL },
        { ram_perc, "RAM:%2s%% ",       NULL },
        { run_command, "I/O:%s ",       "iostat -x -p /dev/sda | grep '^sda ' | awk '{print $NF}'" },
        { netspeed_tx, "TX:%6s ",       "eth0" },
        { netspeed_rx, "RX:%6s ",       "eth0" },
        { datetime, "%s",               "%F %H:%M" },
};

Resources

moar patches

attachabove https://dwm.suckless.org/patches/attachabove/

flextile layout https://dwm.suckless.org/patches/flextile/

columns https://dwm.suckless.org/patches/columns/


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun