Skip to content

Instantly share code, notes, and snippets.

View Akemi's full-sized avatar

der richter Akemi

  • Aschaffenburg, Germany
View GitHub Profile
@Akemi
Akemi / metal_layer.swift
Created July 25, 2020 15:17
metal_layer
import Cocoa
class MetalLayer: CAMetalLayer {
unowned var common: MacCommon
override var device: MTLDevice? {
didSet{
if oldValue == nil {
//clearBuffer()
}
@Akemi
Akemi / edr.swift
Last active September 13, 2022 00:20
macOS EDR Test
import Cocoa
import OpenGL.GL
import OpenGL.GL3
extension NSDeviceDescriptionKey {
static let screenNumber = NSDeviceDescriptionKey("NSScreenNumber")
}
extension NSScreen {
@Akemi
Akemi / touchbar.swift
Last active January 22, 2020 13:52
touch bar NSSliderTouchBarItem problem
import Cocoa
extension NSTouchBarItem.Identifier {
static let sliderTest = NSTouchBarItem.Identifier("test.bar.slider")
}
extension NSTouchBar.CustomizationIdentifier {
static let testBar = NSTouchBar.CustomizationIdentifier("test.bar")
}
@Akemi
Akemi / remote.swift
Created July 28, 2019 09:55
MPRemoteCommandCenter Test
// call like "swift remote.swift"
import MediaPlayer
let centre = MPRemoteCommandCenter.shared()
let handler: (String) -> ((MPRemoteCommandEvent) -> (MPRemoteCommandHandlerStatus)) = { (name) in
return { (event) -> MPRemoteCommandHandlerStatus in
print("\(name)")
return .success
}
@Akemi
Akemi / display_test.swift
Last active March 11, 2018 22:45
macOS check display bit depth
// swift -swift-version 3 display_test.swift
import Cocoa
func model() {
var size = 0
sysctlbyname("hw.model", nil, &size, nil, 0)
if size <= 0 {
print("Model: unknown")
} else {