MacOS
  • 목록
  • 아래로
  • 위로
  • 쓰기
  • 검색

[수정3] 잠자기 활성화/비활성화 토글 앱 SleepToggle

SleepToggle.app.zip

https://github.com/laelsirus/SleepToggle


잠자기 활성화/비활성화 토글 앱입니다

현재 잠자기 활성화 상태에 따라 반대 상태로 토글됩니다

첫 토글 시 권한 묻습니다

터미널이 켜진 상태에서 실행하면 잠자기 토글 후 터미널이 꺼집니다 - 주의하세요 수정 됨

아래 스크립트를 이용하였습니다

자유롭게 수정하세요


- 오류가 있어 수정했습니다

- 터미널 닫기/종료 수정 05/20/20:00

- pmset -g disablesleep 명령어를 한번도 사용하지 않은 시스템을 위한 구문 추가 05/20/21:30

- 님의 아이콘 적용, 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

QuitAllApps.app.zip 모든 응용프로그램 종료 앱 입니다저장하지 않은 문서는 저장 여부를 물어봅니다아래 스크립트를 이용하였습니다자유롭게 수정하세요알림 센터 초기화 추가...
Ael | 2019.05.19


 

  • 구독(37명)

Ael Ael
42 Lv. 42766/43000P

댓글 7

참여를 하시면 세상을 바꿉니다.
profile image
1등 Mactopia 2019.05.20. 15:40 |댓주소:#3506937
Ael

너무 감사합니다. 모하비 이후 잠자기 안걸려야 하는 앱을 무시하고 곤히 잠들고 있어 ...곤란했는데요.

profile image
Ael 작성자 2019.05.20. 18:40 |댓주소:#3507149
Mactopia

서드파티 앱은 조금 꺼림직해서 터미널 명령어로 잠자기 활성/비활성하는데 타이핑이 귀찮아서 만들었어요..ㅎㅎ

토글 앱 동작 오류가 있어서 수정해서 재첨부 했습니다

댓글 쓰기

선택 삭제 전체 선택
익명상태

신고

"님의 댓글"

이 댓글을 신고 하시겠습니까?

삭제

"님의 댓글"

이 댓글을 삭제하시겠습니까?