Google Reader keyboard shortcut emulation plugin

Post plugins and custom CSS snippets here
User avatar
raindog469
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 17 Mar 2013, 22:35

Google Reader keyboard shortcut emulation plugin

Postby raindog469 » 17 Mar 2013, 23:03

Hi,

Another Google Reader refugee here. Installed tt-rss yesterday and this morning decided to write this plugin. It rebinds keys as follows:

j - next article
k - previous article
N - next feed (or folder)
P - previous feed (or folder)
Space - next article, or scroll down if the current one is long
r - refresh current feed
u - collapse sidebar (replaces both fullscreen mode and hide folder pane in google reader)
m - toggle item unread
v - open item in new window/tab
A - mark current feed as read

I didn't change the following keys because they do roughly the same thing in tt-rss as GR: /, s, and e.

I didn't change the following keys because either I couldn't immediately figure out how to replicate the Google Reader functionality by just rebinding a key, or it was in use by tt-rss for a multi-key sequence: n, p, X, f, 1, 2, a, S (should be implemented in googleplus plugin), o, enter, and T.

To install, go to the root of your tt-rss install and unzip. It should drop itself into the plugins subdirectory. Reload tt-rss, go to Preferences, Plugins, and enable. Apologies if this breaks anything. I've been using tt-rss for several hours with it and it works for me.

Looking forward to doing more with tt-rss; thanks to fox for making it sane and extensible.

Rob/raindog469
Attachments
ttrss-plugin-google_reader_keys.zip
Tiny Tiny RSS plugin to enable (some) Google Reader keyboard shortcuts.
(2.5 KiB) Downloaded 506 times

rmtew
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 17 Mar 2013, 00:11

Re: Google Reader keyboard shortcut emulation plugin

Postby rmtew » 18 Mar 2013, 01:20

Thanks for this, I've made some additional changes and use it locally. I like standard browser key behaviours work the same on all web pages, like having cursor up and down and space bar do normal browser things. Which they do in Google Reader.

Code: Select all

.. cleared at start of function
      foreach ($hotkeys as $key => $element) {
         unset($hotkeys[$key]);
      }
.. added
      $hotkeys["n"] = "next_article_noscroll";
      $hotkeys["p"] = "prev_article_noscroll";
.. commented
      //$hotkeys[" "] = "next_article"; // by default this just scrolls down

User avatar
raindog469
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 17 Mar 2013, 22:35

Re: Google Reader keyboard shortcut emulation plugin

Postby raindog469 » 18 Mar 2013, 15:39

I actually unbound cursor up and down too, but didn't want to unbind them in the plugin, since I wasn't rebinding them to anything else.

I'll be digging deeper this week to try to get things like expand/collapse article to work, as I miss that in particular, and (I hope) come up with a more comprehensive plugin. For now I'd say it's more than halfway there, though.

jmozmoz
Bear Rating Trainee
Bear Rating Trainee
Posts: 26
Joined: 14 Apr 2013, 18:07

Re: Google Reader keyboard shortcut emulation plugin

Postby jmozmoz » 19 Apr 2013, 22:27

Here are my modifications (if anybody cares :D )

Code: Select all

diff --git a/plugins/googlereaderkeys/init.php b/plugins/googlereaderkeys/init.php
index c8e7d7a..7b075d5 100644
--- a/plugins/googlereaderkeys/init.php
+++ b/plugins/googlereaderkeys/init.php
@@ -18,8 +18,16 @@ class GoogleReaderKeys extends Plugin {

                $hotkeys["j"]           = "next_article_noscroll";
                $hotkeys["k"]           = "prev_article_noscroll";
+               $hotkeys["n"]           = "next_article_noexpand";
+               $hotkeys["p"]           = "prev_article_noexpand";
+               $hotkeys["(27)|escape"] = "toggle_expand";
+               $hotkeys["(13)|return"] = "toogle_expand";
+               $hotkeys["(10)|enter"]  = "toogle_expand";
+               $hotkeys["*m"]          = "feed_catchup";
+               $hotkeys["r"]           = "feed_refresh";
                $hotkeys["*n"]          = "next_feed";
                $hotkeys["*p"]          = "prev_feed";
+               $hotkeys["*x"]          = "cat_toggle_collapse";
                $hotkeys["v"]           = "open_in_new_window";
                $hotkeys["r"]           = "feed_refresh";
                $hotkeys["m"]           = "toggle_unread";

Some are inspired by feedly, some by google reader (X, n, p, r). What I do not really got to work is the ENTER key.

User avatar
raindog469
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 17 Mar 2013, 22:35

Re: Google Reader keyboard shortcut emulation plugin

Postby raindog469 » 19 Apr 2013, 23:47

jmozmoz wrote:Some are inspired by feedly, some by google reader (X, n, p, r). What I do not really got to work is the ENTER key.

I didn't either, so I ended up just making Enter close the article.

Code: Select all

      $hotkeys["(13)|Enter"] = "close_article";


(I've made other changes to the plugin too, like unbinding up and down arrows to make them just go up and down a single line as they normally would, but I'll be updating to trunk before I update the plugin.) Haven't gotten around to making anything expand the article, if that's possible, so I hit j then k to reopen one that I've closed.

I definitely don't think toggling closed/expanded with a single key will be possible just by changing the keymap. But patching tt-rss itself to emulate Google Reader or Feedly completely would be counterproductive, and nothing you'd do would please everyone anyway, as a scan of the topics regarding starred/unread/published articles will show you. Most of us switched from something else to Google Reader and learned its workflow, and eventually we'll all learn tt-rss's too.

jmozmoz
Bear Rating Trainee
Bear Rating Trainee
Posts: 26
Joined: 14 Apr 2013, 18:07

Re: Google Reader keyboard shortcut emulation plugin

Postby jmozmoz » 20 Apr 2013, 00:14

Actually, the main reason to change the key shortcuts for me is that I use Firefox with "Search for text when I start typing". Then two keys shortcuts do not work but after the first key the search box opens and the second key pressed goes into this search box.

jmozmoz
Bear Rating Trainee
Bear Rating Trainee
Posts: 26
Joined: 14 Apr 2013, 18:07

Re: Google Reader keyboard shortcut emulation plugin

Postby jmozmoz » 20 Apr 2013, 00:46

It was just a typo :P
Now it works as expected:

Code: Select all

diff --git a/plugins/googlereaderkeys/init.php b/plugins/googlereaderkeys/init.php
index c8e7d7a..00b414f 100644
--- a/plugins/googlereaderkeys/init.php
+++ b/plugins/googlereaderkeys/init.php
@@ -18,8 +18,15 @@ class GoogleReaderKeys extends Plugin {

                $hotkeys["j"]           = "next_article_noscroll";
                $hotkeys["k"]           = "prev_article_noscroll";
+               $hotkeys["n"]           = "next_article_noexpand";
+               $hotkeys["p"]           = "prev_article_noexpand";
+               $hotkeys["(27)|Escape"] = "close_article";
+               $hotkeys["(13)|Enter"]  = "toggle_expand";
+               $hotkeys["*m"]          = "feed_catchup";
+               $hotkeys["r"]           = "feed_refresh";
                $hotkeys["*n"]          = "next_feed";
                $hotkeys["*p"]          = "prev_feed";
+               $hotkeys["*x"]          = "cat_toggle_collapse";
                $hotkeys["v"]           = "open_in_new_window";
                $hotkeys["r"]           = "feed_refresh";
                $hotkeys["m"]           = "toggle_unread";


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 4 guests