Fedora - Let’s try dwm — dynamic window manger - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Computers (https://www.sickgaming.net/forum-86.html) +--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html) +--- Thread: Fedora - Let’s try dwm — dynamic window manger (/thread-89329.html) |
Fedora - Let’s try dwm — dynamic window manger - xSicKxBot - 03-19-2019 Let’s try dwm — dynamic window manger <div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/03/lets-try-dwm-dynamic-window-manger.png" width="1024" height="469" title="" alt="" /></div><div><p>If you like efficiency and minimalism, and are looking for a new window manager for your Linux desktop, you should try <em>dwm</em> — dynamic window manager. Written in under 2000 standard lines of code, dwm is extremely fast yet powerful and highly customizable window manager.</p> <p>You can dynamically choose between tiling, monocle and floating layouts, organize your windows into multiple workspaces using tags, and quickly navigate through using keyboard shortcuts. This article helps you get started using dwm.</p> <p> <span id="more-25632"></span> </p> <h2><strong>Installation</strong></h2> <p>To install dwm on Fedora, run:</p> <pre class="wp-block-preformatted">$ sudo dnf install dwm dwm-user</pre> <p>The <em>dwm</em> package installs the window manager itself, and the <em>dwm-user</em> package significantly simplifies configuration which will be explained later in this article.</p> <p>Additionally, to be able to lock the screen when needed, we’ll also install <em>slock</em> — a simple X display locker.</p> <pre class="wp-block-preformatted">$ sudo dnf install slock</pre> <p>However, you can use a different one based on your personal preference.</p> <h2><strong>Quick start</strong></h2> <p>To start dwm, choose the <em>dwm-user</em> option on the login screen.</p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/03/lets-try-dwm-dynamic-window-manger.png" alt="" class="wp-image-25636" /></figure> <p>After you log in, you’ll see a very simple desktop. In fact, the only thing there will be a bar at the top listing our nine tags that represent workspaces and a <em>[]=</em> symbol that represents the layout of your windows.</p> <h3>Launching applications</h3> <p>Before looking into the layouts, first launch some applications so you can play with the layouts as you go. Apps can be started by pressing <em>Alt+p</em> and typing the name of the app followed by <em>Enter</em>. There’s also a shortcut <em>Alt+Shift+Enter</em> for opening a terminal.</p> <p>Now that some apps are running, have a look at the layouts.</p> <h3>Layouts</h3> <p>There are three layouts available by default: the tiling layout, the monocle layout, and the floating layout.</p> <p>The tiling layout, represented by <em>[]=</em> on the bar, organizes windows into two main areas: master on the left, and stack on the right. You can activate the tiling layout by pressing <em>Alt+t.</em></p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/03/lets-try-dwm-dynamic-window-manger-1.png" alt="" class="wp-image-25637" /></figure> <p>The idea behind the tiling layout is that you have your primary window in the master area while still seeing the other ones in the stack. You can quickly switch between them as needed.</p> <p>To swap windows between the two areas, hover your mouse over one in the stack area and press <em>Alt+Enter</em> to swap it with the one in the master area.</p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/03/lets-try-dwm-dynamic-window-manger-2.png" alt="" class="wp-image-25638" /></figure> <p>The monocle layout, represented by <em>[N]</em> on the top bar, makes your primary window take the whole screen. You can switch to it by pressing <em>Alt+m</em>. </p> <p>Finally, the floating layout lets you move and resize your windows freely. The shortcut for it is <em>Alt+f</em> and the symbol on the top bar is <em>><></em>.</p> <h3>Workspaces and tags</h3> <p>Each window is assigned to a tag (1-9) listed at the top bar. To view a specific tag, either click on its number using your mouse or press <em>Alt+1..9.</em> You can even view multiple tags at once by clicking on their number using the secondary mouse button.</p> <p>Windows can be moved between different tags by highlighting them using your mouse, and pressing <em>Alt+Shift+1..9.</em> </p> <h2><strong>Configuration</strong></h2> <p>To make dwm as minimalistic as possible, it doesn’t use typical configuration files. Instead, you modify a C header file representing the configuration, and recompile it. But don’t worry, in Fedora it’s as simple as just editing one file in your home directory and everything else happens in the background thanks to the <em>dwm-user</em> package provided by the maintainer in Fedora.</p> <p>First, you need to copy the file into your home directory using a command similar to the following:</p> <pre class="wp-block-preformatted">$ mkdir ~/.dwm<br />$ cp /usr/src/dwm-VERSION-RELEASE/config.def.h ~/.dwm/config.h</pre> <p>You can get the exact path by running <em>man dwm-start.</em></p> <p>Second, just edit the <em>~/.dwm/config.h</em> file. As an example, let’s configure a new shortcut to lock the screen by pressing <em>Alt+Shift+L</em>.</p> <p>Considering we’ve installed the <em>slock</em> package mentioned earlier in this post, we need to add the following two lines into the file to make it work:</p> <p>Under the <em>/* commands */ </em>comment, add:</p> <pre class="wp-block-preformatted">static const char *slockcmd[] = { "slock", NULL };</pre> <p>And the following line into <em>static Key keys[]</em>:</p> <pre class="wp-block-preformatted">{ MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } },</pre> <p>In the end, it should look like as follows: (added lines are highlighted)</p> <pre class="wp-block-preformatted">...<br /> /* commands */<br /> static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */<br /> static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };<br /> static const char *termcmd[] = { "st", NULL };<br /><strong> static const char *slockcmd[] = { "slock", NULL };<br /></strong> <br /> static Key keys[] = {<br /> /* modifier key function argument */<br /><strong> { MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } },<br /></strong> { MODKEY, XK_p, spawn, {.v = dmenucmd } },<br /> { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },<br /> ... <br /></pre> <p>Save the file.</p> <p>Finally, just log out by pressing <em>Alt+Shift+q</em> and log in again. The scripts provided by the <em>dwm-user</em> package will recognize that you have changed the <em>config.h</em> file in your home directory and recompile dwm on login. And becuse dwm is so tiny, it’s fast enough you won’t even notice it.</p> <p>You can try locking your screen now by pressing <em>Alt+Shift+L</em>, and then logging back in again by typing your password and pressing enter.</p> <h2><strong>Conclusion</strong></h2> <p>If you like minimalism and want a very fast yet powerful window manager, dwm might be just what you’ve been looking for. However, it probably isn’t for beginners. There might be a lot of additional configuration you’ll need to do in order to make it just as you like it.</p> <p>To learn more about dwm, see the project’s homepage at <a href="https://dwm.suckless.org/">https://dwm.suckless.org/</a>.</p> </div> |