# BEGIN twmrc
# TWM - "Crisp" / Carl Svensson / www.datagubbe.se / version 2.11

# Misc flags
NoGrabServer
RestartPreviousState
DecorateTransients
NoMenuShadows
DontMoveOff
RandomPlacement
OpaqueMove
IconifyByUnmapping
FramePadding 1
AutoRelativeSize
MoveDelta 5

# Fonts
TitleFont       "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso10646-1"
ResizeFont      "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso10646-1"
MenuFont        "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso10646-1"
IconFont        "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso10646-1"
IconManagerFont "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso10646-1"

# Custom colours
Color {
  TitleBackground       "#C06077"
  TitleForeground       "Gainsboro"
  BorderColor           "#F0A0BB"
  BorderTileBackground  "#206090"
  BorderTileForeground  "#206090"

  MenuBackground        "Gray"
  MenuForeground        "Black"
  MenuBorderColor       "#004070"
  MenuTitleBackground   "#C06077"
  MenuTitleForeground   "Gainsboro"

  IconManagerBackground "SteelBlue"
  IconManagerForeground "#004070"
  IconManagerHighlight  "#F0A0BB"
}


# Custom title bar pixmap
Pixmaps {
  TitleHighlight ".config/twmtitle2.xbm"
}

# Icon manager configuration
ShowIconManager
IconManagerGeometry "119-0+154"
IconManagerDontShow {
  "gkrellm"
  "xclock"
  "xload"
  "sysinf2"
}

# Turn off some window titles
NoTitle {
  "TWM Icon Manager"
  "gkrellm"
  "xload"
  "xclock"
  "sysinf2"
  "feh"
  "Cell"
  "VIC-II"
  "xeyes"
}

# Custom functions
Function "move-and-raise" {
  f.raise
  f.move
}
Function "move-or-iconify" {
  f.move
  f.deltastop
  f.iconify
}
Function "deiconify-and-raise" {
  f.deiconify
  f.raise
}
Function "next-and-raise" {
  f.downiconmgr
  f.raise
}

# Mouse bindings
Button3 = : root : f.menu "defops"
Button1 = : root : f.menu "apps"
Button2 = : root : f.menu "TwmWindows"

Button1 = : title : f.function "move-and-raise"
Button2 = : title : f.iconify
Button3 = : title : f.raiselower
Button3 = : frame : f.raiselower

Button1 = : iconmgr : f.function "deiconify-and-raise"
Button2 = : iconmgr : f.lower
Button3 = : iconmgr : f.iconify

# Keyboard Bindings
"F1"  = m4 : all : f.fullzoom
"F2"  = m4 : all : f.zoom
"Tab" = m  : all : f.function "next-and-raise"

# Meta key + mouse actions, useful for title-less windows
Button1 = m4 : window : f.move
Button3 = m4 : window : f.raiselower
Button2 = m4 : window : f.resize

# Turn off default iconify and resize button
NoDefaults
# Custom Titlebuttons
#   Bitmaps are stored in /usr/include/X11/bitmaps
#   Built-in options:
#   :dot, :xlogo, :iconify, :resize, :question, :delete, :menu
LeftTitleButton  "close.xbm"    = f.menu "winmops"
RightTitleButton "minimize.xbm" = f.iconify
RightTitleButton "vertmax.xbm"  = f.zoom
RightTitleButton "resiz2.xbm"   = f.resize


# Small menu for window "close" button
menu "winmops"
{
  "Iconify" f.iconify
  "Delete"  f.delete
}

# System menu (Right click in root)
menu "defops"
{
  "System"  f.title
  "Resize"  f.resize
  "Move"    f.move
  ""        f.nop
  "Kill"    f.destroy
  "Delete"  f.delete
  ""        f.nop
  "SysLog"  f.exec "xterm -fn 7x14 -geometry 130x40 -cr blue -bg gray -fg black -title syslog -e tail -f /var/log/syslog &"
  "SysTemp" f.exec "psensor &"
  ""        f.nop
  "Sleep"   f.menu "asksleep"
  "Lock"    f.exec "dm-tool lock &"
  ""        f.nop
  "Restart" f.restart
  "Exit"    f.menu "askexit"
}

# System submenu: Confirm sleep mode
menu "asksleep"
{
  "Sleep?" f.title
  "No"     f.nop
  "Yes"    f.exec "systemctl suspend"
}

# System submenu: Confirm exit
menu "askexit"
{
  "Exit?" f.title
  "No"    f.nop
  "Yes"   f.quit
}

# Workspace Menu (Left click in root)
menu "apps"
{
  "Workspace"     f.title
  "XTerm"         f.exec "xterm -fn 7x14 &"
  "Small XTerm"   f.exec "xterm &"
  "Large XTerm"   f.exec "xterm -fn -*-fixed-medium-*-*-*-18-*-*-*-*-*-iso10646-1 &"
  "X-Large XTerm" f.exec "xterm -geometry 80x36 -fn -*-fixed-medium-*-*-*-24-*-*-*-*-*-*-1 &"
  ""              f.nop
  "Firefox"       f.exec "firefox &"
  "Links2"        f.exec "links2 -g &"
  "Sylpheed"      f.exec "sylpheed &"
  "TubeShell"     f.exec "xterm -title tube -e tubeshell &"
  "Grafx2"        f.exec "grafx2&" 
  "Slack-Term"    f.exec "xterm -fn 7x14 -geometry 177x58 -title slack-term -e slack-term &"
  "Notes"         f.exec "leafpad ~/docs/notes.txt &"
  "Economy"       f.exec "xterm -geometry 80x36 -title Economy -fn -*-fixed-medium-*-*-*-24-*-*-*-*-*-*-1 -e sc -n ~/docs/ekonomi &"
  "File Manager"  f.exec "pcmanfm &"
  ""              f.nop
  "Volume Mixer"  f.exec "xterm -e alsamixer --device pulse &"
  "Audio Panel"   f.exec "pavucontrol &"
  "HTop"          f.exec "xterm -e htop &"
  ""              f.nop
  "Graphics"      f.menu "gfx" 
  "Audio"         f.menu "audio"
  "Applications"  f.menu "miscapps"
}

# Workspace submenu: Graphics
menu "gfx"
{
  "Grafx2"    f.exec "grafx2&"
  "mtPaint"   f.exec "mtpaint&"
  "Pixcen"    f.exec "wine64-stable ~/winapps/Pixcen.exe &"
  "SpritePad" f.exec "wine64-stable ~/winapps/Spritepad/SpritePad.exe &"
}

# Workspace submenu: Misc apps
menu "miscapps"
{
   "LeafPad"     f.exec "leafpad &"
   "Geany"       f.exec "geany &"
   "XPDF"        f.exec "xpdf &"
   "Evince"      f.exec "evince &"
   "FocusWriter" f.exec "focuswriter &"
   "Abiword"     f.exec "abiword &"
   "Calculator"  f.exec "xcalc &"
   "Economy"     f.exec "xterm -geometry 80x36 -title Economy -fn -*-fixed-medium-*-*-*-24-*-*-*-*-*-*-1 -e sc -n ~/docs/ekonomi &"
   "Calendar"    f.exec "orage &"
   "GNumeric"    f.exec "gnumeric &"
   "XMag"        f.exec "xmag -source 150x150 &"
   "XFontSel"    f.exec "xfontsel &"
   "Dillo"       f.exec "dillo &"
}

# Workspace submenu: Audio apps
menu "audio"
{
   "Audacious"    f.exec "audacious &"
   "VLC"          f.exec "vlc &"
   "Gnome-MPV"    f.exec "gnome-mpv &"
   "MilkyTracker" f.exec "milkytracker -nosplash &"
   "MikMod"       f.exec "xterm -title MikMod -e mikmod &"
}

# END twmrc
