// Name: Move Chrome Tab to New Window // Description: Moves the active Google Chrome tab into its own window. // Author: tayiorbeii // GitHub: tayiorbeii import "@johnlindquist/kit" if (!isMac) { await notify("This script only works on macOS.") process.exit(0) } const script = ` -- Move active Google Chrome tab to a new window tell application "System Events" set isRunning to (exists process "Google Chrome") end tell if isRunning then tell application "Google Chrome" if (count of windows) is 0 then return set theTab to active tab of front window set newWindow to make new window move theTab to newWindow set index of theTab to 1 -- Close the default new tab in the new window if present if (count of tabs of newWindow) > 1 then repeat with t in (tabs of newWindow) try if (URL of t) is "chrome://newtab/" or (URL of t) is "chrome://newtab" or (URL of t) is "" then close t exit repeat end if end try end repeat end if set index of newWindow to 1 activate end tell else return "Google Chrome is not running" end if ` try { const result = await applescript(script) if (result = "Google Chrome is not running") { await notify(result) } else { await notify("Moved active Chrome tab to a new window") } } catch (e: any) { await notify(`Failed to move tab: ${e?.message || e}`) throw e }