-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: try adjustment to applescript * ci: record during ci * chore: bump package version
- Loading branch information
Showing
7 changed files
with
127 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { execSync, spawn } from "child_process"; | ||
import { dirname } from "path"; | ||
import { unlinkSync } from "fs"; | ||
|
||
/** | ||
* Start a screen recording. | ||
* | ||
* @param {string} filepath The file path to save the screen recording to. | ||
* @returns {Function} A function to stop the screen recording. | ||
*/ | ||
export function record(filepath: string): () => void { | ||
execSync(`mkdir -p ${dirname(filepath)}`); | ||
|
||
try { | ||
unlinkSync(filepath); | ||
} catch (_) { | ||
// file doesn't exist. | ||
} | ||
|
||
const screencapture = spawn("/usr/sbin/screencapture", [ | ||
"-v", | ||
"-C", | ||
"-k", | ||
"-T0", | ||
"-g", | ||
filepath, | ||
]); | ||
|
||
return () => { | ||
screencapture.stdin.write("q"); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters