My personal build of Suckless’ sent
Go to file
Hiltjo Posthuma fd303ee9c1 load slide image on-demand
On Sat, Jun 04, 2016 at 05:28:31PM +0200, Markus Teich wrote:
> Hiltjo Posthuma wrote:
> > previously an image file would be opened but only ffread when advancing to
> > the slide, but when the slide was not used it gave an error:
> >
> > 	/usr/local/bin/2ff: failed to convert image/png
>
> Heyho Hiltjo,
>
> thanks for the patch. Unfortunately it does not work if the first slide contains
> an image (ffopen is only called in advance). I think it would be good to merge
> ffopen and ffread instead into a single function ffload. This makes the `LOADED`
> state clearer and also enforces that the fd is closed in the same function where
> it is opened. This ffload function should then be called in advance() replacing
> the ffread() calls if the image is not loaded yet and once in load() for the
> first slide if it is an image.
>

Ah yes, sorry for the oversight.

> If you want to take this new approach, go for it, otherwise I'll look into it
> myself.
>

I have attached a patch that does this, I hope you'll like it.

Also I'm not sure if we need the below code in advance(), I have removed it in
the patch:

        if (slidecount > idx + 1 && slides[idx + 1].img)
                ffread(slides[idx + 1].img);
        if (0 < idx && slides[idx - 1].img)
                ffread(slides[idx - 1].img);

That seems to preload the next and previous slide image right? A minor issue I
notice also is that images seem to flicker, it uses XPutImage directly to
xw.win. Maybe it can be replaced with a backbuffer then XCopyArea? What do you
think?

In advance() it should also not always be needed to rescale the image.

--
Kind regards,
Hiltjo

From 97bebdcab4003f9acdfdd4bdf424449299ffd61d Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 4 Jun 2016 21:34:25 +0200
Subject: [PATCH] merge ffread and ffopen into one function
2016-06-06 17:26:50 +02:00
.gitignore add stuff 2014-06-23 00:39:21 +02:00
arg.h Import arg.h OOB fix from Lucas Gabriel Vuotto. 2016-03-06 20:56:29 +01:00
config.def.h import new drw and util from libsl. 2016-05-24 19:28:44 +02:00
config.mk fix include and lib paths for the BSDs 2016-03-15 23:51:30 +01:00
drw.c import new drw and util from libsl. 2016-05-24 19:28:44 +02:00
drw.h import new drw and util from libsl. 2016-05-24 19:28:44 +02:00
example minor syntax, style and README fixes 2015-12-08 22:09:26 +01:00
LICENSE Support farbfeld as an intermediate format 2015-12-08 20:01:36 +01:00
Makefile prepare switch to libsl 2015-04-05 15:48:47 +02:00
nyan.png add png support 2014-06-29 23:43:01 +02:00
README.md Fix cmdline argument check 2016-03-06 20:49:18 +01:00
sent.c load slide image on-demand 2016-06-06 17:26:50 +02:00
util.c import new drw and util from libsl. 2016-05-24 19:28:44 +02:00
util.h import new drw and util from libsl. 2016-05-24 19:28:44 +02:00

sent is a simple plaintext presentation tool.

sent does not need latex, libreoffice or any other fancy file format, it uses plaintext files to describe the slides and can include images via farbfeld. Every paragraph represents a slide in the presentation.

The presentation is displayed in a simple X11 window. The content of each slide is automatically scaled to fit the window and centered so you also don't have to worry about alignment. Instead you can really concentrate on the content.

Dependencies

You need Xlib to build sent and the farbfeld[0] tools installed to use images in your presentations.

Demo

To get a little demo, just type

make && ./sent example

You can navigate with the arrow keys and quit with q.

Usage

sent [FILE]

If FILE is omitted or equals -, stdin will be read. Produce image slides by prepending a @ in front of the filename as a single paragraph. Lines starting with # will be ignored. A \ at the beginning of the line escapes @ and #. A presentation file could look like this:

sent

@nyan.png

depends on
- Xlib

sent FILENAME
one slide per paragraph
# This is a comment and will not be part of the presentation
\# This and the next line start with backslashes

\@FILE.png

thanks / questions?

Development

sent is developed at http://tools.suckless.org/sent

0: http://tools.suckless.org/farbfeld/