Search code examples
keymando

How to execute system commands in keymando


I need to be able to force a "Detect Display" via Keymando. I didn't see any examples on how to execute system commands. Any thoughts on how to do this?


Solution

  • Thanks to Kevin and this article I got this working using this script. Hope this helps someone in the future.

    # Detect Displays
    map "<Cmd-Ctrl-d>" do
      `osascript -e '
        tell application "System Preferences" to activate
        tell application "System Events"
          tell process "System Preferences"
            click menu item "Displays" of menu "View" of menu bar 1
            tell button "Detect Displays" of window 1 to click
          end tell
        end tell
        tell application "System Preferences" to quit
      '`
    end