Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antitoxic/mac-openchrometab
Opens URL in chrome, reusing tab if present, done as an NPM package using JXA script written in TS
https://github.com/antitoxic/mac-openchrometab
applescript chrome google-chrome jxa macos npm typescript
Last synced: 1 day ago
JSON representation
Opens URL in chrome, reusing tab if present, done as an NPM package using JXA script written in TS
- Host: GitHub
- URL: https://github.com/antitoxic/mac-openchrometab
- Owner: antitoxic
- Created: 2023-07-10T18:10:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-22T07:34:33.000Z (about 1 year ago)
- Last Synced: 2024-09-17T22:07:27.379Z (8 days ago)
- Topics: applescript, chrome, google-chrome, jxa, macos, npm, typescript
- Language: TypeScript
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# `@antitoxic/mac-openchrometab`
- `npm` package which offers a single function called `openChromeTab`
- `openChromeTab` opens a URL in `Google Chrome` (_or other Chromium
alternative_), reusing tab if present
- if tab is not opened already, it will attempt to load the URL in a tab which
is blank (`about:blank`) or create a new tab
- if `Google Chrome` is not running, it will start it
- if `Google Chrome` window is unfocused or minimized, it will respectively
focus & un-minimizeTo make work, this package uses a
[`JXA`](https://developer.apple.com/library/archive/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html#//apple_r 'JavaScript for Automation')
script written in `TypeScript`. Even though `JXA` is outdated and unsupported
`JavaScript`, the `TypeScript` offers more familiar development environment than
the usual `AppleScript` used for automating mac.## Usage
```ts
import { openChromeTab } from '@antitoxic/mac-openchrometab';
//...
openChromeTab('http://localhost:8080');
// or
openChromeTab('http://localhost:8080', 'Chromium');
```## Use cases
- During active web development, you can automatically open or reuse already
opened tab
- Writing scripts to focus on specific tab you know the url of.