# This Fvwm2 setup file provides the basic emacs-centered environment # that I have found most comfortable on my standalone machine at home. # Basically it gives me a big Emacs window at the left and a slightly # smaller XTerm at the right, together with a clock and CPU monitor # and a few buttons for accessing independent desktops. # I've tried to write lots of comments because I will certainly forget # most of the details of Fvwm2's syntax and semantics before long. # My screen is 1024 pixels wide and 768 high; about 88dpi. # First, make sure that Exec chooses tcsh instead of bash: #ExecUseShell /bin/bash # Next, specify the path to the Fvwm modules: #ModulePath /usr/lib/fvwm # Next, specify the paths for all icons (.xpm files) that I'm using: #ImagePath /usr/share/icons:/usr/share/pixmaps/ ImagePath +:$[HOME]/local/share/pixmaps:$[HOME]/local/icons ImagePath +:/usr/share/icons/Default/$[ICON_SIZE] ;.png ImagePath +:/usr/share/icons/hicolor/$[ICON_SIZE] ;.png ImagePath +:/usr/share/icons/crystalsvg/$[ICON_SIZE] ;.png ImagePath +:/usr/share/icons/Default/$[ICON_SIZE2] ;.png ImagePath +:/usr/share/icons/hicolor/$[ICON_SIZE2] ;.png ImagePath +:/usr/share/icons/crystalsvg/$[ICON_SIZE2] ;.png ImagePath +:/usr/share/pixmaps:/usr/local/share/fvwm/icons:/usr/local/icons:/usr/share/icons:/usr/share/icons/mini:/usr/share/icons/wm-icons:/usr/X11R6/include/X11/pixmaps ImagePath +:/usr/share/icons/wm-icons/32x32-kde2;.xpm ImagePath +:/usr/share/pixmaps;.png;/usr/share/pixmaps;.xpm # (Fvwm2 also has an IconPath for monochrome, but I don't think I need it.) # I tried mxn desktops and didn't like them. DeskTopSize 1x1 # X's font rendering without anti-aliasing looks least bad with the following: WindowFont -rfx-times-bold-r-*-*-14-*-*-*-*-*-koi8-r IconFont -rfx-helvetica-bold-r-*-*-10-*-*-*-*-*-koi8-r # "gainsboro" is a light grey; it's for the active window border HilightColor black gainsboro # FVWM style menus have a 3D look but not exaggeratedly so; # this MenuStyle option must come first MenuStyle * FVWM # I'm guessing that gold letters on deep blue background will make cool menus MenuStyle * Foreground gold, Background #000060, Greyed #202080 MenuStyle * Font -rfx-times-bold-r-*-*-14-*-*-*-*-*-koi8-r # With FocusFollowsMouse and AutoRaise, I don't need to click for attention. # (FvwmAuto will raise the window after one second = 1000 milliseconds.) # But I set SloppyFocus on text windows below; this keeps them focused # when the mouse goes over an empty ("root window") area. Module FvwmAuto 1000 Raise Nop Style * FocusFollowsMouse # Setting HandleWidth to 7 makes the handle 6 pixels wide; this seems # most effective for a classy 3D look (2+2+2). Style * BorderWidth 7, HandleWidth 7 # I'm glad I don't have to use the ugly "unknown1.xpm" that came as default... Style * Icon unknown.xpm # The default colors for window titles and frames might as well be documented: Style * Color white/dimgrey # The next is just to provide approximately decent behavior when a program # has been written to follow protocols of Motif or OpenLook: Style * MWMFunctions, MWMDecor, MWMButtons, HintOverride, OLDecor # Transient windows will get title bar and other decorations by default. Style * DecorateTransient # Icons are supposed to cluster in the upper right part of the screen. # (I could specify another IconBox for overflows, if I need it...) # This specification evidently applies on all desktops. # The number 488 is the width of my emacs window; FvwmButtons are 132x84 Style * IconBox 380x84+488+0, IconFill right bottom # Try to place in open space, otherwise at random Style * SmartPlacement, RandomPlacement # And I hope SuperSmart placement takes advantage of open corners. # (The documentation says the GlobalOpts feature is "temporary"....) Style * MinOverlapPlacement # XTerm gets the icon that I made from Royal Shell's web pages. # (It surely is protected by trademark, but it's just for me at home.) #Style XTerm Icon royalshell.xpm, SloppyFocus, NoTitle Style Emacs Icon emacs.xpm, SloppyFocus, NoTitle Style XOsview Icon xosview.xpm, ClickToFocus Style Gimp Icon gimp.xpm, StaysOnTop Style XEyes NoTitle, StaysOnTop, Sticky, WindowListSkip Style Xmag Icon xmag.xpm # (By the way, it's interesting to try "while(1) ; xeyes & ; end".) # Key bindings # # Now we set-up some hot-keys. # The format for Key-bindings is: # # Key keyname context modifier function # # context describes where the binding applies, W for an application window, # R for root window, A for anywhere, T for title, etc. # modifier is keyboard meta-keys which should be pressed, N for none, # S for Shift, M for Meta, C for Control, or A for any. You can combine # these, so things like SM (shift-Meta) are valid. # IgnoreModifiers L25 #Key F3 W M Iconify #Key F3 I M Iconify #Key F4 W M Close #Key F11 A C Exec exec xlock -mode swarm & #перемещение между различными экранами Alt-1,2,3,4 Key 1 A M GotoDesk 0 0 Key 2 A M GotoDesk 0 1 Key 3 A M GotoDesk 0 2 Key 4 A M GotoDesk 0 3 Key 5 A M GotoDesk 0 4 Key 6 A M GotoDesk 0 5 #Alt TAB Key Tab A M WindowList Root c c \ CurrentDesk, NoGeometry, CurrentAtEnd, IconifiedAtEnd Key Super_L A A WindowList Key Super_R A A Menu Window-Ops Nop Key Menu A A Menu Root-Menu Nop # Now for mouse commands in the root window R: # Left mouse button brings up Root-Menu; middle button brings up Window-Ops # Clicking instead of dragging makes the menu stay up; cursor is <== then. # Double-clicking takes the menu away. # Here "A" means an arbitrary combination of shift/meta/control/numlock etc. Mouse 3 R A Menu Root-Menu Nop Mouse 2 R A Menu Window-Ops Nop # Right button gives window list. Caution: Double clicking gets you a sort of # random window, because double-click control comes only with a Menu spec! Mouse 1 R A WindowList # I'm putting three buttons in the titlebars of ordinary windows. # At the left (which Fvwm calls button 1), a lightning bolt; # this will close the program when touched with any mouse click. # (It does NOT pop up a menu. Closing is better than Deleting and Destroying: # it tries to delete gracefully, then destroys if the window is uncooperative.) Mouse 0 1 A Close ButtonStyle 1 Vector 7 \ 65x15@0 25x55@1 45x55@0 35x85@1 75x45@0 55x45@1 65x15@0 ButtonStyle 1 - MWMDecorMenu # At the right, a button that iconifies the window; we draw a small square # (because I tried to draw an X but it looked horrible): Mouse 0 2 A Iconify #ButtonStyle 2 Vector 17 \ # 20x20@1 30x20@1 50x40@1 70x20@1 80x20@1 80x30@0 60x50@0 80x70@1 \ # 80x80@0 70x80@0 50x60@0 30x80@0 20x80@0 20x70@0 40x50@1 20x30@0 20x20@1 ButtonStyle 2 Vector 5 40x40@1 60x40@1 60x60@0 40x60@0 40x40@1 ButtonStyle 2 - MWMDecorMin # Next to that, a button with a big square; this one maximizes the window. # (More precisely, if you double-click, the window goes to full screen size; # if you single-click, it goes to full height but keeps its width. # But if the window was already in "maximized" state, it goes back to normal. # If you try to drag this button, it unconditionally goes to full width.) Mouse 0 4 A Maximize-Function ButtonStyle 4 Vector 5 20x20@1 80x20@1 80x80@0 20x80@0 20x20@1 AddtoFunc Maximize-Function "D" Maximize 100 100 + "C" Maximize 0 100 + "M" Function Go-Max AddtoFunc Go-Max "I" Current (Maximized) Maximize + "I" Maximize 100 100 ButtonStyle 4 - MWMDecorMax # Ordinary windows also have title bar ("T"), corner frames ("F"), # side frames ("S"), or iconic state ("I"). Left mouse in the corner # will resize or raise; in the title or on the side it will move or raise; # double raising is lowering. Left mouse on an icon moves the icon, # or deiconifies it on double-click. Mouse 1 F A Resize-or-Raise Mouse 1 TS A Move-or-Raise Mouse 1 I A Move-or-DeIconify AddToFunc Resize-or-Raise "I" Raise + "M" Resize + "D" Lower AddToFunc Move-or-Raise "I" Raise + "M" Move + "D" Lower AddToFunc Move-or-DeIconify "I" Raise + "M" Move + "D" Iconify # Middle mouse Stick or UnStick Mouse 2 FTSI A Stick # Right mouse raises or lowers. Mouse 3 FTSI A RaiseLower #генерируемое системой меню Read /etc/X11/fvwm/menudefs.hook # The root menus are next. Since I'm perfectly happy with launching programs # from a command line, my menus mostly provide functions that are difficult # to type (for example, when no terminal window is handy) or impossible # to activate from a command line (namely Fvwm's builtin modules). AddtoMenu Root-Menu "xterm " Exec exec gnome-terminal + "Emacs " Exec exec emacs -geometry 100x48+0+0 -fn 10x20 #+ "" Nop + "" Nop + "Почта" exec gnome-terminal -t "alpine" -e "alpine" + "Mozilla" exec firefox + "" Nop + "Терминалы" Popup NET-menu + "Программы" Popup Application-menu + "Мультимедия" Popup Multimedia-menu + "Debian" Popup /Debian #+ "Debian" Popup /Ubuntu + "" Nop #+ "Show window info" FvwmIdent + "ScreenSaver" exec xscreensaver-command -activate + "" Nop + "FvwmConsole" FvwmConsole + "Disable AutoRaise" KillModule FvwmAuto + "Enable AutoRaise" Module FvwmAuto 1000 Raise Nop + "" Nop + "Exit Fvwm" Popup Quit-Verify AddToMenu Debian-apps "Debian" Title #Меню с мультимедиа AddToMenu Multimedia-menu "Мультимедия" Title + "xmms" Exec xmms AddToMenu Application-menu "Программы" Title + "Stardict" exec stardict AddToMenu Quit-Verify "Really Quit Fvwm?" Title + "Yes, Take Me Back To The Shell" Quit + "" Nop + "No, Sorry ... I Didn't Mean It" Nop + "" Nop + "Try To Refresh" Refresh #+ "Try To Recapture" Recapture + "Try To Restart" Restart fvwm2 # The other root menu, invoked by the middle mouse button, gives me a chance # to do any window operation on a window of my choice. (The cursor changes to # a big black ball as I go searching for the window that will be affected.) AddToMenu Window-Ops "Window Operations" Title + "Move" Move + "Resize" Resize + "Raise" Raise + "Lower" Lower + "Iconify/DeIconify" Iconify + "Stick/UnStick" Stick + "Maximize/Normalize" Maximize #+ "Refresh" RefreshWindow + "" Nop + "Delete" Delete + "Close" Close + "Destroy" Destroy # Now comes the fun part: Buttons to push that will take me from one # desktop to another. # # Being a control freak, I am not trusting FvwmButtons to find the # correct button layout; I'm building it myself. The goal is # to have a 64x64 ASClock at the upper right, preceded by four 32x32 buttons # that will aim my display at another desktop, all above a 16x128 CPU load # display. Geometry-wise, I consider it to be an 8x5 grid of 16x16 squares # (although I could have regarded it as a 4x5 grid of 32x16s). # The border adds 4 pixels. *FvwmButtonsRows 5 *FvwmButtonsColumns 10 *FvwmButtonsGeometry 165x84-0+0 *FvwmButtonsBoxSize fixed *FvwmButtonsFont None *FvwmButtonsBack Orange *FvwmButtonsPadding 0 0 *FvwmButtons(4x4+6+0, Swallow(UseOld,Respawn) ASClock "Exec LANG=C asclock -theme /usr/share/asclock/penguin/") *FvwmButtons(10x1+0+4, Swallow(UseOld,Respawn) \ XLoad "Exec xload -nolabel -geometry 165x12+0+0 -bg dimgrey -fg white -update 1") #метки на Pager'е *FvwmPager: Label 0 "1" *FvwmPager: Label 1 "2" *FvwmPager: Label 2 "3" *FvwmPager: Label 3 "4" *FvwmPager: Label 4 "5" *FvwmPager: Label 5 "6" *FvwmPager: Columns 3 *FvwmPager: Rows 2 *FvwmButtons: (6x4+0+0,Swallow "FvwmPager" "FvwmPager 0 5") #*FvwmButtons: (4x2+0+2,Swallow "FvwmPager" "FvwmPager 2 3") #*FvwmButtons: (2x2+0+0,Swallow "FvwmPager" "FvwmPager 0") #*FvwmButtons: (2x2+2+0,Swallow "FvwmPager" "FvwmPager 1") #*FvwmButtons: (2x2+0+2,Swallow "FvwmPager" "FvwmPager 2") #*FvwmButtons: (2x2+2+2,Swallow "FvwmPager" "FvwmPager 3") #*FvwmButtons(2x2+0+0, Icon zero.xpm, Action "Desk 0 0") #*FvwmButtons(2x2+2+0, Icon one.xpm, Action "Desk 0 1") #*FvwmButtons(2x2+0+2, Icon two.xpm, Action "Desk 0 2") #*FvwmButtons(2x2+2+2, Icon three.xpm, Action "Desk 0 3") Style FvwmButtons ClickToFocus, NoTitle, NoHandles, Sticky, WindowListSkip # Finally, the initialization and restart logic. # (The pattern "mod 2 2" is an attractive 2x2 plaid texture.) AddToFunc Basic-Setup "I" Module FvwmButtons + "I" Wait FvwmButtons + "I" Exec exec xsetroot -mod 2 2 -fg \#001860 -bg \#183078 + "I" Echo done with basic setup... AddToFunc InitFunction "I" Echo initializing... + "I" Function Basic-Setup + "I" Desk 0 1 + "I" Exec exec gnome-terminal -t "kedr" + "I" Wait gnome-terminal + "I" Desk 0 2 #+ "I" Exec exec xosview -geometry 400x200-11+92 #+ "I" Wait xosview + "I" Exec exec gnome-terminal + "I" Wait gnome-terminal + "I" Desk 0 0 + "I" Exec exec xplanet -longitude 82 -latitude 55 + "I" Exec exec emacs -fn 10x20 -geometry 100x52+420+0 + "I" Exec exec xscreensaver -no-splash #emacs -geometry 82x56+0+0 #+ "I" Wait emacs #+ "I" Exec exec xeyes -geometry 55x50+1050+12 -fg DarkGreen -center dimgrey -outline \#000060 #+ "I" Wait xeyes + "I" Exec exec setxkbmap -layout "us,ru(winkeys)" -option "grp:caps_toggle,grp_led:scroll,grp:switch" + "I" Exec exec xxkb #Мультимедиа Клавиатура #+ "I" Exec exec lineakd #+ "I" Echo ready... AddToFunc RestartFunction "I" Echo restarting... + "I" Function Basic-Setup Style "*" BackingStore,SaveUnder #Style "HIGZ*" BackingStore,SaveUnder #Style "R Graphics*" BackingStore, SaveUnder # By putting the line "exec fvwm2 >& /tmp/fvmw.out" in my .xinitrc, # I'm getting an error log in /tmp/fvmw.out. The following command # writes a message to that log. Echo Hello, world