mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
Modified the way shell script are called (#430)
* Added shell detection * Replaced deprecated object to supported version * Updated haptic feedback.swift to support for newer mac Added support for m1 mac
This commit is contained in:
parent
26ad83be70
commit
ac0e44db4d
@ -19,6 +19,7 @@ class HapticFeedback {
|
|||||||
0x200_0000_0100_0000, // MacBook Pro 2016/2017
|
0x200_0000_0100_0000, // MacBook Pro 2016/2017
|
||||||
0x300_0000_8050_0000, // MacBook Pro 2019/2018
|
0x300_0000_8050_0000, // MacBook Pro 2019/2018
|
||||||
0x200_0000_0000_0024, // MacBook Pro (13-inch, M1, 2020)
|
0x200_0000_0000_0024, // MacBook Pro (13-inch, M1, 2020)
|
||||||
|
0x200_0000_0000_0023 // MacBook Pro M1 13-Inch 2020 with 1tb
|
||||||
]
|
]
|
||||||
|
|
||||||
// you can get a plist `otool -s __TEXT __tpad_act_plist /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/Current/MultitouchSupport|tail -n +3|awk -F'\t' '{print $2}'|xxd -r -p`
|
// you can get a plist `otool -s __TEXT __tpad_act_plist /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/Current/MultitouchSupport|tail -n +3|awk -F'\t' '{print $2}'|xxd -r -p`
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.27</string>
|
<string>0.27</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>434</string>
|
<string>448</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.utilities</string>
|
<string>public.app-category.utilities</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
@ -78,7 +78,11 @@ class ShellScriptTouchBarItem: CustomButtonTouchBarItem {
|
|||||||
|
|
||||||
func execute(_ command: String) -> String {
|
func execute(_ command: String) -> String {
|
||||||
let task = Process()
|
let task = Process()
|
||||||
|
if let shell = getenv("SHELL") {
|
||||||
|
task.launchPath = String.init(cString: shell)
|
||||||
|
} else {
|
||||||
task.launchPath = "/bin/bash"
|
task.launchPath = "/bin/bash"
|
||||||
|
}
|
||||||
task.arguments = ["-c", command]
|
task.arguments = ["-c", command]
|
||||||
|
|
||||||
let pipe = Pipe()
|
let pipe = Pipe()
|
||||||
|
|||||||
@ -51,7 +51,11 @@ class SwipeItem: NSCustomTouchBarItem {
|
|||||||
if scriptBash != nil {
|
if scriptBash != nil {
|
||||||
DispatchQueue.shellScriptQueue.async {
|
DispatchQueue.shellScriptQueue.async {
|
||||||
let task = Process()
|
let task = Process()
|
||||||
|
if let shell = getenv("SHELL") {
|
||||||
|
task.launchPath = String.init(cString: shell)
|
||||||
|
} else {
|
||||||
task.launchPath = "/bin/bash"
|
task.launchPath = "/bin/bash"
|
||||||
|
}
|
||||||
task.arguments = ["-c", self.scriptBash!]
|
task.arguments = ["-c", self.scriptBash!]
|
||||||
task.launch()
|
task.launch()
|
||||||
task.waitUntilExit()
|
task.waitUntilExit()
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class VolumeViewController: NSCustomTouchBarItem {
|
|||||||
super.init(identifier: identifier)
|
super.init(identifier: identifier)
|
||||||
|
|
||||||
var forPropertyAddress = AudioObjectPropertyAddress(
|
var forPropertyAddress = AudioObjectPropertyAddress(
|
||||||
mSelector: kAudioHardwareServiceDeviceProperty_VirtualMasterVolume,
|
mSelector: kAudioHardwareServiceDeviceProperty_VirtualMainVolume,
|
||||||
mScope: kAudioDevicePropertyScopeOutput,
|
mScope: kAudioDevicePropertyScopeOutput,
|
||||||
mElement: kAudioObjectPropertyElementMaster
|
mElement: kAudioObjectPropertyElementMaster
|
||||||
)
|
)
|
||||||
@ -66,7 +66,7 @@ class VolumeViewController: NSCustomTouchBarItem {
|
|||||||
var volume: Float32 = 0.5
|
var volume: Float32 = 0.5
|
||||||
var size: UInt32 = UInt32(MemoryLayout.size(ofValue: volume))
|
var size: UInt32 = UInt32(MemoryLayout.size(ofValue: volume))
|
||||||
var address: AudioObjectPropertyAddress = AudioObjectPropertyAddress()
|
var address: AudioObjectPropertyAddress = AudioObjectPropertyAddress()
|
||||||
address.mSelector = AudioObjectPropertySelector(kAudioHardwareServiceDeviceProperty_VirtualMasterVolume)
|
address.mSelector = AudioObjectPropertySelector(kAudioHardwareServiceDeviceProperty_VirtualMainVolume)
|
||||||
address.mScope = AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput)
|
address.mScope = AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput)
|
||||||
address.mElement = AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)
|
address.mElement = AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)
|
||||||
AudioObjectGetPropertyData(defaultDeviceID, &address, 0, nil, &size, &volume)
|
AudioObjectGetPropertyData(defaultDeviceID, &address, 0, nil, &size, &volume)
|
||||||
@ -86,7 +86,7 @@ class VolumeViewController: NSCustomTouchBarItem {
|
|||||||
var address: AudioObjectPropertyAddress = AudioObjectPropertyAddress()
|
var address: AudioObjectPropertyAddress = AudioObjectPropertyAddress()
|
||||||
address.mScope = AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput)
|
address.mScope = AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput)
|
||||||
address.mElement = AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)
|
address.mElement = AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)
|
||||||
address.mSelector = AudioObjectPropertySelector(kAudioHardwareServiceDeviceProperty_VirtualMasterVolume)
|
address.mSelector = AudioObjectPropertySelector(kAudioHardwareServiceDeviceProperty_VirtualMainVolume)
|
||||||
return AudioObjectSetPropertyData(defaultDeviceID, &address, 0, nil, size, &inputVolume)
|
return AudioObjectSetPropertyData(defaultDeviceID, &address, 0, nil, size, &inputVolume)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user