Viewers should stay in foreground
Classified in : Homepage, Debian, Command line, Grumble
Traditionally, when you start a program to view a document, for instance
xpdf resume.pdf
, it stays in foreground, and only returns when it
finishes, when you are done with the document. Of course you can still run it in
background if you want.
Nowadays, several programs behave in a different way, for instance Evince. When you first start it, it stays in foreground as usual. However, if you launch it a second time while the first instance it still running, it will reuse this existing instance, asking it to open your document in a new window, and immediately return. Other examples are Firefox and LibreOffice.
Increase your productivity with two spaces
Classified in : Homepage, Debian, Command line
Shell prompts are often designed to provide a reminder of useful context information such user name, host and current directory:
PS1="\u@\h:\w\$" tanguy@muscat:~/public_html$
Such a prompt is sufficient to serve its original purpose, but it can be enhances in at least one useful way. Sometimes you have to copy the path of the current directory: with this prompt, it means selecting it by precisely dragging the mouse over it. Well, by adding spaces around the current directory you can become able to select it with a simple double click:
PS1="\u@\h: \w \$" tanguy@muscat: ~/public_html $
Indeed, with such a prompt, you can now roughly point to the path, double click, and let your terminal emulator's word detection feature select the whole path for you. This simple modification may save you several tenths of seconds!
Startup scripts of Bash and Zsh
Classified in : Homepage, Debian, Command line, To remember
Both Bash and Zsh use several startup scripts: profile, bashrc, zlogin, zshrc, etc.
The existence of several startup scripts exists to allow you to apply specific actions for interactive or login shells. For instance, you may want to set up a fancy colour prompt or to enable a powerful completion system for interactive shells only, as it would be pointless to apply it to non-interactive shells (that is, for shell scripts). Or you may want to display a joke and the weather forecast at login, but not each time you spawn a shell by other means.
Repacking ZIP-based containers
Classified in : Homepage, Debian, Command line, To remember
Several modern complex file formats are based on a ZIP container: this is at least the case of OpenDocument and EPUB. However, they are not simply a bunch of files joined into an archive, but they follow some rules in order to be easily recognized by tools such as file. As I had to unpack, modify and repack such a container, here is a recipe to do that.
rxvt-unicode: generate key symbols
Classified in : Homepage, Debian, Command line
rxvt-unicode is a terminal emulator with some interesting features. Here is one of them I find most amazing and elegant: it can generate the symbol characters corresponding to keyboard keys.
It works by pressing and releasing ⎈ + ⇧ (⎈ is the symbol for the Control key, and ⇧ is Shift, of course), then the key which symbol you want to get.
For instance, to get the Caps lock symbol, you type ⎈ + ⇧, ⇬, which gives you the following symbol: ⇬. Here are some other nice examples: ↵ (Return) ⇮ (AltGr aka Level3 Shift) ⌫ (BackSpace) ⎀ (Insert) ⌦ (Delete) ⇱ (Home) ⇲ (End) ⇞ (Prior) ⇟ (Next).
Beware that this will not cancel the effect of {Caps, Num} lock keys: you will get their symbols but also enter the corresponding mode.