Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm having a very specific problem, however any help will aid in understanding X's relationship to the keyboard.

I'd like to be able to launch the ElectricSheep program on top of music playing from XBMC. I've already got the launch script set up, and I can launch ElectricSheep with no problems.

The problem occurs when I try to close it. If I launch ElectricSheep without XBMC running, pressing escape closes it. If XBMC is running (or even if I include a line in the script to kill xbmc before launching), it grabs all keyboard input making my only route out of ElectricSheep to either kill it from an ssh session or kill X itself.

If I run xev while XBMC is running, it recieves no input.

Is there any way to launch an application and explicitly give it the X keyboard? Thanks for any help!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Depends on which application has the 'focus'. I prefer 'focus follows mouse', so whatever window my mouse is over, is where my keyboard presses are going to register. Other modes are 'click to focus' and some variations on 'focus under mouse'. Microsoft Windows is "Click to Focus" (as an example), although if you play with some of the tweakui tools, you can obtain 'focus follows mouse' if you desire.

I'm not sure what mode your X-windows desktop is in initially, I THINK it's usually 'click to focus' by default, you'd have to check yours, my setup for mouse focus is under 'window behavior' in system settings, KDE 4.7.4)

I'll admit I don't have much experience with Electric Sheep (dreaming screensaver, right?) and XMBC (media center, IIRC). Both of those seem like they'd want to be full-screen apps, which could present problems because of the loss of focus. Almost sounds like a problem with ES, since if it's in the foreground (having taken over as a screensaver...) it SHOULD capture any keystrokes and use that as an abort signal to quit, returning your screen to anything else running.

You might try ALT-TAB to flip between the various apps you've got running, which should rotate focus between them, it sort of depends on how XMBC & ES are being used, whether windowed or full-screen.

You CAN control focus command-line-wise using several programs, of course, I've gone blank... looking through my /bin directories and my notes to find them. I wrote my own control programs a few months ago for a project, seeing what I could do programmatically to control windows and focus...

ah, here's one:

wmctrl, man page says you can raise a window using the '-R' option...

There's another that I found more useful, although I'm totally at a loss to name it today, maybe someone will know what I'm hinting at and post it. I'll keep looking though, evidently my blonde is kicking in hard today.

share|improve this answer

As a hack, maybe it's possible to run the "greedy" app in Xephyr or Xvnc or such and sort of decouple it from your actual X server. Use it by remote.

More correct answer might be to reconfigure or fix the code so the "greedy" app isn't.

Or, if the app is really meant to take over the screen, find a way to run ES as a plugin of some sort.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.