On Fri, 22 Feb 2002 12:27:05 -0800 (PST) "Sean 'Shaleh' Perry" <[EMAIL PROTECTED]> wrote:
> On 22-Feb-2002 Jeremy C. Reed wrote: > > Or maybe a simple shell tool using xlsclients and xprop could do > > this? (But not runing all the time.) > > this could work too. > > > But I am not sure if xprop(1) can return all that; it does offer > > "_BLACKBOX_ATTRIBUTES" and "WM_STATE" and more. > > xprop has all of the information it seems. Well, here's a quick stab, for those of you interested. It locates all windows (at least those reported by xlsclients) and starts gathering information about them. Then stores this information in "~/.bbsession". Currently, it get's the workspace and geometry. Gather state won't be difficult, at least not if someone can give me a few pointers (or ideas where to look) regarding the information reported by "xprop". Feedback/pointers appreciated. <script> #!/bin/sh # ------------------------------------------------------------ # Version: 0.01 # Released: 2/23/02 # Author: Jamin W. Collins ([EMAIL PROTECTED]) # Web Site: http://www.asgardsrealm.net/linux/ # E-Mail: [EMAIL PROTECTED] # ------------------------------------------------------------ # # This is a first take at a script to capture window position # information to be used in conjuction with a launcher # application (perhaps bblaunch) to provide a simple means # for starting applications up in the same location. # # Uses the following programs to gather the needed information: # xprop xwininfo xlsclients # # Uses the following programs for data manipulation: # grep sed cut # # Uses the following programs for file manipulations: # tempfile mv # # ------------------------------------------------------------ # # Copyright (C) 2002 Jamin W. Collins # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA# # ------------------------------------------------------------ # set IFS to new line only so we get complete command lines IFS=$'\n' TEMPFILE=`tempfile` echo "#!/bin/sh" >> $TEMPFILE # get hex ids for all windows WINDOW_IDS=(`xlsclients -l | grep Window | sed s/"Window "// | sed s/://`) # loop through each entry in command lines for WINDOW_ID in ${WINDOW_IDS[@]}; do # get the application command line (with arguments) COMMAND_LINE=`xlsclients -l | grep $WINDOW_ID -A 5 | grep Command | sed s/" Command: "//` # grab just the executable, not the command line arguments APP_NAME=`echo $COMMAND_LINE| cut -f1 -d ' '` # Get application's geometry APP_GEOM=`xwininfo -id $WINDOW_ID | grep 'geometry'` # Grab list of BB attributes for later use BB_ATTR=`xprop -id $WINDOW_ID | grep _BLACKBOX_ATTRIBUTES` # get workspace that application is running on (3rd BB attribute?) WORKSPACE=`echo $BB_ATTR | cut -f 3 -d ',' | sed s/" 0x"//` # display retrieved information echo "WINDOW_ID = $WINDOW_ID" echo "Command line = $COMMAND_LINE" echo "Executable = $APP_NAME" echo "Blackbox Attributes= $BB_ATTR" echo "Workspace = '$WORKSPACE'" echo "Application Geometry = $APP_GEOM" echo "" if [ -n "$WORKSPACE" ]; then echo "bblaunch -w $(($WORKSPACE+1)) $COMMAND_LINE $APP_GEOM" >> $TEMPFILE fi done mv $TEMPFILE ~/.bbsession </script> Jamin W. Collins