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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-06-2012, 03:10 AM
|
#1
|
|
Member
Registered: Aug 2012
Posts: 46
Rep: 
|
open windows, by hovering over their taskbar buttons
hello!
I would like to open windows, by hovering over their taskbar buttons (only)
is it possible?
thanks!
|
|
|
|
09-06-2012, 06:27 PM
|
#3
|
|
Member
Registered: Aug 2012
Posts: 46
Original Poster
Rep: 
|
ubuntu, thanks!
but i dont want it to click when I hover over the actual windows, only when I hover over their taskbar buttons!
|
|
|
|
09-07-2012, 05:48 AM
|
#4
|
|
Senior Member
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,624
|
I don't know of anything that can do this by default... Why do you want to do this? You might be able to hack something together with C/C++, but it would be a bit of a kludge, I'm afraid...
|
|
|
|
09-07-2012, 03:43 PM
|
#5
|
|
Member
Registered: Aug 2012
Posts: 46
Original Poster
Rep: 
|
this is a functionality, easily achieved with autohotkey in winxp, and I find it very handy, so I would like it in my linux as well
|
|
|
|
09-08-2012, 07:01 AM
|
#6
|
|
Senior Member
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,624
|
Haha! I've done it! It is a horribly ugly bit of code that makes some terrible assumptions, but better than nothing:
Code:
#!/usr/bin/env python2
#######################
# Edit stuff in here: #
#######################
timestep = 0.1 #seconds between each mouse check
hovertime = 1 #seconds before click is carried out
boxes = [ClickableBox(0,0,100,100),ClickableBox(400,0,100,100)]
#######################
# ...stop here. #
#######################
from Xlib import display, ext, X
from time import sleep
disp = display.Display()
debugLevel = 0
class ClickableBox:
def __init__(self,x,y,w,h):
self.x = x
self.y = y
self.w = w
self.h = h
self.count = 0
self.clicked = False
def update(self,mousePos):
x,y = mousePos
if self.x <= x and x <= self.x + self.w and self.y <= y and y <= self.y + self.h:
if not self.clicked:
self.count += timestep
if debugLevel >= 1: print hovertime-self.count,"to click..."
else:
if self.clicked and debugLevel >= 1:
print "Reset."
self.count = 0
self.clicked = False
if self.count >= hovertime and not self.clicked:
clickMouse()
self.clicked = True
if debugLevel >= 1: print "Clicked!"
def getMousePos():
data = disp.screen().root.query_pointer()._data
return data["root_x"], data["root_y"]
def clickMouse():
mouseDown()
mouseUp()
def mouseDown():
ext.xtest.fake_input(disp,X.ButtonPress,1)
disp.sync()
def mouseUp():
ext.xtest.fake_input(disp,X.ButtonRelease,1)
disp.sync()
if __name__=="__main__":
while True:
for box in boxes:
box.update(getMousePos())
if debugLevel >= 2: print "@#{0}".format(getMousePos())
sleep(timestep)
What it does is simple: there's a list of rectangles in the 'boxes' array at the start (currently set to a 100x100 square at (0,0) and another 100x100 square at (400,0) measured from the top-left corner of your screen) and if you hover in that box for 'hovertime' seconds, it will simulate a mouseclick. All that you need to do is make sure these boxes correspond to your taskbar buttons. Oh, and don't have the taskbar on autohide, or it will just click on whatever's underneath...
|
|
|
|
09-08-2012, 08:27 PM
|
#7
|
|
Member
Registered: Aug 2012
Posts: 46
Original Poster
Rep: 
|
the method you use is interesting approach
however, isnt there an API of Gnome or other window managers, so we can detect taskbar buttons and then set an event listener on it?
|
|
|
|
09-09-2012, 04:24 AM
|
#8
|
|
Senior Member
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,624
|
It's possible there is - I was just coming up with a quick fix. The WM is going to depend on your version of Gnome. I think Gnome 2 used Metacity and Gnome 3 uses Mutter.
EDIT: I think http://developer.gnome.org/ will be of interest...
Last edited by Snark1994; 09-09-2012 at 04:27 AM.
|
|
|
|
09-09-2012, 08:54 AM
|
#9
|
|
Member
Registered: Aug 2012
Posts: 46
Original Poster
Rep: 
|
I would like to ask, is it a few lines code? is the appropriate commands and documentation available somewhere?
|
|
|
|
09-09-2012, 09:48 PM
|
#10
|
|
Member
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 122
Rep:
|
I use kde and there's an app called kmousetool that allows dwell click. I've never used it, but from its description, I assume it does what you want. Maybe you can search for something similar on gnome, or you can try the kde version of ubuntu.
|
|
|
|
09-10-2012, 05:44 AM
|
#11
|
|
Senior Member
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,624
|
Quote:
Originally Posted by unixor
I would like to ask, is it a few lines code? is the appropriate commands and documentation available somewhere?
|
I don't really know the API - if it is possible without recompiling bits of the WM, I would think it's of comparable length to what I posted. It's possible you would need to make changes to the taskbar itself, in which case it'd be a harder job, and you might be better off making a suggestion to the developers of the taskbar. Personally, I suspect it's not easily possible with the API that is exposed by the WM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:15 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|