lib/volay/widget/system_tray.rb in volay-1.0.1 vs lib/volay/widget/system_tray.rb in volay-1.1.0
- old
+ new
@@ -4,10 +4,11 @@
module Widget
# Events class
class SystemTray < Events
LEFT_CLICK = 1
RIGHT_CLICK = 3
+ M_KEYCODE = 47
##
# When left click on the status icon, popup the window menu
#
# @param [Gtk::Widget] widget Widget
@@ -28,9 +29,19 @@
##
# When click outside the window
#
def on_system_tray_window_focus_out_event
@app.get_object('system_tray_window').hide
+ end
+
+ ##
+ # Check for M keycode to toggle mute
+ #
+ def on_system_tray_window_key_release_event(_widget, event)
+ return unless event.is_a?(Gdk::EventKey) &&
+ event.hardware_keycode == M_KEYCODE
+ @app.mixer.toggle
+ @app.utils.update_status_icon
end
##
# When right click on the status icon
#