Is there any way to have a popover open with a long press?

I’ve got some spare time and looking to create a custom widget. Just thought I’d check if what I’m imagining is even possible before I waste my spare time! I’ve made a few custom widgets before, but they have been very simple. I also need a long press to be recognised distinctly from a quick tap, and my reading suggests that can’t be done in MainUI,

I want to come up with something to control my lights similar to the controls in the iOS Home App. Basically a button that you can tap to toggle the light on and off, which can also be held to reveal a slide control. I find this to be an elegant solution in the Home App and would really like to do something similar in OH3/MainUI. I would also like to do something similar to control my blinds - tap to open/shut, long press to reveal a slide control to choose height exactly.

Does anyone have any suggestions, or should I just forget about this idea?

You just have to be using a recent enough version (3.3 milestone 3, I believe) and this feature is available in a limited capacity. You will find that for a few components (I think it’s currently limited to buttons and cards) that have the action series of properties now also have that same series of properties available with the prefix taphold. These actions respond to long clicks in mobile environments and right clicks in desktop environments. So you would make a button with a regular toggle action and a popup taphold action.

1 Like

Awesome! I am on 3.3M3 so all set to go. I’ll report back on my progress.

I am also looking for this way of controlling my lights in the overview page: did you find these taphold properties documented somewhere?
(I looked into the documentation pages and in the milestones release notes, but I was unable to find anything)

They are new enough that they have not made it into the docs yet, as far as I know. However, very little documentation is required.

  1. They are exactly the same as the regular actions so any configuration for the regular actions applies to the taphold actions and this also means you can just use the action documentation under any of the standard action components.
  2. Using the MainUI widget editor, ctrl + space, under a config heading brings up the available options and you will see them and all the sub-options listed for the components where you can use them.
1 Like