-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System Tray #363
Comments
OSX - Start here . There will be an api somewhere. For example, we could create a NotifyOS non gui class ( like SvgHandle is). Perhaps we could move some of those Shoes.app.methods like fullscreen or set_app_icon into that class (or ancestor class). I'm starting to really like this idea although it's huge amount of work. |
As expected, unification of the two apis Cocoa and Gtk is going to result in a skinny set of features - No replies so there's no need to deal with buttons in notifications. Title, subtitle, icon/image would be the only arguments. Something like OsNotify.new("My Bot", "responded to a tweet", "#{DIR}/images/done.png") Is that useful? Could be, I guess. Opinions? It could be paired with an alert or confirm to be more useful for some designs: OsNotify.new("Long Running Solver", "needs your attention")
if confirm("continue solution generation"
find_solution
else
clean_up
Shoes.quit
end That would be suspend the Shoes gui threads until you get it front and center and deal with the dialog. Is that sufficient? FWIW, more advanced notification things require that Shoes implement/become a GApplication (linux, windows) which is a big deal and would probably require using Gtk3 on OSX. If possible. |
The proposed API doesn't feel Shoes-like, especially using it with new keyword. What do you think of systray("Long Running Solver", "needs your attention") # ordered parameters
systray title: "Long Running Solver", notification: "needs your attention" |
systray is fine with me and it is more Shoes like even though there will not be a Shoes visible GUI widget to back it - it's really just a message to the desktop manager - function call if you will. Thanks for the feedback. It's a good opportunity for me to really work with our/your refactoring of the C code. |
* mostly a git branch initial commit thing. don't expect to to compile. It's a branch!
* have a test script * gdb verified that shoes_systray_new is called and the c strings are extracted * the icon_path will be tricky - ignore for now.
Sadly, I missed seeing. So, my simple scheme isn't going to work. GApplication (or GtkApplication) is not something Shoes is written to deal with. Implementing GtkApplication is a big deal. It affects main loop and command line handling, ruby init changes, quite possibly packaging changes. A lot of work. There's probably some other downsides I haven't thought of. On the positive side of GtkApplication is systray, obviously, but also dbus compatiblty (for linux), better control of gtk resources (like themes). We also get something to hang menus on, if we had them. Because of the code changes to main.c.//world.c/app.c/shoes.rb then we might as well just use the Gtk3 for OSX and dump cocoa.m. |
As I often the case, things could be a little easier that I expected. On branch systray, replace gtk_init () in shoes/native/gtk.c (shoe_native_init) with a call to gtk_application_new and setup a a call back for the 'activate' signal. systray is working (linux) and so far other Shoes things appear normal. Windows however is complaing with a couple of gtk errors and a crash when running the systray test. |
The windows problem with calling 'gtk_application_new' is that it ignores the given argc/argv and and re-reads the windows command line args (from cshoes.exe) - documented. The proper fix requires work and understanding and should be done. That said, there is a workaround for Windows - the deprecated in Gtk 3.14 GtkStatusIcon. It does work - Windows systray is not as clever as GNotification or Cocoa. but it works! |
* replace gtk_init with gtk_new_application. Linux can run systray test * xwin7 complains about the command line * xwin7 systray crashes because app setup failed.
* uses older gtk_status_icon calls * saves a copy for sequent calls (updates) which matches the linux GNotification behavior.
Shoes Windows beta 3.3.4 with systray |
* OSX is working * Will revisit the windows to see if I can use the newer code in GTK
* Shoes/Windows can use gtk_application_new. Linux is fine too. implement command-line signal-handler. Goodbye gtk_init. * Windows/Gtk can not use the GNotifican code so it uses the status_icon. * clean up code and comments and #ifdefs
What do you think of the new approach for implementing types/native widgets so far? |
I like it now that rake file is more intelligent about what to compile. |
There's a Shoes 3.3.4 beta |
via shoes/shoes-deprecated#285
see https://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html
Currently I have no idea if or how Shoes can do this cross platform.
For Gtk and note the deprecation in 3.14
This is a more Shoes Amenable gtk class
The text was updated successfully, but these errors were encountered: