# Qt and unix signals trapping

**URL:** <https://www.ruby-forum.com/t/qt-and-unix-signals-trapping/223332>\
**Category:** Ruby\
**Created:** [September 30, 2012, 12:52am UTC](https://www.ruby-forum.com/t/qt-and-unix-signals-trapping/223332 "2012-09-30T00:52:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 30, 2012, 12:52am UTC](https://www.ruby-forum.com/t/qt-and-unix-signals-trapping/223332/1 "2012-09-30T00:52:20Z")

</div>

Hi. In my program written on ruby+qt I want to bind desktop-wide  
keyboard shortcut to some function. Default qt does not support this.  
What is the best method to reach this goal?

(This was also posted on Freenode’s #qtruby few days before, still not  
answered)

I tried to bind global keyboard shortcut to shellscript that sighups my  
application but the handler seems to be launched only after a long time  
~10s-1m. I posted more details and test sample to  
[Unix signals travel to handlers very slowly · Issue #42 · ryanmelt/qtbindings · GitHub](https://github.com/ryanmelt/qtbindings/issues/42) (now I think I should  
have asked here first). On my system ruby interpreter performs write(4,  
“!”, 1) just after receiving sighup. If Qt::Application was created and  
exec’ed, we then see unsuccessful read and recvfrom continued by poll.  
This every poll lasts for very long time. If we do not launch  
Qt::Application, after sighup we receive sigvtalarm and then immediately  
run signal handler.

Please tell me whether unix-signal approach is (should be) good enough  
and if there is a way better method.

Nearly-actual sources of my app can be seen at  
[Modem tray notifier · GitHub](https://gist.github.com/3784802) by the way.
