Prevent application from grabbing some keys.

I have media keys for volume control on my keyboard and use them. I have mapped them with KDE hotkeys control module. All work fine. However, some applications, for example, SDL-based ones, grab all keyboard input, including media keys. I lose ability to change audio volume until I stop the application.
The question is: How can I protect some keys from being grabbed by applications? I mean, how to make sure that some key events always reach target app, even when another app tries to grab all input. For example, Ctrl-Alt-F1 still works in all apps. Is there X server config to protect another key?
Last edited by Barafu Albino Cheetah (2011-09-16 20:20:31)

I've made two AUR packages for this:
https://aur.archlinux.org/packages.php? … _Search=Go
I'm just using libx11-nokeyboardgrab now, so I let the sdl one go unmaintained.
libx11-nokeyboardgrab is incompatible with dmenu (edit: and password screensavers), but works with everything (also dialog pop-ups).
sdl-nokeyboardgrab doesn't grab non-sdl programs (Virtualbox, maybe Wine, I haven't tested it).
It doesn't prevent mouse grab, because that's necessary for FPS games and Virtualbox mouse mode.
I have thought of adding in a mechanism where the mouse is only grabbed on some condition. Like the existence of a "/tmp/grabmouse" file. But I've been fine without it.
One problem that occurs even with mouse grab enabled is that when the game loses focus, it loses the mouse grab too. When you switch back to the game, you need to do something to make it re-grab the mouse.
For instance in Urban Terror (FPS), when you switch back to the game, the mouse behaves erratic until you press ~ for Console (which normally ungrabs the mouse) and then press it again.
Last edited by Procyon (2012-01-23 20:14:08)

Similar Messages

  • Prevent games from grabbing every key & mouse button

    I've been gaming a lot of native linux games (especially the Humble Bundle ones), and a great deal of them tend to grab the all the keyboard and mouse keys/buttons.
    This means that NO keys work; for example, I've a mouse with lots of buttons, and some of these control my volume (via xbindkeys). Some media keys on my keyboard do this as well, and control vlc play/stop (also via xbindkeys), and some other switch desktop, minimize, etc (via compiz keybinds).
    Is there a way to keep these games for grabbing these keys/mouse-buttons? I kind of lose control of my desktop while they're running. I belive they grab the mouse entirely somehow, though I must admit, I'm not an expert on this area.

    I've made two AUR packages for this:
    https://aur.archlinux.org/packages.php? … _Search=Go
    I'm just using libx11-nokeyboardgrab now, so I let the sdl one go unmaintained.
    libx11-nokeyboardgrab is incompatible with dmenu (edit: and password screensavers), but works with everything (also dialog pop-ups).
    sdl-nokeyboardgrab doesn't grab non-sdl programs (Virtualbox, maybe Wine, I haven't tested it).
    It doesn't prevent mouse grab, because that's necessary for FPS games and Virtualbox mouse mode.
    I have thought of adding in a mechanism where the mouse is only grabbed on some condition. Like the existence of a "/tmp/grabmouse" file. But I've been fine without it.
    One problem that occurs even with mouse grab enabled is that when the game loses focus, it loses the mouse grab too. When you switch back to the game, you need to do something to make it re-grab the mouse.
    For instance in Urban Terror (FPS), when you switch back to the game, the mouse behaves erratic until you press ~ for Console (which normally ungrabs the mouse) and then press it again.
    Last edited by Procyon (2012-01-23 20:14:08)

  • Prevent application from stealing all input

    Some applications grab all keyboard keys in such a way, that my window manager (i3) does not get the keys any more that are meant for it. Until recently, I only came across dosbox and the qemu window with this behavior. But both of them offer a way to stop grabbing every input of the X server (by default, dosbox uses the key binding CTRL+F10, QEMU uses CTRL+ALT). But then I ran OgreSampleBrowser for which I could not find such a key binding (did I miss something). Thus, now I'm interested in a general way to prevent applications to grab every key event if they are part of a key binding of my window manager. Is there some way to only whitelist the ones, which may grab all keys? Additionally to that, OgreSampleBrowser also unconditionally grabbed all mouse input, but I could live with that.
    Any ideas or help, how to circumvent the issue (and still being able to interact with the window manager) is appreciated.

    It is kind of difficult to tell you anything without seeing what you do when the user logs off and just what you mean by turns off. Could you please expand on that: does the app close, do you loose your VPN connect, just what happens?

  • How can I prevent Applications from being copied to external drive?

    Hello,
    Just a quick one...
    I run a studio in an education evironment. We've got quite a lot of software installed on our machines (Mac OS X 10.7.4) and there's always the chance that students will copy applications from the Applications folder onto an external drive to take home!
    Obviously this is becoming increasingly easy with large USB sticks and Applications which are entirely contained in the Applications folder.
    Is there any way that students can still run these applications during class but prevent them from copying the whole applications?
    With thanks in advance,
    Lawrence

    You can hide the Applications folder, but it isn't a total solution. Open Terminal and type:
    cd /
    sudo chflags hidden /Applications

  • Prevent application from quitting

    Does anyone know a program that can disapple the "quit" option in programs??
    I need it because i run one of my macs as an iTunes "server", and running on a miniMac i also have an n-wifi application running, that i will prevent from accidential quitting...
    Does this make any sense??
    Message was edited by: Beeker2Beeker

    motech29 wrote:
    would that slow down the mac if something was constantly checking to see if app was running ?
    It may be possible to write the application in a way that would constantly "poll" the system to see if iTunes was running, but that's a very bad idea. An application like that would waste cycles like you're thinking.
    However, Apple provides ways to accomplish the same thing without constant polling and with minimal impact on performance. Instead of polling, you simply tell the system you're interested in receiving a notification any time an application quits, at which point you see if it's iTunes. If it isn't, you just ignore it, and if it is, you force iTunes to launch again. So, nothing happens until applications quit.
    I wrote a little app to do just that. http://homepage.mac.com/mdouma46/images/KeepiTunesRunning.zip (~ 60 KB). It runs as a background application (so there's no icon in the Dock). You'll want to add it to your login items and when it's launched, it'll make sure iTunes is running. Then, if iTunes were to quit, it would automatically re-launch it. If you choose to Logout, Shutdown, or Restart, Keep iTunes Running will stop caring whether iTunes is running and allow the logout, shutdown, or restart to happen properly.
    [EDIT] added an AppleScript that you can use to quit Keep iTunes Running if it's running.
    Hope this helps....
    Message was edited by: MarkDouma®

  • Time Capsule preventing me from accessing some sites

    Hello,
    I've been using a 1TB Time Capsule as a router and external HD in my home network for almost one year and never had this problem, but around 3 days ago I noticed that I couldn't access certain sites like wikipedia.org and last.fm anymore (My browser doesn't get past the "waiting for www.wikipedia.org" when I try) in any of the computers I have connected to the TC.
    When I disconnected my modem from the TC and connected it directly to one of my computers I didn't have any problems accessing any sites, so the issue is definitely with the router.
    I already tried rebooting the TC and renewing the DHCP on AirPort, but neither worked.
    My TC has firmware 7.4.1 and is connected directly to 3 PCs running Windows XP Home with Firefox and wirelessly to 2 MacBooks running 10.5 Leopard with Safari, and they all have the same issue with the same sites.
    Any help would be greatly appreciated.

    buemba,
    I have been having the same exact problem--it just started about a week ago. I had gotten the 500gb Time Capsule in December and it has been working flawlessly until now.
    I've had numerous conversations with my ISP (Comcast) who swears up and down that it is not their problem to correct. I've come to learn they might be right: I can plug my laptop directly into my cable modem and access the sites which I cannot access behind my TC. It isn't a problem limited to one computer on my network--I have three Apple computers and a Linux box that can't connect to the same sites.
    I tried everything--restarted the TC, complete with new profile settings, did a powerflush of my modem, even left it off for a day hoping it would lease a new IP that would fix this problem (it didn't).
    My wife and I both rely on our Internet to do University coursework, and unfortunately, one of the sites we can't access is our online classrooms. This is a HUGE problem. I've scoured the Internet searching for a solution to this issue but have yet to come across one that applies to the Time Capsule. I really don't want to stop using my TC's router capability but short of getting a new router, I don't have the solution for this problem and nobody else seems too, either.
    Apple: help, please?
    UPDATE: Searched these forums, found a couple of other threads with other users having the same problem:
    http://discussions.apple.com/thread.jspa?messageID=9483141
    http://discussions.apple.com/thread.jspa?messageID=9421774
    http://discussions.apple.com/thread.jspa?messageID=9254854
    This is definitely not an isolated occurrence.

  • Prevent apps from stealing focus

    Is there a general overall setting for preventing applications from stealing focus?

    i'm having problems with itunes 6.0.5(20). I set up a playlist to burn, hit the burn button, it asks for a cd, i feed it the cd, it says "checking media...". Then, that's all it needs from me, so I go back to my word processing and while I'm typing in that suddenly the iTunes window pops back to the foreground - not asking for input or anything, it just pops to the foreground once the write process starts on the cd. I've had it steal focus from Firefox, Finder, Word, pretty much everything at one time or another.
    EDIT: I've found if I minimize iTunes it won't pop up and steal focus, but if I just switch it to the background instead of minimizing it, it will pop to the foreground

  • Sandboxd prevents preview from opening images

    The sanboxd is preventing me from opening some, but not all, images with preview.
    The system.log shows:
    Dec 16 23:36:17 computer_name Preview[7570]: PVImageContainer initWithURL:file://localhost/Users/username/Library/Containers/com.apple.Previe w/Data/file.jpg failed, error = Error Domain=NSCocoaErrorDomain Code=257 "The file âfile.jpgât be opened because you donât have permission to view it." UserInfo=0x104ef6960 {NSFilePath=/Users/username/Library/Containers/com.apple.Preview/Data/file.jpg, NSUnderlyingError=0x104e71ec0 "The operation couldnât be completed. Operation not permitted"}
    Dec 16 23:36:17 computer_name sandboxd[10125] ([7570]): Preview(7570) deny file-issue-extension /Users/username/file.jpg
    Dec 16 23:36:17 computer_name Preview[7570]: Bookmark failed to issue extension for item /Users/username/Library/Containers/com.apple.Preview/Data/file.jpg (depth=1): Operation not permitted
    I have recently migrated from a macbook with 10.6 to a macbook air with 10.7. I used migration assistant via wifi.
    The problem arises both on newly downloaded images as well as images that were transferred via migration assistant.
    The file permission is 755, and File->View permissions looks perfectly fine.
    Any idea what is causing this and how to I prevent this from happening again?

    Hi Linc,
    thank you for the suggestion, but unfortunately it did not help. For the top directory, and all subsequent directories, I have read&write (755) permissions, as well as for the files that i can not open.
    This appears to happen randomly. Some directories are affected, some are not, and it appears to happen to all files in certain directories.
    Interestingly, if I control-click and select e.g. Explorer, I can view the image. Also, if I copy the file to my Desktop, I can also view the image. So it only happens to Preview in certain directories.

  • Running application from installer in vista prevents drag and drop

    Running a desktop application from Vista and Windows 7 through a wizzard, prevents doing a drag and drop from the desktop or another windows explorer to our java application.
    We are using a windows wizard to install the application once it finishes it launches the application within the application the drag and drop work perfectly, but I can not drag from desktop or external windows explorer into my application, dragging from the application to the desktop or to another windows explorer is working fine.
    If we run the application by clicking directly on the exe file (generated by the installer app), the application launches and do not present the anomaly (Drag and drop into a out side the applications work fine).
    So the issue might be related to the way the installer executes the application, that maybe have a different configuration or windows permissions are not set correctly when started by the installer.
    Both ways of launching the application have the same working directory the only difference i found was in the system environment (System.getenv()) the one that works has a SESSIONNAME key with a CONSOLE value in it, could this be the problem?
    Any idea on how to workaround this issue or some idea to look at the installer will be kindly appreciated.

    One idea is to use [Java Webstart|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp] *(<- link)* as your installer. It might not fix the D'n'D problem, but at least if you get to the point of telling Sun about it, they will care (at least) one iota about fixing it.

  • The application detected an error that prevents changes from being saved.

    Hi. I'm having this problem almost all the time when I do some color correction.
    "The application detected an error that prevents changes from being saved. To avoid losing your work, quit Final Cut Pro."
    Any ideas why this is happening?
    I'm on a 2010 Mac Pro running latest Mavericks and latest FCP X.
    I already removed FCP X, and all the effects I have installed. But still the issue persists.
    Thanks.

    That could have happened. I can't remember though.
    Is there any work around?
    I currently only have 1 open library and 1 event on it. If I move or copy that event into a new library, would that in theory work?
    Thanks for the help so far.

  • Restore some application from time machine problem.

    Hi Everybody,
    I just restored my MBP from Time Machine, everything went fine. But I feel my MBR start up much slower than before. So now I want to do a clean install Leopard.
    I would like to ask you guys who experiences in Time Machine that after installing Leopard, I want to restore some applications from Time Machine such as MS office, Wow, Photoshop...Will they fully function if I restore from TM?
    I acknowledge that some applications are like packages so after installing in Mac OS, they are actually located in different places in the system. Whereas others is like small application so we just copy and use. So if big applications as packages, I can not just copy from TM and put it in my new Leopard to use, can't I? If I can't, so is there any ways I can copy it back and use?
    I am so confusing about this and I hope very much that somebody could help me out this problem, I would greatly appreciated.
    Thank you.

    +I just restored my MBP from Time Machine, everything went fine. But I feel my MBR start up much slower than before. So now I want to do a clean install Leopard.+
    Wait on the erase and install. Launch Disk Utility which is in the Applications > Utilities folder and Verify your disk and repair permissions. If Verify shows any errors boot from the Leopard install DVD by holding the "c" key down until the spinning gear appears. Pick a language and choose Utilities > Disk and run Repair until no errors appear. Repair permissions.
    If that doesn't work try resetting the PRAM which quite often fixes slow boot times.
    http://docs.info.apple.com/article.html?artnum=2238
    +Would like to ask you guys who experiences in Time Machine that after installing Leopard, I want to restore some applications from Time Machine such as MS office, Wow, Photoshop...Will they fully function if I restore from TM?+
    I don't know about Wow but Photoshop and MS Office install too many files in too many places for it to be practical to restore them from Time Machine backups after doing an erase and install. You need to reinstall those from the original disks for those applications.

  • Were sorry but "application" has encountered an error that is preventing it from working correctly. Repair now?

    Hello
    win 7- office prof. 2013
    after installation is OK. but every time i restart i get 
    "Were sorry but "application" has encountered an error that is preventing it from working correctly. Repair now?"
    it ask me again for my product key. and than everything is OK until next time i restart my computer.
    it happens with all the applications
    it happens also with other vision of office.
    I tried to uninstall with your tool, I tried  to erase from the registry, clean boot, safe mode... and nothing works

    Hi,
    Uninstall Office and install it again in Clean Boot to determine if background programs are interfering with this:
    http://support.microsoft.com/kb/929135
    Regards,
    Melon Chen
    TechNet Community Support

  • I have an ancient laptop (from 2005) that has my entire music library. This laptop barely works and some keys don't type anymore. How can I get all this music transferred to another computer, or available to me on the cloud?

    I have an ancient laptop (from 2005) that has my entire music library. This laptop barely works and some keys don't type anymore. How can I get all this music transferred to another computer, or available to me on the cloud?

    No... do not move programs.
    About the iTunes library files
    Your iTunes library files track the media you add to iTunes, how you've organized it, and other information such as playlists. By default, these two files are in your iTunes folder:
    Mac OS X: /Users/username/Music/iTunes/
    Windows XP: C:\Documents and Settings\username\My Documents\My Music\iTunes\
    Windows Vista: C:\Users\username\Music\iTunes\
    Windows 7: C:\Users\username\My Music\iTunes\
    Windows 8: C:\Users\username\My Music\iTunes\

  • Firefox connects to google-analytics for some sites, and then gets stuck, and I can never get onto the site. How do I prevent Firefox from connecting to google-analytics? I use XP with service pak 3 in English

    Firefox connects to google-analytics for some sites,when i click on links in websites or emails and then gets stuck, and I can never get onto the site. Or opens a new bower behind the one i'm usind that's blank i don't even know it's there untill i close the one i'm using. How do I prevent Firefox from connecting to google-analytics? Or opening a blank bowser behind the one i'm using. I use XP with service pak 3 in English
    == This happened ==
    A few times a week
    == a couple months ago

    I got the same issue.
    I go on a website and all the sudden another window pops up with "results.google-analytics.com" or "search.google-analytics.com". It has often ads for other sites for example. black single dating site
    how can I can I stop that from happening again?
    I didn't download or do anything, just visit websites, that I visit on a regular basis.
    OS: Windows XP
    Firefox Version: 3.6.6

  • I'm having some difficulty with Time Machine.  It appears to be deleting backups from random dates on my external hard drive.  I am not deleting them.  Are they hidden and how do I prevent this from happening?  Can I retrieve them?

    I'm having some difficulty with Time Machine.  It appears to be deleting backups from random dates on my external hard drive.  I am not deleting them.  Are they hidden and how do I prevent this from happening?  Can I retrieve them?

    ... I didn't know that Time Machine was more a last resort back up instead of main back up.
    Don't rely upon Time Machine to the exclusion of all else. I compliment Time Machine with a periodic "clone". TM is much better than nothing, but it's a safety net, not a hammock
    Here is my understanding of Time Machine's file deletion algorithm, distilled from Pondini's FAQ, Apple's KB articles, and my own observations.
    Time Machine deletes ("thins") files from the backup disk as follows:
    Hourly backups over 24 hours old, except the first backup of the day
    Daily backups over 30 days old, except the first backup of the week
    Older backups get deleted when Time Machine requires space and you deleted them from the source disk.
    Therefore, assuming TM has been performing at least one backup per day, backup files will remain available:
    at least thirty days, if they existed on your Mac for at least a day
    until you run out of space, if they existed on your Mac for at least a week
    In addition to the above, Time Machine always keeps one complete copy of your source disk so that the entire volume could be restored if necessary. Any files that remain on your source volume will be present on the TM backup, no matter how old they are.
    If you are using 250 GB of space on your source disk, its Time Machine backups are likely to require at least twice that much. A good estimate of the minimum required backup volume size would be about three times the size of your source disk - 1.5 TB in your case.
    A more thorough explanation would require Pondini since he has plumbed Time Machine's mysteries far more than I have.
    http://support.apple.com/kb/HT1427

Maybe you are looking for

  • I need to reinstall lightroom 5 after a hard drive format. I do not have a disc.

    I need to reinstall lightroom 5 after a hard drive format. I do not have a disc.

  • Syntax for calling a form & passing a query condition

    I have a stored PL/SQL procedure where I am attempting to link to a master detail form from a button created in the procedure. The procedure is called from a form based on a table. I want to pass an id from the first form to the second when the user

  • Nokia C5: When on Headphone, Ringtone in Loudspeak...

    Is it a feature or a bug? When I listen to some music using my headphones or headset and an SMS or Call is arriving, the SMS arriving-signal or the Call announcement ringtone is coming out of the loudspeaker of the Nokia C5 but I do not hear it in th

  • Error in SMQ1 outbound queue in SAP CRM

    Hi SAP CRM Experts, When the changes are made to an existing order in SAP CRM and in change mode showing the message as "Document is being distributed-changes are not possible".I have cheked the SMQ1 , there was  sysfail with info " The ASSERT condit

  • What is wrong with this coding?

    I'm working on a page system tutorial from Studio22.org and am converting as2 to as3.  Not sure why this isn't working.  It's loading the fade out movie clip but not the next page.  It's from the Flash Site 3 tutorial.  It's showing this error TypeEr