Difference between revisions of "Trigger: Floating Button"

 
Line 1: Line 1:
<pre class="header-style">
+
<pre class="header-style">The Floating Button trigger displays an interactive button on the screen that can be pressed to activate a macro. The button's visibility is controlled by enabling or disabling the macro or trigger. Dragging the button over the bin icon will result in the macro or trigger being disabled (as configured).</pre>
This trigger will display a floating button on the screen that can be clicked to activate a macro.
 
  
To show and hide the button, the macro must be activated or deactivated accordingly.
+
''' Options '''
  
If the button is dragged over the trash can icon, the macro will be deactivated (set by default).
+
* '''Identifier''': A unique ID for referencing the button in actions, enabling control across multiple macros. This is displayed in brackets after the trigger name.
</pre>
 
  
Please also see '''[https://macrodroidforum.com/wiki/index.php/Action:_Floating_Button_Configure Floating Button Configure action]'''
+
* '''Icon Type''':
 +
** '''Use Icon''': Select an icon from apps, user images, MacroDroid icons, or Material Design library
 +
** '''Use Text''': Display text characters on the button (up to 8 characters), with customizable text color. Supports magic text.
  
'''Configuration options'''
+
* '''Background Color''': Select a custom background color for the button, or use transparent background
  
* Identifier
+
* '''Icon Padding''': Adjust the padding around the icon within the button (shown as percentage)
  
<pre border-radius: 10px; padding: 10px;">
+
* '''Opacity''': Set the transparency level of the button (0-100%)
It is an id that will serve you later when you use the "Configure floating button" action to identify the button that will be configured in the same macro or another macro.
 
</pre>
 
  
* Icon
+
* '''Size''': Choose between normal or mini (small) size variants
  
<pre border-radius: 10px; padding: 10px;">
+
* '''Show on Lock Screen''': When enabled, the button will be visible on the lock screen (not available on Android 8.0 and above)
It allows you to use installed application icons, user icons (own images), macrodroid icons, as well as notification and material design.
 
</pre>
 
  
* Set background
+
* '''Prevent Removal by Dragging to Bin''': When enabled, the button cannot be removed by dragging it to the trash icon
  
<pre border-radius: 10px; padding: 10px;">
+
* '''Disable Macro/Trigger on Remove''': When the button is dragged to the trash icon, choose whether to disable the entire macro or just the trigger
Use a background color below the icon.
 
</pre>
 
  
* Transparent background
+
* '''Vibrate on Press''': Enable haptic feedback when the button is pressed
  
<pre border-radius: 10px; padding: 10px;">
+
* '''Force Location When Enabled''': Specify exact X and Y coordinates for the button position when the macro is enabled
Show the floating button without a background color.
+
** Coordinates can be specified in pixels or as a percentage of screen size
</pre>
+
** Supports magic text and variables for dynamic positioning
  
* Padding
+
* '''Fixed Location''': Prevents the button from being dragged to a new position
  
<pre border-radius: 10px; padding: 10px;">
+
''' Examples '''
Change a larger or smaller icon padding.
 
</pre>
 
  
* Opacity
+
''Example 1: Quick Screenshot Button''
 +
  <pre class="trigger-style">Triggers
  
<pre border-radius: 10px; padding: 10px;">
+
Floating Button (screenshot_btn)</pre>
Change the opacity, higher or lower.
+
  <pre class="action-style">Actions
</pre>
 
  
* Normal or Small
+
Take Screenshot</pre>
  
<pre border-radius: 10px; padding: 10px;">
+
This creates a floating button that takes a screenshot when pressed. The identifier "screenshot_btn" allows other macros to control this button.
Toggling between 2 different sizes of floating button.
 
</pre>
 
  
* Disable macro/trigger on remove
+
''Example 2: Toggle Flashlight''
 +
  <pre class="trigger-style">Triggers
  
<pre border-radius: 10px; padding: 10px;">
+
Floating Button (flashlight)</pre>
This allows you to define the desired behaviour when you drag the floating button to the recycle bin
+
  <pre class="action-style">Actions
(it will appear when you start dragging the button).
 
  
By default the entire macro will be disabled when dragging to the bin, but you can change the option to disable only the trigger if preferred.
+
Torch Toggle</pre>
</pre>
 
  
* Force location when enabled
+
A floating button that toggles the device's flashlight/torch on and off.
  
<pre border-radius: 10px; padding: 10px;">
+
''' Notes '''
Whenever this box is checked the floating button will appear at the specified coordinates, otherwise it will appear at it's previous location when it was last hidden/removed.
 
  
You can use magic text to define the location when enabled (use a numerical variable).
+
* This trigger requires the "Draw over other apps" (overlay) permission.
</pre>
+
* The button remembers its last position when hidden, unless "Force Location When Enabled" is configured.
 +
* Multiple floating buttons can exist simultaneously if they have different identifiers.
 +
* Use the [[Action:_Floating_Button_Configure|Floating Button Configure action]] to dynamically modify button appearance and position.
 +
* Icons can be selected from app icons, user-uploaded images, MacroDroid's built-in icons, or Material Design icons.
 +
* Text icons support magic text, allowing dynamic text based on variables or system values.
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action:_Floating_Button_Configure|Floating Button Configure action]]
 +
* [[Action:_Enable/Disable_Macro|Enable/Disable Macro action]]

Latest revision as of 23:01, 5 January 2026

The Floating Button trigger displays an interactive button on the screen that can be pressed to activate a macro. The button's visibility is controlled by enabling or disabling the macro or trigger. Dragging the button over the bin icon will result in the macro or trigger being disabled (as configured).

Options

  • Identifier: A unique ID for referencing the button in actions, enabling control across multiple macros. This is displayed in brackets after the trigger name.
  • Icon Type:
    • Use Icon: Select an icon from apps, user images, MacroDroid icons, or Material Design library
    • Use Text: Display text characters on the button (up to 8 characters), with customizable text color. Supports magic text.
  • Background Color: Select a custom background color for the button, or use transparent background
  • Icon Padding: Adjust the padding around the icon within the button (shown as percentage)
  • Opacity: Set the transparency level of the button (0-100%)
  • Size: Choose between normal or mini (small) size variants
  • Show on Lock Screen: When enabled, the button will be visible on the lock screen (not available on Android 8.0 and above)
  • Prevent Removal by Dragging to Bin: When enabled, the button cannot be removed by dragging it to the trash icon
  • Disable Macro/Trigger on Remove: When the button is dragged to the trash icon, choose whether to disable the entire macro or just the trigger
  • Vibrate on Press: Enable haptic feedback when the button is pressed
  • Force Location When Enabled: Specify exact X and Y coordinates for the button position when the macro is enabled
    • Coordinates can be specified in pixels or as a percentage of screen size
    • Supports magic text and variables for dynamic positioning
  • Fixed Location: Prevents the button from being dragged to a new position

Examples

Example 1: Quick Screenshot Button

Triggers

Floating Button (screenshot_btn)
Actions

Take Screenshot

This creates a floating button that takes a screenshot when pressed. The identifier "screenshot_btn" allows other macros to control this button.

Example 2: Toggle Flashlight

Triggers

Floating Button (flashlight)
Actions

Torch Toggle

A floating button that toggles the device's flashlight/torch on and off.

Notes

  • This trigger requires the "Draw over other apps" (overlay) permission.
  • The button remembers its last position when hidden, unless "Force Location When Enabled" is configured.
  • Multiple floating buttons can exist simultaneously if they have different identifiers.
  • Use the Floating Button Configure action to dynamically modify button appearance and position.
  • Icons can be selected from app icons, user-uploaded images, MacroDroid's built-in icons, or Material Design icons.
  • Text icons support magic text, allowing dynamic text based on variables or system values.

See Also