class Volay::Widget::SystemTray
Events
class
Constants
- KEYCODE_M
- KEYCODE_MOUSE_CLICK_LEFT
- KEYCODE_MOUSE_CLICK_RIGHT
Public Instance Methods
get_position(window)
click to toggle source
Retrieve the good position to be above the status icon
@param [Gtk::Window] window Window
# File lib/volay/widget/system_tray.rb, line 94 def get_position(window) _e, screen, rectangle, orientation = @app.get_object('status_icon') .geometry window.set_screen(screen) monitor_num = screen.get_monitor_at_point(rectangle.x, rectangle.y) monitor = screen.get_monitor_geometry(monitor_num) window_width, window_height = window.size if orientation == Gtk::Orientation::VERTICAL if monitor.width - rectangle.x == rectangle.width # right panel posx = monitor.x + monitor.width - window_width - rectangle.width else # left panel posx = rectangle.x + rectangle.width posy = rectangle.y end elsif rectangle.y + rectangle.height + window_height <= monitor.y + monitor.height posy = rectangle.y + rectangle.height else posy = rectangle.y - window_height posx = if rectangle.x + window_width <= monitor.x + monitor.width rectangle.x else monitor.x + monitor.width - window_width end end [posx, posy] end
init()
click to toggle source
When popup window menu is draw
# File lib/volay/widget/system_tray.rb, line 16 def init refresh_cards_menu end
on_system_tray_window_focus_out_event()
click to toggle source
When click outside the window
# File lib/volay/widget/system_tray.rb, line 42 def on_system_tray_window_focus_out_event @app.get_object('system_tray_window').hide end
on_system_tray_window_key_release_event(_widget, event)
click to toggle source
Check for M keycode to toggle mute
# File lib/volay/widget/system_tray.rb, line 49 def on_system_tray_window_key_release_event(_widget, event) return unless event.is_a?(Gdk::EventKey) && event.hardware_keycode == KEYCODE_M @app.mixer.toggle @app.utils.update_status_icon end
on_system_tray_window_show()
click to toggle source
When system tray window is showed
# File lib/volay/widget/system_tray.rb, line 79 def on_system_tray_window_show @app.mixer.refresh refresh_cards_menu @app.get_object('volume_adjustement') .value = @app.mixer.percent @app.utils.update_status_icon end