kojix2 / LibUI

A portable GUI library for Ruby
MIT License
208 stars 10 forks source link

Strange behaviour - can libui respond to SIGINT? #13

Open rubyFeedback opened 3 years ago

rubyFeedback commented 3 years ago

Hey there kojix2,

Sorry for filling this issue tracker in the new year! :D

(I am just randomly testing libui again ... I sort of start with ruby-gtk when I wake up, fix some old issues, then have more fun afterwards playing with libui hehe)

There is one thing that annoys me a bit.

When I start a .rb file with fiddle + libui, the widget works, it is shown, all works fine. But I start it from the terminal (commandline, KDE konsole), and when when I press ctrl+c I can normally quit. I usually do this because it is faster than clicking with the mouse cursor.

But, libui or so seems to not respond to it. This is different to ruby-gtk.

In my custom ruby code I generally use a method such as this:

def register_sigint
  Signal.trap('SIGINT') { exit }
end; register_sigint

Then ctrl+c tends to work.

Is there a way to "assign" ctrl+c to cause a libui based .rb file to also behave in the same way? Right now I can still use ctrl+z for background sending, but I'd love to see ctrl+c also works by default if that is possible. If not don't worry, just ignore this issue request.

kojix2 commented 3 years ago

Yes.

I understand very well. I also tend to press Ctrl+C and get a little disappointed when the libui window doesn't close. I'll see if there's any way to improve it.