Set window gravity and other property for specific window

i use fvwm 2.2.5 and wanted to have just one xclock instance open every time i log in/restart fvwm. i want it to work exactly like FvwmPager, where it floats above maximised windows by default and can’t be moved/focused with mouseclick.

this relevant lines is in my ~/.fvwmrc, which is default copied from /usr/X11R6/lib/X11/fvwm/.fvwmrc. i have appended this lines to my end of file:

Style "xclock" StaysOnTop
DestroyFunc StartXClock
AddToFunc StartXClock
+ I Exec { if ! /usr/bin/pgrep -x /usr/X11R6/bin/xclock > /dev/null ; then /usr/X11R6/bin/xclock -digital & fi ; }
AddToFunc StartFunction
+ I StartXClock

i predict this is bad optimised but i tried hard to come as close as possible. without pgrep check xclock would open every fvwm restart.

i don’t want all xclock to StaysOnTop, only this one xclock opening.

biggest of all is window gravity! i check with xprop and select xclock. the window gravity: NorthWest. but i check FvwmPager and window gravity: SouthEast. how to have just my xclock open to the bottom left of FvwmPager, at SouthEast gravity? i research for many hours and cannot resolve.

image for clear view aid (desires):
screenshot-corner

Note, 2.2.5 is not longer supported, we suggest you upgrade. fvwm3 is the currently supported version.

That being said, xprop should also be able to set the gravity, xprop -name skype -set "win_gravity" "SouthEast".

hello somiaj thanks for reply.

i read this stackexchange post previously and tried this solution but i discover:

$ xprop -name xclock -set "win_gravity" "SouthEast"
xprop: error: unsupported conversion for win_gravity

i am urged by supervisor to leave packages default as strict as possible, this is means fvwm 2. is this impossible action with fvwm 2? i’m confused because this behavour already works perfect on FvwmPager.

I don’t think this is an fvwm issue, fvwm just honors the gravity an application sets. I’m unsure what to use if xprop won’t work to set an applications gravity.

hello somiaj thanks you for informations.

is this X11 issue perhaps? must i modify the xclock code to force him to open SouthEast? i read this gentooforum post today and confused if this must be done. if fvwm cannot SouthEast xclock i must force SouthEast by code inside xclock, but this is final option and not preferential because i know not of programming languages excludes shell scripts (i know not how to force SouthEast by code in this situation)

is fvwm 3 has window gravity define feature? if yes this could be exciting.

Looking back, you just want to control where xclock opens? I don’t think this is gravity. Read the man page for your version of fvwm. Things were way different in 2.2.5 (note the last version 2 was 2.7). Look at InitFunction and maybe PositionPlacement.

correct somiaj, in this current configuration everything operate ok except xclock open at top left of screen, similar to xterm and other windows. i ask if he can open next to FvwmPager at bottom right of screen or at specific coordinates (this location in photograph which is bottom right correct.).

i read man fvwm today but he has no search for InitFunction and PositionPlacement. this is confusing. i research on internet for more documentation today

(i search function and position but no relevancy in man )

i refrence my ~/.fvwmrc and find this:

######################## Initialization Functions ############################
AddToFunc InitFunction    "I" Module FvwmPager 0 0
AddToFunc RestartFunction "I" Module FvwmPager 0 0

however 0 0 is confusing. i am not expert. is xclock not Module? potentially 0 0 is exclusive for Module FvwmPager. from this researching i determine Exec is for execute shell command for xclock. PositionPlacement is not inside ~/.fvwmrc

I can’t really help with 2.2.5, it is a much older syntax for configuration. StartFunction runs every time you start, InitFunction only runs the first time, so this could simplify your pgrep command to launch xclock. xclock is some other app you are just running, it is not part of fvwm. Read the manual pages, they tell you what things mean. The 0 0 tells you what desks to show in the FvwmPager.

My guess is you are on openbsd, I really suggest installing fvwm from ports, or fvwm3 from ports, so you get a more modern version.

But if you want to stick with 2.2.5, read the manual pages, they should give you what different things control. Lots has changed since the 2.2.x series which was released in 2001.

thanks you for advices and informations somiaj

unfortunately i’m disallowed to install modern fvwm today. exclusion was the 2.2.5 fvwm from openbsd default (correct he’s our OS). thanks you for valuable help thus far somiaj.

i use this however xclock open every restartion of fvwm. he is inside ~/.fvwmrc:

######################## Initialization Functions ############################
AddToFunc InitFunction    "I" Module FvwmPager 0 0
+                         "I" Exec /usr/X11R6/bin/xclock -digital
AddToFunc RestartFunction "I" Module FvwmPager 0 0
+                         "I" Exec /usr/X11R6/bin/xclock -digital

i remove FvwmPager area provisionally but xclock still open every restartion fvwm. see his alterations:

AddToFunc InitFunction    "I" Exec /usr/X11R6/bin/xclock -digital
AddToFunc RestartFunction "I" Exec /usr/X11R6/bin/xclock -digital

today i have pgrep command used. he is only functioning method for me. maybe this is bug from old 2.2.5 fixed in modern version fvwm. it isn’t significant inconvenience for provisional usage. if modern fvwm version 2/3 fix this bug i am excited and pursue further to supervisor permission.

is “manual pages” mean man fwvm or is this another documentation? i know GNU manuals on internet contain extra informations compare to simple man <command>. i continue read more extensive of man fvwm today

possibly another user of fvwm has suggestions to change this for 2.2.5 fvwm? if this is impossible i can pursue for modern version of 2 or 3 fvwm

today i remove this lines and replace with smaller code:

Style "xclock" StaysOnTop
DestroyFunc StartXClock
AddToFunc StartXClock
+ I Exec { if ! pgrep -x xclock > /dev/null ; then /usr/X11R6/bin/xclock -digital & fi ; }
AddToFunc StartFunction
+ I StartXClock

this is now this code:

Style "xclock" StaysOnTop
######################## Initialization Functions ############################
AddToFunc InitFunction    "I" Module FvwmPager 0 0
+ "I" Exec { if ! pgrep -x xclock > /dev/null ; then /usr/X11R6/bin/xclock -digital & fi ; }
AddToFunc RestartFunction "I" Module FvwmPager 0 0
+ "I" Exec { if ! pgrep -x xclock > /dev/null ; then /usr/X11R6/bin/xclock -digital & fi ; }

summary: this are small changes but make small code: good for BSD mindset yes? ;)

Not sure if this answers your question. I did a few tests with xclock.

Style "xclock" StaysOnTop, NeverFocus, !Borders, !Title
+ I ThisWindow ("xclock*") Move -10 -0

Example of window position

Or… add xclock in FvwmButtons and place it with Geometry.

Module FvwmButtons XclockBox
DestroyModuleConfig XclockBox:*
*XclockBox: Geometry 167x167-120-0
*XclockBox: (Swallow(NoClose,UseOld) "Exec exec xclock", Frame 0)
Style XclockBox !Borders, !Title, WindowListSkip, Sticky, StaysOnTop, NeverFocus

I am just showing different options.

Rather than using pgrep you can ask FVWM to only run xclock once:

None (XClock) Exec exec xclock 

hello thomasadam and amlug thanks you for informations

i use this lines here and he works ok. no pgrep usage and one xclock only. maintained on restartions of fvwm:

######################## Initialization Functions ############################
AddToFunc InitFunction    "I" Module FvwmPager 0 0
+                         "I" None (XClock) Exec exec /usr/X11R6/bin/xclock -digital
AddToFunc RestartFunction "I" Module FvwmPager 0 0
+                         "I" None (XClock) Exec exec /usr/X11R6/bin/xclock -digital

amlug however this xclock code not appear working for me? i try your code and variations of both with result of no success or change. FvwmButtons maybe not needed because -digital flag on xclock only show text? he must not be clickable like button. i am excited about FvwmButtons behavior of (Swallow(NoClose,UseOld) however because i see one copy and he start fresh like FvwmPager on fvwm restartion. i am also excited about Style XclockBox !Borders, !Title, WindowListSkip, Sticky, StaysOnTop, NeverFocus because this applies to only XclockBox instance and not all xclock.

today xclock still open in top left corner. i cannot make him open in specific location. i use 1920x1080 display if this is useful informations. 1 display and no special upscaling.


addendum: thomasadam has precious bear toyanimal :)

With geometry you can place it anywhere. Test this code in your FvwmConsole. I added light blue color. My date/time is in right bottom corner.

Exec exec xclock -geometry 240x44-130-20 -digital -bg "light blue"

xclock-geometry

2 Likes

thanks you significantly amlug using -geometry -97-3 result xclock to open in perfect location! i forgot about this -geometry argument. photographing amlug xclock beneficial for my geometry’s calculations. please forgive because X11 configuring is new task for me. i am not expert.

this is my ~/.fvwmrc changes of relevance today if other persons want guidance:

Style "xclock" StaysOnTop, NeverFocus, !Borders, !Title
######################## Initialization Functions ############################
AddToFunc InitFunction    "I" Module FvwmPager 0 0
+                         "I" None (XClock) Exec exec /usr/X11R6/bin/xclock -geometry -97-3 -digital
AddToFunc RestartFunction "I" Module FvwmPager 0 0
+                         "I" None (XClock) Exec exec /usr/X11R6/bin/xclock -geometry -97-3 -digital

he open to correct location today. xprop write window gravity: SouthEast for xclock. :)

i am curious however, for what reason is Exec exec? why not Exec only? i see exec is shellcommand but no existence of manpage using man exec. i use exec -h and he close my SSH (-hangup)?

oops, i read answer for exec here on this stackexchange post however i am confused for why specials lines in /usr/X11R6/lib/X11/fvwm/.fvwmrc use Exec exec […] and different specials lines of him use Exec […] (not use exec)

this is lines i find of him today:

AddToMenu Utilities "Utilities" Title
+                   "Top"       Exec exec xterm -T Top -n Top -e top

[…]

AddToMenu Utilities "Utilities" Title
+                   "Reset X defaults" Exec xrdb -load $HOME/.Xdefaults

if exec replace current process with […] for memorylimit/exiting/security, whynot all use exec? apologise if this isn’t correct location for this discussion. xclock positions is resolved with -geometry option

In a recent post by @somiaj, a short description about the two Exec exec.

the first Exec tells fvwm to run the command, the second exec is a shell command to launch a new shell.