For what you want to do, you don't actually need to send an f. command at all; 
you should be able to execute an action more directly with

dtaction ExitSession

You have may have to do something to keep your script from getting killed after 
exiting the session but before issuing the shutdown command. Maybe

nohup sh -c 'dtaction ExitSession;sleep 5;exec sudo shutdown -h now' >/dev/null 
2>&1

or something like that (the exact way to issue the shutdown command with needed 
privileges and options will vary by OS and other considerations).

If in some other circumstance, dtaction isn't good enough and you actually DO 
need to script f. commands, I wrote something years ago to do that.

The attached file dtwmcmd.c, when compiled, should allow sending arbitrary f. 
commands to dtwm. (something similar might work with the smaller set of 
commands for mwm, I don't recall whether I tried)

See the comments for examples of compiling it, although on anything other than 
Solaris, you probably want /usr/X11/include and /usr/X11/lib rather than 
/usr/openwin/include and /usr/openwin/lib; evidently on some systems you don't 
even need the options to find those. At any rate, they should at least identify 
the -l options needed.

This is something like what libDtSvc does for a few functions that change the 
backdrop or initiate a dtwm restart, but the have the particular command 
hard-coded. And I reverse-engineered it long before CDE went open-source, by 
using xscope to see what was being passed around; it annoyed me that some 
command (dtstyle?) could trigger a dtwm restart when needed, but a provided 
script could only prompt the user to do the restart themselves.

And being extra stubborn, here's a list of f. commands I dug both out of man 
pages and out of binaries (with strings command). The references are all to 
Solaris 9 man pages (Sun's version of CDE); the sdt* were commands peculiar to 
theirs (they had some of the TriTeal like stuff, such as a graphical workspace 
tool, although that wasn't among those referenced in my list).

In practice, a lot of the commands are not terribly useful from a script 
(especially if they take some sort of implied window context), although one 
person wanted to cycle through workspaces in a loop with a sleep between, 
because they were driving a projection display to show multiple system 
monitoring screens repeatedly, one after another.

The following are the man page references to dtwm "f." commands in Solaris
9.  Primary description is dtwmrc(4), others may be incidental
references.

f.action dtwmrc(4), dticonfile(4), sdtdir2dtwmrc(1), sdthotkey(1)
f.beep dtwmrc(4)
f.circle_down dtwmrc(4)
f.circle_up dtwmrc(4)
f.create_workspace dtwmrc(4), sdthotkey(1)
f.delete_workspace dtwmrc(4), sdthotkey(1)
f.exec dtwmrc(4), dtwm(1), sdthotkey(1)
f.focus_color dtwmrc(4)
f.focus_key dtwmrc(4)
f.focus_key_raise dtwmrc(4)
f.goto_workspace dtwmrc(4), sdthotkey(1)
f.help dtwmrc(4)
f.help_mode dtwmrc(4)
f.ignore dtwmrc(4)
f.kill dtwmrc(4), dtwm(1), VendorShell(3x)
f.lower dtwmrc(4), dtwm(1)
f.marquee_selection dtwmrc(4)
f.maximize dtwmrc(4), dtwm(1), VendorShell(3x)
f.menu dtwmrc(4), sdtdir2dtwmrc(1)
f.minimize dtwmrc(4), dtwm(1), VendorShell(3x)
f.move dtwmrc(4), dtwm(1), VendorShell(3x)
f.next_cmap dtwmrc(4)
f.next_key dtwmrc(4)
f.next_workspace dtwmrc(4), sdthotkey(1)
f.nop dtwmrc(4)
f.normalize dtwmrc(4)
f.normalize_and_raise dtwmrc(4), dtwm(1)
f.occupy_all dtwmrc(4)
f.pack_icons dtwmrc(4), sdthotkey(1)
f.pass_keys dtwmrc(4), sdthotkey(1)
f.post_wmenu dtwmrc(4)
f.prev_cmap dtwmrc(4)
f.prev_key dtwmrc(4)
f.prev_workspace dtwmrc(4), sdthotkey(1)
f.quit_mwm dtwmrc(4)
f.raise dtwmrc(4), dtwm(1)
f.raise_lower dtwmrc(4), dtwm(1)
f.refresh dtwmrc(4), dtwm(1), sdthotkey(1)
f.refresh_win dtwmrc(4), dtwm(1)
f.remove dtwmrc(4)
f.resize dtwmrc(4), dtwm(1), VendorShell(3x)
f.restart dtwmrc(4)
f.restore dtwmrc(4)
f.restore_and_raise dtwmrc(4), dtwm(1)
f.screen dtwmrc(4), sdthotkey(1)
f.send_msg dtwmrc(4), XmDeactivateProtocol(3x)
f.separator dtwmrc(4)
f.set_behavior dtwmrc(4)
f.title dtwmrc(4), sdtdir2dtwmrc(1)
f.toggle_frontpanel dtwmrc(4), sdthotkey(1)
f.version dtwmrc(4)
f.workspace_presence dtwmrc(4)

Undocumented:
f.change_backdrop (used somewhere in libDtSvc)
     usage: f.change_backdrop BackDropName HexPixmapIDNoLeading0x 0 (i.e.
     sender creates and loads pixmap, etc.); not sure whether final 0 arg
     could be anything else

f.set_context     (no known reference outside of dtwm)
     usage: unknown; incorrect (or perhaps any) usage may result in dtwm
     and/or X server crash




Attachment: dtwmcmd.c
Description: Binary data





> On Feb 15, 2021, at 13:14, cyrus torros <sugondesenuts...@gmail.com> wrote:
> 
> Does anyone know how I can use  f.action ExitSession
> in a script? I am trying to chain that together with shut down because
> its the only thing that saves my session properly.
> 
> On 2/13/21, Jon Trulson <j...@radscan.com> wrote:
>> On 2/12/21 9:08 AM, Chase via cdesktopenv-devel wrote:
>>> This patch allows dtksh to be built in parallel in the autotools branch.
>>> 
>> 
>> It sure does :)  Applied, thanks!
>> 
>> -jon
>> 
>>> Thank you for your time,
>>> -Chase
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> cdesktopenv-devel mailing list
>>> cdesktopenv-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel
>> 
>> --
>> Jon Trulson
>> 
>>  "Entropy.  It isn't what it used to be."
>>                           -- Sheldon
>> 
>> 
> 
> 
> _______________________________________________
> cdesktopenv-devel mailing list
> cdesktopenv-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to