Showing posts with label browsers. Show all posts
Showing posts with label browsers. Show all posts

Thursday, July 21, 2011

Browsers: use TAB to move between form fields

In Firefox, there's a useful setting that allows you to use TAB key to move between form fields only, skipping links. To do so, open "about:config" page, find "accessibility.tabfocus" variable and set it to 3. It took me quite some time to make Chromium to behave in a similar way. This solution was found here

Edit ~/.config/chromium/Default/Preferences. Find the section called `webprefs`. Add the following line at the beginning of the section:

        "tabs_to_links": false,

You can add the line at any place of the section, actually, but keep an eye on commas, they should appear at the end of all lines but the last one. The recipe was not tested on Google Chrome, but I see no reasons why it shouldn't work.

Friday, December 25, 2009

Google Chromium

I've installed Google Chromium today to have a look at the browser features. I think I will put it aside for now. First, I could not find a place where I could define the minimum font size. Chromium's default fonts were painfully small. Second, in Firefox I set accessibility.tabfocus to 3, so that when I press TAB, the cursor moves from one entry field to another, skipping hyperlinks. I could not find something similar in Chromium. Third, Google Wave is not really much faster in Chromium than in Firefox. Fourth, there is no Zotero plugin for Chromium. On the other hand, Google Reader works like a charm in Chromium. Besides, there's a great extension for Chromium, called CrossFire, that imitates Opera "spatial keyboard navigation". So, I'll wait for a while till the numbers one to four above are sorted out...

Tuesday, October 13, 2009

Readability+Opera+StumpWM

Last time I wrote about using Readability bookmarklet in Opera running under StumpWM without mouse. The straightforward solution had a lot of deficiencies. One of the worst ones was that it didn't work in full-screen mode. Here's a much better way. Opera has a number of command-line switches (listed here). One of them, openURL, allows us to open a URL in the current window. So, if we put the bookmarklet code into the URL field, it will do the trick:

(defcommand readability () ()
   (run-shell-command "opera -remote \"openURL(javascript:
(function(){readStyle='style-novel';
readSize='size-medium';
readMargin='margin-medium';
_readability_script=document.createElement('SCRIPT');
_readability_script.type='text/javascript';
_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());
document.getElementsByTagName('head')[0].appendChild(_readability_script);
_readability_css=document.createElement('LINK');
_readability_css.rel='stylesheet';
_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';
_readability_css.type='text/css';
_readability_css.media='screen';
document.getElementsByTagName('head')[0].appendChild(_readability_css);
_readability_print_css=document.createElement('LINK');
_readability_print_css.rel='stylesheet';
_readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';
_readability_print_css.media='print';
_readability_print_css.type='text/css';
document.getElementsByTagName('head')[0].appendChild(_readability_print_css);
})();)\""))

Now, this Stump command will work even in full screen mode. It will even work when the Opera window does not have the input focus.

Of course, the code for any bookmarklet may be supplied instead of Readability.

NB: Just like before, the lines containing the bookmarklet code should be merged in one line before cutting and pasting the above snippet!

Monday, October 5, 2009

Readability bookmarklet, browsers and StumpWM

Recently, I was looking for a way to get rid of the web-design while surfing the Net. Some most obvious ways, like banning custom fonts in Firefox work nice, while banning custom colors makes reading Gmail and Google Reader extremely unpleasant.

In Firefox I use TidyRead extension regularly. In the rare cases when TidyRead fails to do its job in the way I expect it to do, I use Readability bookmarklet. Readability, though, has a huge deficiency of being a bookmarklet. I mean, to use it you have to grab the mouse and click it. Of course, one could use keyboard to select Bookmarks menu and press twenty four arrows to get to the bookmarklet, but, of course, this is not what I would like to see. Especially because I love StumpWM window manager which is known for the disregard of mouse-like pointers. I needed a way to call the bookmark from the keyboard.

Here's what I came up with. Below is a piece of my .stumpwmrc file:

(defcommand readability () ()
  (send-meta-key (current-screen) (kbd "C-l"))
  (window-send-string "javascript:(function(){readStyle='style-novel';readSize='size-medium';
readMargin='margin-medium';
_readability_script=document.createElement('SCRIPT');
_readability_script.type='text/javascript';
_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());
document.getElementsByTagName('head')[0].appendChild(_readability_script);
_readability_css=document.createElement('LINK');
_readability_css.rel='stylesheet';
_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';
_readability_css.type='text/css';
_readability_css.media='screen';
document.getElementsByTagName('head')[0].appendChild(_readability_css);
_readability_print_css=document.createElement('LINK');
_readability_print_css.rel='stylesheet';
_readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';
_readability_print_css.media='print';
_readability_print_css.type='text/css';
document.getElementsByTagName('head')[0].appendChild(_readability_print_css);
})();
")
  (send-meta-key (current-screen) (kbd "RET")))
  (define-key *top-map* (kbd "s-p") "readability")

NB! I had to split the long line into a number of shorter ones. Merge them together to make the command work!

The first lines defines a new command which behaves just like you would: "presses" C-l to move the pointer to the address bar of the browser, pastes the full text of the bookmarklet and presses Return. That's it! And the last line maps the new command to a keyboard shortcut super-p.

Thursday, September 10, 2009

Keyboard navigation addons for Firefox

As I wrote before, Conkeror doesn't support many useful Firefox extensions. I thought I should go back to Firefox and check a number of Firefox addons for surfing with keyboard: mozless, Hit-A-Hint, NumberFox, nomouse. Much to my surprise, neither of them worked with Firefox 3, all of them were outdated. The only one that worked was Mouseless Browsing, but it lacks some features. To begin with, the link numbering cannot be turned off.

So, if four extensions out of five are abandoned, does it mean that the mouseless browsing in Firefox turned out to be too uncomfortable or even completely impossible?

Tuesday, September 8, 2009

Conkeror once more

I've learned to move focus away from the input fields and I found a replacement for TidyRead. See the new configuration file below (unfocus and readability).

// new webjumps:
define_webjump("gread", "http://google.com/reader");
define_webjump("gmail", "https://mail.google.com");
define_webjump("youtube", "http://www.youtube.com/results?search_query=%s&search=Search");
define_webjump("del", "http://delicious.com/search?p=%s&lc=0&atags=&rtags=&context=userposts%7cminaev%7c");


// show history in the url bar:
url_completion_use_bookmarks = false;
url_completion_use_history = true;

// my login at delicious:
add_delicious_webjumps ("minaev");

// install addons from anywhere:
session_pref("xpinstall.whitelist.required", false);

// use tabs:
user_pref("conkeror.load.tab-bar", 1);
require("tab-bar.js");

// auto-save and auto-load session:
require("session.js");
//session_auto_save_file = "/home/minaev/.conkeror.session";
session_auto_save_auto_load = true;
session_auto_save_auto_load_fn = session_auto_save_load_window_current;

//Open Middle-Clicked Links in New Buffers:
require("clicks-in-new-buffer.js");
clicks_in_new_buffer_target = OPEN_NEW_BUFFER; 

// Borrowed from David Kettler (http://www.mozdev.org/pipermail/conkeror/2008-September/001129.html)
interactive("toggle-stylesheets",
            "Toggle whether conkeror uses style sheets (CSS) for the " +
            "current buffer.  It is sometimes useful to turn off style " +
            "sheets when the web site makes obnoxious choices.",
            function(I) {
  var s = I.buffer.document.styleSheets;
  for (var i = 0; i < s.length; i++)
    s[i].disabled = !s[i].disabled;
});

// http://lab.arc90.com/experiments/readability/
interactive("readability_arc90", 
            "Readability is a simple tool that makes reading on the web more enjoyable by removing the clutter around what you are reading", 
            function readability_arc90(I) {
                var document = I.window.buffers.current.document;

                _readability_readStyle=document.createElement('SCRIPT');
                _readability_readStyle.text = 'var readStyle = style-novel;';
                document.getElementsByTagName('head')[0].appendChild(_readability_readStyle);
                _readability_readSize=document.createElement('SCRIPT');
                _readability_readSize.text = 'var readSize = size-large;';
                document.getElementsByTagName('head')[0].appendChild(_readability_readSize);
                _readability_readMargin=document.createElement('SCRIPT');
                _readability_readMargin.text = 'var readMargin = margin-narrow;';
                document.getElementsByTagName('head')[0].appendChild(_readability_readMargin);
                _readability_script=document.createElement('SCRIPT');
                _readability_script.type='text/javascript';
                _readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());
                document.getElementsByTagName('head')[0].appendChild(_readability_script);
                _readability_css=document.createElement('LINK');
                _readability_css.rel='stylesheet';
                _readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';
                _readability_css.type='text/css';
                _readability_css.media='screen';
                document.getElementsByTagName('head')[0].appendChild(_readability_css);
                _readability_print_css=document.createElement('LINK');
                _readability_print_css.rel='stylesheet';
                _readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';
                _readability_print_css.media='print';
                _readability_print_css.type='text/css';
                document.getElementsByTagName('head')[0].appendChild(_readability_print_css);
            });

//interactive("new-tab",
//      "Open new tab",
//      alternates(follow_new_buffer, follow_new_window);
//      $browser_object="http://google.com");

define_key(content_buffer_normal_keymap, "M-q", "unfocus");
define_key(content_buffer_normal_keymap, "M-s", "toggle-stylesheets");
define_key(content_buffer_normal_keymap, "C-x C-s", "session-save");
define_key(content_buffer_normal_keymap, "F", "follow-new-buffer-background");
define_key(content_buffer_normal_keymap, "C-f", "follow-new-buffer");
define_key(content_buffer_normal_keymap, "d", "follow-new-window");
define_key(content_buffer_normal_keymap, "z", "readability_arc90");

// some Firefox keybindings:
define_key(content_buffer_normal_keymap, "C-page_up", "buffer-previous");
define_key(content_buffer_normal_keymap, "C-page_down", "buffer-next");
//define_key(content_buffer_normal_keymap, "C-t", "new-tab");
define_key(content_buffer_normal_keymap, "C-w", "kill-current-buffer");

Monday, September 7, 2009

What is wrong with Conkeror?

  1. You have to change focus from input fields to something else if you want to run a command from the keyboard.
  2. I couldn't find a way to do what I used to do with the right click in Firefox, like copy the url, save image, etc.
  3. Too many extensions do not work in Conkeror. Most of all I miss Google Notebook, TidyRead and Flashblock.

Conkeror: Emacs-like browser

While a long-time user of Firefox, I'm always ready to have a look at the alternatives. Firefox works well, but it's too heavy. Some time ago I found a new Firefox extension called Conkeror, which added Emacs-like keybindings to Firefox. It was too unusual for me at that time and I ditched it. Since then I switched to tiling window managers (first Ion, now Stumpwm) and I thought that Conkeror might fit my new style of work.

It turns out that the new Conkeror is not an extension anymore, but a standalone browser packed with features. It's fully customizable (in JavaScript), extensible (in Python, AFAIU) and, of course, keybound all the way through.

Below is the initialization file I compiled on the very first day with Conkeror:

// shortcuts for Google Reader and Gmail:
define_webjump("gread", "http://google.com/reader");
define_webjump("gmail", "https://mail.google.com");

// keybindings to open links in new buffer and new window
define_key(content_buffer_normal_keymap, "F", "follow-new-buffer-background");
define_key(content_buffer_normal_keymap, "C-f", "follow-new-buffer");
define_key(content_buffer_normal_keymap, "d", "follow-new-window");

// show history items when typing URL:
url_completion_use_bookmarks = false;
url_completion_use_history = true;

// use my delicious:
add_delicious_webjumps ("minaev");

// allow installation of addons from any URL:
session_pref("xpinstall.whitelist.required", false);

// show Firefox-like tabs:
user_pref("conkeror.load.tab-bar", 1);
require("tab-bar.js");

There's a lot of things to borrow from other RC files, but the first steps were made.

I started by installing Conkeror packaged with Ubuntu 9.04, version 080629. This version could not find the location of the Conkeror init file till I explicitly pointed at the file in .conkeror.mozdev.org/conkeror/<profile>/prefs.js, where I added a new line:

user_pref('conkeror.rcfile', '/home/minaev/.conkerorrc');

The Ubuntu version did not support tabs, so I had to grab a Debian package from the Conkeror web site, version 090624.