stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] StumpWM and browser bookmarklets


From: Dmitri Minaev
Subject: [STUMP] StumpWM and browser bookmarklets
Date: Thu, 29 Oct 2009 10:58:14 +0400

Bookmarklets can be handy, but very uncomfortable to use in a
basically mouseless environment, like StumpWM. Below is a simple Stump
command which you might find useful -- it triggers a bookmarklet in
the current window. It works in Opera, Firefox and Conkeror.
Unfortunately, in the two latter browsers it works awkwardly: just
pastes the URL into the address bar. It works, but slowly, and it may
be a problem with the bookmarklets longer than the one I used. If you
know a better way, let me know, please :)


(defcommand readability () ()
            (let ((bookmarklet
"javascript:(function(){var%20s=document.createElement(%22script%22);s.charset=%22UTF-8%22;s.language=%22javascript%22;s.type=%22text/javascript%22;s.src=%22http://tidyread.com/tidyread.js?u=%22+encodeURIComponent(document.location.href)+%22&t=%22+encodeURIComponent(document.title);document.body.appendChild(s)})();")
                  (window-class (format-expand
                  *window-formatters* "%c" (current-window))))
              (cond
                ((equal window-class "Firefox")
                 (send-meta-key (current-screen) (kbd "C-l"))
                 (window-send-string bookmarklet)
                 (send-meta-key (current-screen) (kbd "RET")))
                ((equal window-class "Opera")
                 (run-shell-command
                  (concatenate    'string    "opera    -remote
                          \"openURL(" bookmarklet ")\"")))
                ((equal window-class "Conkeror")
                 (window-send-string (concatenate 'string "g " bookmarklet))
                 (send-meta-key (current-screen) (kbd "RET")))
                (t "no"))))

PS: The bookmarklet text should be one line! Delete linebreaks
inserted by mail clients (if any).

PPS: Actually, the keyboard navigation in Opera makes it an almost
ideal browser for Stump.

-- 
With best regards,
Dmitri Minaev

Russian history blog: http://minaev.blogspot.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]