#---------------------------------
# CPI   # PROJ. : DT.R01.twmrc
#       # FILE  : .twmrc
#   +   # VER.  : 20220228.0718UTC
#    +  # EMAIL : hal@clockworkpi.com
#  +++  # HOST  : clockworkpi.com
#---------------------------------

NoGrabServer
RestartPreviousState
DecorateTransients
RandomPlacement
BorderWidth 2
NoHighlight
OpaqueMove
MenuBorderWidth 1
NoMenuShadows

NoDefaults
LeftTitleButton "~/.twm/close" = f.delete
RightTitleButton "~/.twm/iconify" = f.iconify
RightTitleButton "~/.twm/resize" = f.resize
RightTitleButton "~/.twm/fullsize" = f.fullzoom

TitleFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
ResizeFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
MenuFont "-misc-fixed-medium-r-normal--15-*-*-*-*-*-*-*"
IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*"

Color
{
   BorderColor "grey30"
   DefaultBackground "rgb:5/5/5"
   DefaultForeground "gray80"
   TitleBackground "rgb:5/5/5"
   TitleForeground "gray80"
   MenuBackground "rgb:5/5/5"
   MenuForeground "gray80"
   MenuTitleBackground "gray80"
   MenuTitleForeground "rgb:5/5/5"
   MenuBorderColor "gray60"
   IconBackground "rgb:4/4/4"
   IconForeground "gray80"
   IconBorderColor "gray70"
   IconManagerBackground "rgb:5/5/5"
   IconManagerForeground "gray80"
}

Cursors
{
   Menu "hand2"
}

ForceIcons
Icons
{
   "xterm" "~/.twm/xlogo32"
}

MoveDelta 3
Function "move-or-lower" { f.move f.deltastop f.lower }
Function "move-or-raise" { f.move f.deltastop f.raise }
Function "move-or-iconify" { f.move f.deltastop f.iconify }

Button1 = : root : f.menu "main"
Button3 = : root : f.menu "exec"
Button1 = m : window|icon : f.function "move-or-raise"
Button2 = m : window|icon : f.iconify
Button3 = m : window|icon : f.resize
Button1 = : title : f.function "move-or-raise"
Button2 = : title : f.raiselower
Button1 = : icon : f.function "move-or-iconify"
Button2 = : icon : f.iconify
Button1 = : iconmgr : f.iconify
Button2 = : iconmgr : f.iconify

NoTitle
{
   "gkrellm"
}

menu "main"
{
   ":: DevTerm-R01 ::" f.title
   "Raise..." f.raise
   "Lower..." f.lower
   "Focus..." f.focus
   "Unfocus..." f.unfocus
   "Show Iconmgr" ("gray80":"#445255") f.showiconmgr
   "Hide Iconmgr" ("gray80":"#445255") f.hideiconmgr
   "Kill..." f.destroy
   "Restart TWM" f.restart
   "Exit" ("gray80":"#773333") f.menu "exit"
}

menu "exit"
{
   "Are you sure ?" ("gray80":"#773333") f.title
   "Shutdown"  f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -bc -T 'Warning! System Shutdown' -fs 12 -geometry 80x10 -bg '#332211' -fg '#dc8700' -e sudo /usr/sbin/halt -p &"
   "No" f.nop
   "Yes" f.quit
}

menu "exec"
{
   ":: Applications ::" f.title
   "▒ Xterm       (Ctrl-Alt-t)" ("gray80":"#20404b") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 &"
   "▒ Xterm in Orange" ("gray80":"#864b2d") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 -fg '#dc8700' &"
   "♫ CMUS        (Ctrl-Alt-m)" ("gray80":"#445255") f.exec "exec xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 -e cmus &"
   "♫ ALSA Mixer" ("gray80":"#445255") f.exec "alsamixergui &"
   "@ Network...  (Ctrl-Alt-n)" ("gray80":"#2a3639") f.exec "exec /usr/bin/xterm +sb -T 'Network Manager' -fa 'fixed' -fs 12 -geometry 80x21 -e sudo /usr/bin/nmtui &"
   "@ Qutebrowser (Ctrl-Alt-b)" ("gray80":"#3a4649") f.exec "exec /usr/bin/qutebrowser &"
   "@ ELinks      (Ctrl-Alt-e)" ("gray80":"#3a4649") f.exec "exec /usr/bin//xterm +sb -fa 'fixed' -fs 12 -geometry 100x22 -e /usr/bin/elinks &"
   "¶ VIM" ("gray80":"#445255") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 100x22 -e /usr/bin/vim &"
   "¶ Emacs" ("gray80":"#445255") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 100x22 -e /usr/bin/emacs -nw &"
   "¶ Tilde" ("gray80":"#445255") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 100x22 -e /usr/bin/tilde &"
   "π Basic Calc" ("gray80":"#314852") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 -e /usr/bin/bc -l &"
   "π Gnuplot" ("gray80":"#314852") f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 -e /usr/bin/gnuplot &"
   "■ DosBox" ("gray80":"#20404b") f.exec "exec /usr/bin/dosbox &"
   "■ Chocolate-Doom" ("gray80":"#20404b") f.exec "SDL_RENDER_DRIVER=software /usr/games/chocolate-doom &"
   "☻ GIMP" f.exec "exec /usr/bin/gimp &"
   "☻ Inkscape" f.exec "exec /usr/bin/inkscape &"
   "☻ Xfig" f.exec "exec /usr/bin/xfig &"
   "» Utilities" ("gray80":"#335533") f.menu "Utilities"
}

menu "Utilities"
{
   ":: Utilities ::" f.title
   "¶ Nedit" f.exec "exec /usr/bin/nedit &"
   "¶ Xpdf" f.exec "exec /usr/bin/xpdf &"
   "π Xcalc" ("gray80":"#314852") f.exec "exec /usr/bin/xcalc &"
   "π Xaos" ("gray80":"#314852") f.exec "exec /usr/bin/xaos &"
   "• XClock" f.exec "exec /usr/bin/xclock &"
   "• OClock" f.exec "exec /usr/bin/oclock &"
   "• Xeyes" f.exec "exec /usr/bin/xeyes &"
   "• Xmag"   f.exec "exec /usr/bin/xmag &"
   "• Gkrellm"   f.exec "/usr/bin/gkrellm &"
}

WindowRing
{
   "xterm"
   "xpdf"
}

"t" = m | c: all : f.exec "exec /usr/bin/xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 &"
"m" = m | c: all : f.exec "exec xterm +sb -fa 'fixed' -fs 12 -geometry 80x21 -e cmus &"
"n" = m | c: all : f.exec "exec /usr/bin/xterm +sb -T 'Network Manager' -fa 'fixed' -fs 12 -geometry 80x21 -e sudo /usr/bin/nmtui &"
"b" = m | c: all : f.exec "exec /usr/bin/qutebrowser &"
"e" = m | c: all : f.exec "exec /usr/bin//xterm +sb -fa 'fixed' -fs 12 -geometry 100x22 -e /usr/bin/elinks &"

"i" = m | s: all : f.iconify
"x" = m | s: all : f.delete
"F12" = : all : f.fullzoom
"Tab" = m : all : f.warpring "next"
"f" = m | s: all: f.focus
"u" = m | s: all: f.unfocus
"n" = m : all  : f.warpring "next"
"n" = m|s : all  : f.warpring "prev"

"XF86MonBrightnessUp" = : all : f.exec "exec /usr/local/bin/cpi-backlight up"
"XF86MonBrightnessDown" = : all : f.exec "exec /usr/local/bin/cpi-backlight down"

"XF86AudioLowerVolume" = : all : f.exec "exec pactl set-sink-volume @DEFAULT_SINK@ -10%"
"XF86AudioRaiseVolume" = : all : f.exec "exec pactl set-sink-volume @DEFAULT_SINK@ +10%"

"Print" =  : all : f.exec "exec import -window root screenshot.png"

