Created attachment 170460 [details] Bluetooth tray applet screenshot (Bluetooth turned off) SUMMARY There is no way to enable Bluetooth in one click from Bluetooth applet (except using middle-click on tray icon, which is not obvious or memorable for me). STEPS TO REPRODUCE 1. Turn off Bluetooth 2. Click on the Bluetooth tray icon OBSERVED RESULT Just the text "Bluetooth is disabled" is shown (see attachment) in the applet, with no control to enable it. In the System Settings page, however, both the button and the toggle is present, but it takes one more click (and opening an application) to be able to use them. EXPECTED RESULT There some way to enable Bluetooth if it is disabled (and can be enabled) from the open applet. For example, there either the "Enable Bluetooth" bluetooth, or the "Enabled" toggle, or both, in all cases when such controls are shown on the System Settings page. SOFTWARE/OS VERSIONS KDE Plasma Version: 6.0.5 KDE Frameworks Version: 6.3.0 Qt Version: 6.7.1
Can confirm! There's supposed to be a button below the text; I guess it went missing! Let me see if I can figure out what happened to it.
Code says this: helpfulAction: { if (BluezQt.Manager.rfkill.state === BluezQt.Rfkill.Unknown) { return null; } else if (btManager.bluetoothBlocked) { return enableBluetoothAction; } else if (root.emptyList) { return addBluetoothDeviceAction; } else { return null; } } So we're only showing the button when btManager.bluetoothBlocked is true. Probably we're missing another condition in there.
Ok, while debugging this, the button returned! :/ That'll make it more annoying.
Argh, now I can't get it to happen anymore!
Git commit d4da9ece3dc475ccea0bdaec919eb6784604cc5f by Nate Graham. Committed on 13/06/2024 at 19:56. Pushed by ngraham into branch 'master'. applet: remove unnecessary action enablement conditions These actions are only visible under certain conditions; no need to also set their enablement statuses to the same conditions. M +0 -4 src/applet/package/contents/ui/FullRepresentation.qml https://invent.kde.org/plasma/bluedevil/-/commit/d4da9ece3dc475ccea0bdaec919eb6784604cc5f
I don't know if that might fix it, but it was also wrong.
(Disclaimer: I do not know anything about neither QML, nor Plasma Applet internals) I tried to debug things myself, and the preliminary results were pretty weird (like, the `if` branch taken in `text` was seemingly not the same as `if` branch taken in `helpfulAction`), but after some time bug has suddenly disappeared by itself for me too, and I was unable to complete the debugging process. But, for little I was able to gather before bug has stopped reproducing, it seems to me that the bug somewhere in the QML handling side of things rather than in the QML markup of the applet itself. I applied your patch, and also added extensive (I hope so) `console.log()` coverage for later: ```qml text: { // We cannot use the adapter count here because that can be zero when // bluetooth is disabled even when there are physical devices console.log("!!! text, btManager =", btManager); console.log("!!! text, root =", root); console.log("!!! text, BluezQt.Manager =", BluezQt.Manager); console.log("!!! text, BluezQt.Manager.rfkill =", BluezQt.Manager.rfkill); if (BluezQt.Manager.rfkill.state === BluezQt.Rfkill.Unknown) { console.log("!!! text 1, rfkill.state =", BluezQt.Manager.rfkill.state); return i18n("No Bluetooth adapters available"); } else if (btManager.bluetoothBlocked) { console.log("!!! text 2, btManager.bluetoothBlocked =", btManager.bluetoothBlocked); return i18n("Bluetooth is disabled"); } else if (root.emptyList) { console.log("!!! text 3, root.emptyList =", root.emptyList); return i18n("No devices found"); } else { console.log("!!! text 4"); return ""; } } helpfulAction: { console.log("!!! button, btManager =", btManager); console.log("!!! button, root =", root); console.log("!!! button, BluezQt.Manager =", BluezQt.Manager); console.log("!!! button, BluezQt.Manager.rfkill =", BluezQt.Manager.rfkill); if (BluezQt.Manager.rfkill.state === BluezQt.Rfkill.Unknown) { console.log("!!! button 1, rfkill.state =", BluezQt.Manager.rfkill.state); return null; } else if (btManager.bluetoothBlocked) { console.log("!!! button 2, btManager.bluetoothBlocked =", btManager.bluetoothBlocked); return enableBluetoothAction; } else if (root.emptyList) { console.log("!!! button 3, root.emptyList =", root.emptyList); return addBluetoothDeviceAction; } else { console.log("!!! button 4"); return null; } } ``` I will try to continue to look into it when the bug will be back again. Thank you!
Have any of you tried to print rfkill state, both in CLI and from BlueZ point of view? It happened to me last week that after a whole day of fixing/refactoring Bluetooth applet, next morning my internal Bluetooth device went completely missing, as if it did not exist, and the only clue I had were two lines of cryptic errors in the kernel journal `dmesg`. Luckily, I had an external USB stick so I could continue with my work. I couldn't figure it out though, but after one more day it kinda fixed itself. And that's how I found out that the "Enable" buttons and switches can be out of sync when no devices are present.
Anyone still reproducing this? It's been working reliably for me for a couple of months now with Plasma 6.2 and now current git master(which will be 6.3) and the 6.10 and 6.11 kernels.
๐๐งน โ ๏ธ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME. For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging. Thank you for helping us make KDE software even better for everyone!
๐๐งน This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.