FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
13.53k stars 842 forks source link

Option to disable media keys support #1465

Open stpnwf opened 3 years ago

stpnwf commented 3 years ago

Is your feature request related to a usage problem (not a bug)? Please describe. Ubuntu often fails to get media keys to control the right application when there is more than one capable of playing audio open at the same time. Since I always mean for the media keys to control Spotify, I turn off media key support to other applications, like Firefox. I can't do this to Freetube.

Describe the solution you'd like to see implemented I would like to be able to turn off media key support in Freetube, similarly to how it is possible to do this in Firefox.

Additional context I only mean for the media keys to control Spotify, and having Freetube and Spotify open messes that behavior up. For example, I often would like to pause the music I am listening to so that I can watch a video on Freetube... Instead video on Fretube plays and I have to go to Spotify, pause manually then go back to Freetube. Having an option to turn off this feature in Freetube would solve my problem.

blipdrifter commented 2 years ago

Any updates on this? I'd love to be able to do this as well.

stabilergriller commented 2 years ago

Hello, I found this thread while searching for the solution for the same problem as described by the creator of the issue.

There's also a related issue at https://github.com/FreeTubeApp/FreeTube/issues/1230 which has been closed as completed, but despite this there still seems to be no possibility to disable hardware media keys properly, neither in the settings nor in the command line.

With the help of https://github.com/electron/electron/issues/21731 and especially https://github.com/electron/electron/issues/18253#issuecomment-589542934, I was able to figure out that adding

app.commandLine.appendSwitch('disable-features', 'HardwareMediaKeyHandling,MediaSessionService'); in the index.js really blocks all MPRIS related interaction, which would totally solve my problem. But of course, this functionality is used by other users.

Maybe a toggle in the settings menu to switch between enabling and disabling mode would be the best?

efb4f5ff-1298-471a-8973-3d47447115dc commented 2 years ago

Suggestion for @Aiz0 maybe a nice followup on the shortcuts PR :)

dmt-hub commented 1 year ago

Would also love to have this option available. Thank you!

In the meantime you can run it with media keys disabled like this: Open terminal paste this line: /Applications/FreeTube.app/Contents/MacOS/FreeTube -disable-features=HardwareMediaKeyHandling

press enter - now you are running freetube with mediakeys disabled. Enjoy!

TBat commented 1 year ago

Thank you @stabilergriller for the workaround! Works exactly as I wanted

For a one-click solution, you can turn it into a batch file:

@echo off
cd "C:\Program Files\FreeTube"
start FreeTube.exe -disable-features=HardwareMediaKeyHandling
SkyeMors commented 3 months ago

Any chance this is going to be added? I use Foobar2000 to listen to local music, and don't want it to have FreeTube hijack my input and start playing stuff I have loading in the background. Loving FreeTube so far btw, after only a day of use. This is kind of a sticking point for me since I play games and listen to music and watch YouTube (well, now FreeTube), so you can probably see why I'd really want this to be something I can just toggle off.