Resizing programmatically from inside WebView

I'm using a floating menu to keep an WebView fixed on the screen similarly to Notchbar but made with my code custom code.

I want to be able to expand/collapse said menu from events inside said Webview.

I've tried using named triggers and callBTT to override the menu config, however, it won't immediately resize the menu, needing manually reloading the config, and also glitches everything after a while.

This will be used in order to allow interaction with elements like hovering the cover from the current song:

However, the menu should only be expanded if something triggered inside, so resize-on-hover won't fit.

If anyone is interested, the code of my bar is here

Good idea, I'll add a way to do this.


With 4.202 you should be able to do something like this via the "Run Real Java Script" action:

(async ()=> {
   const updateDescription = {
     "BTTMenuFrameWidth": 400, 
     "BTTMenuFrameHeight": 100, 
     "BTTMenuHoverExpansionDirection": 7
   await update_menu_item({"item_uuid": "DA17F88C-6A00-443A-AF31-9E2D0F400202", "json": JSON.stringify(updateDescription)})

The item_uuid needs to be the uuid of the menu you want to resize (get via right-clicking the menu in the BTT configuration)

The BTTMenuHoverExpansionDirection can be any of the following values:
rightAndUp = 0
leftAndUp = 1
rightAndDown = 2
leftAndDown = 3
leftAndRightAndDown = 4
leftAndRightAndUp = 5
upAndDownAndLeft = 6
upAndDownAndRight = 7

1 Like

Nice @Andreas_Hegenberg

I was able to successfully run on "Run Real Java Script". Is it possible to access this new method on Web Views, tho? Or maybe, somehow passing parameters to the action an a named trigger?

Also, I noticed that when BTTMenuHoverExpansionDirection === 2, and the Height is decreased, there is a nice expansion transition. However, when the height is increased, the change is instant without any transition. Am I doing something wrong?

Damn, I forgot to make that function available to the web view. With the new alpha 4.205 (currently uploading) that JS should also work fine from within a webview.

I'll need to look into the animation thing. It's a bit complicated, maybe I missed something there.

1 Like