Archive for August, 2015

Alt + Print screen in Xfce

Perhaps it’s merely a fluke of Debian Xfce, but the Print screen key does nothing by default. If you just want to use Print screen that’s easy to rectify through Settings > Keyboard > Application Shortcuts > Add. Use the command xfce4-screenshooter -f or -w for respectively full screen and window. As it turns out that interface doesn’t support the key combination of Alt + Print screen thanks to some kernel feature. The suggestion is to disable the kernel feature, but interestingly enough it works when you add the shortcut manually. Remember how we regained control of Ctrl + F1F12? Once again, edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml. Look for the custom section, which should look a little something like this:

    <property name="custom" type="empty">
      <property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
      <property name="&lt;Primary&gt;&lt;Alt&gt;Delete" type="string" value="xflock4"/>
      <property name="&lt;Primary&gt;Escape" type="string" value="xfdesktop --menu"/>
      <property name="&lt;Alt&gt;F2" type="string" value="xfrun4"/>
      <property name="override" type="bool" value="true"/>
      <property name="&lt;Super&gt;p" type="string" value="xfce4-display-settings --minimal"/>
    </property>

Next, we add in our custom setting:

      <property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>

Now it should look like this.

    <property name="custom" type="empty">
      <property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
      <property name="&lt;Primary&gt;&lt;Alt&gt;Delete" type="string" value="xflock4"/>
      <property name="&lt;Primary&gt;Escape" type="string" value="xfdesktop --menu"/>
      <property name="&lt;Alt&gt;F2" type="string" value="xfrun4"/>
      <property name="override" type="bool" value="true"/>
      <property name="&lt;Super&gt;p" type="string" value="xfce4-display-settings --minimal"/>
      <property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>
    </property>

You’re going to have to log out and log in again (or restart) for the changes to take effect. I have to admit it’s probably more useful to bind Print screen to take window screenshots by default, but on the other hand it might be a good idea to stick to the global standard so you can still use desktop environments other than your own without feeling hampered.

Comments

Custom page number count in Prince

Prince makes it really easy to do all of the usual things with page numbers, like a different numbering scheme in the front matter and whatnot. Unfortunately you can’t counter-increment on @page, but thanks to Prince.addScriptFunc() you’ve got something better.

h2 {counter-reset: page 50}

@page {
	@bottom-left {
		content: prince-script(fixpagenum, counter(page));
		margin-left: 2cm;
	}
}

In this CSS, instead of passing regular generated content, we’re passing a prince-script. That script has to be defined somewhere, like this.

Prince.addScriptFunc("fixpagenum", function(pagenum) {
	pagenum = Number(pagenum);
	pagenum = pagenum + pagenum - 50;
	return pagenum;
});

The rationale in this case was to generate two separate documents, starting at page 50, one only left pages and the other only right pages. (Of course, the other one started at page 51.) I combined them with pdftk’s shuffle command.

pdftk left.pdf right.pdf shuffle output combined.pdf

I don’t think there’s a way to do something like this purely in Prince using CSS, but I’d love to be proved wrong.

Comments

LaTeX: combining added margins with hanging indents

Since I’m using KOMA, the obvious method would seem to be:

\begin{addmargin}[1cm]{0cm}
	Yada.
\end{addmargin}

Unfortunately, that doesn’t seem to combine with the hanging environment. So I did it a little more manually, which will probably have someone shaking their head while I’m stuck feeling pretty clever about it:

\parindent=1cm\hangindent=2cm Yada.

Comments