Floating Menu Alpha Development Thread

But it will, soon.. :slight_smile:

1 Like

I'm using Node-RED to integrate with BTT a lot via HTTP API.
I'm not sure if I've missed out something, but I can't find the docs for HTTP API on how to perform these basic actions:
• Toggle visibility of a Floating Menu
• Get/Update Slider values
• Update text of a menu item
• Update Window Level of a floating menu

There seems to be docs for AppleScript & Javascript within Floating Menu, but not from something outside BTT like curl, HTTP API

Do you need to do it over HTTP or can you use the command line?
(I can provide examples for the HTTP API later, but in general I recommend to only use that if you need it).

With the osascript command line utility you can trigger any Apple Script command from the command line:

/usr/bin/osascript -e "tell application \"BetterTouchTool\" to update_menu_item menu_name \"the menu name\" item_name \"the item name\" json \"{BTTMenuWindowLevel: 3, BTTMenuItemText: 'some new text'}\" persist true"

I can use command line, but prefer HTTP API as I am writing an app to update it.

I've tried your sample command, but it doesn't update the Window Level of the menu.
Your command is targeting at a Menu Item, not a Menu.

Anyway, the reason why I need to update BTTMenuWindowLevel is because there is a random bug that I am not able to always replicate:
My menu with Same As Desktop Icons (-2147483603) level randomly appears on top of everything else and doesn't go away, even with hover out, or clicking.

@torinnguyen You were right, the previous version didn't work well for updating items via the HTTP API, it should now work with 4.281

Simple Java Script example to update the ext of an item

fetch("http://127.0.0.1:55585/update_menu_item/?uuid=C742C8E8-A5BF-4DAC-B3ED-305925B7B301&json={BTTMenuItemText:'NewText'}")

(you can either reference an item or menu via its UUID or via menu_name & item_name )

I have also made some improvements on the window level handling. Maybe that already fixes your issue.

Great! I've just tried that out asap and it worked!
Thank you very much!!

Another question: what do you suggest for updating 'BTTMenuAttributedText' since the maximum length of a GET request is only about 2048 characters. I tried Apple Script, it doesn't work either.

Unfortunately there is currently no good way to update this, it's also a pretty bad representation but currently the best we got for serializing AttributedStrings. One of the next versions will allow you to put HTML code when updating the BTTMenuAttributedText and then it will translate it automatically according to the formatting given by the HTML/CSS.

Right now if you update the BTTMenuItemText, it will automatically create a new AttributedString by transferring all attributes to the given text.

Well yeah, I figured out that much.

My little hack-ish suggestion:
You can create a new field called BTTMenuItemTextColor and use it to change the entire NSForegroundColorAttributeName of the entire NSAttributedString :slight_smile:

I'm an iOS developer too :smiley:

Reference here:

with 4.282 (building now) you can do something like this (needs to start with <html>):

http://127.0.0.1:55585/update_menu_item/?uuid=C742C8E8-A5BF-4DAC-B3ED-305925B7B301&json={BTTMenuAttributedText:'<html><b><span style="color:red">hello</span> world</b></html>'}

this will however override any other font property as well

This HTTP API works much better than using oascript when handling special characters and HTML syntax inside JSON5.

Thank you!!!!

Size and resize on hover>Expansion direction

Sorry if this is a known issue or it's still under development.

If I set the expansion direction to the left (and after up or down or right) the hovered area is expanded to the left, but the expansion of the inner items is oriented to the right side.

Here is a floating menu I am configuring for the menu bar. The hover area is orange. You can see the buttons go away from the cursor when the hovered area is expanded.

I would like that these EMBSM buttons have the same behaviour of the icons of the status bar: all aligned to the right, and when an item is shown or hidden, the rest of items moves accordingly.

I suggest to add a new dropdown menu called "Expansion Items Direction" and recall the current expansion direction to "Expansion Hover Direction".


Also I would like to propose to divide the "Size and resize on hover" section in two, because there is a lot of info there:

Clicking new folder/group button creates new menu:

menus are handled as groups of menu items, unfortunately you can’t create folders to contain menus.

1 Like

currently menu items are always layouted from the top left, the expansion direction right now only handles the menu „container“. However I might be able to add different layout algorithms in upcoming versions.

1 Like

This is a bug:
The floating menu Window Level is set as "Same as Desktop Icon", no trigger or script to change it.

Sometimes the menu floats above other windows randomly.
After awhile or some interaction, it is ok again.

I just tried adding a "Sub menu" item to my floating menu, but I'm unable to properly configure it. When I click 'Open to Add Items" it updates the display, but still shows me the same root menu configuration. It looks like it's pushing the root menu into the stack again instead of the submenu. I can drag new items into the submenu from the parent menu, but without being able to open it I can't edit or remove items in it.

Also, toggling the menu's visibility doesn't reset the floating menu back to the default as I'd expect. It also doesn't refresh (ie: after creating and dragging a 'Back' button into it) automatically - I had to restart BTT to reset the menu (after which the back button I added worked).

Btw, why do I need to restart BetterTouchTool for each and every Floating Menu setting change in order for it to be able to be shown using my keybinding? The menu just doesn't respond to anything unless I restart BetterTouchTool.

@torinnguyen I was also experiencing this recently, currently looking into it
@David_Edell sub menus seem to work ok here, does it in your case not behave like this:

@mkozjak there should be no need to restart BTT. Maybe I didn't fully understand, do you have an example of something you changed that's not reflected?

submenus in floating menus don't work for me, never worked since the beginning.

I never said nothing because I thought it was still in development...

Here is a super small example with a simple submenu, does this not work for you?
submenu.bttpreset (58.7 KB)

I think maybe just the UI to create them is confusing right now. This will be improved soon.