GSConnect / gnome-shell-extension-gsconnect

KDE Connect implementation for GNOME
GNU General Public License v2.0
3.2k stars 259 forks source link

Make the GSConnect toggle in Quick Settings Menu optional #1653

Open FelixFourcolor opened 1 year ago

FelixFourcolor commented 1 year ago

Describe your request

I'm referring to this menu and this toggle.

Screenshot from 2023-07-13 01-37-04

(Presumption: I believe without the toggle, GSConnect can still be turned off by switching off the extension.)

In my workflow I don't see when I ever need to turn GSConnect off, while the toggle is always there, thus redundant. I also know many folks use something like Extension List (a GNOME extension) that makes it very convenient to switching on and off any extension, including GSConnect, so there being also a toggle in the Quick Settings Menu is redundant.

Proposed solution

I suggest adding an option to the extension settings to hide the toggle.

GSConnect version

55

ferdnyc commented 1 year ago

@FelixFourcolor

Hmmm. I have to think about this one.

The indicator isn't there solely for the purpose of turning GSConnect on and off, BTW. In fact,that's not even its primary purpose. It's mostly there to provide access to the device status and actions menus for each currently-connected device (clicking the arrow on its right edge will open that menu), as well as to give an easy way to launch the GSConnect preferences (which appear at the bottom of that same menu).

Now, it's true that, just like you can switch the extension on and off using the Extensions app, you can also launch GSConnect's Mobile Settings dialog from there as well.

And, while it's possible to access device actions from the Mobile Settings dialog, the interface for doing so is... well, "clunky" is probably an understatement, considering it requires you to:

  1. Launch Mobile Settings
  2. Click on the device you want to access
  3. Click the hamburger menu in the headerbar once its settings open up

And then you can access the same list of commands that are shown in the indicator's submenu.

...Still, perhaps you never use those menu options, or you do and you're perfectly fine with that being the process.

My only remaining concern is whether having an extension running with no visible UI might lead to problems... things like GNOME Shell considering the extension as disabled/not-running, or failing to deliver notifications about UI events.

Much like in Android (where KDE Connect has to keep a persistent notification visible, to ensure it's able to access device resources and get CPU cycles allocated to it), having the QuickSettings indicator visible means that we can be sure the extension will periodically get called to refresh its UI.

Am I sure that GNOME Shell would starve an extension with no visible UI? Not at all, no. Could be that it makes no difference at all whether the extension has any widgets displayed in the UI, currently.

But even if the Shell doesn't de-prioritize invisible extensions now, I wouldn't be surprised if starts to, at some point in the future. Then again, even that might not matter too much, since most of the GSConnect code is already running as a background service separate from GNOME Shell's runtime.

ferdnyc commented 1 year ago

There are plenty of extensions that don't display a QuickSettings indicator, of course... But I'm trying to think of any with no visible UI at all.

There are a few out there, I suppose. Things like the "always start a new instance" extension that tweaks application-launching behavior. Or any of the ones that customize user interactions, like workspace-switching tools or Alt+Tab customizations.

But those extensions hook their code into some part of the Shell when they're initially started. The code will run whenever the user triggers whatever interaction they've modified —- in fact, that's the only time the extension code will run. GSConnect can't wait around for the user to call on it directly like that.

FelixFourcolor commented 1 year ago

@ferdnyc Thank you for your inputs.

I opened this issue thinking it's probably an easy quality-of-life improvements, but apparently it's not as easy as I thought. Not being a developer, I have no idea how difficult these ideas are, so I yield to your expertise, I just want to clarify my proposal.

I intended that this topbar tool would still be available to indicate that the extension is running as well as providing quick access to device-control menu. I do not wish to hide every UI element; only the toggle in the QS menu. Screenshot from 2023-07-13 16-12-28 I concede that hiding the toggle will make it harder to change extension preferences. But I think it's fair to give the user the option to hide it, and I wouldn't advocate for hiding the toggle by default.

ferdnyc commented 1 year ago

@FelixFourcolor

I opened this issue thinking it's probably an easy quality-of-life improvements, but apparently it's not as easy as I thought.

Oh, completely understood, and I'm glad you did open it — it's something I hadn't personally thought about much, so it's an interesting question to consider.

I intended that this topbar tool would still be available to indicate that the extension is running as well as providing quick access to device-control menu. I do not wish to hide every UI element; only the toggle in the QS menu.

Ah, OK... if you're using the top bar support, then I can see how that changes the perspective a bit.

Unfortunately, it runs into the same issue — the top-bar device icons are only shown when a device is connected... and if there isn't a device connected, then you end up back in the same situation of GSConnect running with no visible UI. (Which means that the code won't necessarily notice when a device does connect.)

Prior to GNOME 43/44 (I forget which) and the move to QuickSettings, GSConnect kept an additional icon in the top bar for itself, so that there was something displayed even when no device was connected. But IIRC that API wasn't well-supported, so its "UI anchor" was moved to QuickSettings since that's the (well, an) API GNOME Shell officially supports for Extensions that need to hook into the runtime on a continuously-available basis.

Purely by coincidence (cannot make this stuff up), just a few minutes ago I ran into an entry in my own system's user menu that I'd never seen before, a background-task indicator/alert:

Screenshot from 2023-07-13 19-40-55

Which, if nothing else, reinforces my intuition that GNOME Shell doesn't really like it when something's running with no visible UI. (But that's a development version of Nautilus built as a Flatpak, so the rules are a lot different.)

...Anyway, point is, the QuickSettings icon is probably an unavoidable necessity, as things stand. There's a comment in the extension's source file just above the class that defines the icon, describing its purpose/utility:

https://github.com/GSConnect/gnome-shell-extension-gsconnect/blob/83d041c7170e649246dcf20fce11509999fa8ed9/src/extension.js#L34-L40

That applies equally whether the extension is running in menu mode or panel mode — in the current codebase, that preference only determines where the device-access menus are spawned. It no longer affects the primary extension UI elements.