# Xournal (Fork)¶

I use Xournal a lot for my work. There are two features which I think are missing. Now that on Pentecost break 2016, I finally added both features. This is a fork of Xournal in the hope that these features make it to the upstream eventually.

## Toolbar to the side¶

On my laptop screen, I only have 1366×768 pixel. The worst part is probably the 16:9 where I use a paper in portrait mode on. This means that a lot of space on the left and right are just not used. Then there are two toolbars at the top which steal screen estate. So it looks like this by default:

From the screen economy, that is not idea. What I wanted is something like this:

This way I could use the full height of the screen and still have the toolbars.

First I needed to change the interface a bit. It is generated with glade-2 which is not the current version (GTK is at version 3 now). Fedora luckily ships with the older version as well. Clicking in the GUI there lead me to the changes that I would have to make in src/xo-interface.c.

In order to preserve the original mode, I added a gboolean vertical to this setup function. Depending on the desired mode, the program is then started with either of the interface choices:

if (vertical)
vboxMain = gtk_hbox_new(FALSE, 0);
else
vboxMain = gtk_vbox_new(FALSE, 0);
gtk_widget_show (vboxMain);

gtk_box_pack_start (GTK_BOX (vboxMain), menubar, FALSE, FALSE, 0);


When you now start my fork with --vertical, it will look like this:

I have yet to test that in real life but I am confident that this will be rather neat.

## Export PDF command line option¶

Then I also want to export Xournal files to PDF files from the command line. I have my legacy-file-formats which does that automatically. Currently I have a Java program which simulates the key presses to get the files exported.

On the project homepage, there is a patch which is so outdated that one cannot even apply it to the latest Git version any more. But the gist of it can certainly be used still.

First I needed to find the function that does the printing. In the UI one can find the menu entry:

<child>
<property name="visible">True</property>
<property name="label" translatable="yes">_Export to PDF</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_filePrintPDF_activate" last_modification_time="Wed, 30 Nov 2005 18:44:18 GMT"/>
</widget>
</child>


From there the signal:

g_signal_connect ((gpointer) filePrintPDF, "activate",
G_CALLBACK (on_filePrintPDF_activate),
NULL);


And that is defined here:

void
gpointer         user_data);


And then finally there is the one line that I was looking for:

print_to_pdf_cairo(filename)


Looking at the commandline option parser from the glib, I was able to build in an --export function.

One now has the following help screen by glib:

\$ src/xournal --help
Aufruf:
xournal [OPTION …]

Hilfeoptionen:
-h, --help                  Hilfeoptionen anzeigen
--help-all                  Alle Hilfeoptionen anzeigen
--help-gtk                  GTK+-Optionen anzeigen

Anwendungsoptionen:
-v, --verbose               Be verbose
--vertical                  Vertical layout
-e, --export                Export the file as PDF, exit
--display=ANZEIGE           X-Anzeige, die verwendet werden soll


And then you can call xournal foo.xoj --export bar.pdf and get it exported right away. That is very handy for my work!

You can find my fork here:

GitHub Page

git clone git://github.com/martin-ueding/xournal.git