Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#491 Customize mouse actions on tray icon and support mouse wheel


Here is a patch I made that adds two features that I miss in SMPlayer :
- support the mouse wheel on tray icon (X11 only), either to change volume or current track
- customize mouse actions on tray icon, so that the left click and middle click can be changed to do different things (mute/unmute, play/pause, show/hide)

You can see how it works in the attached capture. It shows the default settings.

Click actions can be set to :
- Do nothing
- Play/Pause
- Show/Hide
- Mute/Unmute

Mouse wheel options are :
- Do nothing
- Volume up/down
- Next/previous track

The mouse wheel combo is greyed out on non-X11 platforms (Mac OS X, Windows, etc.). The customization should work as expected though.

Technical details :
- To ease the synchronization betwen the preferences dialog and the options menu ("Show icon in system tray"), the show_icon_tray setting is added to class Preferences, and changed whenever the checkbox is changed in the menu through a new slot, BaseGuiPlus::setTrayVisibility().
- The preferences dialog's applied() signal is now connected to a new slot, BaseGui::handlePreferences(), which will read the update pref and call applyNewPreferences(), so that we can properly subclass applyNewPreferences() in BaseGuiPlus to update tray settings.
- Qt requires us to subclass QSystemTrayIcon to handle mouse wheel events, which is done in class MyTrayIcon. It provides an additional signal wheel() to report for mouse wheel events.


  • Here is a new patch, updated for SMPlayer 14.3.0 and with a couple of other fixes too.