Forum: Ruby-Gnome 2 capture keyboard input without window focus

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Philipp G. (Guest)
on 2009-02-26 21:09
Hello everyone,
i need a suggestion, i have a GTK app that start without a window when i
press shift+ctr+p a window should be shown.

My current try is like follow its not really nice but its nearly working

The code below is only working when the focus/cursor is on a window this
is not possible because its hidden, is there a opportunity to catch it
global from X ? or do i need a dummy window in the background ?

Gtk.key_snooper_install{|w, e|
   @key_input.push e.hardware_keycode
   #puts "code=#{e.hardware_keycode}"
   #puts "l =#{@key_input.length}"

   @key_input.clear unless([33,37,64].include? e.hardware_keycode or
@key_input.length < 4)

   if @key_input.include?(33) and @key_input.include?(37) and
@key_input.include?(64)  then

       # show cusor that was hidden
       #do my action / unhide my window

thanks ahead!

kind regards

This topic is locked and can not be replied to.