Difference between revisions of "Trigger: Clipboard Change"

 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<span style="color: #B22A2A; font-size: 24px; display: inline-block; margin-top: 15px; margin-bottom: 0px;"><strong>About this trigger</strong></span>
+
<pre class="header-style">
 +
This trigger will fire when the value stored in the clipboard is updated.
 +
</pre>
 +
 
 +
''' Options '''
 +
 
 +
* '''Text to Match''' - Enter text to match against the clipboard content. Leave blank to trigger on any clipboard change.
 +
** Supports wildcards (e.g., * for any characters)
 +
** Supports Magic Text variables
 +
 
 +
* '''Enable Regex''' - Enable regular expression matching for advanced pattern matching of clipboard content.
 +
 
 +
* '''Case Insensitive''' - When checked, ignores the use of upper and lower case when matching. This option is disabled when regex mode is enabled.
 +
 
 +
* '''Use Logcat (ADB Hack)''' - On Android 10+, standard clipboard access is not possible in the background unless you have a rooted device with appropriate Magisk modules. MacroDroid can monitor logcat output to help detect new clipboard content as a workaround for unrooted devices. This option requires granting the READ_LOGS permission via ADB.
 +
 
 +
''' Examples '''
 +
 
 +
Example 1: Speak clipboard content when copied
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Clipboard Change [Any]</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Speak Text: [clipboard]</pre>
  
This trigger will fire when the value stored in the clipboard is updated.
+
Example 2: Open URL when web address is copied
  
Requires additional configuration on Android 10 and above. This limitation is due to Google blocking clipboard access from background applications since Android 10.
+
  <pre class="trigger-style">Triggers
  
==<p><b>Supported configurations</b></p>==
+
Clipboard Change [Text: http*]</pre>
 +
  <pre class="action-style">Actions
  
 +
Open URL: [clipboard]</pre>
  
=== Relgular expression matching ===
+
''' Notes '''
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* On Android 10 and later, Google restricted background clipboard access. To use this trigger on Android 10+, you need one of the following:
Regular expression matching (or regex matching) is a technique for finding patterns within text using a specialized syntax known as regular expressions. It's a powerful tool for text processing and pattern recognition.
+
** Root access with appropriate Magisk modules
</pre>
+
** Enable the "Use Logcat (ADB Hack)" option and grant READ_LOGS permission via ADB
 +
** Enable the UI Interaction accessibility service (allows reading clipboard when MacroDroid is in the foreground)
 +
* The logcat method requires the "Draw Over Other Apps" permission for proper operation.
 +
* When using the logcat method, you must grant permission via ADB with the command: <code>adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS</code>
  
=== Case insensitive ===
+
''' Permissions Required '''
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* READ_LOGS (only for logcat method on Android 10+)
It will ignore the use of upper and lower case in title and detail.
+
* Draw Over Other Apps (for logcat method)
</pre>
 
  
=== Use logcat (ADB Hack)===
+
''' See Also '''
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* [[Action:_Fill_Clipboard|Fill Clipboard Action]]
Standard clipboard access is not possible on Android 10+ unless you have a rooted device with appropriate Magisk modules. As a workaround MacroDroid can monitor the devices logcat output to try and detect when new content appears in the clipboard.
 
</pre>
 

Latest revision as of 22:23, 5 January 2026

This trigger will fire when the value stored in the clipboard is updated.

Options

  • Text to Match - Enter text to match against the clipboard content. Leave blank to trigger on any clipboard change.
    • Supports wildcards (e.g., * for any characters)
    • Supports Magic Text variables
  • Enable Regex - Enable regular expression matching for advanced pattern matching of clipboard content.
  • Case Insensitive - When checked, ignores the use of upper and lower case when matching. This option is disabled when regex mode is enabled.
  • Use Logcat (ADB Hack) - On Android 10+, standard clipboard access is not possible in the background unless you have a rooted device with appropriate Magisk modules. MacroDroid can monitor logcat output to help detect new clipboard content as a workaround for unrooted devices. This option requires granting the READ_LOGS permission via ADB.

Examples

Example 1: Speak clipboard content when copied

Triggers

Clipboard Change [Any]
Actions

Speak Text: [clipboard]

Example 2: Open URL when web address is copied

Triggers

Clipboard Change [Text: http*]
Actions

Open URL: [clipboard]

Notes

  • On Android 10 and later, Google restricted background clipboard access. To use this trigger on Android 10+, you need one of the following:
    • Root access with appropriate Magisk modules
    • Enable the "Use Logcat (ADB Hack)" option and grant READ_LOGS permission via ADB
    • Enable the UI Interaction accessibility service (allows reading clipboard when MacroDroid is in the foreground)
  • The logcat method requires the "Draw Over Other Apps" permission for proper operation.
  • When using the logcat method, you must grant permission via ADB with the command: adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS

Permissions Required

  • READ_LOGS (only for logcat method on Android 10+)
  • Draw Over Other Apps (for logcat method)

See Also