Mouse Wheel Up/Down to control Volume Up/Down?

Issue #1 new
Sean Crotty
created an issue

I love the middle-click mute! How about having mouse wheeling over the icon control the volume?

Although I suppose it may not be possible: perhaps wheel events over a system tray icon aren't propagated to the icon's application?


Comments (4)

  1. Anonymous

    I think wheel events are propagated, but I'm not sure that is exposed in the C# API. I also want this functionality. It exists in Ubuntu and it's awesome.

  2. Sean Crotty reporter

    Here is what I came up with. (However, I've never programmed in C# before AND I don't have a mouse with a wheel to test with, so I don't know if it works!):

       // This line in Main()
       TrayIcon.MouseMove += new MouseEventHandler(TrayIcon_MouseWheel);
       private static void TrayIcon_MouseWheel(object sender, MouseEventArgs e)
           if (e.Delta != 0)
               float newVolume = 
                  DefaultMediaDevice.AudioEndpointVolume.MasterVolumeLevelScalar + (0.1f * e.Delta/120);
               if (newVolume < 0)
                   newVolume = 0;
               else if (newVolume > 1.0f)
                   newVolume = 1.0f;
               DefaultMediaDevice.AudioEndpointVolume.MasterVolumeLevelScalar = newVolume;
  3. factormystic repo owner

    It doesn't, I have already tried that method. MouseMove fires, but not for wheel events, so delta is always 0. What it will probably have to be is a mouse hook that only changes the volume when the cursor is over the icon. Nontrivial, but straightforward enough. I'll try to put in in by 1.2.

  4. Log in to comment