On 2019-03-21 09:48:36 Dr. Nikolaus Klepp wrote: > Anno domini 2019 Wed, 20 Mar 23:46:39 -0500 > > J Leslie Turriff scripsit: > > On 2019-03-15 02:52:33 Dr. Nikolaus Klepp wrote: > > > Anno domini 2019 Thu, 14 Mar 22:40:38 -0500 > > > > > > J Leslie Turriff scripsit: > > > > On 2019-03-14 20:15:13 Michael wrote: > > > > > On Thursday 14 March 2019 06:26:16 pm J Leslie Turriff wrote: > > > > > > On 2019-03-11 04:12:29 Dr. Nikolaus Klepp wrote: > > > > > > > Anno domini 2019 Sun, 10 Mar 11:16:03 -0500 > > > > > > > > > > .> > J Leslie Turriff scripsit: > > > > > > > > On 2019-03-10 10:35:32 BorgLabs - Kate Draven wrote: > > > > > > > > > On Sunday 10 March 2019, J Leslie Turriff wrote: > > > > > > > > > > Is there a way to make TDE aware of running > > > > > > > > > > non-Trinity applications so that they can be resurrected > > > > > > > > > > after Logout/Login? I have at least one X11-based > > > > > > > > > > application (X2 - The Programmer's Editor) that I use > > > > > > > > > > extensively, and it would be nice if it could remember > > > > > > > > > > across Logout/Login events. I'm wondering if something > > > > > > > > > > like a DCOP wrapper might do the job? > > > > > > > > > > > > > > > > > > Load the application into your autostart dir. > > > > > > > > > /home/foo/.trinity/autostart > > > > > > > > > Also, check the program's setting to see if it has an > > > > > > > > > autostart feature. > > > > > > > > > > > > > > > > Yes, that would work if I wanted it to start at every > > > > > > > > login, not just if it was running when I logged out... > > > > > > > > > > > > > > Once upon a time there was a little kingdom where all > > > > > > > applications held the X11 standards high and the grand master > > > > > > > of session management called > > > > > > > > > > > > So I guess you're saying that there's no way to get TDE to > > > > > > notice my X2, then. > > > > > > > > > > You can use the autostart dir [1], but you'll need to do the work > > > > > yourself. You could add a wrapper to starting X2 and a script in > > > > > the autostart dir. Or better would be a check script in the > > > > > shutdown dir (if it exists) and a corresponding script in the > > > > > autostart dir. > > > > > > > > > > Here's some out of context code from something else, hack-and-slash > > > > > as needed. > > > > > > > > > > #!/bin/bash > > > > > /path-to-X2/X2 > > > > > Pid=`pgrep -f /path-to-X2/X2` > > > > > if [ "$Pid" != "" ] ; then > > > > > # echo Already running... > > > > > # ps "$Pid" > > > > > touch /home/foo/.trinity/apps-to-restart/X2 > > > > > exit > > > > > fi > > > > > > > > > > In any event, what you want can be done, it just might be painful. > > > > > > > > > > Best, > > > > > Michael > > > > > > > > > > [1] Mine seems to be called: /home/michael/.trinity/Autostart > > > > > > > > You're apparently misunderstanding what I'm looking for. I don't > > > > want this program to Always start when I login, only when it was > > > > running at the time that I previously logged out. That's why I > > > > wondered if some sort of DCOP wrapper might be appropriate. > > > > > > > > Leslie > > > > > > As your editor is not xsession-aware you have to wrap it some shell > > > script, that just saves the state of x2 in the form of commandline > > > invocation in a file when it's close due to TDE shutdown. So there is > > > no invocation of X2 when no X2 was open when TDE closed the session. At > > > TDE login you execute that file with invocations and be happy. Sure, > > > you have to manage some stuff like which desktop to put it, window > > > placement etc. but that's not that complicated. > > > > > > Nik > > > > Yes, but what to put in that wrapper? That's what my original question > > was. > > Ah, ok. I do not know X2, is it this one? > http://www.tangbu.com/x2main.shtml If yes, then there is one notable things > about the application (but correct me if I'm wrong): The X11 application > "xx" does not set the X11 window title to the filename of the file that's > edited - which makes it an extremly hostile application and difficult to > find the filename in a general solution. The terminal application "x" does > neither, but you can get the filename from the current instance if you > parse the escape-sequence (<ESC>[H, then some chatter and there comes the > filename). > > Anyway, the geometry of each window and the desktop where it runs on can be > found like this: > > for ID in $(xwininfo -all -root|awk '/"X2 Editor Version 2.08.1"/ {print > $1}'); do echo $(xprop -id $ID|awk '/_NET_WM_DESKTOP/{print $3}') \ > $(xwininfo -id $ID|awk '/geometry/ {print $2}'| tr -c '[0-9]' ' ') \ > $(/do/some/black/magic/to/get/filename/from/X2) > done > /some/place/to/store > > Example /some/place/to/store: > 2 484 559 58 0 /tmp/a.txt > 4 100 100 100 100 /tmp/b.txt > > To restore each window you basicly do something like this - nota bene: if > x2 were a nice application, you would not have to do this trickery to get > it's window id: > > cat /some/place/to/store | while read DESKTOP W H X Y FILE; do > A=$(xwininfo -all -root|awk '/X2 Editor Version 2.08.1/ {print $1}') > /path/to/xx $FILE & > sleep 1 > B=$(xwininfo -all -root|awk '/X2 Editor Version 2.08.1/ {print $1}') > ID=$(echo $A $B|tr ' ' '\n'|sort|uniq -u) > xdotool set_desktop_for_window $ID $DESKTOP > xdotool windowsize $ID $W $H > xdotool windowmove $ID $X $Y > done > > I hope that get's you started. As I do not know how you use X2 (xx or x > ...), I cannot give you a hint how to obtain the filename of a window > instance. > > Nik > > > Leslie Okay, I seem to have a working script (attached) that remembers the X applications I'm concerned with (thank you, Nik); now, how do I tell Trinity to execute it at shutdown time before it kills said applications? Leslie
#!/bin/bash # Extract information for instances of the X2 editor. # # NB: X2 programs may be restored to the wrong windows/positions if the # order of ps output is different from the order of xwininfo output. # # Content of ~/activeXapps.info: # .---------------------------------- Instance # . .-------------------------------- Desktop # | | .---------------------------- Width # | | | .------------------------ Height # | | | | .-------------------- Left # | | | | | .---------------- Top # | | | | | | .-------------- Path to program # | | | | | | | .-- Arguments for program # V V V V V V V V # 0 2 484 559 58 0 path/to/bin switches, path/to/file, etc. # 1 4 100 100 100 100 path/to/bin switches, path/to/file, etc. # 2 3 75 200 75 0 path/to/bin switches, path/to/file, etc. # Clean up in case restoreXapps failed. if [ -f ~/activeXapps.info ]; then rm ~/activeXapps.info fi # Begin counting instances. instance=0 # Collect information about X2 instances: # Get the full name of the program. X2Bin=$(which xx) for ID in $(/usr/bin/xwininfo -root -all \ | /usr/bin/grep 'X2 Editor Version 2' \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/cut --delimiter=' ' --field=2) do # Get the desktop number: desktop[$instance]=$(/usr/bin/xprop -id $ID \ | /usr/bin/egrep '^_NET_WM_DESKTOP' \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/cut --delimiter=' ' --field=3) # Get the window size and position: geometry[$instance]=$(/usr/bin/xwininfo -id $ID \ | /usr/bin/egrep '^ -geometry' \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/tr 'x+' ' ' \ | /usr/bin/cut --delimiter=' ' --fields=3-) # Get the program arguments (can't get them from xwininfo): argList[$instance]=$(/usr/bin/ps aux \ | /usr/bin/grep xx \ | /usr/bin/grep --invert grep \ | /usr/bin/tail --lines=1 \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/cut --delimiter=' ' --fields=12-) # Write them out: echo "$instance $desktop[$instance] $geometry[$instance] $X2Bin $argList[$instance]" # Count this instance: (( instance += 1 )) done >> ~/activeXapps.info # Collect information about xthe instances: # Get the full name of the program. xtheBin=$(which xthe) for ID in $(/usr/bin/xwininfo -root -all \ | /usr/bin/egrep 'THE 3.3' \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/cut --delimiter=' ' --field=2) do # Get the desktop number: desktop[$instance]=$(/usr/bin/xprop -id $ID \ | /usr/bin/egrep '^_NET_WM_DESKTOP' \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/cut --delimiter=' ' --field=3) # Get the window size and position: geometry[$instance]=$(/usr/bin/xwininfo -id $ID \ | /usr/bin/egrep '^ -geometry' \ | /usr/bin/tr --squeeze-repeats ' ' \ | /usr/bin/tr 'x+' ' ' \ | /usr/bin/cut --delimiter=' ' --fields=3-) # Get the program arguments: argList[$instance]=$(/usr/bin/xwininfo -id $ID \ | /usr/bin/egrep '^xwininfo: ' \ | /usr/bin/cut --delimiter=' ' --field=8-) # Write them out: echo "$instance $desktop[$instance] $geometry[$instance] $xtheBin $argList[$instance]" # Count this instance: (( instance += 1 )) done >> ~/activeXapps.info exit
--------------------------------------------------------------------- To unsubscribe, e-mail: trinity-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxxxxxx For additional commands, e-mail: trinity-users-help@xxxxxxxxxxxxxxxxxxxxxxxxxx Read list messages on the web archive: http://trinity-users.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting