how to run bash scripts and cancel the close action?

i write some code to set the specific environment variables in my .xprofile
which used to be invoked by gdm and it works quite well, but now i use xdm
and fvwm, it seems i could not make xdm to work with that, i try to write a
line in the fvwm config to do that, but not work at all.
config:
AddToFunc InitFunction

  • I Exec exec /bin/sh -c “source ~/.xprofile”

    .xprofile:
    export LANG=zh_CN
    export LC_CTYPE=zh_CN

any ideas about that, i have to do it manualy every time!

i alway click on the minimize or close button by mistake, in other GUI

desktop like MS windows or Gnome, i just hold the button and move to
anywhere else, then release it , the action would be cancelled automatically. but fvwm would not behave in that way. can i configure it?

thanks…

best regards
daniel h.f

xdm reads ~/.xsession by default so you should create that file if it doesn’t exist. Into that you can then source your ~/.xprofile script, as in the following example:

#!/bin/sh

[ -f ~/.xprofile ] && . ~/.xprofile
exec fvwm

Make sure the perms on ~/.xsession are ‘700’ octal. (u+x)

It works that way just fine for me. Where are you releasing the mouse to cancel the effect? Either way, I’d need to see your config file to be of further help.

– Thomas Adam

thanks for your help, i tried the way you told me before, failed though, i make it this time, i found as long as i set the XSESSION variable in /etc/rc.conf, the .xsession will not
be executed, when unset, it works ( on my gentoo box). thanks again.

  as for the mouse, do you really works find that way, i don't know , my config is very 

simple. so i paste it here:

  1# Virtual Desktop
  2 EdgeScroll  0 0
  3 DeskTopSize 3x3
  4 
  5 Style * NoPPosition, ResizeOpaque, NoIcon
  6 Style * DecorateTransient
  7 OpaqueMoveSize unlimited
  8 
  9 # Focus
 10 Style * SloppyFocus, MouseFocusClickRaises
 11 Style * FPGrabFocus
 12 
 13 # Path
 14 ImagePath +:/usr/share/icons/fvwm
 15 ImagePath +:/usr/share/pixmaps
 16 ImagePath +:/opt/LumaQQ;.png
 17 
 18 # Cursor
 19 CursorStyle ROOT     left_ptr
 20 CursorStyle DEFAULT  left_ptr
 21 CursorStyle MENU     right_ptr
 22 CursorStyle SYS      right_ptr
 23 
 24 # Font
 25 Style * Font "xft:tahoma:Medium:-microsoft-tahoma-medium-r-normal--0-0-0-0-p-0-is        o8859-1"
 26 
 27 # Border
 28 Style *   BorderWidth 5, HandleWidth 5
 29 Style "*" TitleAtTop
 30 
 31 # Menu
 32 MenuStyle * Foreground black, Background white
 33 MenuStyle * Font "xft:tahoma:Medium:-microsoft-tahoma-medium-r-normal--0-0-0-0-p-        0-iso8859-1"
 34 
 35 # Module
 36 Module FvwmPager    myPager
 37 Module FvwmTaskBar  myTaskBar
 38 Module FvwmButtons  myButtons
 39 
 40 Style myPager        StaysOnTop, NoTitle, Sticky, WindowListSkip
 41 Style myTaskBar     StaysOnTop, NoTitle, Sticky, WindowListSkip
 42 Style myButtons     StaysOnTop, NoTitle, Sticky, WindowListSkip, Layer 1
 43 
 44 DestroyModuleConfig myButtons: *
 45 *myButtons: BoxSize  fixed
 46 *myButtons: Rows     5
 47 *myButtons: columns  1
 48 *myButtons: Pixmap   none
 49 *myButtons: Geometry 100x500+0+0
 50 *myButtons: (Icon QQ_icon.png,      Action(Mouse 1) `exec /opt/LumaQQ/lumaqq`)
 51 *myButtons: (Icon gaim.png,         Action(Mouse 1) `exec /usr/bin/gaim`)
 52 *myButtons: (Icon firefox-icon.png, Action(Mouse 1) `exec /usr/bin/firefox`)
 53 *myButtons: (Icon mrxvt.xpm,        Action(Mouse 1) `exec /usr/bin/mrxvt`)
 54 *myButtons: (Icon stardict.png,     Action(Mouse 1) `exec /usr/bin/stardict`)
 55 
 56 DestroyModuleConfig myTaskBar: *
 57 *myTaskBar: UseSkipList
 58 
 59 DestroyModuleConfig myPager: *
 60 *myPager: Geometry  80x80-0+0
 61 *myPager: NoSeparators
 62 *myPager: Back  gray
 63 *myPager: UseSkipList
 64 
 65 # Mouse
 66 Mouse 1 2 A Close
 67 Mouse 1 4 A Maximize
 68 Mouse 1 6 A Iconify
 69 Mouse 1 8 A WindowShade
 70 
 71 Mouse 1 R A Menu MenuFvwmRoot
 72 
 73 # Button
 74 AddButtonStyle 2 Pixmap mini.winXX-close.xpm
 75 AddButtonStyle 4 Pixmap mini.winXX-maximize.xpm
 76 AddButtonStyle 6 Pixmap mini.winXX-minimize.xpm

I’m an fvwm noob with more questions than answers but, just as a workaround for the mouse issue, you can hit escape before you release (don’t even have to move the mouse off) and it should cancel the action.

I checked it and my windows close like you describe yours doing, too. It’s probably related to some kind of ‘on release’ related setting - not so much something you have set as something you haven’t set - but I’m not familiar enough with fvwm yet to say. Didn’t see anything that seemed relevant in the man page, but you could try searching it for ‘release’ or the like and maybe see something I missed.

thanks, i still could not find any topic related in the man page, perhaps i have to use some
config files from someone else and check this behavior, if there is a one that works, i may modify my own accordingly to find out what on earth the option is !

Not sure if I understood it correctly, but for the close issue, bind the close button to a function like this one:[code]
DestroyFunc Close-or-not
AddToFunc Close-or-not

  • H Nop
  • C Close
    [/code]

That way you can close the window with a single click, or if you realize you missed, you can drag the mouse off and it wont close the window. Or you could just move the close button to somewhere else, where it isn’t so easy to hit by accident.

thank you so much, i solve it already though. i use a similar way .

  • M Nop
  • C Close

:slight_smile: thank you

oh, by the way. do you know how to change the font of window titles?
i use a pixmap under it, and could not change the font face and color.
AddToTitleStyle or TitleStyle , neither could use “Font” setting, and “fg” in Colorset setting does not work… ie. not affect font color.

My titles are set by DefaultFont. TitleStyle and Style should allow you to set the Font, but for the color, you’ll want to look at ActiveFore, HilightFore, or HilightColorset.

For example, Style * HilightFore red The active window will have a red font color.

Or something like

Colorset 9 fg blue, bg black, HilightFore green Style * Colorset 9
Would set your titles to blue when not active and green when active.
Or you could get the same behavior with the following, and be able to add more customization…

Colorset 9 fg blue, bg black Colorset 10 fg green, bg black Style * Colorset 9, HilightColorset 10