Introducing vipdf

Sun 09 March 2014 by Peter Ward

I mentioned in an earlier post (almost a year ago now, eep!) that I had some more software to release to the world, and as promised, this is the next one. The word “introducing” in the title is perhaps a bit misleading— I’ve written (but not released) several similar programs to this, and I’ve been using this particular program for a few years now, so it’s not really new.

But enough of that, let’s get on to what this thing is.

Rationale

The rationale for vipdf is that I’m unhappy with a lot of existing presentation software, for a variety of reasons, and I realised I could solve a lot of these problems with a vi-style keyboard mapping for navigating presentations.

The things which I wanted specifically were:

  • Moving to an arbitrary slide. If you get to the end of a presentation and then someone in your audience asks you a question about something on slide 15, you should be able to go directly to that slide— you shouldn’t have to move through all the intermediate slides.
  • Skipping over slides. Suppose you’re giving a talk, and you realise that you haven’t got time to talk about something in depth. No matter, your software should let you just skip over the next slide (or two), without flashing those slides at your audience.
  • Keyboard controls. If I have to use a mouse while giving a presentation, I’m going to accidentally click things I didn’t mean to and miss things that I meant to click on. Since I can touch-type, it makes sense to control everything by the keyboard, and by using familiar vi-style keybindings, I can reduce the cognitive overhead of remembering shortcuts.

At the moment, vipdf only supports PDFs (just in case the name didn’t make that obvious), which makes it great for pairing with beamer (as much as I dislike TeX, I haven’t found anything better yet), but you can easily export PDFs from most other presentation software (Microsoft Powerpoint, Keynote and LibreOffice Impress all have this functionality).

Yes, this will remove the gratuitous animations you had carefully wasted time setting up. No, there’s no support for embedded videos (in case you didn’t know, yes, you can do that with PDFs).

Controls

As I mentioned, there are vi-style keyboard controls:

<Left>
Move to the previous slide
N <Left>
Go back N slides (e.g. 3<Left> will move you back 3 slides)
<Right>
Move to the next slide
N <Right>
Go forward N slides (e.g. 2<Right> will skip forward over a slide)
N g
Goto slide N (e.g. 33g takes you to slide 33)
b
Toggle blackout

Yeah, I didn’t map hjkl. If you feel strongly about that, you should let me know in the comments what the mapping should be (should both h and j move back, or only h?)

There’s also controls for auto-advancing slides (t is for timer, btw):

t
Toggle auto-advance on or off.
N t
Start auto-advance (if not already started), and set the time interval to advance every N seconds. The default time interval is 5 seconds.
N [
Set the start slide to slide N, or unset if N is 0.
N ]
Set the end slide to slide N, or unset if N is 0. If auto-advance reaches the end slide, it will loop back to the start slide if one is set, otherwise it will turn off that auto-advance.

API

There’s also a DBUS api available for use, and there’s also a sample control script provided so you can write your own scripts to control your presentation:

$ vipdf-control list
# will give you a list of viewer ids, though at the moment there's just one
# you should take that and pass it into the following commands

$ vipdf-control next $viewerid
# advances by 1 slide

$ vipdf-control next $viewerid 2
# advances by 2 slides

$ vipdf-control prev $viewerid
# goes back 1 slide

$ vipdf-control goto $viewerid 10
# goto slide 10

Unfortunately, the API doesn’t make a lot of sense at the moment, as you can’t have more than one presentation open in a vipdf instance at a time.

Implementation

vipdf is written in Vala, using Poppler and Clutter. You can find the code here.

Quick build instructions for Debian:

$ sudo aptitude install valac libgee-dev libpoppler-glib-dev libclutter-1.0-dev
$ make
...
$ bin/vipdf /path/to/file.pdf

I’ve also written a web interface for it (which also integrates with pjlink).


Python: Wat

Sat 08 March 2014 by Peter Ward

You’ve all seen wat, right? Of course you have.

Of course, Python doesn’t have any Wats, right? Well, not so much.

Let’s talk about Python!

>>> 'toys"r"us'
'toys"r"us'

Makes sense. So if we change those outer quotes to double quotes, we should get a ...

read more

Learning Go with AppEngine

Sat 06 April 2013 by Peter Ward

I’ve been meaning to learn Go for a while, and I had a nice opportunity today to do that. But before I talk about Go, let me explain why I was writing a Go program in the first place.

Last night, I saw that Alex (a friend of mine ...

read more

Introducing gst-launch-dynamic

Fri 05 April 2013 by Peter Ward

I thought it would probably be a good idea to write posts about the random projects I do. As it happens, this particular post is about a tool which still could do with more work, but is in a reasonable enough state to present to the world. I’ve got ...

read more

Blackmagic DeckLink, ConsoleKit and TTYs

Tue 19 February 2013 by Peter Ward

Regular readers may skip this blog post, it’s being posted so people find the solution when the google it, not because it’s interesting.

I had a computer with a Blackmagic capture card, and discovered that it wouldn’t shut down properly. After tracing my way through PolicyKit, I ...

read more

Shell startup scripts

Sun 17 February 2013 by Peter Ward

If you’re a regular shell user, you’ve almost certainly got a .bash_profile or .bashrc script in your home folder, which usually contains various tweaks, such as setting environment variables (adding that directory to $PATH), telling your shell to do clever things (like set -o noclobber) and adding various ...

read more

PSA: Hotmail is Borken

Sat 09 February 2013 by Peter Ward

I’ve just debugged an issue where someone was trying to send an email to my domain, and got back an error message, which they took to mean that the email address no longer existed.

Of the very little debugging information I managed to get out, was this snippet (some ...

read more

Controlling Projectors with PJLink

Fri 30 November 2012 by Peter Ward

I regularly need to control a data projector, and previously the only way to do this has been using a web interface created by the manufacturer. Of course the interface is, while usable, poorly designed, and somewhat sluggish.

Fortunately, there’s a protocol for controlling projectors, PJLink, but unfortunately, there ...

read more

Awesome + GNOME Configuration

Wed 28 November 2012 by Peter Ward

I was recently prompted to publish my configuration for integrating GNOME and awesome. At the time I wrote this setup, the awesome wiki was recommending a configuration which didn’t correctly autostart applications, nor integrate well with anything expecting to find a session manager. However, it now contains instructions for ...

read more

Prettify script for PC^2

Sat 17 November 2012 by Peter Ward

When I was doing programming competitions at uni, I wrote this script, which takes the default HTML output from PC^2 and add some colour to it to indicate passed / failed problems. Since it was written / enhanced on the day of the competition, there’s definitely some hacky code in ...

read more