https://wiki.archlinux.org/api.php?action=feedcontributions&user=Sda1&feedformat=atomArchWiki - User contributions [en]2024-03-29T11:36:38ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Rxvt-unicode&diff=131335Rxvt-unicode2011-02-17T21:36:41Z<p>Sda1: urxvt-url-select is in [community]</p>
<hr />
<div>{{DISPLAYTITLE:rxvt-unicode}}<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|Rxvt-unicode}}<br />
{{i18n_entry|Español|Rxvt-unicode (Español)}}<br />
{{i18n_links_end}}<br />
[http://software.schmorp.de/pkg/rxvt-unicode.html rxvt-unicode] is a highly customizable [[Terminal Emulator|terminal emulator]] forked from [[Wikipedia:Rxvt|rxvt]]. Commonly known as <tt>urxvt</tt>, rxvt-unicode can be [[daemon]]ized to run clients within a single [[Wikipedia:Process (computing)|process]] in order to minimize the use of system resources. Developed by Marc Lehmann, some of the more outstanding features of rxvt-unicode include international language support through [[Wikipedia:Unicode|Unicode]], the ability to display multiple font types and support for [[Wikipedia:Perl|Perl]] extensions.<br />
<br />
==Installation==<br />
<br />
{{Package Official|rxvt-unicode}} is available in [extra] and now includes 256 color support:<br />
<br />
# pacman -S rxvt-unicode<br />
<br />
{{Package AUR|rxvt-unicode-patched}} is available in the [[AUR]] and includes a fix for the font width bug and adds support for ignoring window hints (to remove layout gaps in tiling window managers).<br />
<br />
==Configuration==<br />
See the [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod rxvt-unicode reference page] for the complete list of available setting and values.<br />
<br />
===Creating ~/.Xresources===<br />
The look, feel and function of rxvt-unicode is controlled by command-line arguments and/or [[Wikipedia:X resources|X resources]]. X resources can be set using {{Filename|~/.Xresources}} and xrdb, see the [[Xresources|wiki page]] for details.<br />
<br />
{{Note|Command-line arguments override and take precedence over the resource settings established in this file.}}<br />
<br />
===True transparency===<br />
<br />
To use true transparency you need to be using a window manager that supports compositing or a separate compositor.<br />
<br />
From the command-line:<br />
<br />
$ urxvt -depth 32 -bg rgba:3f00/3f00/3f00/dddd<br />
<br />
Using the configuration file:<br />
<br />
{{File|name=~/.Xresources|content=<br />
URxvt.depth: 32<br />
URxvt.background: rgba:3f00/3f00/3f00/dddd<br />
}}<br />
<br />
===Scrollbar===<br />
The look of the scrollbar can be chosen through this entry in {{Filename|~/.Xresources}}:<br />
<br />
<pre><br />
# scrollbar style - rxvt (default), plain, next, or xterm<br />
URxvt*scrollstyle:rxvt<br />
</pre><br />
<br />
Of which "plain" is the most compact one.<br />
<br />
===Font Declaration Methods===<br />
URxvt.font: 9x15<br />
is the same as:<br />
URxvt.font: -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1<br />
and:<br />
URxvt.font: 9x15bold<br />
is the same as:<br />
URxvt.font: -misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1<br />
<br />
The complete list of short names for X core fonts can be found in {{Filename|/usr/share/fonts/misc/fonts.alias}} (there's also some fonts.alias files in some of the other subdirectories of {{Filename|/usr/share/fonts/}}, but as they are packaged separately from the actual fonts, they may list fonts you don't actually have installed). It is worth noting that these short aliases select for ISO-8859-1 versions of the fonts rather than ISO-10646-1 (Unicode) versions, and 75 DPI rather than 100 DPI versions, so you're probably better off avoiding them and choosing fonts by their full long names instead.<br />
<br />
==Perl extensions==<br />
===Clickable URLs===<br />
You can make URLs in the terminal clickable using the matcher extension. For example, to open links in [[Firefox]] add the following to {{Filename|.Xresources}}:<br />
URxvt.perl-ext-common: default,matcher<br />
URxvt.urlLauncher: /usr/bin/firefox<br />
URxvt.matcher.button: 1 <br />
<br />
===Yankable URLs (No Mouse)===<br />
In addition, you can select and open URLs in your web browser without using the mouse.<br />
<br />
Install the {{Package Official|urxvt-url-select}} package from the [community] repo and adjust your {{Filename|.Xresources}} as necessary. An example is shown below:<br />
URxvt.perl-ext: default,url-select<br />
URxvt.keysym.M-u: perl:url-select:select_next<br />
URxvt.urlLauncher: firefox<br />
URxvt.underlineURLs: true<br />
<br />
{{Note|This extension replaces the Clickable URLs extension mentioned above, so <tt>matcher</tt> can be removed from the <tt>URxvt.perl-ext</tt> list.}}<br />
<br />
'''Key commands:'''<br />
<br />
{{Keypress|Alt}} + {{Keypress|U}} Enter selection mode. The last URL on your screen will be selected. You can repeat <tt>Alt+u</tt> to select the next upward URL.<br />
<br />
{{Keypress|k}} Select next upward URL<br />
<br />
{{Keypress|j}} Select next downward URL<br />
<br />
{{Keypress|Return}} Open selected URL in browser and quit selection mode<br />
<br />
{{Keypress|o}} Open selected URL in browser without quitting selection mode<br />
<br />
{{Keypress|y}} Copy (yank) selected URL and quit selection mode<br />
<br />
{{Keypress|Esc}} Cancel URL selection mode<br />
<br />
===Tabs===<br />
To add tabs to urxvt, add the following to your {{Filename|~/.Xresources}}:<br />
<pre><br />
URxvt.perl-ext-common: default,tabbed<br />
</pre><br />
<br />
To control tabs use:<br />
<br />
{{Keypress|Shift}} + {{Keypress|↓}} new tab<br />
<br />
{{Keypress|Shift}} + {{Keypress|←}} go to left tab<br />
<br />
{{Keypress|Shift}} + {{Keypress|→}} go to right tab<br />
<br />
{{Keypress|Ctrl}} + {{Keypress|←}} move tab to the left<br />
<br />
{{Keypress|Ctrl}} + {{Keypress|→}} move tab to the right<br />
<br />
{{Keypress|Ctrl}} + {{Keypress|d}}: close tab <br />
<br />
You can change tabs' colors with the following:<br />
<pre><br />
URxvt.tabbed.tabbar-fg: 2<br />
URxvt.tabbed.tabbar-bg: 0<br />
URxvt.tabbed.tab-fg: 3<br />
URxvt.tabbed.tab-bg: 0<br />
</pre><br />
<br />
Colors must be specified using color indexes: 0 to 15 correspond to your {{Filename|~/.Xresources}} colors, -1 is the background color and -2 is the foreground color. Colors are declared like this :<br />
<pre><br />
XTerm.color0: #000000<br />
XTerm.color2: #aece92<br />
XTerm.color3: #968a38<br />
</pre><br />
<br />
For named tabs, see [http://aur.archlinux.org/packages.php?ID=38990 this package in the AUR], (Shift+Up: names a tab).<br />
<br />
==Improving Performance==<br />
*Avoid the use of Xft fonts. If Xft fonts must be used, append {{Codeline|<nowiki>:antialias=false</nowiki>}} to the setting value.<sup>[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#Can_I_speed_up_Xft_rendering_somehow]</sup><br />
<br />
*Build rxvt-unicode with disabled support for unnecessary features, {{Codeline|--disable-xft}} and {{Codeline|--disable-unicode3}} in particular.<sup>[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#Rxvt_unicode_uses_gobs_of_memory_how]</sup><br />
<br />
*Limit the number of {{Codeline|saveLines}} (option {{Codeline|-sl}}) in the scrollback buffer to reduce memory usage.<sup>[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#Isn_t_rxvt_unicode_supposed_to_be_sm]</sup><br />
<br />
*Consider running {{Codeline|urxvtd}} as a daemon accepting connections from {{Codeline|urxvtc}} clients.<br />
<br />
==Cut and Paste==<br />
For users unfamiliar with [[Xorg]] data transfer methods, the exchange of information to and from rxvt-unicode can become a burden. Suffice to say that rxvt-unicode uses cut buffers which are typically loaded into the current <tt>PRIMARY</tt> selection by default.<sup>[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod#THE_SELECTION_SELECTING_AND_PASTING_]</sup> Users are urged to review [[Wikipedia:X Window selection]] for additional information.<br />
<br />
====Clipboard Management====<br />
* [http://parcellite.sourceforge.net/ Parcellite] is a GTK+ clipboard manager which can also run in the background as a daemon.<br />
<br />
* [http://www.nongnu.org/autocutsel/ autocutsel] provides command line and daemon interfaces to synchronize PRIMARY, <tt>CLIPBOARD</tt> and cut buffer selections.<br />
<br />
* [http://glipper.sourceforge.net/ Glipper] is a [[GNOME]] panel applet with older versions available for use in environments other than GNOME.<br />
<br />
* [http://goodies.xfce.org/projects/panel-plugins/xfce4-clipman-plugin Clipman] (xfce-clipman-plugin) is a GUI clipboard manager plugin for the [[Xfce]] panel (xfpanel).<br />
<br />
====Automatic Script Management====<br />
Skottish[http://bbs.archlinux.org/viewtopic.php?pid=506845#p506845] created a perl script to automatically copy any selection in urxvt to the X clipboard. Save the following as {{Filename|/usr/lib/urxvt/perl/clipboard}}:<br />
<pre><br />
#! /usr/bin/perl<br />
<br />
sub on_sel_grab {<br />
my $query=quotemeta $_[0]->selection;<br />
$query=~ s/\n/\\n/g;<br />
$query=~ s/\r/\\r/g;<br />
system( "echo -en " . $query . " | xsel -i -b -p" );<br />
}<br />
</pre><br />
<br />
Xyne has also created his own variation of Skottish's script (which is also [http://aur.archlinux.org/packages.php?ID=35526 available in the AUR]):<br />
<pre><br />
#! /usr/bin/perl<br />
<br />
sub on_sel_grab {<br />
my $query = $_[0]->selection;<br />
open (my $pipe,'|-','xsel -ibp') or die;<br />
print $pipe $query;<br />
close $pipe;<br />
}<br />
</pre><br />
<br />
It also requires {{Codeline|xsel}} and needs to be enabled in the {{Codeline|*perl-ext-common}} or {{Codeline|*perl-ext}} field in {{Filename|.Xresources}}. For example:<br />
URxvt.perl-ext-common: default,clipboard<br />
<br />
==Improved Kuake-like Behavior in Openbox==<br />
This was originally posted on the forum by Xyne<sup>[http://bbs.archlinux.org/viewtopic.php?pid=550380]</sup> and it relies on {{Codeline|xdotool}} which is available in the community repo.<br />
<br />
===Scriptlets===<br />
Save this scriptlet from the {{Codeline|urxvtc}} man page somewhere on your system as {{Filename|urxvtc}} (e.g., in {{Filename|~/.config/openbox}}):<br />
<pre><br />
#!/bin/sh<br />
urxvtc "$@"<br />
if [ $? -eq 2 ]; then<br />
urxvtd -q -o -f<br />
urxvtc "$@"<br />
fi<br />
</pre><br />
<br />
and save this one as {{Filename|urxvtq}}:<br />
<pre><br />
#!/bin/bash<br />
<br />
wid=$(xdotool search --classname urxvtq)<br />
if [ -z "$wid" ]; then<br />
/path/to/urxvtc -name urxvtq -geometry 80x28<br />
wid=$(xdotool search --classname urxvtq | head -1)<br />
xdotool windowfocus $wid<br />
xdotool key Control_L+l<br />
else<br />
if [ -z "$(xdotool search --onlyvisible --classname urxvtq 2>/dev/null)" ]; then<br />
xdotool windowmap $wid<br />
xdotool windowfocus $wid<br />
else<br />
xdotool windowunmap $wid<br />
fi<br />
fi<br />
</pre><br />
<br />
A previous version of xdotool introduced a bug which disabled recognition of visible windows and thus led some users to use the following scriptlet in place of the previous one. This is no longer necessary as xdotool>=1.20100416.2809, but it has been left here for future reference.<br />
<pre><br />
#!/bin/bash<br />
<br />
wid=$(xprop -name urxvtq | grep 'WM_COMMAND' | awk -F ',' '{print $3}' | awk -F '"' '{print $2}')<br />
if [ -z "$wid" ]; then<br />
/path/to/urxvtc -name urxvtq -geometry 200x28<br />
wid=$(xprop -name urxvtq | grep 'WM_COMMAND' | awk -F ',' '{print $3}' | awk -F '"' '{print $2}')<br />
xdotool windowfocus $wid<br />
xdotool key Control_L+l<br />
else<br />
if [ -z "$(xprop -id $wid | grep 'window state: Normal' 2>/dev/null)" ]; then<br />
xdotool windowmap $wid<br />
xdotool windowfocus $wid<br />
else<br />
xdotool windowunmap $wid<br />
fi<br />
fi<br />
</pre><br />
<br />
Make sure that you change {{Filename|/path/to/urxvtc}} to the actual path to the {{Filename|urxvtc}} scriptlet that you saved above. We'll be using {{Filename|urxvtc}} to launch both regular instances of {{Codeline|urxvt}} and the kuake-like instance.<br />
<br />
===urxvtq with tabbing===<br />
If you want to have tabs in your kuake-like {{Filename|urxvtc}} (here called {{Filename|urxvtq}}) just replace the third line in your {{Filename|urxvtq}}:<br />
wid=$(xdotool search --name urxvtq)<br />
with:<br />
wid=$(xdotool search --name urxvtq | grep -m 1 "" )<br />
<br />
To activate the tab support, you can either replace the fifth line of your {{Filename|urxvtq}}:<br />
/path/to/urxvtc -name urxvtq -geometry 80x28<br />
with:<br />
/path/to/urxvtc -name urxvtq -pe tabbed -geometry 80x28<br />
or replace this line of your {{Filename|.Xresources}}:<br />
URxvt.perl-ext-common: default,matcher<br />
with<br />
URxvt.perl-ext-common: default,matcher,tabbed<br />
<br />
====Tab control====<br />
<SHIFT>-Left: Switch to the tab left of current one<br />
<br />
<SHIFT>-Right: Switch to the tab right of current one<br />
<br />
<SHIFT>-Down: Create a new tab<br />
<br />
You can also use your mouse to switch the tabs by clicking the wished one and create a new tab by clicking on ''[NEW].\\''<br />
<br />
To close a tab just enter 'exit' like you'll close a terminal.<br />
<br />
===Openbox configuration===<br />
Now add the following lines to the {{Codeline|<applications>}} section of {{Filename|~/.config/openbox/rc.xml}}:<br />
<pre><br />
<application name="urxvtq"><br />
<decor>no</decor><br />
<position force="yes"><br />
<x>center</x><br />
<y>0</y><br />
</position><br />
<desktop>all</desktop><br />
<layer>above</layer><br />
<skip_pager>yes</skip_pager><br />
<skip_taskbar>yes</skip_taskbar><br />
<maximized>Horizontal</maximized><br />
</application><br />
</pre><br />
<br />
and add these lines to the {{Codeline|<keyboard>}} section:<br />
<pre><br />
<keybind key="W-t"><br />
<action name="Execute"><br />
<command>/path/to/urxvtc</command><br />
</action><br />
</keybind><br />
<keybind key="W-grave"><br />
<action name="Execute"><br />
<execute>/path/to/urxvtq</execute><br />
</action><br />
</keybind><br />
</pre><br />
<br />
Here too you need to change the {{Filename|/path/to/*}} lines to point to the scripts that you saved above. Save the file and then reconfigure Openbox. You should now be able to launch regular instances of urxvt with the Windows/Super key + "'''t'''", and toggle the kuake-like console with Windows/Super+grave ('''`''').<br />
<br />
===Further configuration===<br />
The advantage of this configuration over the urxvt kuake perl script is that Openbox provides more keybinding options such as modifier keys. The kuake script hijacks an entire physical key regardless of any modifier combination. Review the [http://icculus.org/openbox/index.php/Help:Bindings Openbox bindings documentation] for the full range or possibilities.<br />
<br />
The [http://icculus.org/openbox/index.php/Help:Applications Openbox per-app settings] can be used to further configure the behavior of the kuake-like console (e.g. screen position, layer, etc). You may need to change the "geometry" parameter in the {{Filename|urxvtq}} scriptlet to adjust the height of the console.<br />
<br />
===Related scripts===<br />
*hbekel has posted a generalized version of the {{Filename|urxvtq}} [http://bbs.archlinux.org/viewtopic.php?pid=550380#p550380 here] which can be used to toggle any application using {{Codeline|xdotool}}.<br />
<br />
*http://www.jukie.net/~bart/blog/20070503013555 - A script for opening url's with your keyboard instead of mouse with urxvt.<br />
<br />
==Troubleshooting==<br />
===Transparency not working after upgrade to V9.09===<br />
The rxvt-unicode devs removed compatibility code for a lot of non standard wallpaper setters with this update. Using a non compatible wallpaper setter will break transparency support. Recommended wallpaper setters:<br />
* [[feh]]<br />
* hsetroot<br />
* esetroot<br />
<br />
To make true transparency work, make sure to comment urxvt*tintColor and urxvt*inheritPixmap.<br />
<br />
===Remote Hosts===<br />
If you are logging into a remote host, you may encounter problems when running text-mode programs under rxvt-unicode. This can be fixed by copying {{Filename|<br />
/usr/share/terminfo/r/rxvt-unicode}} from your local machine to your host at {{Filename|~/.terminfo/r/rxvt-unicode}}.<br />
<br />
===Using rxvt-unicode as gmrun terminal===<br />
Unlike some other terminals, urxvt expects the arguments to -e to be given separately, rather than grouped together with quotes. This causes trouble with gmrun, which assumes the opposite behavior. This can be worked around by putting an "eval" in front of gmrun's "Terminal" variable in .gmrunrc:<br />
<pre><br />
Terminal = eval urxvt<br />
TermExec = ${Terminal} -e<br />
</pre><br />
(gmrun uses /bin/sh to execute commands, so the "eval is understood here.) The "eval" has the side-effect of "breaking up" the argument to -e in the same way $@ does in bash, making the command intelligible to urxvt.<br />
<br />
==External resources==<br />
*[http://software.schmorp.de/pkg/rxvt-unicode.html rxvt-unicode] - Official site<br />
*[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod rxvt-unicode FAQ] - Official FAQ<br />
*[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod rxvt-unicode Reference] - Official manual page<br />
*[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/src/urxvt.pm urxvtperl] - Official Perl extension reference<br />
*{{Codeline|man urxvt}}<br />
<br />
[[Category:Terminal emulators (English)]]</div>Sda1https://wiki.archlinux.org/index.php?title=Dwm&diff=128420Dwm2011-01-18T21:40:47Z<p>Sda1: </p>
<hr />
<div>[[Category:Dynamic WMs (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|dwm}}<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Information on installing and configuring dwm}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|dmenu}}<br />
{{Article summary wiki|wmii}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:dwm}}<br />
[http://dwm.suckless.org/ dwm] is a dynamic window manager for [[X]]. It manages windows in tiled, stacked, and full-screen layouts, as well as many others with the help of optional patches. Layouts can be applied dynamically, optimizing the environment for the application in use and the task performed. dwm is extremely lightweight and fast, written in C and with a stated design goal of remaining under 2000 source lines of code. It provides multi-head support for xrandr and Xinerama.<br />
<br />
==Installing==<br />
These instructions will install dwm using [[makepkg]] along with the Arch Build System, or [[ABS]] for short. This will allow reconfiguring it at a later time without complications. If only interested in installing dwm for a test drive, simply install the binary package from the repositories instead:<br />
# pacman -S dwm<br />
<br />
Note that by omitting compiling dwm from source a great deal of customizability is lost, since dwm's entire configuration is performed by editing its source code. Taking this in mind, the rest of the article assumes that dwm has been compiled from source as explained in the entirety of this section.<br />
<br />
You will probably also want to consider installing [[dmenu]], a fast and lightweight dynamic menu for X:<br />
# pacman -S dmenu<br />
<br />
===Requirements===<br />
Basic programming tools present in {{package Official|base-devel}} are needed in order to compile dwm and build a package for it, and the {{package Official|abs}} package is also a requisite for fetching the necessary build scripts:<br />
# pacman -S base-devel abs<br />
<br />
===Download build scripts with ABS===<br />
Once the required packages are installed, use ABS to fetch the latest build scripts from the repositories:<br />
# abs<br />
<br />
Lastly, copy the dwm build scripts from the ABS tree to a temporary directory. For example:<br />
$ cp -r /var/abs/community/dwm ~/dwm<br />
<br />
===Build and install package===<br />
Use {{Codeline|cd}} by switching to the directory containing the build scripts (the example above used {{Filename|~/dwm}}). Then run:<br />
$ makepkg -i<br />
<br />
This will compile dwm, build an Arch Linux package containing the resulting files, and install the package file all in one step. If problems are encountered, review the output for specific information. <br />
<br />
{{Tip|If this directory ({{filename|~/dwm}}) is saved, it can subsequently be used for making changes to the default configuration.}}<br />
<br />
==Configuring==<br />
dwm, as mentioned before, is exclusively configured at compile-time via some of its source files, namely {{Filename|config.h}} and {{Filename|config.mk}}. While the initial configuration provides a good set of defaults, it's realistic to expect that at some point potential users will probably want to make adjustments to their setups.<br />
<br />
===Method 1: ABS rebuild (recommended)===<br />
Modifying dwm is quite simple using this route.<br />
<br />
====Customizing config.h====<br />
Browse to the dwm source code directory saved during the [[#Installing|installation process]]; {{filename|~/dwm}} in the example. The {{filename|config.h}} found within this directory is where the general dwm preferences are stored. Most settings within the file should be self-explanatory, while others may not share the same trait. For detailed information on these settings, see the [http://www.suckless.org/dwm/ dwm website].<br />
<br />
{{note|Be sure to make a backup copy of config.h before modifying it, just in case something goes wrong.}}<br />
<br />
Once changes have been made, pipe the new md5sums into the [[PKGBUILD]]:<br />
$ makepkg -g >> PKGBUILD<br />
This will eliminate a checksum mismatch between the official config.h and the new revised copy.<br />
<br />
Now, compile and reinstall:<br />
$ makepkg -efi<br />
<br />
Assuming the configuration changes were valid, this command will compile dwm, build and reinstall the resulting package. If problems were encountered, review the output for specific information.<br />
<br />
Finally, restart dwm in order to apply the changes.<br />
<br />
====Notes====<br />
From now on, instead of updating the md5sums for every {{filename|config.h}} revision, which are known to become frequent, one may erase the md5sums array and build dwm with the {{codeline|--skipinteg}} option:<br />
$ makepkg -efi --skipinteg<br />
<br />
And after adding a few lines to dwm's start-up script, it is possible to [[#Restart dwm without logging out or closing programs|restart dwm without logging out or closing programs]].<br />
<br />
===Method 2: Mercurial (advanced)===<br />
dwm is maintained upstream within a [http://www.selenic.com/mercurial/wiki/ Mercurial] version control system at [http://hg.suckless.org/dwm suckless.org]. Those already familiar with Mercurial may find it more convenient to maintain configurations and patches within this system. A [http://www.suckless.org/dwm/customisation/patch_queue.html detailed tutorial] on this method is available at the dwm website.<br />
<br />
Before building dwm from the Mercurial sources, be sure to alter config.mk accordingly, because failure to do so may result in X crashes. Here are the values that need changing:<br />
<br />
Modify {{codeline|PREFIX}}:<br />
PREFIX = /usr<br />
The X11 include folder:<br />
X11INC = /usr/include/X11<br />
And the the X11 lib directory:<br />
X11LIB = /usr/lib/X11<br />
<br />
==Starting dwm==<br />
To start dwm with {{Codeline|startx}} or the [[SLIM]] login manager, simply append the following to {{Filename|~/.xinitrc}}: <br />
exec dwm<br />
<br />
For [[GDM]], add it to {{Filename|~/.Xclients}} instead, and select "Run XClient Script" from the Sessions menu.<br />
<br />
==Statusbar configuration==<br />
dwm uses the root window's name to display information in its statusbar, which can be changed with {{Codeline|xsetroot -name}}.<br />
<br />
===Basic statusbar===<br />
This example prints the date in [http://en.wikipedia.org/wiki/ISO_8601 ISO 8601] format. Add it to files {{filename|~/.xinitrc}} or {{filename|~/.Xclients}} or see this page's discussion for more details about the GDM-3 case :<br />
<pre><br />
while true; do<br />
xsetroot -name "$( date +"%F %R" )"<br />
sleep 1m # Update time every minute<br />
done &<br />
exec dwm<br />
</pre><br />
<br />
Here is an example intended for laptops that depends on the {{Package Official|acpi}} package for showing battery information:<br />
<pre><br />
while true ; do<br />
xsetroot -name "$( acpi -b | awk '{ print $3, $4 }' | tr -d ',' )"<br />
sleep 1m<br />
done &<br />
exec dwm<br />
</pre><br />
<br />
The script displays the amount of battery remaining besides its charging status by using the awk command to trim away the unneeded text from acpi, and tr to remove the commas.<br />
<br />
An alternative to the above is to selectively show the battery status depending on the current charging state:<br />
<pre><br />
while true; do<br />
batt=$(LC_ALL=C acpi -b)<br />
<br />
case $batt in<br />
*Discharging*)<br />
batt="${batt#* * * }"<br />
batt="${batt%%, *} "<br />
;;<br />
*)<br />
batt=""<br />
;;<br />
esac<br />
<br />
xsetroot -name "$batt$(date +%R)"<br />
<br />
sleep 60<br />
done &<br />
<br />
exec dwm<br />
</pre><br />
<br />
Finally, make sure there is only one instance of dwm in {{filename|~/.xinitrc}} or {{filename|~/.Xclients}}, so combining everything together should resemble this:<br />
~/.setbg<br />
autocutsel &<br />
termirssi &<br />
urxvt &<br />
<br />
while true; do<br />
xsetroot -name "$(date +"%F %R")"<br />
sleep 1m # Update time every minute<br />
done &<br />
'''exec dwm'''<br />
<br />
Here is another example that displays also the alsa volume and the battery state. The latter only when the system is off-line.<br />
<br />
#set statusbar<br />
while true<br />
do<br />
if acpi -a | grep off-line > /dev/null; then<br />
xsetroot -name "Bat. $( acpi -b | awk '{ print $4 " " $5 }' | tr -d ',' ) | Vol. $(amixer get Master | tail -1 | awk '{ print $5}' | tr -d '[]') | $(date +"%a, %b %d %R")"<br />
else<br />
xsetroot -name "Vol. $(amixer get Master | tail -1 | awk '{ print $5}' | tr -d '[]') | $(date +"%a, %b %d %R")"<br />
fi<br />
sleep 1s <br />
done &<br />
<br />
===Conky statusbar===<br />
Available from the [[AUR]], {{package AUR|conky-cli}} is a special build of conky which prints to <tt>stdout</tt>. If already accustomed to [[conky]], a statusbar rich with information can be ready within minutes. Once conky has been configured to preference, simply print it to the statusbar with {{Codeline|xsetroot -name}}:<br />
conky | while read -r; do xsetroot -name "$REPLY"; done &<br />
exec dwm<br />
<br />
The following is a sample conkyrc for a dual core CPU, displaying several stats:<br />
<pre><br />
background no<br />
out_to_console yes<br />
update_interval 2<br />
total_run_times 0<br />
use_spacer none<br />
<br />
TEXT<br />
$mpd_smart :: ${cpu cpu1}% / ${cpu cpu2}% ${loadavg 1} ${loadavg 2 3} :: ${acpitemp}c :: $memperc% ($mem) :: ${downspeed eth0}K/s ${upspeed eth0}K/s :: ${time %a %b %d %I:%M%P}<br />
</pre><br />
<br />
==Basic usage==<br />
===Using dmenu===<br />
Dmenu is a useful addon to dwm. Rather than a standard list-style menu, it acts as a sort of autocomplete to typing in the names of binaries. It is more advanced than many program launchers and integrates well within dwm.<br />
<br />
To start it, press {{Keypress|Mod1}} + {{Keypress|P}} ({{Keypress|Mod1}} should be the {{Keypress|Alt}} key by default). This can, of course, be changed if you so desire. Then, simply type in the first few characters of the binary you wish to run until you see it along the top bar. Then, simply use your left and right arrow keys to navigate to it and press enter.<br />
<br />
For more information, see [[dmenu]].<br />
<br />
===Controlling windows===<br />
====Moving a window to another tag====<br />
Moving a window from one tag to another is very simple. To do so, simply bring the window into focus by hovering over it with your cursor, then press {{Keypress|Shift}} + {{Keypress|Mod1}} + {{Keypress|x}}, where 'x' is the number of the tag to which you want to move the window. [Mod1] is, by default, the {{Keypress|Alt}} key.<br />
====Closing a window====<br />
To cleanly close a window using dwm, simply press {{Keypress|Shift}} + {{Keypress|Mod1}} + {{Keypress|C}}.<br />
<br />
====Window layouts====<br />
By default, dwm will operate in tiled mode. This can be observed by new windows on the same tag growing smaller and smaller as new windows are opened. The windows will, together, take up the entire screen (except for the menu bar) at all times. There are, however, two other modes: floating and monocle. Floating mode should be familiar to users of non-tiling window managers; it allows users to rearrange windows as they please. Monocle mode will keep a single window visible at all times.<br />
<br />
To switch to floating mode, simply press {{Keypress|Mod1}} + {{Keypress|F}}. {{Keypress|Mod1}} is, by default, the {{Keypress|Alt}} key. To check if you are in floating mode, you should see something like this next to the numbered tags in the top right corner of the screen: X>.<br />
<br />
To switch to monocole mode, press {{Keypress|Mod1}} + {{Keypress|M}}. To check if you are in monocle mode, you can see an M in square brackets (if no windows are open on that tag) or a number in square brackets (which corresponds with the number of windows open on that tag). Thus, a tag with no windows open would display this: [M], and a tag with 'n' windows open would display this: [n].<br />
<br />
To return to tiled mode, press {{Keypress|Mod1}} + {{Keypress|T}}. You will see a symbol which looks like this: []= .<br />
<br />
===Exiting dwm===<br />
To cleanly exit dwm, press {{Keypress|Shift}} + {{Keypress|Mod1}} + {{Keypress|Q}}.<br />
<br />
Source: [http://dwm.suckless.org/tutorial dwm tutorial].<br />
<br />
==Extended usage==<br />
<br />
===Patches & additional tiling modes===<br />
The official website has a number of [http://www.suckless.org/dwm/patches patches] that can add extra functionality to dwm. Users can easily customize dwm by applying the modifications they like. The [http://www.suckless.org/dwm/patches/bottom_stack.html Bottom Stack] patch provides an additional tiling mode that splits the screen horizontally, as opposed to the default vertically oriented tiling mode. Similarly, bstack horizontal splits the tiles horizontally. <br />
<br />
The [http://dwm.suckless.org/patches/gapless_grid gaplessgrid patch] allows windows to be tiled like a grid.<br />
<br />
====Enable one layout per tag====<br />
The default behaviour of dwm is to apply the currently selected layout for all tags.To have different layouts for different tags use the [http://dwm.suckless.org/patches/pertag pertag] patch.<br />
<br />
===Fixing gaps around terminal windows===<br />
If there are empty gaps of desktop space outside terminal windows, it is likely due to the terminal's font size. Either adjust the size until finding the ideal scale that closes the gap, or toggle {{Codeline|resizehints}} to ''False'' in {{filename|config.h}}:<br />
static Bool resizehints = False; /* False means respect size hints in tiled resizals */<br />
<br />
This will cause dwm to ignore resize requests from all client windows, not just terminals. The downside to this workaround is that some terminals may suffer redraw anomalies, such as ghost lines and premature line wraps, among others.<br />
<br />
====Urxvt====<br />
Another choice for [[urxvt]] users is applying the [[urxvt#Fix maximized window gaps|hints patch]] and regressing to dwm's original behaviour:<br />
static Bool resizehints = '''True''';<br />
<br />
===Restart dwm without logging out or closing programs===<br />
For restarting dwm without logging out or closing applications, change or add a startup script so that it loads dwm in a ''while'' loop, like this:<br />
<pre><br />
while true; do<br />
# Log stderror to a file <br />
dwm 2> ~/.dwm.log<br />
# No error logging<br />
#dwm >/dev/null 2>&1<br />
done<br />
</pre><br />
<br />
dwm can now be restarted without destroying other X windows by pressing the usual Mod-Shift-Q combination.<br />
<br />
It's a good idea to place the above startup script into a separate file, {{Filename|~/bin/startdwm}} for instance, and execute it through {{filename|~/.xinitrc}}. From this point on, when desiring to actually end the X session simply execute {{Codeline|killall startdwm}}, or bind it to a convenient key.<br />
<br />
===Make the right Alt key work as if it were Mod4 (Windows Key)===<br />
When using Mod4 (aka Super/Windows Key) as the {{codeline|MODKEY}}, it may be equally convenient to have the right Alt key (Alt_R) act as Mod4. This will allow performing otherwise awkward keystrokes one-handed, such as zooming with Alt_R+Enter. <br />
<br />
First, find out which keycode is assigned to Alt_R:<br />
xmodmap -pke | grep Alt_R<br />
<br />
Then simply add the following to the startup script (e.g. {{filename|~/.xinitrc}}), changing the keycode ''113'' if necessary to the result gathered by the previous {{codeline|xmodmap}} command:<br />
xmodmap -e "keycode 113 = Super_L" # reassign Alt_R to Super_L<br />
xmodmap -e "remove mod1 = Super_L" # make sure X keeps it out of the mod1 group<br />
<br />
Now, any functions that are triggered by a Super_L (Windows) key press will also be triggered by an Alt_R key press.<br />
===Disable focus follows mouse behaviour===<br />
To disable focus follows mouse behaviour comment out the following line in definiton of struct handler in dwm.c <br />
<pre>[EnterNotify] = enternotify, </pre><br />
<br />
===Adding custom keybinds/shortcuts===<br />
Two entries are needed in {{filename|config.h}} to create custom keybinds. One under the "/* commands /*" section, and another under the "static Key keys[] = {" section.<br />
<br />
static const char *<keybindname>[] = { "<command>", "<flags>", "<arguments>", NULL };<br />
<br />
<keybindname> can be anything... <command> <-flags> and <arguments> can be anything but they have to be individually enclosed in "",<br />
<br />
{ MODKEY, XK_<key>, spawn, {.v = <keybindname> } },<br />
<br />
...would bind Mod+<key> to the command defined previously.<br />
<br />
{ MODKEY|ShiftMask, XK_<key>, spawn, {.v = <keybindname> } },<br />
<br />
...would bind Mod+Shift+<key> Use ControlMask for Ctrl key.<br />
<br />
Single keys such as Fn or multimedia keys have to be bound with the hex codes obtainable from the program "xev"<br />
<br />
{ 0, <0xff00>, spawn, {.v = <keybindname> } },<br />
<br />
...would bind foo key <0xff00> to <keybindname><br />
<br />
===Fixing misbehaving Java applications===<br />
<br />
As of JRE 6u20, Java applications misbehave in dwm because it is not a known window manager to Java. This causes menus to close when the mouse is released, and other little issues. First, install wmname from the [community] repository:<br />
# pacman -S wmname<br />
<br />
Now all you have to do is use wmname to set a WM name that Java recognizes:<br />
$ wmname LG3D<br />
<br />
This is not permanent, so you may want to add this command to your .xinitrc.<br />
<br />
<br />
==Resources==<br />
* [http://www.suckless.org/dwm dwm's official website]<br />
* [[dmenu]] - Simple application launcher from the developers of dwm<br />
* The [http://bbs.archlinux.org/viewtopic.php?id=57549/ dwm thread] on the forums<br />
* [http://bbs.archlinux.org/viewtopic.php?id=92895/ Hacking dwm thread]<br />
* Check out the forums' [http://bbs.archlinux.org/viewtopic.php?id=57768/ wallpaper thread] for a selection of dwm wallpapers<br />
* [http://www.xsnake.net/howto/dwm/dwm-eng.php HowTo by Snake]<br />
* [http://0x80.org/blog/?p=72 Moved to dwm]</div>Sda1