Skip to content

Instantly share code, notes, and snippets.

View amomchilov's full-sized avatar

Alexander Momchilov amomchilov

View GitHub Profile
@amomchilov
amomchilov / visible_apps.py
Last active January 19, 2023 12:57 — forked from pudquick/visible_apps.py
Getting the list of visible apps (think: Force Quit) in macOS via Python and PyObjC
#!/usr/bin/env python3
#ref: https://gist.github.com/pudquick/eebc4d569100c8e3039bf3eae56bee4c
from Foundation import NSBundle
import objc # pip3 install objc
CoreServices = NSBundle.bundleWithIdentifier_('com.apple.CoreServices')
functions = [
('_LSCopyRunningApplicationArray', b'@I'),
('_LSCopyApplicationInformation', b'@I@@'),
import Dispatch
import Foundation
// The Weak struct is the weak wrapper
struct Weak<T: AnyObject> {
weak var object: T?
}
// Stand-in for AUGraphAddRenderNotify
func call(
@amomchilov
amomchilov / DownloadProgressIndicatorDemo.swift
Last active November 3, 2023 08:44 — forked from mminer/DownloadProgressIndicatorDemo.swift
Displays a progress indicator on a file in the Finder.
import Cocoa
let path = "/Users/You/Pick/Any/Random/File/On/Your/System.txt"
let destination = URL(fileURLWithPath: path)
let progress: Progress = {
let p = Progress(parent: nil, userInfo: [
.fileOperationKindKey: Progress.FileOperationKind.downloading,
.fileURLKey: destination,
])