Show Sticky Notes selectively

I would like the Sticky Notes app to be visible only when app A is in the foreground. If any other app is in front, Sticky Notes should be hidden (⌘+H)

How do I do this with BTT? :thinking:

I was hoping it would work with two CAG and two named triggers ... but it doesn't.

I don't think the float on top property of the stickies app can be scripted without activating the stickies app (I have only quickly checked). Because of this it is hard to do a good setup for this.

I think there are probably good alternative stickies apps that could be scripted better...

Hi @Frank1,

If I understand your goal correctly, you want the Stickies app to automatically appear when App A (e.g., Google Chrome) is active and be hidden when any other app takes focus. Here's how you can achieve this in BetterTouchTool (BTT) using "Trigger On Change Of Advanced Trigger Condition / BTT Variables."


Steps:

  1. Set up an advanced condition: Configure a condition to check if either Google Chrome or Stickies is the active app.
  2. Add actions:
    • When the condition evaluates to True, use JavaScript for Automation (JXA) to make Stickies visible.
    • When the condition evaluates to False, use JXA to hide Stickies.

JXA Scripts:

To show Stickies:

var systemEvents = Application('System Events');
systemEvents.applicationProcesses['Stickies'].visible = true;

To hide Stickies:

var systemEvents = Application('System Events');
systemEvents.applicationProcesses['Stickies'].visible = false;

Important Note:

This solution only works if the Sticky note(s) you want to show or hide are set to “Float on Top”. You can enable this setting by:

  1. Selecting the Sticky note you want to modify.

  2. Navigating to the menu bar and clicking Window > Float on Top.

Without this setting, the Stickies app might appear in the background but won’t consistently show the notes in front of other application windows.


Example Configuration:

You can copy and paste the JSON below into BTT to replicate my setup. It checks the active application name and runs the appropriate action based on whether the condition is True or False.

[
  {
    "BTTActionCategory" : 0,
    "BTTLastUpdatedAt" : 1736801134.3442769,
    "BTTTriggerConditionsFormatReadOnly" : "active_app_name == \"Google Chrome\" OR active_app_name == \"Stickies\"",
    "BTTTriggerConditionsData" : "YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGvEBoLDBMZISssLzY6P0BDR0tQUVRcYGRpbG1wclUkbnVsbNMNDg8QERJfEBdOU0N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nGiRjXSMDFzdF8QE05TQ29tcG91bmRQcmVkaWNhdGWjc2M1AAgAEQAaACQAKQAyADcASQBMAFEAUwBwAHYAfQCXAKkAsACyALQAtgC7AMYAyQDLAM0AzwDYAOwA_wEVARcBGQEbAR0BKAEyAUEBVAFgAWIBZAFmAWgBagF3AXwBfgGAAYUBkAGZAawBsAG9AcYBywHNAc8B0QHYAeIB5AHmAegB+gH_Ah4CIgInAjYCOgJCAkcCXQJiAnkCgAKSApQClgKYAqYCqwLHAssC1gLhAuoC9AMDAwUDBgMIAw0DKwMvA0UDSgNiA2YDcgN7A30DfwOBA4MDigOMA44DlwOiA6QDpQOqA60DsgPIAAAAAAAAAgEAAAAAAAAAdQAAAAAAAAAAAAAAAAAAA8w=",
    "BTTTriggerType" : 797,
    "BTTTriggerTypeDescriptionReadOnly" : "Trigger On Change Of Advanced Trigger Condition \/ BTT Variables",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTUUID" : "B239D679-FD36-49D0-BD19-7AB99CE7ECA4",
    "BTTPredefinedActionType" : 366,
    "BTTPredefinedActionName" : "Empty Placeholder",
    "BTTATCTriggerForInitialValue" : 1,
    "BTTATCCheckInterval" : 1,
    "BTTRepeatRate" : 1,
    "BTTEnabled" : 1,
    "BTTEnabled2" : 1,
    "BTTOrder" : 35,
    "BTTAdditionalActions" : [
      {
        "BTTActionCategory" : 7,
        "BTTLastUpdatedAt" : 1736801225.1756439,
        "BTTTriggerParentUUID" : "B239D679-FD36-49D0-BD19-7AB99CE7ECA4",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "239544B7-8289-4F88-A9AD-190FDC6AE85F",
        "BTTPredefinedActionType" : 252,
        "BTTPredefinedActionName" : "Run JavaScript for Automation (async in background)",
        "BTTAdditionalActionData" : {
          "BTTScriptType" : 1,
          "BTTAppleScriptString" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = false;",
          "BTTAppleScriptUsePath" : false,
          "BTTAppleScriptRunInBackground" : true,
          "SelectedAction" : 195,
          "BTTScriptLocation" : 0
        },
        "BTTInlineAppleScript" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = false;",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 1
      },
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1736801214.529562,
        "BTTTriggerParentUUID" : "B239D679-FD36-49D0-BD19-7AB99CE7ECA4",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "C47972F5-919C-4EC9-A67B-FB50E484F550",
        "BTTPredefinedActionType" : 252,
        "BTTPredefinedActionName" : "Run JavaScript for Automation (async in background)",
        "BTTAdditionalActionData" : {
          "BTTScriptType" : 1,
          "BTTAppleScriptString" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = true;",
          "BTTAppleScriptUsePath" : false,
          "BTTAppleScriptRunInBackground" : true,
          "SelectedAction" : 195,
          "BTTScriptLocation" : 0
        },
        "BTTInlineAppleScript" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = true;",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 694
      }
    ]
  }
]

This setup will ensure Stickies appears only when App A is active and hides when focus shifts elsewhere. Let me know if this works for you or if you encounter any issues!

1 Like

ah true that would work! You can also use the "Specific App Did Activate" and "Specific App Did Deactivate" triggers to call the scripts

1 Like

@Frank1 see below the implementation using the "Specific App Did Activate" and "Specific App Did Deactivate" triggers:

[
  {
    "BTTActionCategory" : 0,
    "BTTLastUpdatedAt" : 1736804125.1680191,
    "BTTTriggerType" : 671,
    "BTTTriggerTypeDescriptionReadOnly" : "Specific App Did Activate: Google%20Chrome.app",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTUUID" : "4FF582FE-1FD6-4BDD-B2A1-15103A5A02D5",
    "BTTPredefinedActionType" : 366,
    "BTTPredefinedActionName" : "Empty Placeholder",
    "BTTAdditionalConfiguration" : "file:\/\/\/Applications\/Google%20Chrome.app\/",
    "BTTEnabled" : 1,
    "BTTEnabled2" : 1,
    "BTTOrder" : 36,
    "BTTAdditionalActions" : [
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1736804099.175849,
        "BTTTriggerParentUUID" : "4FF582FE-1FD6-4BDD-B2A1-15103A5A02D5",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "C011F8E4-694A-411E-AB47-AA6D255EF36F",
        "BTTPredefinedActionType" : 252,
        "BTTPredefinedActionName" : "Run JavaScript for Automation (async in background)",
        "BTTAdditionalActionData" : {
          "BTTScriptType" : 1,
          "BTTAppleScriptString" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = true;",
          "BTTAppleScriptUsePath" : false,
          "BTTAppleScriptRunInBackground" : true,
          "SelectedAction" : 195,
          "BTTScriptLocation" : 0
        },
        "BTTInlineAppleScript" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = true;",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 1
      }
    ]
  },
  {
    "BTTActionCategory" : 0,
    "BTTLastUpdatedAt" : 1736804120.4594941,
    "BTTTriggerType" : 672,
    "BTTTriggerTypeDescriptionReadOnly" : "Specific App Did Deactivate: Google%20Chrome.app",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTUUID" : "16584216-801A-42A8-8508-02BE9E717BA9",
    "BTTPredefinedActionType" : 366,
    "BTTPredefinedActionName" : "Empty Placeholder",
    "BTTAdditionalConfiguration" : "file:\/\/\/Applications\/Google%20Chrome.app\/",
    "BTTEnabled" : 1,
    "BTTEnabled2" : 1,
    "BTTOrder" : 37,
    "BTTAdditionalActions" : [
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1736804134.992058,
        "BTTTriggerParentUUID" : "16584216-801A-42A8-8508-02BE9E717BA9",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "9FD9A78A-B7E3-41DD-A04B-5F05E61EC071",
        "BTTPredefinedActionType" : 252,
        "BTTPredefinedActionName" : "Run JavaScript for Automation (async in background)",
        "BTTAdditionalActionData" : {
          "BTTScriptType" : 1,
          "BTTAppleScriptString" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = false;",
          "BTTAppleScriptUsePath" : false,
          "BTTAppleScriptRunInBackground" : true,
          "SelectedAction" : 195,
          "BTTScriptLocation" : 0
        },
        "BTTInlineAppleScript" : "var systemEvents = Application('System Events');\nsystemEvents.applicationProcesses['Stickies'].visible = false;",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 1
      }
    ]
  }
]

I have a lot of scripting experience with the Stickies app... it's horrible, a nightmare... I agree Andreas.

Thank you both very much. I'm sure what you're suggesting will work. But since I don't know anything about scripting, I don't know what I'm doing here.

So I have chosen the easy way. If app A is in front, the stickies are also called up. And if one of the 5 other apps I use the most is in front, the stickies are simply hidden. This works perfectly.

Since I activate all apps with shortcuts, it's easy to add this.

Thanks again! :pray:

1 Like