LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-30-2009, 04:19 PM   #1
rrrssssss
Member
 
Registered: Mar 2005
Posts: 266

Rep: Reputation: 32
[SOLVED] Focus Problem with Dual Monitors when Launching Program with Bash script


Hello programming forum,

My computer has two monitors and each monitor operates from its own separate X server.

I want to launch a program on the second monitor from the first monitor using a simple bash script (DISPLAY=":0.1" /usr/bin/mythfrontend &).

This approach works but once I lose focus on the application in the second monitor, I can not get focus back again unless I close the application and open it back again.

The only remedy is to launch the program from the second monitor instead of the first monitor.

Is there a way I can fix this problem such as adding code to the bash script so that I can launch the program from the first monitor and be able to regain focus in the second monitor (with a mouse click) if it is lost?

Thank much in advance,
Roy

Last edited by rrrssssss; 12-01-2009 at 05:43 AM.
 
Old 12-01-2009, 05:42 AM   #2
rrrssssss
Member
 
Registered: Mar 2005
Posts: 266

Original Poster
Rep: Reputation: 32
Solved

I figured out a simple way to start mythfrontend from the first monitor and the focus problem be resolved. I used the following script below:

#!/bin/bash
DISPLAY=":0.1" /usr/bin/icewm &
sleep 1
DISPLAY=":0.1" /usr/bin/mythfrontend &

If both commands (icewm and mythfrontend) are combined into one script instead of using two separate scripts, the focus problem is resolved. I had been using separate scripts, one script for icewm and another script for mythfrontend. That will not work. Both commands must be in the same script. Now I can start mythfrontend from my first monitor and have no focus problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to set the focus to the window my bash program is running in? jlinkels Programming 1 09-18-2008 05:26 AM
Compiz - with Dual Monitors - screen focus NoStop Linux - Desktop 0 01-16-2008 09:47 AM
Independant monitors: launching an app to a monitor from CLI / script piete Slackware 0 12-12-2006 09:41 AM
launching programs from a bash script Ian D Linux - Software 2 10-25-2005 04:31 PM
Dual Monitors Problem Schmoe Linux - Software 2 06-30-2002 11:09 PM


All times are GMT -5. The time now is 07:45 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration