Add hotkeys to copy submission permalink and submission url
This commit is contained in:
@@ -57,6 +57,8 @@ https://github.com/michael-lazar/rtv
|
|||||||
o : Open the submission or comment url
|
o : Open the submission or comment url
|
||||||
SPACE : Fold or expand the selected comment tree
|
SPACE : Fold or expand the selected comment tree
|
||||||
b : Display urls with urlview
|
b : Display urls with urlview
|
||||||
|
y : Copy submission permalink to clipboard
|
||||||
|
Y : Copy submission link to clipboard
|
||||||
|
|
||||||
[Prompt]
|
[Prompt]
|
||||||
The `/` prompt accepts subreddits in the following formats
|
The `/` prompt accepts subreddits in the following formats
|
||||||
|
|||||||
23
rtv/page.py
23
rtv/page.py
@@ -5,6 +5,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import curses
|
import curses
|
||||||
|
import pyperclip
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import six
|
import six
|
||||||
@@ -318,6 +319,28 @@ class Page(object):
|
|||||||
message = 'New Messages' if inbox > 0 else 'No New Messages'
|
message = 'New Messages' if inbox > 0 else 'No New Messages'
|
||||||
self.term.show_notification(message)
|
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):
|
def clear_input_queue(self):
|
||||||
"""
|
"""
|
||||||
Clear excessive input caused by the scroll wheel or holding down a key
|
Clear excessive input caused by the scroll wheel or holding down a key
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ INBOX = i
|
|||||||
REFRESH = r, <KEY_F5>
|
REFRESH = r, <KEY_F5>
|
||||||
PROMPT = /
|
PROMPT = /
|
||||||
SAVE = w
|
SAVE = w
|
||||||
|
COPY_SUBMISSION_PERMALINK = y
|
||||||
|
COPY_SUBMISSION_URL = Y
|
||||||
|
|
||||||
; Submission page
|
; Submission page
|
||||||
SUBMISSION_TOGGLE_COMMENT = 0x20
|
SUBMISSION_TOGGLE_COMMENT = 0x20
|
||||||
|
|||||||
Reference in New Issue
Block a user