This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
const App = Application.currentApplication(); | |
App.includeStandardAdditions = true; | |
const BINARY = '/usr/libexec/avconferenced'; | |
function run(_) { | |
const avconferenced = App.doShellScript( | |
`ps -A | grep '${BINARY}' | awk '{print $1,$4}'`, |
This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
function run() { | |
const VSCode = axApp('com.microsoft.VSCode'); | |
const window = axGet(VSCode, 'AXWindows')[0]; | |
return axWindowSetBounds(window, 200, 200, 1200, 1400); | |
} | |
/** |
This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
const USER = 'stephan'; | |
function run() { | |
const ControlCenterPID = | |
$.NSRunningApplication.runningApplicationsWithBundleIdentifier( | |
'com.apple.controlcenter', | |
).firstObject.processIdentifier; |
This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
function run(_) { | |
const pid = $.NSRunningApplication.runningApplicationsWithBundleIdentifier( | |
'com.microsoft.VSCode', | |
).firstObject.processIdentifier; | |
// Bring all VSCode windows to the current Mission Control view. | |
$.CGSProcessAssignToAllSpaces($.CGSMainConnectionID(), pid); |
This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
const App = Application.currentApplication(); | |
App.includeStandardAdditions = true; | |
function run(_) { | |
// Prompt for folder selection. | |
const dir = `${App.chooseFolder({ | |
withPrompt: 'Select the folder containing your exported messages...', | |
})}`; |
This file contains hidden or 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
// | |
// InlineHostTextView.swift | |
// InlineHostTextView | |
// | |
// Created by Stephan Casas on 4/30/23. | |
// | |
import SwiftUI; | |
import AppKit; | |
import Combine; |
This file contains hidden or 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
/// Where `axApplication` is an instance of an AXUIElement application and `self` is the receiving notification class. | |
AXObserverAddNotification(observer, axApplication, kAXMainWindowChangedNotification as CFString, | |
UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())); | |
AXObserverAddNotification(observer, axApplication, kAXFocusedWindowChangedNotification as CFString, | |
UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())); | |
AXObserverAddNotification(observer, axApplication, kAXFocusedUIElementChangedNotification as CFString, | |
UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())); | |
AXObserverAddNotification(observer, axApplication, kAXApplicationActivatedNotification as CFString, | |
UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())); |
This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
const $attr = Ref(); | |
const $windows = Ref(); | |
const $children = Ref(); | |
function run(_) { | |
// Get TextMate AXUIElement | |
const textmatePid = | |
$.NSRunningApplication.runningApplicationsWithBundleIdentifier( |
This file contains hidden or 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
#!/usr/bin/env osascript -l JavaScript | |
/** | |
* ----------------------------------------------------------------------------- | |
* Toggle Do Not Disturb Mode from Control Center | |
* ----------------------------------------------------------------------------- | |
* | |
* Created on May 18, 2023 by Stephan Casas | |
* | |
* Options: |