Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Keyboard Shortcut #190

Open
ibehnam opened this issue Jul 30, 2022 · 4 comments
Open

[Suggestion] Keyboard Shortcut #190

ibehnam opened this issue Jul 30, 2022 · 4 comments

Comments

@ibehnam
Copy link

ibehnam commented Jul 30, 2022

Many users use apps that hide menu bar items. It'd be great if we could set a keyboard shortcut to toggle KeepingYouAwake without having to click on its icon.

@newmarcel
Copy link
Owner

That's definitely a good idea to provide a customizable keyboard shortcut 👍. Thanks for the suggestion!

@ibehnam
Copy link
Author

ibehnam commented Sep 13, 2022

Sure thing! I think if KYA gets integrated with Raycast, then it would solve the problem because one can set shortcuts in Raycast. For example, this does what KYA does within Raycast, but unfortunately it doesn't show the status in the menu bar like KYA.

@tjdoc
Copy link

tjdoc commented Feb 4, 2023

You can add custom Raycast scripts to achieve this functionality. Commands you'll need are

  • open keepingyouawake:///activate
  • open keepingyouawake:///deactivate
  • open keepingyouawake:///toggle

for example, you can use the following code (keepingyouawake.py)

#!/usr/bin/env python3
#
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title keepingyouawake
# @raycast.mode silent
# @raycast.packageName Raycast Scripts
#
# Optional parameters:
# @raycast.argument1 { "type": "text", "placeholder": "on/off/Toggle", "optional": true}

import sys
import subprocess
if sys.argv[1].lower() == 'on':
  subprocess.call("open keepingyouawake:///activate", shell=True)
elif sys.argv[1].lower() == 'off':
  subprocess.call("open keepingyouawake:///deactivate", shell=True)
else:
  # no argument will toggle on/off
  subprocess.call("open keepingyouawake:///toggle", shell=True)

@ibehnam
Copy link
Author

ibehnam commented Feb 12, 2023

You can add custom Raycast scripts to achieve this functionality. Commands you'll need are

  • open keepingyouawake:///activate
  • open keepingyouawake:///deactivate
  • open keepingyouawake:///toggle

for example, you can use the following code (keepingyouawake.py)

#!/usr/bin/env python3
#
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title keepingyouawake
# @raycast.mode silent
# @raycast.packageName Raycast Scripts
#
# Optional parameters:
# @raycast.argument1 { "type": "text", "placeholder": "on/off/Toggle", "optional": true}

import sys
import subprocess
if sys.argv[1].lower() == 'on':
  subprocess.call("open keepingyouawake:///activate", shell=True)
elif sys.argv[1].lower() == 'off':
  subprocess.call("open keepingyouawake:///deactivate", shell=True)
else:
  # no argument will toggle on/off
  subprocess.call("open keepingyouawake:///toggle", shell=True)

Thanks, this is the way. I aliased it with ka in Raycast and solved the problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants