Skip to content

Commit

Permalink
Add hotkey listener
Browse files Browse the repository at this point in the history
  • Loading branch information
lamasters committed Aug 17, 2020
1 parent 6c1d51d commit eae93bb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions defe/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import argparse
import sys
import keyboard
import pynput

from colorama import Fore, Style, init

Expand Down Expand Up @@ -101,6 +103,7 @@ def main():

args = parser.parse_args()

hotkey_listener()
set_feed(args.feed, args.max_feed_count, False)

def set_feed(feed_arg, max_feed_count, refresh):
Expand Down Expand Up @@ -161,6 +164,12 @@ def set_feed(feed_arg, max_feed_count, refresh):
Style.BRIGHT + "Open a PR at https://github.com/Bhupesh-V/defe", end="\n\n",
)

def on_press():
controller = pynput.keyboard.Controller()
controller.type('REFRESH\n')

def hotkey_listener():
keyboard.add_hotkey('alt+r', on_press)

if __name__ == "__main__":
main()

0 comments on commit eae93bb

Please sign in to comment.