Skip to Content

cmdop os

cmdop os controls the desktop of the machine it runs on: windows, applications, keyboard, mouse, clipboard, screenshots, and notifications.

cmdop os list cmdop os focus Safari cmdop os type "Hello, World!"

These actions go through the operating system’s own automation surfaces. macOS requires Accessibility permission for input and window control, and Screen Recording permission for screenshots; Cmdop does not bypass either. Grant only the permission the action you intend actually needs.

Windows and applications

cmdop os list # every visible window cmdop os list Safari # filter by application name cmdop os list --json cmdop os active # the currently focused window cmdop os active --json cmdop os apps # running applications cmdop os focus "Visual Studio Code" cmdop os launch Safari cmdop os quit Safari cmdop os quit -f Safari # force quit

focus matches a substring of the window title, so cmdop os focus Terminal finds any window containing “Terminal”. launch takes an application name or a bundle identifier and accepts --no-wait to return without waiting for the app to come up. list also answers to windows and ls.

Keyboard

cmdop os type "Hello, World!" cmdop os type --delay 50 "Slower typing" cmdop os key enter cmdop os key --mod cmd c cmdop os key --mod cmd,shift z

type writes into whatever window is active — focus the right window first. --delay is the pause between keystrokes in milliseconds.

key presses one key, with modifiers supplied through --mod as a comma-separated list (cmd, ctrl, alt, shift). Write --mod cmd,shift z, not cmd+shift+z. Named keys include enter, tab, escape, backspace, delete, space, up, down, left, right, home, end, pageup, pagedown, and f1 through f12.

Mouse

cmdop os click 100 200 cmdop os click 500 300 --button right cmdop os click 100 100 --double cmdop os move 100 200 cmdop os scroll 3 # up cmdop os scroll -5 # down

--button takes left (the default), right, or middle. move positions the cursor without clicking. scroll acts at the current cursor position; positive values scroll up, negative down.

Clipboard

cmdop os clipboard get cmdop os clipboard set "Hello"

Screen

cmdop os screenshot # base64 to stdout cmdop os screenshot screen.png # to a file cmdop os screenshot -r 0,0,800,600 # a region cmdop os screenshot -d 1 # a specific display

-r/--region takes x,y,width,height. -d/--display selects a display, 0 being the main one.

cmdop os ui cmdop os ui --depth 5 cmdop os ui --json

ui returns the accessibility tree of the active window — buttons, text fields, and other elements — to a maximum depth of 3 unless you raise --depth.

Notifications

cmdop os notify "Build complete" cmdop os notify --title "Error" --level error "Deploy failed" cmdop os notify --urgent "Critical: disk space low" cmdop os notify --banner "Info message"
FlagPurpose
--title <text>Notification title. Defaults to the product name.
--level <level>info (default), success, warning, or error.
--urgentShow a modal alert on top of all windows, bypassing Focus Mode.
--bannerForce a banner even while Focus Mode is on — the OS may still hide it.

notify runs a delivery check first and explains what is blocking a notification (a missing platform tool, an active Focus Mode) rather than failing silently.

Platform scripts

cmdop os script 'tell app "Finder" to activate' cmdop os script --lang bash 'echo $HOME' cmdop os script --file script.applescript

The default language follows the platform: AppleScript on macOS, PowerShell on Windows, Bash on Linux. --lang takes applescript, powershell, or bash. -f/--file reads the script from a file instead of an argument.

Last updated on