LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-26-2011, 05:23 PM   #1
clstanton
LQ Newbie
 
Registered: May 2008
Posts: 27

Rep: Reputation: 0
extract title of aixterm window


I have a script that opens six xterm windows. Each window serves a different task for the research I perform. After each window opens I need to go to that window and do some amount of set-up (get to correct directory, open specific files, and load software). I would like to have these tasks initiated through script(s). I thought if I could identify the window (named during creation) then I could install a script file that runs from the .profile.

I have spent most of the day trying to find out how to get the window title. So far with no luck. I have found several ways to change the title, but not extract what is there.

Any ideas on how to extract the window title example (I/O Report) or another way to accomplish the goal
 
Old 09-26-2011, 05:49 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Try:
Code:
wmctrl -l
Update: On re-reading, I think what you want is a method of getting the window title for the terminal window that the script is running in. If so, you can do something like this:
Code:
wmctrl -l | grep `wmctrl -v -r :ACTIVE: -b add,above 2>&1 | awk '/Using window:/ {print$3}'`

Last edited by macemoneta; 09-26-2011 at 06:05 PM.
 
Old 09-26-2011, 06:41 PM   #3
clstanton
LQ Newbie
 
Registered: May 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Macemoneta

Thanks for the reply, however I received this error.

ksh: wmctrl: not found.
usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list...
[-f pattern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...]
 
Old 09-26-2011, 07:13 PM   #4
dickey
Member
 
Registered: Jun 2009
Posts: 43

Rep: Reputation: 18
re: getting title from aixterm

xprop is more likely to be found - the WM_NAME property would have the information.

xprop wants a window-id. xterm's would have that as $WINDOWID in your environment.

By the way, aixterm isn't xterm. Check its manpage for $WINDOWID (the workarounds are less portable if it doesn't set that).

Last edited by dickey; 09-26-2011 at 07:18 PM.
 
Old 09-26-2011, 07:39 PM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Quote:
Originally Posted by clstanton View Post
Macemoneta

Thanks for the reply, however I received this error.

ksh: wmctrl: not found.
usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list...
[-f pattern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...]
If you don't have a given software package, you need to use your distribution's package management software to install it.

For deb based systems:

apt-get update
apt-get install wmctrl

For rpm based systems:

yum install wmctrl
 
Old 09-26-2011, 09:17 PM   #6
clstanton
LQ Newbie
 
Registered: May 2008
Posts: 27

Original Poster
Rep: Reputation: 0
When I echo the $WINDOWID I get a seven digit number (whatever that means).

I appreciate the attempts to help. Maybe it is just beyond me or can't be done. I still think it would be a time saver for me if I could figure it out.
Thanks again
 
Old 09-27-2011, 04:52 AM   #7
dickey
Member
 
Registered: Jun 2009
Posts: 43

Rep: Reputation: 18
re: title from aixterm

As a shell script, for instance

#!/bin/sh
if test -n "$WINDOWID"
then
xprop -id $WINDOWID |fgrep 'WM_NAME(STRING)'|sed -e 's/^[^=]*= //'
else
echo "? WINDOWID is not set"
fi
 
Old 09-27-2011, 05:05 PM   #8
clstanton
LQ Newbie
 
Registered: May 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Thank you very much. I didn't understand until I played with it today but I have it now.
Thanks again
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to have the title bar of a X window at the bottom ? Linux.tar.gz Linux - Software 4 02-19-2011 05:25 AM
mrxvt window title. page_seven Linux - Software 1 08-30-2010 04:36 PM
SRGP window title lito_117 Programming 2 11-13-2007 09:38 AM
Window title font erwinfletch Programming 1 03-23-2007 03:20 PM
Bash: Extract Title Information From Playlist xxfunkxx Linux - Newbie 5 07-28-2004 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration