1 #----------------------------------------------------------------------------#
3 # 8. Now define some handy complex functions
5 #----------------------------------------------------------------------------#
7 #------------------------------------------------------------------------------
8 # This one moves and then raises the window if you drag the mouse,
9 # only raises the window if you click, or does a vertical maximize if
10 # you double click (full screen maximize would be 'Maximize 100 100')
11 #------------------------------------------------------------------------------
13 DestroyFunc Move-or-Raise
14 AddToFunc Move-or-Raise M Move
20 #------------------------------------------------------------------------------
21 # As above but double click shade
22 #------------------------------------------------------------------------------
24 DestroyFunc Move-or-Raise-or-Shade
25 AddToFunc Move-or-Raise-or-Shade M Move
30 #------------------------------------------------------------------------------
31 # This one moves and then lowers the window if you drag the mouse,
32 # only lowers the window if you click, or does a RaiseLower if you double
34 #------------------------------------------------------------------------------
36 DestroyFunc Move-or-Lower
37 AddToFunc Move-or-Lower M Move
43 #------------------------------------------------------------------------------
44 # This one moves or (de)iconifies:
45 #------------------------------------------------------------------------------
47 DestroyFunc Move-or-Iconify-or-Raise
48 AddToFunc Move-or-Iconify-or-Raise M Move
52 #------------------------------------------------------------------------------
53 # This one maximizes vertically if you click (leaving room for the taskbar
54 # at the bottom, or does a full maximization if you double click, or a
55 # true full vertical maximization if you just hold the mouse button down.
56 #------------------------------------------------------------------------------
58 DestroyFunc Maximize-Func
59 AddToFunc Maximize-Func M Maximize 0 98
63 #------------------------------------------------------------------------------
64 # This one resizes and then raises the window if you drag the mouse,
65 # only raises the window if you click, or does shade if you double
67 #------------------------------------------------------------------------------
69 DestroyFunc Resize-or-Raise-or-Shade
70 AddToFunc Resize-or-Raise-or-Shade M Resize
76 #------------------------------------------------------------------------------
77 # This one focuses and then 'warps' to the window.
78 #------------------------------------------------------------------------------
81 DestroyFunc FocusAndWarp
82 AddToFunc FocusAndWarp I Focus
86 #------------------------------------------------------------------------------
87 # Like the previous one, but de-iconifies first.
88 #------------------------------------------------------------------------------
90 DestroyFunc DeiconifyFocusAndWarp
91 AddToFunc DeiconifyFocusAndWarp I Iconify off
94 #------------------------------------------------------------------------------
95 # Like the previous one, but only Raise.
96 #------------------------------------------------------------------------------
98 DestroyFunc DeiconifyFocusAndRaise
99 AddToFunc DeiconifyFocusAndRaise I Iconify off
103 #------------------------------------------------------------------------------
104 # This one is used to modify some style for a window (almost obsolet)
105 #------------------------------------------------------------------------------
107 DestroyFunc StyleAndRecapture
108 AddToFunc StyleAndRecapture I Style "$0" $1
109 + I All ("$0") RecaptureWindow
112 #------------------------------------------------------------------------------
113 # A really useful one: de-iconifies, warps to the window
114 # or creates it if it doen't exist (often used with mailtools)
115 #------------------------------------------------------------------------------
117 DestroyFunc WarpOrExec
118 AddToFunc WarpOrExec I Next (AcceptsFocus $0) Iconify -1
119 + I Next (AcceptsFocus $0) FocusAndWarp
120 + I None (AcceptsFocus $0) Exec $0 $1
122 #------------------------------------------------------------------------------
123 # For the left button
124 #------------------------------------------------------------------------------
126 DestroyMenu "window_ops_func"
127 AddToFunc "window_ops_func" "C" PopUp Window-Ops2
128 + "M" PopUp Window-Ops2
131 #------------------------------------------------------------------------------
132 # Functions to restart Modules and Restart/Kill FvwmButtons by aliases
133 #------------------------------------------------------------------------------
135 DestroyFunc RestartModule
136 AddToFunc RestartModule
140 DestroyFunc RestartModuleByAlias
141 AddToFunc RestartModuleByAlias
146 # This function is for WMakerFvwmButtons (start or iconify id started)
147 DestroyFunc MyPanelButtons
148 AddToFunc MyPanelButtons
150 + I None (CirculateHit $0) FvwmButtons -g +$1+$2 $0
152 #------------------------------------------------------------------------------
153 # Functions for FvwmScript-BaseConfig
154 #------------------------------------------------------------------------------
156 DestroyFunc BaseConfigOkFunc
157 AddToFunc BaseConfigOkFunc I Read styles
159 DestroyFunc BaseConfigApplyFunc
160 AddToFunc BaseConfigApplyFunc I Read styles
163 #------------------------------------------------------------------------------
164 # Functions which start and save state for FvwmAnimate, FvwmEvent, etc ...
165 # $1 $2 is used only by FvwmAuto
166 #------------------------------------------------------------------------------
172 + I Exec echo "AddToFunc StartFunction I $0 $1 $2" > $FVWM_USERDIR/.start-$0
174 DestroyFunc ModuleOff
177 + I Exec echo "# Do not start $0" > $FVWM_USERDIR/.start-$0
179 #------------------------------------------------------------------------------
180 # Functions which start and save state for MiniButtons and WinMakerAppButtons
181 #------------------------------------------------------------------------------
183 DestroyFunc ButtonsOn
187 + I Exec echo "AddToFunc StartFunction I $0 $1" > $FVWM_USERDIR/.start-$1
189 DestroyFunc ButtonsOff
192 + I Exec echo "# Do not start $0" > $FVWM_USERDIR/.start-$0
194 #------------------------------------------------------------------------------
195 # Functions for choosing the "Big" buttons Wharf or BarButtons
196 #------------------------------------------------------------------------------
198 DestroyFunc ChangeButtonsOn
199 AddToFunc ChangeButtonsOn
200 + I All (BarButtons) Close
201 + I KillModule FvwmWharf
202 + I Exec echo "AddToFunc StartFunction I $0" > $FVWM_USERDIR/.start-FvwmButtons
205 DestroyFunc ChangeButtonsOff
206 AddToFunc ChangeButtonsOff
207 + I All (BarButtons) Close
208 + I KillModule FvwmWharf
209 + I Exec echo "# No Buttons Bar" > $FVWM_USERDIR/.start-FvwmButtons
212 #------------------------------------------------------------------------------
213 # Functions for Raising modules only
214 #------------------------------------------------------------------------------
216 DestroyFunc StartModulesAutoRaise
217 AddToFunc StartModulesAutoRaise
218 + I Style FvwmDesker Lenience
219 + I FvwmAuto 400 Silent ModulesAutoRaise
220 + I Exec echo "AddToFunc StartFunction I StartModulesAutoRaise" > $FVWM_USERDIR/.start-FvwmAuto
222 DestroyFunc ModulesAutoRaise
223 AddToFunc ModulesAutoRaise
224 + I Current (FvwmButtons) Raise
225 + I Current (FvwmTaskBar) Raise
226 + I Current (FvwmIconBox) Raise
227 + I Current (FvwmDesker) Raise
228 + I Current (FvwmIconMan) Raise
229 + I Current (FvwmWinList) Raise
230 + I Current (FvwmWharf) Raise
231 + I Current (panel) Raise
233 #------------------------------------------------------------------------------
234 # Functions which start and save a background
235 #------------------------------------------------------------------------------
237 DestroyFunc SetBackground
238 AddToFunc SetBackground
239 + I KillModule FvwmBacker
241 + I Exec echo "AddToFunc StartFunction I $0" > $FVWM_USERDIR/.start-Background
243 DestroyFunc SetBackgroundOff
244 AddToFunc SetBackgroundOff
245 + I KillModule FvwmBacker
246 + I Exec echo "# Background disabled" > $FVWM_USERDIR/.start-Background
248 #------------------------------------------------------------------------------
249 # Functions which start and defines which applications manager we use
250 #------------------------------------------------------------------------------
252 DestroyFunc ChangeAppsMan
253 AddToFunc ChangeAppsMan
254 + I KillModule FvwmTaskBar
255 + I KillModule FvwmWinList
256 + I KillModule FvwmIconMan
257 + I KillModule FvwmIconBox
258 + I Exec echo "AddToFunc StartFunction I $0" > $FVWM_USERDIR/.start-apps-man
261 DestroyFunc AppsManNone
262 AddToFunc AppsManNone
264 + I KillModule FvwmTaskBar
265 + I KillModule FvwmWinList
266 + I KillModule FvwmIconMan
267 + I KillModule FvwmIconBox
268 + I Exec echo "AddToFunc StartFunction I Style * NoIcon # No applications Manager" > $FVWM_USERDIR/.start-apps-man
274 # Need to reaload menus for KDE mini-icons styles
276 + I KillModule FvwmTaskBar
277 + I KillModule FvwmWinList
278 + I KillModule FvwmIconMan
279 + I KillModule FvwmIconBox
280 + I Exec echo "# Use Icons" > $FVWM_USERDIR/.start-apps-man
282 DestroyFunc WinListDesk
283 AddToFunc WinListDesk
285 + I *FvwmWinList: ShowCurrentDesk
286 + I Module FvwmWinList
288 DestroyFunc WinListGlobal
289 AddToFunc WinListGlobal
291 + I DestroyModuleConfig FvwmWinList: ShowCurrent*
292 + I Module FvwmWinList
294 DestroyFunc TaskBarDesk
295 AddToFunc TaskBarDesk
297 + I DestroyModuleConfig FvwmTaskBar: AutoHid*
298 + I *FvwmTaskBar: DeskOnly
299 + I Module FvwmTaskBar
301 DestroyFunc TaskBarGlobal
302 AddToFunc TaskBarGlobal
304 + I DestroyModuleConfig FvwmTaskBar: AutoHid*
305 + I DestroyModuleConfig FvwmTaskBar: Desk*
306 + I Module FvwmTaskBar
308 DestroyFunc TaskBarDeskAutoHide
309 AddToFunc TaskBarDeskAutoHide
311 + I *FvwmTaskBar: DeskOnly
312 + I *FvwmTaskBar: AutoHide
313 + I Module FvwmTaskBar
315 DestroyFunc TaskBarGlobalAutoHide
316 AddToFunc TaskBarGlobalAutoHide
318 + I DestroyModuleConfig FvwmTaskBar: Desk*
319 + I *FvwmTaskBar: AutoHide
320 + I Module FvwmTaskBar
322 DestroyFunc IconManGlobal
323 AddToFunc IconManGlobal
325 + I *FvwmIconMan: *Resolution global
326 + I Module FvwmIconMan
328 DestroyFunc IconManDesk
329 AddToFunc IconManDesk
331 + I *FvwmIconMan: *Resolution desk
332 + I Module FvwmIconMan
334 DestroyFunc IconManPage
335 AddToFunc IconManPage
337 + I *FvwmIconMan: *Resolution page
338 + I Module FvwmIconMan
340 DestroyFunc IconBoxDesk
341 AddToFunc IconBoxDesk
343 + I *FvwmIconBox: ResolutionDesk
344 + I Module FvwmIconBox
346 DestroyFunc IconBoxGlobal
347 AddToFunc IconBoxGlobal
349 + I DestroyModuleConfig FvwmIconBox: Reso*
350 + I Module FvwmIconBox
352 #------------------------------------------------------------------------------
353 # Functions for Layers
354 #------------------------------------------------------------------------------
356 DestroyFunc SetLayers
358 + I StyleAndRecapture $n $0
359 + I Exec F=$FVWM_USERDIR; Z=$F/.fvwm-layers; T=$F/.tmp-layers; if grep -qe "$n" $Z; then sed -e "s/\ $n\ .*/\ $n\ $0/" $Z>$T; cat $T>$Z; else echo "Style $n $0" >>$Z; fi
361 DestroyFunc DestroyLayers
362 AddToFunc DestroyLayers
363 + I StyleAndRecapture $n StaysPut
364 + I Exec F=$FVWM_USERDIR; Z=$F/.fvwm-layers; T=$F/.tmp-layers; sed -e "/^Style\ $n\ .*/d" $Z>$T; cat $T>$Z
366 #------------------------------------------------------------------------------
367 # Function for reloading the icons styles
368 #------------------------------------------------------------------------------
370 DestroyFunc ReloadIconStylesAndMenus
371 AddToFunc ReloadIconStylesAndMenus
374 # Need to reload the NoIcon style
375 + I PipeRead 'if grep -qe AddToFunc $FVWM_USERDIR/.start-apps-man; then echo "Style * NoIcon"; fi'
377 #------------------------------------------------------------------------------
378 # Functions for Loading/Saving/Showing Settings
379 #------------------------------------------------------------------------------
381 DestroyFunc SaveAsSettings
382 AddToFunc SaveAsSettings
383 + I Exec F=$FVWM_USERDIR;for i in ~/.xinitrc-fvwm $F/.FvwmBaseConfig $F/.FvwmAnimate $F/.FvwmForm $F/.start-Background $F/.start-apps-man $F/.start-FvwmButtons $F/.start-DeskerPanelButtons $F/.start-MiniButtons $F/.start-WinMakerAppButtons $F/.start-FvwmAnimate $F/.start-FvwmAuto $F/.start-FvwmBanner $F/.start-FvwmEvent $F/.fvwm-layers; do [ ! -f "$i" ] || /bin/cp $i $i-$0; done;
385 DestroyFunc LoadSettings
386 AddToFunc LoadSettings
387 + I Exec F=$FVWM_USERDIR; for i in ~/.xinitrc-fvwm $F/.FvwmBaseConfig $F/.FvwmAnimate $F/.FvwmForm $F/.start-Background $F/.start-apps-man $F/.start-FvwmButtons $F/.start-DeskerPanelButtons $F/.start-MiniButtons $F/.start-WinMakerAppButtons $F/.start-FvwmAnimate $F/.start-FvwmAuto $F/.start-FvwmBanner $F/.start-FvwmEvent $F/.fvwm-layers; do [ ! -f "$i-$0" ] || /bin/cp $i-$0 $i; done;
388 + I Exec [ ! -f ~/.xinitrc-fvwm-$0 ] || (xscreensaver-command -exit; ~/.xinitrc-fvwm-$0)
389 + I PipeRead '[ ! -f $FVWM_USERDIR/.FvwmBaseConfig ] || (echo Read .FvwmBaseConfig; echo BaseConfigOkFunc)'
391 + I Read .fvwm-layers-$0
392 + I KillModule FvwmAnimate
393 + I KillModule FvwmAuto
394 + I KillModule FvwmEvent
395 + I KillModule FvwmButtons
396 + I KillModule FvwmWharf
397 + I KillModule FvwmTaskBar
398 + I KillModule FvwmWinList
399 + I KillModule FvwmIconMan
400 + I KillModule FvwmIconBox
401 + I PipeRead 'F=$FVWM_USERDIR; F=$FVWM_USERDIR; for i in $F/.start-Background $F/.start-apps-man $F/.start-FvwmButtons $F/.start-DeskerPanelButtons $F/.start-MiniButtons $F/.start-WinMakerAppButtons $F/.start-FvwmAnimate $F/.start-FvwmAuto $F/.start-FvwmBanner $F/.start-FvwmEvent; do [ ! -f "$i-$0" ] || sed -e s/AddToFunc\\.StartFunction\\.I\\.// $i-$0; done; if [ -f "$F/.start-apps-man-$0" ]; then if grep -qe Icons $F/.start-apps-man-$0; then echo "Style * Icon"; echo "Read iconstyles"; echo "Read menus"; fi; fi'
403 DestroyFunc ShowFvwmSettings
404 AddToFunc ShowFvwmSettings I Exec F=$FVWM_USERDIR;f=$F/.tmp-modules-setting; echo "" > $f; for j in 0 1 2 3 4; do if [ "$j" -eq "0" ]; then j=""; t="Current Setting:"; l="--------------"; else j="-$j"; t="Setting$j:"; l="---------"; fi; echo $t >> $f; echo $l >> $f; for i in $F/.start-Background $F/.start-apps-man $F/.start-FvwmButtons $F/.start-DeskerPanelButtons $F/.start-MiniButtons $F/.start-WinMakerAppButtons $F/.start-FvwmAnimate $F/.start-FvwmAuto $FVWM_USERDIR/.start-FvwmBanner $F/.start-FvwmEvent; do z="$i$j"; [ ! -f "$z" ] || sed -e s/^\\#\.// -e s/\.*exec/Background:/ -e s/AddToFunc\.StartFunction\.I/Start/ -e s/FvwmEvent/Sounds\ Effect/ $z >> $f; done; echo -n "Base Config: ">>$f; if [ -f $F/.FvwmBaseConfig$j ]; then echo "Used">>$f; else echo "Not Used">>$f; fi; echo "">>$f;done; xmessage -file $f
406 DestroyFunc ShowXSettings
407 AddToFunc ShowXSettings \
408 I Exec T=$FVWM_USERDIR/.tmp-x-set;u=~/.xinitrc-fvwm;echo "">$T;for j in 0 1 2 3 4;do if [ "$j" -eq "0" ];then z=$u;t="Current Setting:";else z="$u-$j";t="Setting-$j:";fi;echo $t >>$T;if grep -qe Bell $z;then grep -e "xset b" $z|sed -e s/xset\.b/Bell:/>>$T;fi;if grep -qe Screen $z;then echo -n "Background: ">>$T;if grep -qe \#xsetroot $z;then echo "disabled">>$T;elif grep -qe xpmroot $z;then grep -e xpmroot $z|sed -e s/xpmroot\.//>>$T;else grep -e xsetroot $z|sed -e s/xsetroot\.//>>$T;fi;grep -e "xset s" $z|sed -e s/xset\.s/xsaver:/>>$T;echo -n "DPMS: ">>$T;grep -e xset\.*dpms $z|sed -e s/xset\.-dpms/Off/ -e s/xset\.dpms/On/>>$T;echo -n "xscreensaver: ">>$T;if grep -qe \#xscreen $z;then echo "Off">>$T;else echo "On">>$T;fi;fi;if grep -qe Keyboard $z;then echo -n "Keyboard: ">>$T;grep -e "xset r" $z|sed -e s/xset\.r/auto\ repeat/ -e s/c/Vol/>>$T;fi;if grep -qe Pointer $z;then echo -n "Mouse: ">>$T;grep -e "xset m" $z|sed -e s/xset\.m//>>$T;fi;echo "">>$T;done;xmessage -file $T
411 DestroyFunc ShowLayers
412 AddToFunc ShowLayers I Exec F=$FVWM_USERDIR; T=$F/.tmp-layers; echo -e "A StaysOnTop window is a window which is above \nthe normal (i.e., StaysPut) windows, a StaysOnBottom\nwindow is below the normal windows. Here the list\nof StaysOnTop and StaysOnBottom windows:\n"> $T; u=$F/.fvwm-layers; for j in 0 1 2 3 4; do if [ "$j" -eq "0" ];then z=$u; t="Current Setting:"; l="---------------"; else z="$u-$j"; t="Setting-$j:"; l="----------"; fi; echo $t >>$T; echo $l >>$T; [ ! -f $z ] || cat $z>>$T; echo "" >> $T; done; xmessage -file $T