MacOS专区,系统管理新增系统音量、锁定屏幕、进入睡眠、设置Dock、隐藏菜单、深色模式

This commit is contained in:
fofolee
2025-01-11 19:11:57 +08:00
parent d6f5350425
commit f7165c9f2d
3 changed files with 32 additions and 104 deletions

View File

@@ -1,26 +1,4 @@
module.exports = {
// 控制中心
controlCenter: async function () {
return await quickcommand.runAppleScript(`
tell application "System Events"
tell process "Control Center"
click menu bar item 1 of menu bar 1
end tell
end tell
`);
},
// 通知中心
notificationCenter: async function () {
return await quickcommand.runAppleScript(`
tell application "System Events"
tell process "NotificationCenter"
click menu bar item 1 of menu bar 1
end tell
end tell
`);
},
// 设置系统音量
setVolume: async function (volume) {
return await quickcommand.runAppleScript(`
@@ -28,17 +6,6 @@ module.exports = {
`);
},
// 设置屏幕亮度
setBrightness: async function (brightness) {
return await quickcommand.runAppleScript(`
tell application "System Events"
tell process "SystemUIServer"
set value of slider 1 of group 1 of window "Display" to ${brightness}
end tell
end tell
`);
},
// 锁定屏幕
lockScreen: async function () {
return await quickcommand.runAppleScript(`
@@ -92,14 +59,6 @@ module.exports = {
`);
},
// 设置时钟格式
setClockFormat: async function (format) {
return await quickcommand.runAppleScript(`
do shell script "defaults write com.apple.menuextra.clock DateFormat -string '${format}'"
do shell script "killall SystemUIServer"
`);
},
// 切换深色模式
toggleDarkMode: async function (enabled) {
return await quickcommand.runAppleScript(`