Add hotkeys to copy submission permalink and submission url

This commit is contained in:
Josue Ortega
2017-04-17 15:16:27 -06:00
parent 967f352081
commit 7a2d248875
4 changed files with 28 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import os
import sys
import time
import curses
import pyperclip
from functools import wraps
import six
@@ -318,6 +319,28 @@ class Page(object):
message = 'New Messages' if inbox > 0 else 'No New Messages'
self.term.show_notification(message)
@PageController.register(Command('COPY_SUBMISSION_PERMALINK'))
def copy_submission_permalink(self):
"""
Copies submission permalink to OS clipboard
"""
data = self.get_selected_item()
url = data.get('permalink')
if url is not None:
pyperclip.copy(url)
@PageController.register(Command('COPY_SUBMISSION_URL'))
def copy_post_permalink(self):
"""
Copies submission url to OS clipboard
"""
data = self.get_selected_item()
url = data.get('url')
if url is not None:
pyperclip.copy(url)
def clear_input_queue(self):
"""
Clear excessive input caused by the scroll wheel or holding down a key