Skip to content

Instantly share code, notes, and snippets.

View stephancasas's full-sized avatar

Stephan Casas stephancasas

View GitHub Profile
@stephancasas
stephancasas / symbolichotkeynames.txt
Created August 13, 2026 00:38
macOS SymbolicHotKey Names
0: ProcIntr
1: SwitchFwd
2: SwitchBack
3: SessionIntr
4: ScreenSaver
5: DiskEject
6: ProcKill
7: AccessMenu
8: AccessDock
9: AccessWindow
@stephancasas
stephancasas / InteractiveDumbShapeView.swift
Created May 18, 2026 21:44
A playground-style SwiftUI view for experimenting with rounded rectangle stroke styles/behaviors in CoreGraphics
//
// InteractiveDumbShapeView.swift
// StupidRoundedRectangleStroke
//
// Created by Stephan Casas on 3/4/26.
//
import SwiftUI
struct InteractiveDumbShapeView: View {
@stephancasas
stephancasas / NSAlert+NSTextField.swift
Last active March 3, 2026 10:25
An extension on `NSAlert` for `NSTextField` drawing/management
//
// NSAlert+NSTextField.swift
//
// Created by Stephan Casas for OpenAI on 2/26/26.
//
import Foundation
import AppKit
extension NSAlert {
@stephancasas
stephancasas / logprefs.sh
Created February 21, 2026 09:29
macOS zsh utility for logging preference keys of a given process
logprefs () {
LOG_PROCESS="${*}"
log stream \
--level debug \
--style compact \
--predicate '((process == "'"$LOG_PROCESS"'") AND (subsystem == "com.apple.defaults") AND (eventMessage contains[cd] "for key")) AND NOT ((eventMessage contains[cd] "AppleLanguages") OR (eventMessage contains[cd] "cursorIsCustomized") OR (eventMessage contains[cd] "AppleReduceDesktopTinting") OR (eventMessage contains[cd] "reduceMotion"))' \
| perl -ne 'printf "%-70s %-70s\n", $1, $2 if /key (\S+) .*?Domain: ([^,]+)/'
}
@stephancasas
stephancasas / WKWebView+UserIgnoreEvents.h
Last active April 22, 2025 02:22
macOS: Ignore `WKWebView` events
//
// WKWebView+UserIgnoreEvents.h
// EventEavesdropper
//
// Created by Stephan Casas on 4/21/25.
//
#import <WebKit/WebKit.h>
@interface WKWebView (UserIgnoreEvents)
@stephancasas
stephancasas / UnsafeCGWindowListCreateImage.swift
Created March 10, 2025 23:26
Warning-free bindings for the legacy CoreGraphics screenshot/window-capture functions.
//
// UnsafeCGWindowListCreateImage.swift
//
// Created by Stephan Casas on 3/10/25.
//
import Foundation
import CoreGraphics
func UnsafeCGWindowListCreateImage(
@stephancasas
stephancasas / IntelligenceUIPlatterView.swift
Created February 14, 2025 23:49
A SwiftUI expression of Apple Intelligence' NSIntelligenceUIPlatterView — used to accent intelligence-enabled UI components.
//
// IntelligenceUIPlatterView.swift
//
// Created by Stephan Casas on 2/13/25.
//
import SwiftUI
import AppKit
import Combine
@stephancasas
stephancasas / IntelligenceLightView.swift
Created February 12, 2025 23:25
A basic SwiftUI expression of the native Apple Intelligence NSIntelligenceUILightView
//
// IntelligenceLightView.swift
//
// Created by Stephan Casas on 2/12/25.
//
import SwiftUI
import AppKit
struct IntelligenceLightView: NSViewRepresentable {
@stephancasas
stephancasas / Font+Properties.swift
Last active January 31, 2025 21:43
An extension on SwiftUI's font struct adding getters for assigned properties.
//
// Font+Properties.swift
//
// Created by Stephan Casas on 1/31/25.
//
// @depends: https://gist.github.com/stephancasas/4653f98d55a9bfcd7e0830d22e1a3515
import SwiftUI
extension Font {
@stephancasas
stephancasas / Mirror+Extraction.swift
Created January 31, 2025 21:34
An extension providing runtime value extraction and debug utilities for Swift types.
//
// Mirror+Extraction.swift
//
// Created by Stephan Casas on 1/31/25.
//
import Foundation
extension Mirror {