Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » How to implement a global hot-key listener ? [RSS Feed]

#1 Nov. 21, 2010 15:50:07

Shuge L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


Hi all:

Any good idea about grab key global and works on Linux, Mac OS X and Windows
?

XgrabKey seems not works well on Windows.

--
Shuge Lab. Lee Li_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 Dec. 4, 2010 17:01:28

richard b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


not entirely sure what you mean: global to your application, or global to
the window system?

if you mean your application, then it's easy:

- make your top level window
- connect "key-press-event" signal to the top level window
- process the key press action in your registered callback function
- done

richard

On Sun, Nov 21, 2010 at 2:25 AM, Shuge Lee <shuge.***@*mail.com> wrote:

> Hi all:
>
> Any good idea about grab key global and works on Linux, Mac OS X and
> Windows ?
>
> XgrabKey seems not works well on Windows.
>
> --
> Shuge Lab. Lee Li
>
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list>
>_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#3 Dec. 4, 2010 17:47:59

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


here is the lib it's called libgtkhotkey
but there is only a blog with old entrys... so i dunno
also it's not very nice to use it in vala without vapi so i don't atmhttp://www.google.com/search?sourceid=chrome&ie=UTF-8&q=libgtkhotkeyboscowitch

Am Samstag, den 04.12.2010, 10:00 -0700 schrieb richard boaz:
> not entirely sure what you mean: global to your application, or global
> to the window system?
>
> if you mean your application, then it's easy:
> * make your top level window
> * connect "key-press-event" signal to the top level window
> * process the key press action in your registered callback
> function
> * done
> richard
>
> On Sun, Nov 21, 2010 at 2:25 AM, Shuge Lee <shuge.***@*mail.com>
> wrote:
> Hi all:
>
>
> Any good idea about grab key global and works on Linux, Mac OS
> X and Windows ?
>
>
> XgrabKey seems not works well on Windows.
>
> --
> Shuge Lab. Lee Li
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list>
>
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#4 Dec. 4, 2010 17:52:24

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


i think he means system wide, i wanted to do that in the past too
and gtk seems to lack it.
windows can qt maby too but gtk can atm there is a libhotkey for gtk
but it's independent and not very active atm.

so i think system wide hotkey registrations and management is something
at least GTK 3 should so support!!! (so this is something for the
gtk-devel list i think)

i really like gtk am a gnome user (and started to like vala) but i do
develop a lot of applications who need global hotkey registration
and atm i can't do that with gtk so i might switch...

boscowitch


Am Samstag, den 04.12.2010, 10:00 -0700 schrieb richard boaz:
> not entirely sure what you mean: global to your application, or global
> to the window system?
>
> if you mean your application, then it's easy:
> * make your top level window
> * connect "key-press-event" signal to the top level window
> * process the key press action in your registered callback
> function
> * done
> richard
>
> On Sun, Nov 21, 2010 at 2:25 AM, Shuge Lee <shuge.***@*mail.com>
> wrote:
> Hi all:
>
>
> Any good idea about grab key global and works on Linux, Mac OS
> X and Windows ?
>
>
> XgrabKey seems not works well on Windows.
>
> --
> Shuge Lab. Lee Li
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list>
>
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#5 Dec. 4, 2010 19:55:04

Vikram A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


On 12/04/2010 12:52 PM, boscowitch wrote:i think he means system wide, i wanted to do that in the past too
and gtk seems to lack it.This is unlikely a solution for you, as its not portable, but this ishow I do it:http://en.pastebin.ca/2010642My only issue is that, I don't know how to figure out if someone elsehas already registered a particular key. And thus, when I blindlyregister keys, if its already been registered, my app crashes right away._______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#6 Dec. 6, 2010 06:26:53

Erick P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


Hey:so i think system wide hotkey registrations and management is something
at least GTK 3 should so support!!! (so this is something for the
gtk-devel list i think)You do realize there's no way that is gtk responsibility. Global, system
wide hotkey is not for gtk to handle, That is for the window manager/desktop
enviroment/whatever manager you've been running, to catch and then signal
the applications to do something in response.

"GTK+ is a highly usable, feature rich toolkit for creating graphical user
interfaces" fromhttp://www.gtk.orgErick_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#7 Dec. 6, 2010 09:55:49

richard b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


indeed.

and if i'm not wrong, it seems the future here will be solved by D-Bus:http://www.freedesktop.org/wiki/Software/dbusin time, i hope, this solution/implementation will take hold at the WM level
and this problem will be solved in a generic and universal manner for now
and ever. but, as always with new solutions, its universal adoption and
implementation will take time.

complete description here:http://www.freedesktop.org/wiki/Software/dbusrichard

2010/12/6 Erick Pérez Castellanos <erick.***@*mail.com>

> Hey:
>
> so i think system wide hotkey registrations and management is something
>> at least GTK 3 should so support!!! (so this is something for the
>> gtk-devel list i think)
>>
>
> You do realize there's no way that is gtk responsibility. Global, system
> wide hotkey is not for gtk to handle, That is for the window
> manager/desktop
> enviroment/whatever manager you've been running, to catch and then signal
> the applications to do something in response.
>
> "GTK+ is a highly usable, feature rich toolkit for creating graphical user
> interfaces" fromhttp://www.gtk.org>
> Erick
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list>_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#8 Dec. 6, 2010 20:37:36

Mike M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


Hi,

2010/11/21 Shuge Lee <shuge.***@*mail.com>:
> Hi all:
> Any good idea about grab key global and works on Linux, Mac OS X and Windows
> ?
> XgrabKey seems not works well on Windows.

keybinder looks to be in good shape, however it works for the X Window
System only, atleast it's what the website mentions.http://kaizer.se/wiki/keybinder/https://github.com/engla/keybinderMy 2 cents,
--
Mike
_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#9 Dec. 6, 2010 23:57:08

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to implement a global hot-key listener ?


Am Montag, den 06.12.2010, 01:19 -0300 schrieb Erick Pérez Castellanos:
> Hey:
>
> > so i think system wide hotkey registrations and management is something
> > at least GTK 3 should so support!!! (so this is something for the
> > gtk-devel list i think)
>
> You do realize there's no way that is gtk responsibility. Global, system
> wide hotkey is not for gtk to handle, That is for the window manager/desktop
> enviroment/whatever manager you've been running, to catch and then signal
> the applications to do something in response.

normally it would be the display manager, but i never heard of a good
library or a gnome library who does it an using the X code directly is
also no good especially because canoncial want to replace X.
so in the near future a decend wrapper would be good anyway.
and as in other systems windows manager functionns and gui functions
aren't seperated (see win32 for example) other gui toolkits like
wxWidgets implement a wrapper (wich atm does'nt work with the gtk
backend with linux which is a great downside for linux, gnome and gtk)
as you as coder don't have a function that will work regardless of what
to expect if GTK is present....
so i would vote for a wrapper in GTK.


> "GTK+ is a highly usable, feature rich toolkit for creating graphical user
> interfaces" fromhttp://www.gtk.org>
> Erick
>
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list>


_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

  • Root
  • » GTK+
  • » How to implement a global hot-key listener ? [RSS Feed]

Board footer

Moderator control

Enjoy the 17th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support