LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-06-2012, 04:10 AM   #1
unixor
Member
 
Registered: Aug 2012
Posts: 46

Rep: Reputation: Disabled
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!
 
Old 09-06-2012, 03:11 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
In Ubuntu, definitely (https://help.ubuntu.com/11.04/ubuntu...wellclick.html), I don't know about other distributions. Which one are you using?
 
Old 09-06-2012, 07:27 PM   #3
unixor
Member
 
Registered: Aug 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
ubuntu, thanks!

but i dont want it to click when I hover over the actual windows, only when I hover over their taskbar buttons!
 
Old 09-07-2012, 06:48 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
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...
 
Old 09-07-2012, 04:43 PM   #5
unixor
Member
 
Registered: Aug 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
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
 
Old 09-08-2012, 08:01 AM   #6
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
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...
 
Old 09-08-2012, 09:27 PM   #7
unixor
Member
 
Registered: Aug 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
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?
 
Old 09-09-2012, 05:24 AM   #8
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
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 05:27 AM.
 
Old 09-09-2012, 09:54 AM   #9
unixor
Member
 
Registered: Aug 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
I would like to ask, is it a few lines code? is the appropriate commands and documentation available somewhere?
 
Old 09-09-2012, 10:48 PM   #10
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
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.
 
Old 09-10-2012, 06:44 AM   #11
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by unixor View Post
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.
 
  


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
KWin Desktop Cube - Configuring hovering windows? Weasel War Dance Linux - Desktop 1 02-08-2011 11:20 PM
ungrouping similar taskbar buttons newbiesforever Linux - Newbie 2 07-25-2008 01:52 PM
Open windows in taskbar with compiz SyCo123 Linux - Desktop 0 12-26-2007 11:19 PM
Minimized taskbar buttons look blurry !!! Vilius Linux - Software 4 01-17-2006 09:26 AM
making active windows appear as buttons in the 'taskbar' in fluxbox scuzzman Linux - Newbie 4 06-24-2004 12:46 AM

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

All times are GMT -5. The time now is 05:39 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration