https://github.com/laelsirus/SleepToggle
잠자기 활성화/비활성화 토글 앱입니다
현재 잠자기 활성화 상태에 따라 반대 상태로 토글됩니다
첫 토글 시 권한 묻습니다
터미널이 켜진 상태에서 실행하면 잠자기 토글 후 터미널이 꺼집니다 - 주의하세요 수정 됨
아래 스크립트를 이용하였습니다
자유롭게 수정하세요
- 오류가 있어 수정했습니다
- 터미널 닫기/종료 수정 05/20/20:00
- pmset -g disablesleep 명령어를 한번도 사용하지 않은 시스템을 위한 구문 추가 05/20/21:30
- 4 님의 아이콘 적용, alert -> dialog 수정 05/26/11:30
--by Ael
on isRunning(appName)
tell application "System Events" to (name of processes) contains appName
end isRunning
on sleepToggle()
tell application "Terminal"
activate
do script "pmset -g"
delay 1
if contents of front window does not contain "SleepDisabled" then
do shell script "sudo pmset -a disablesleep 0" with administrator privileges
else if contents of front window contains "SleepDisabled 0" then
display dialog "잠자기가 활성화 상태입니다" buttons {"닫기", "비활성화"} default button {"비활성화"}
if button returned of result = "비활성화" then
do shell script "sudo pmset -a disablesleep 1" with administrator privileges
tell application "System Events" to activate
display notification "잠자기가 비활성화 되었습니다" with title "Sleep Toggle" sound name "submarine"
end if
else if contents of front window contains "SleepDisabled 1" then
display dialog "잠자기가 비활성화 상태입니다" buttons {"닫기", "활성화"} default button {"활성화"}
if button returned of result = "활성화" then
do shell script "sudo pmset -a disablesleep 0" with administrator privileges
display notification "잠자기가 활성화 되었습니다" with title "Sleep Toggle" sound name "submarine"
end if
end if
end tell
end sleepToggle
set TerminalRunning to isRunning("Terminal")
if TerminalRunning then
sleepToggle()
tell application "Terminal"
tell application "Terminal" to close front window
end tell
else
sleepToggle()
tell application "Terminal"
quit "Terminal"
end tell
end if
모든 응용프로그램 종료 앱 QuitAllApps
https://x86.co.kr/macnews/3505071
서드파티 앱은 조금 꺼림직해서 터미널 명령어로 잠자기 활성/비활성하는데 타이핑이 귀찮아서 만들었어요..ㅎㅎ
토글 앱 동작 오류가 있어서 수정해서 재첨부 했습니다
"님의 댓글"
이 댓글을 신고 하시겠습니까?
너무 감사합니다. 모하비 이후 잠자기 안걸려야 하는 앱을 무시하고 곤히 잠들고 있어 ...곤란했는데요.