diff --git a/src/plugins/preferences/preferences.plugin.ts b/src/plugins/preferences/preferences.plugin.ts index 417ea408..cb1c684d 100644 --- a/src/plugins/preferences/preferences.plugin.ts +++ b/src/plugins/preferences/preferences.plugin.ts @@ -220,6 +220,11 @@ export class PreferencesPlugin extends SpotterPlugin implements SpotterPluginLif icon: '/System/Applications/System\ Preferences.app', action: () => this.sleep(), }, + { + title: 'Lock Screen Preferences', + icon: '/System/Applications/System\ Preferences.app', + action: () => this.lockScreen(), + }, ]; } @@ -242,4 +247,8 @@ export class PreferencesPlugin extends SpotterPlugin implements SpotterPluginLif private async sleep() { await this.api.shell.execute("osascript -e 'tell app \"System Events\" to sleep'") } + + private async lockScreen() { + await this.api.shell.execute("osascript -e 'tell app \"System Events\"' -e 'tell process \"SystemUIServer\" to keystroke \"q\" using {command down, control down}' -e 'tell end'") + } }