OS: FreeBSD 13.0
Shell: csh/tcsh
% cat ~/.twmrc
RestartPreviousState # Reiconify iconified windows on startup
UsePPosition "on" # Use program-specified size hints accepted
NoTitle # No titlebars
BorderWidth 1 # Number of pixels for border around entire window
DontMoveOff # Disallow moving windows off the visible screen
IconifyByUnmapping # Iconifying a window sends it to the Icon Manager
AutoRelativeResize # Don't wait until the window edge is crossed
NoGrabServer
RandomPlacement
IconManagerFont "a14"
IconRegion "90x44-0+0" North East 40 30
IconManagerGeometry "90x44-0+0" 1
IconManagerDontShow
{
"xclock" "xload"
}
Color
{
BorderColor "red"
{
"XTerm" "red" # Active xterm window border: red
}
BorderColor "yellow"
BorderTileBackground "yellow"
BorderTileForeground "yellow"
DefaultBackground "rgb:2/a/9"
DefaultForeground "gray85"
TitleBackground "rgb:2/a/9"
TitleForeground "gray85"
MenuBackground "rgb:2/a/9"
MenuForeground "gray85"
MenuBorderColor "slategrey"
MenuTitleBackground "gray70"
MenuTitleForeground "rgb:2/a/9"
IconBackground "rgb:2/a/9"
IconForeground "gray85"
IconBorderColor "gray85"
IconManagerHighlight "white"
IconManagerBackground "rgb:2/a/9"
{
"XTerm" "#ff595e"
"tea" "#1982c4"
"KeePassXC" "#ffca3a"
"Thunderbird" "#6a4c93"
"Firefox" "#8ac926"
"LibreOffice" "#deff0a"
"soffice.bin" "#deff0a"
"Zathura" "#be0aff"
}
IconManagerForeground "gray85"
{
"XTerm" "#fae0e4"
"tea" "#84DE02"
"KeePassXC" "#219ebc"
"Thunderbird" "#ff595e"
"Firefox" "#ffff3f"
"LibreOffice" "#ff595e"
"soffice.bin" "#ff595e"
"Zathura" "#0aff99"
}
}
Cursors
{
Frame "left_ptr"
Title "left_ptr"
Icon "left_ptr"
IconMgr "left_ptr"
Move "fleur"
Resize "fleur"
Menu "hand1"
Button "hand2"
Wait "clock"
Select "dot"
Destroy "pirate"
}
# ---- Mouse and keyboard bindings ----
# Mouse: Button1=left, Button2=middle, Button3=right
# Keyboard: m=meta (alt), c=ctrl, s=shift, m4=mod4 (Win)
Button1 = : root : f.menu "defops"
Button1 = : iconmgr : f.iconify
Button1 = m : window : f.move # Alt + left mouse button
Button3 = m : window : f.resize # Alt + right mouse button
"s" = m : all : f.showiconmgr # Show the Icon Manager (Alt + s)
"s" = s | m : all : f.hideiconmgr # Hide the Icon Manager (Alt + Shift + s)
"r" = m : all : f.raiselower # Raise window if behind (Alt + r)
"v" = m : all : f.iconify # "Minimize" window (Alt + v)
# Cycle through windows with vi(1)-style key bindings
# NOTE: For best results, make sure that the Icon Manager is *not* hidden
# when the Icon Manager is hidden, only "l" and "j" work
"h" = m : all : f.backiconmgr # previous column
"l" = m : all : f.forwiconmgr # next column
"k" = m : all : f.upiconmgr # previous row
"j" = m : all : f.downiconmgr # next row
# Use keyboard arrow keys to change the input focus between windows
# NOTE: For best results, make sure that the Icon Manager is *not* hidden
"Left" = m : all : f.backiconmgr # previous column
"Right" = m : all : f.forwiconmgr # next column
"Up" = m : all : f.upiconmgr # previous row
"Down" = m : all : f.downiconmgr # next row
# Show time and date (local and UTC): Press Ctrl + Alt + t
"t" = m | c: all : f.exec "(date; echo ''; date -u) | \
/usr/local/bin/xmessage -bg \"#DE3163\" -fg \"#F6EABE\" -rv -fn \
\"-b&h-lucidatypewriter-bold-r-normal-sans-26-190-100-100-m-159-iso10646-1\" \
-geometry -0+0 -buttons OK:1 -default OK -file - &"
# Display virtual desktop number: Press Ctrl + Alt + d
"d" = m | c: all : f.exec "(vdesk) | \
/usr/local/bin/xmessage -bg \"#DE3163\" -fg \"#F6EABE\" -rv -fn \
\"-b&h-lucidatypewriter-bold-r-normal-sans-26-190-100-100-m-159-iso10646-1\" \
-geometry -0+0 -buttons ' ' -default OK -file - &"
# Launch dmenu with Alt + p
"p" = m : all : f.exec "/usr/local/bin/dmenu_run"
"i" = m : all : f.identify # Alt + i
"d" = m : all : f.delete # For closing e.g. "About" windows
"h" = s | m4 : all : f.leftzoom # [Shift + mod4 (Win)] + h
"l" = s | m4 : all : f.rightzoom # [Shift + mod4 (Win)] + l
"k" = s | m4 : all : f.topzoom # [Shift + mod4 (Win)] + k
"j" = s | m4 : all : f.bottomzoom # [Shift + mod4 (Win)] + j
"f" = s | m4 : all : f.fullzoom # [Shift + mod4 (Win)] + o
"m" = s | m4 : all : f.zoom # [Shift + mod4 (Win)] + m <- Zoom vertically
"c" = s | m4 : all : f.circledown # [Shift + mod4 (Win)] + c
"u" = s | m4 : all : f.circleup # [Shift + mod4 (Win)] + u
# QUIT menu
# Defined here, used in the "Main Menu" (below),
# i.e. it's a sub-menu of the Main Menu
menu "quitmenu"
{
"Really Quit?" f.title
"No" f.nop
"Yes" f.quit
}
# Add a menu with the usual things
menu "defops"
{
"Twm" f.title
"Iconify" f.iconify
"Resize" f.resize
"Move" f.move
"Raise" f.raise
"Lower" f.lower
"" f.nop
"Focus" f.focus
"Unfocus" f.unfocus
"Show Iconmgr" f.showiconmgr
"Hide Iconmgr" f.hideiconmgr
"" f.nop
"Xterm" f.exec "exec xterm &"
"" f.nop
"Kill" f.destroy
"Delete" f.delete
"" f.nop
"Restart" f.restart
"Exit" f.menu "quitmenu"
}
# Virtual desktops with vdesk ---- http://offog.org/code/vdesk.html -----
function "set-desktop-1"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 1"
}
function "set-desktop-2"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 2"
}
function "set-desktop-3"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 3"
}
function "set-desktop-4"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 4"
}
function "set-desktop-5"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 5"
}
function "set-desktop-6"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 6"
}
function "set-desktop-7"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 7"
}
function "set-desktop-8"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 8"
}
function "set-desktop-9"
{
f.exec "/usr/local/bin/vdesk 0 `xwininfo -tree -root | grep xclock | awk '{print $1}'`"
f.exec "vdesk 9"
}
function "desktop-back"
{
f.exec "A=$((`vdesk`-1)); if [ $A = 0 ] ; then A=9 ; fi ; vdesk $A"
}
# To switch to one of nine virtual desktop: Alt + [1-9]:
"1" = m : all : f.function "set-desktop-1"
"2" = m : all : f.function "set-desktop-2"
"3" = m : all : f.function "set-desktop-3"
"4" = m : all : f.function "set-desktop-4"
"5" = m : all : f.function "set-desktop-5"
"6" = m : all : f.function "set-desktop-6"
"7" = m : all : f.function "set-desktop-7"
"8" = m : all : f.function "set-desktop-8"
"9" = m : all : f.function "set-desktop-9"
# To cycle forward through virtual desktops:
# Ctrl + Meta (Win key) + right arrow key
"Right" = c | m : all : f.function "desktop-forward"
# To cycle backwards through virtual desktops:
# Ctrl + Meta (Win key) + left arrow key
"Left" = c | m : all : f.function "desktop-back"
% cat ~/.xinitrc
xrdb -load $HOME/.Xresources
xsetroot -solid slategrey
xset b off
# Add fonts
for m in `ls /usr/local/share/fonts/`; do
if [ -d "/usr/local/share/fonts/$m" ]; then
xset fp+ "/usr/local/share/fonts/$m"
fi
done
exec twm > /tmp/twmrclog 2>&1
If you want to have a clock or clocks, add one or more of the following four lines to ~/.xinitrc
.
exec /usr/local/bin/xclock -digital -strftime "Vancouver: %a %d %b %H:%M:%S" \
-update 1 -face mono:size=10 -bg "#002020" -fg "red" -geometry -0-2 &
exec env TZ=Europe/Belgrade xclock -digital -strftime \
"Belgrade: %a %d %b %H:%M" -face mono:size=10 -bg "#002020" -fg "gold" \
-geometry -256-2 &
exec env TZ=UTC /usr/local/bin/xclock -digital -strftime \
'UTC: %a %d %b %H:%M' -face mono:size=10 -bg '#002020' -fg '#f6eabe' \
-geometry -480-2 &
exec env TZ=GMT /usr/local/bin/xclock -digital -strftime \
'GMT: %a %d %b %H:%M' -face mono:size=10 -bg '#002020' -fg '#aaaaaa' \
-geometry -664-2 &
If you want to have xload, you first need to install it (with sudo pkg install xload
), and after that add this line to ~/.xinitrc
:
exec xload -bg steelblue -fg '#001013' -nolabel -geometry 224x33-840-2 &
Start X
with:
% exec startx
or:
% exec xinit
References:
Man pages:
- twm(1) - Tab Window Manager for the X Window System
- xterm(1) - terminal emulator for X
- xwininfo(1) - window information utility for X
- Xsecurity(7) - X display access control,
.Xauthority
- Xserver(1) - X Window System display server
- X(7) - Keyboards, modifiers and keysym - section KEYBOARDS
- Xorg(1) - X11R7 X server
- XOrgFoundation(7) - X.Org Foundation information
- xinit(1) - X Window System initializer
- x11perf(1) - X11 server performance test program
- xauth(1) - X authority file utility
- showrgb(1) - display an rgb color-name database
- xkbwatch(1) - XKB extension user utility
- xkbevd(1) - XKB event daemon
- xkbvleds(1) - display the state of LEDs on an XKB keyboard
- xkill(1) - kill a client by its X resource
- xlsatoms(1) - list interned atoms defined on server
- xprop(1) - property displayer for X
- xmodmap(1) - utility for modifying keymaps and pointer button mappings in X
- xrdb(1) - X server resource database utility
- xset(1) - user preference utility for X
- xrefresh(1) - refresh all or part of an X screen
Retrieved on Apr 3, 2022:
Word Cloud
X(7), libX11, modifier, keysum, the vmodmap array, locale, XkbLatchModifiers(3)