ANN Twitling: a Twitter link digest tool#
Wed, 01 Feb 2012 12:54:57 +0000
Problem: I can't keep up with the Internet
I often check Twitter on my phone. When I see tweets with links in
them I tend to skip over them intending to return later when I'm on a
computer with a full-size screen, and then forget about them either
because I find something else to look at or I can't be bothered with
scrolling all the way down again. And looking through old tweets is
nearly as bad on the full-size twitter web site as it is in a mobile
client.
Proposed solution: I need a computer program to read the Internet for me
Thus, Twitling: a small
script consisting of Ruby and Sinatra and OmniAuth and the Twitter gem
and Typhoeus to grab links in parallel, the function of which is to
read one's timeline and display the resolved URL, the title and an
excerpt from the text of each link that was posted. Source code is on
Github.
I haven't really used it myself yet in anger: the first thing I notice
while testing it is that there are a whole lot more links in my feed
than I thought there were, and the original plan to produce a 24 hour
digest might become very unwieldy.
Possible further development ideas include
- speed it up, by prefetching, better caching, or fetching the links
asynchronously and client-side
- an "older" link at the bottom of the page
- Atom/RSS output so it gets fed to me every so often and I don't have
to remember to check it
- email output (for the same reason)
- some css gradient fills just to make it look modern (hey, I already
used text-shadow, what do you want, round button borders?)
- your suggestion here: email dan@telent.net or open an
issue on Github. Bug
reports too.
Try not to break it, please.
Sharpening the sawfish#
Wed, 22 Feb 2012 20:25:20 +0000
My son is two weeks old today. I don't usually go a bundle on
putting personal info on the public web - I keep that for
Facebook, where they at least pretend to keep it private for me
- but I mention this to explain why I'm using my laptop a lot
more than my desktop lately.
The problem with my laptop is the mouse pointer. It's one of those
pointing stick
devices technically known (apparently) as an isometric joystick
and more commonly known as a nipple , and
when the room is warm the little rubber cap gets slippery very quickly.
So I decided to invest a little time in a few keyboard shortcuts.
As an Emacs user I know I'm supposed to like tiling window
managers, but I don't. My editor windows are windows onto text
files that may be any size and shape but in which it's a fairly
safe bet (see "locality of reference") that the spot I want to
edit next is usually spatially close to the spot I'm currently
looking at. The other 'windows' on my screen are things like web
browsers and GUI programs where there's no such guarantee, and
the only way to make them work is to allow them to take the size
and shape that their authors wanted them to have. So after a
brief experiment with awesome I
punted it and went looking for a programable window manager that
was designed for overlapping windows.
And ended up back with Sawfish, which I used to use
back when it was fashionable.
Sawfish customization is a two-phase process: first you write
commands in Lisp, then you use the sawfish-ui
program to assign
them to keystrokes. A bit like Emacs, really, and perhaps not
surprisingly.
First I needed some shortcuts to focus particular windows (Emacs, Firefox,
xterms). Happily, someone has done the work for this already: I
just had to download
the Gimme script and set up bindings
for it
Then I needed something to chuck windows around the screen. The
requirement is pretty simple here: every window on my screen is
aligned against an edge, so I just need commands to pan a window
to each edge. Here is the finished script
in which the points I would like to draw attention to are
- I use focus-follows-mouse mode, or whatever it's called these
days. This means that if I move a window under the pointer I
need to move the pointer too otherwise it will go out of focus.
The
warp-cursor-to-window
function does this: I needed to
calculate the pointer position relative to window, which for some
reason isn't a builtin.
-
window-frame-dimensions
is window-dimensions
plus the
decorations. We need these dimenstions for throwing windows
rightwards or downwards, otherwise they end up slightly
offscreen.
-
define-command
is the magic that makes our new functions show
up in the sawfish-ui
dialog. The "%f"
sigil means to pass
the current window into the function.
And that's about it. Put the file somewhere that sawfish will
find it - for me, ~/.sawfish/lisp
seems to be a good place - add the lines
(require 'gimme)
(setq warp-to-window-enabled t)
(require 'throw-window)
to .sawfishrc
, and then set up your keys in sawfish-ui
. I
assigned them to Windows-key shortcuts: at last, I have a use for
the Windows key.
If you hadn't spotted in amongst all that, I have
githubbed my dotfiles. More
for my convenience than for your edification, but feel free to
rummage. If you are one of the three other remaining XTerm
users, have a look at the XTerm*VT100*translations
in
my .Xdefaults
- I stole that "press Shift+RET to background the command" trick
from Malcolm Beattie
nearly twenty years ago and have been using
it ever since.