My favourite window manager is Spectrwm but with its default setting I get a minor annoyance in relation to window focusing.
Suppose you have Window A in Main and Window B in Stack and the focus is on Window A. You now swap these two windows with Mod+Return, so that Window A is in the Stack and Window B is in Main. With the default setting the focus is still on Window A but I usually want it to be on Window B, in Main.
Of course, I can easily achieve this with Mod+m, but I find it irritating to have to do this each time I switch windows, which I do very frequently. In dwm the problem doesn’t arise and I was seriously thinking of changing to dwm for this reason. But Spectrwm has so many features I like that this wasn’t really an option.
The solution, as so often, was RTFM. The man page says that setting “focus mode” to “follow” does this:
Set window focus on all cursor border crossings,
including workspace switches and changes to layout.
This gives me the behaviour I want. The cursor is normally in the window I’m working in (Window A initially in this case). When I swap the windows the cursor is still Main, which now contains Window B, and the focus follows it. Simple, really.
However, this creates a problem. Mod+Space cycles between three different layouts one of which is layout_max, but when I access this the display flickers. As I don’t need layout_max (I can use Mod+e for this) I unbind Mod+Space to prevent that layout being accessed accidentally; I bind Mod+v for vertical layout and Mod+z for horizontal layout. Here are the relevant entries in the configuration file.
bind = Mod+space # unbind mod + Space
bind[layout_vertical] = Mod+v
bind[layout_horizontal] = Mod+z
Note: For this to work, the pointer must be in the window you want the focus to be in (on the left of the sceeen, i.e. in Main). Just occasionally I still get a flicker, e.g. if starting Firefox from dmenu); to stop this, use Mod+q.
I’ve long heen an enthusiast for tiling window managers and have blogged about them previously. I last used i3 a number of years ago (perhaps version 4.11). At that time I said that I liked it but preferred Spectrwm. Now i3 is at version.4.6 and its popularity seems to be expanding, so I thought it was time to give it a fresh look to see whether I still prefer Spectrwm. I find I do although i3 is certainly impressive.
Here I summarise what seem to me to be the main differences between the two WMs. Obviously this is a subjective comparison but I shall give the reasons for my preferences.
Community and support
Here i3 has the clear advantage. It has a large user base and lots of online support (mailing list, IRC etc.), which makes it easy for newcomers to get help.
For Spectrwm this element is pretty much lacking. It has good documentation but there isn’t an online community of the kind that i3 enjoys. But it is still maintained; the most recent version (3.2.0) was released in Sept. 2018, and you can chat with the developers at OFTC channel #spectrwm.
The main way in which the two WMs differ is in how they arrange their tiled windows (both offer floating windows if wanted.)
Spectrwm is similar to Dwm and Xmonad. The first window appears in the ‘master’ area on the left of the screen; subsequent windows are created in a stacking area on the right.
This isn’t as rigid as it may sound. You can work in any window you have open, whether it is in the master area or not.
i3 doesn’t have the concept of a master area. It places its windows either side by side (horizontally) or one above the other (vertically). All the windows are of equal status.
Each of these methods has its advantages and disadvantages.
i3 can produce more complex patterns than Spectrwm; you can mix vertical and horizontal windows in the same workspace, as shown above. Spectrwm can’t do this; the windows are either horizontal or vertical but not both in the same workspace.
However, in i3 you have to decide which layout, horizontal or vertical, to use before you create a new window, and as far as I know you can’t alter this later without deleting and recreating the windows concerned. In Spectrwm you can alternate between these layouts on the fly with Mod + Space.
In practice I hardly ever need the complexity that i3 offers because I seldom have more than two or three windows open in any one workspace. On the other hand I prefer the working window to be on the left of the screen; this is easy to achieve in Spectrwm, simply by swapping the stacked and master windows with Mod + Return. Swapping two windows is possible in i3 but more complicated.
Altering the size of the windows
In Spectrwm you can increase or decrease the size of the master area by pressing Mod + l or Mod + h. I find this extremely useful. In i3 you are encouraged to use the mouse to alter the size of windows, which is quite fiddly. I prefer to use the keyboard whenever possible; there is a way of doing this in i3 but it’s not very straightforward.
A peculiarity of i3 is that instead of using the vi key bindings (hjkl) for movement it uses jkl; by default. This annoys me . You can of course change it, but then you have to find an alternative for Mod + h which by default is used to set the horizontal window layout. This seems an unnecessary complication.
As far as I can see, all the commands that i3 offers are also present in Spectrwm apart from those that are i3-specific . On the other hand, a useful feature of Spectrwm that I don’t think is present in i3 is the option to “iconify” a process, which means that it is no longer on-screen but doesn’t stop working. For example, suppose you start mplayer or mpv in an xterm to play some music. If you iconify the window the music will continue playing. When it finishes or if you want a different piece you simply un-iconify the window to make the changes. This command is also useful if you want to start a second browser temporarily or compile a large program.
As you can see, for me Spectrwm comes out on top for all comparisons except community support.
Making this analysis of the differences between i3 and Spectrwm has been a useful exercise. It’s shown me why I prefer Spectrwm. But I don’t want to knock i3; it’s an excellent tiling WM and deciding which is better comes down to personal preference and priorities. Newcomers to the world of tiling WMs would probably find it easier to use i3 initially because it allows for more hand-holding. But even if that’s your case I’d suggest trying Spectrwm later as well.
Fortunately experimentation is easy. Both i3 and Spectrwm work well out of the box with their default settings; perhaps the only immediate change that may be needed is to assign the Windows key (Mod4) as modifier in place of Alt (i3 has a wizard which offers you this choice as part of its setup process.) Anyway, both have configuration via plain text files so there is no need to learn a new programming language in order to configure them.
Mutt has the command ‘c’ to hide (weed) most of the headers in emails. After an upgrade to 1.12.0 I found this wasn’t working. I emailed Stuart Henderson, the maintainer of the Mutt package for OpenBSD. He thinks this is due to a change in the code of the new version of Mutt. He advised including these lines in .muttrc:
unignore From To CC Subject Date Reply-To Organization X-Mailer User-Agent Organisation Organization Priority Importance Mail-Followup-To
This makes ‘c’ work correctly. Thanks, Stuart.
Note added 31 May: Stuart has sent me a link which explains how the problem arose (https://gitlab.com/muttmua/mutt/issues/144).
In a recent post on email@example.com Ingo Schwarze, an OpenBSD developer, wrote as follows.
I waste time whenever i have to select anything from any kind of menu, select any icon from any kind of iconbox or desktop background, select any file or directory from any file selection dialogue, or have to click any icon in any dialogue box.
I prefer typing commands and use as little menus, clickable icons, selection lists, and dialogue boxes as possible because it is faster, simpler, and requires less looking at the screen.
My feeling exactly. I favour the KISS (Keep It Simple, Stupid) principle in computing, although it took me a long time to realise this fully. But looking back I see it’s a continuing trend.
MS-DOS to Linux
I got my first PC some time in the early 1990s to replace an Amstrad PCW, if anyone remembers that. The PC came with MS-DOS and Windows 3.0, which was replaced almost immediately by Windows 3.1. I didn’t upgrade. I didn’t see much point in Windows and continued to use DOS until, at some point in the 1990s, I began to experiment with Linux. After an initial unsuccessful attempt to use Slackware I tried Red Hat and got on better with that.
I knew nothing about Unix at this stage; in fact, I still knew very little about computers in general. But I was beginning to enjoy the intellectual challenge they offered and that was what drew me to Linux. At this time it was pretty much entirely reliant on the command line, but this wasn’t a problem for me because I was used to it from DOS and in fact preferred it. But the lack of word processors was a different matter.
Linux and word processors
My practical reason for using a computer was as a writing tool for books and articles. In my Amstrad and DOS days I’d had a word processor called Protext which I liked, but it wasn’t available for Linux. In fact, there weren’t any real word processors for Linux at the time; you pretty much had to use either Emacs or Vim. I tried both and eventually settled on Vim. Some people disliked it because it is modal (you have to alternate between Insert mode to write the text and Normal mode to modify it), but that didn’t worry me because Protext is also modal.
I still use Vim all the time, even though there are now plenty of word processors and similar programs available to me. The only one I have any use for is LyX, which I’ve used to produce seven books, but even there I usually write my text first in Vim and then paste it into LyX for final editing before printing.
Desktop environments and window managers
Together with the switch to Linux I also began to use the graphics mode, and that led me to explore the world of desktop environments. KDE and Gnome intrigued me at first but gradually I realised that I didn’t need or want either of them. Eventually I settled for a simple stacking window manager, IceWM, and was happy with that for a long time, until I tried tiling window managers. Since then I’ve been sold on them; nothing would persuade me to go back to a stacking WM. My favouring tiling WM, as I’ve explained elsewhere, is Spectrwm. (See my previous blog for details.)
From Linux to OpenBSD
I’d long had a curiosity about the Unix philosophy and I tried out FreeBSD, a couple of times, but found it rather frustrating and always went back to Linux. Then I tried OpenBSD, simply from curiosity. Over a period of about six months I became completely hooked, and four years later I still am.
The transition from Linux to OpenBSD was probably easier for me because the Linux distribution I was coming from was Arch, which is often said to be the most Unix-like version of Linux. I very much doubt I shall change my operating system again. Ths Unix philosophy is based on KISS and that’s what suits me.
Looking back now over almost 40 years of messing about with computers (and doing some proper work with them in the process, obviously!) I see that there has been a gradual but quite definite progression towards simplification and minimalism. I know that at least some other people have had a similar experience. If that’s your case I hope you may find these jottings of interest.
A taste for `minimalism in computing probably reflects a more general attitude to other things in life. I’ve written a post about that as well.
Sorry if you’ve come here because of the title; I’ve had to delete most of what I’d written because it’s no longer correct. It was based on using a site (Online Sitemap Generator) where you can make a large sitemap.xml for free (though you are encouraged to make a small donation). I’d used it for about a year on and off and was reasonably happy with it, although I did need to edit the files quite extensively, which was the point of the post.
Things have now changed at this site; I get a lot of errors when I try to make a sitemap. The resulting file is unreliable so I’m no longer using the site.
I haven’t been able to find another site which offers free sitemaps for more than 500 entries. My book reviews page has almost 600 reviews so that’s no good to me. I’d be willing to pay a reasonable amount occasionally but the charges I’ve found on-line are more than I’m willing to pay on a recurring basis considering I don’t get any income from my reviews.
For the moment my solution for the book reviews page is to keep the last good sitemap I obtained and add new entries by hand. This isn’t a problem as I don’t often write more than one review a week at most.
For WordPress I’ve installed a plugin which provides a sophisticated sitemap.xml system which seems to be working well (google-sitemap-generator.4.1.0).
Starting with Vim 7.0 this brilliant editor introduced a more powerful set of commands for Undo and Redo, using an undo tree. Being lazy, I didn’t fully get to grips with this and as a result didn’t really understand what I was doing. At times I accidentally deleted text I’d just writtenjjjk and then couldn’t recover it.
I knew the previous version of my work had to be there but I didn’t know how to get it back. After a time I realised that when things seemed to go wrong the solution was to use ‘g-‘ and ‘g+’ to go hack and forth in the undo tree. But this was a bit hit & miss.
If you have had a similar experience here are a couple of useful site where things are explained clearly;
The second of these sites has links to a couple of plugins which make life easier. I’m not generally an enthusiast for plugins but I’ve installed Histwin, which seems pretty good; I’ll probably try Undotree as well.
Finally, thanks to a third page I now know why I occasionally deleted work I’d just done and couldn’t recover it. See:
Everything has gone wrong and you have to reinstall from scratch. It shouldn’t happen but it may if you do something silly – I once acccidentally deleted /etc! But you have all sorts of stuff in $HOME that you don’t want to lose. Can you preserve it?
Well, of course, you should have a backup. I save one nightly on Tarsnap. But it may take a long time to restore from backup and it would be better if you didn’t have to.
Fortunately you can save your $HOME quite easily. Here’s how.
When the Install process asks you to use disklabel, choose either OpenBSD or Whole Disk.
2. See which partition contains /home. Suppose it is ‘k’. Type ‘m -k’ (without the quotes). Choose ‘No mount point’.
Complete the Install process. When the system restarts, edit /etc/fstab to mount the ‘k’ partition as /home.
It should work – it has worked for me. But if at all possible make a backup first, just in case it doesn’t.
When writing posts or articles that are to appear on web pages using programs such as LyX or WordPress it probably seems natural to simply start doing so directly, using the native editor of the program in question. I do this this if I’m writing a fairly short piece, perhaps one or two paragraphs. But if it’s a longer or more complicated text I prefer to do it in a more roundabout way, starting in Vim and pasting the material into LyX, WordPress or whatever later. (The exception is when I’m composing emails, but that’s because I have Mutt set up to use Vim as editor.)
This may seem a little eccentric but I’ve always found it makes my life easier. I’ve been using Vim for many years and it’s mostly second nature to me now. I can think as I’m writing, make quick changes – delete, add, move words, sentences, whole paragraphs – easily and quickly. I can instantly reverse changes I’ve made and undo those changes instantly as well. At the end I can do a spell check to look for typos.
The standard editors supplied by the programs allow most of this too, of course, but a good deal less intuitively. It’s more difficult to separate the words you writing from you are writing from how they are going to appear on screen or on the page. But these are different things.
Writers are often asked whether they write in longhand or directly on the keyboard. People who write in longhand often say that physically shaping the words gives them a sense of creativity and immediacy that is missing if they type at the keyboard. It’s tempting to think that there may be something of an artistic snobbery element at work here, but that’s probably unfair; I think many people genuinely feel this sense of satisfaction in writing longhand.
I can understand this feeling but I don’t share it, perhaps because I associate handwriting with punishment. My handwriting was always a subject of criticism in my early school years, and later, minor infringement of rules was penalised by the requirement to write a number pages of script – always on blue paper, which had to be requested from one’s housemaster. This may well explain my dislike of writing by hand now. Anyway,there is good literary precedent for my view; two renowned authors, Henry James and Winston Churchill, used to dictate their books, although this is not something I’d want to do myself.
Whatever the reason, I find I write better and more fluently at the keyboard. At least for me, writing in this way probably does what writing longhand does for many others.
There are plenty of spam filters available for OpenBSD and other BSD systems such as bogofilter or spambayes, but these tend to be overkill for a single user system like mine. Another possibility is bmf, which is described as aiming to be faster, smaller and more versatile than similar Bayesian filters. However, it doesn’t seem to have been updated since 2002 and I didn’t like it too much when I tried it out..
I prefer Quick Spam Filter (QSF), which I have used for a good many years – in fact, since before I changed from Linux to OpenBSD four years ago. Its last update was in 2015. I find that after training it is reliable, with only occasional false positives or negatives. It hasn’t been ported to OpenBSD but it compiles easily. It is available from its author.
The qsf documentation describes how to integrate it with procmail. I have a separate post with details of doing this with fdm – see the OpenBSD category or use the Search facility.
Procmail is still widely used although it is no longer maintained. Its former maintainer, on OpenBSD, Philip Gunther, has said that it should be removed from the ports list because of security vulnerability, although it is still there. A suggested alternative is fdm, which both fetches the mail from a POP3 server and filters it, thus cutting out the need for fetchmail.
I’d been using procmail with fetchmail for a long time but I thought perhaps I should switch to fdm. The main difficulty was that the documentation I found was less complete than what is available for procmail. Getting my mail filtering program to work was a particular problem.
I thought it might be worth posting my fdm.conf here for anyone who is seeking to make the same switch.
I use qsf as my spam filter but it should be easy to adapt the script to work with a different filter. It writes “SPAM” in the subject line of suspect emails. I’ve posted more details about qsf in a separate entry (see under OpenBSD in the Categories list or use the Search facility).
# fdm.conf -see the fdm manual for explanations of the code.
# Set the maximum size of mail.
set maximum-size 128M
# connection settings for my ISP’s mail server
account “<my POP3 account>” pop3 server “<my POP3 server>” user “<my email address>” pass “<my password>”
# filtering rules (adapted from my .procmailrc
match “^(To|Cc):.*firstname.lastname@example.org” action mbox “%h/Mail/lyx-users”
match “^(To|cc|Cc|Sender): .*email@example.com” action mbox “%h/Mail/openbsd”
match “^Subject:.*Sucuri Alert” action mbox “%h/Mail/sucuri” action pipe “cat > /dev/null”
# forward some mail to a different account
match “^From:.*Facebook” action pipe “%h/.forward”
# Spam filter rules
action “spamfilter” rewrite “/home/ac/bin/qsf -s”
match all action “spamfilter” continue
match “^Subject:.*SPAM” action mbox “%h/Mail/spam”
# Set spoolfile for incoming mail
action “inbox” mbox “/var/mail/ac”
match all action “inbox”