datamaskinen

Thomas Frössman's blog on programming, technology, tools, or something like that.

Solarized Light/dark XMonad / URxvt / Emacs

| Comments

Desktop

A theme for my environmnt using the Solarized palette. The following screenshots feature:

Screenshots

Click in the images for full resolution screenshots

Consolas light

Consolas light

I have a global switch for light and dark mode. Its just a simple script that manages a check-file

Consolas light

Sources

Mostly everything is avaiable from the following github repositories:

Save Changes When Emacs Loses Focus

| Comments

On blur hook

Automatically saves all open file buffers or anything else when gnu Emacs loses focus under x.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(when
    (and (featurep 'x) window-system)
  (defvar on-blur--saved-window-id 0 "Last known focused window.")
  (defvar on-blur--timer nil "Timer refreshing known focused window.")
  (defun on-blur--refresh ()
    "Runs on-blur-hook if emacs has lost focus."
    (let* ((active-window (x-window-property
                           "_NET_ACTIVE_WINDOW" nil "WINDOW" 0 nil t))
           (active-window-id (if (numberp active-window)
                                 active-window
                               (string-to-number
                                (format "%x00%x"
                                        (car active-window)
                                        (cdr active-window)) 16)))
           (emacs-window-id (string-to-number
                             (frame-parameter nil 'outer-window-id))))
      (when (and
             (= emacs-window-id on-blur--saved-window-id)
             (not (= active-window-id on-blur--saved-window-id)))
        (run-hooks 'on-blur-hook))
      (setq on-blur--saved-window-id active-window-id)
      (run-with-timer 1 nil 'on-blur--refresh)))
  (add-hook 'on-blur-hook #'(lambda () (save-some-buffers t)))
  (on-blur--refresh))

Inspired by rcircDbusNotification

Emacs Light and Dark Theme

| Comments

Solarized dark and light

(click on the images for full screen)

screen shot

screen shot

The screen shots are of different modes in Emacs 24 and a slightly customized version of Bozhidar Batsov’s solarized-emacs color theme.

Font Face and Size for Light Terminal

| Comments

Light terminal

Trying out font faces and sizes for a default light theme terminal.

The terminal is rxvt-unicode-256, the color theme is Solarized.

(click on the image for full screen)

screen shot

I went for the one to the absolute left, Anonymous Pro 10pt.

Configuration

Rxvt is configured in the ~/.Xresources file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
!
!   .Xresources file
!   Man pages: xrdb, Xsession
!
! --------------------------------------------
! Note that $HOME/.Xdefaults is a relic from
! X Version 10 (and  X11R1)  days, before
! app-defaults  files were implemented.
! It has been deprecated for over ten years
! .Xresources should be used instead.
! --------------------------------------------


! ...

!---- URxvt - General settings {
URxvt*:borderLess:                    true
URxvt*cursorBlink:                    true
URxvt*font:                           terminus-12
URxvt*jumpScroll:                     true
URxvt*scrollBar:                      false
URxvt*scrollTtyOutput:                false
URxvt*scrollTtyKeypress:              true
URxvt*urgentOnBell:                   true
URxvt*visualBell:                     false
URxvt*perl-ext-common:                default,matcher
URxvt*urlLauncher:                    google-chrome
URxvt*matcher.button:                 1

!---- Light URxvt (Solarized Light, 11pt)
LURxvt*font:                   xft:Anonymous Pro-10
LURxvt*fading:                 0
LURxvt*background:             #fdf6e3
LURxvt*foreground:             #839496
LURxvt*fadeColor:              #fdf6e3
LURxvt*cursorColor:            #586e75
LURxvt*pointerColorBackground: #93a1a1
LURxvt*pointerColorForeground: #586e75
LURxvt*color0:                 #073642
LURxvt*color8:                 #fdf6e3
LURxvt*color10:                #93a1a1
LURxvt*color11:                #839496
LURxvt*color12:                #657b83
LURxvt*color14:                #586e75
LURxvt*color7:                 #839496
LURxvt*color15:                #002b36

!---- Default URxvt (Solarized Dark, 12px)
URxvt*fading:                         30
URxvt*background:                     #002b36
URxvt*foreground:                     #657b83
URxvt*fadeColor:                      #002b36
URxvt*cursorColor:                    #93a1a1
URxvt*pointerColorBackground:         #586e75
URxvt*pointerColorForeground:         #93a1a1
URxvt*colorUL:                        #859900
URxvt*colorBD:                        #268bd2
URxvt*color0:                         #073642
URxvt*color8:                         #002b36
URxvt*color1:                         #dc322f
URxvt*color9:                         #cb4b16
URxvt*color2:                         #859900
URxvt*color10:                        #586e75
URxvt*color3:                         #b58900
URxvt*color11:                        #657b83
URxvt*color4:                         #268bd2
URxvt*color12:                        #839496
URxvt*color5:                         #d33682
URxvt*color13:                        #6c71c4
URxvt*color6:                         #2aa198
URxvt*color14:                        #93a1a1
URxvt*color7:                         #eee8d5
URxvt*color15:                        #fdf6e3

The terminal is launched either with plain urxvt for the default dark terminal or urxvt -name LURxvt for the light one.

Monospaced Fonts

| Comments

Time for a new face?

When writing code it is usually a good thing to use a mono spaced font since the text often benefits from alignment based on character and white space counts. I recently did a short review of a bunch of fonts that seems to be generally liked amongst programmers. Below are some screenshots I made to support the decision making during the final selection.

WARNING: If your browser window is too narrow the following screenshots might be scaled and misrepresenting the fonts.

Update 2012-04-27: I have gone back to Consolas after a feew weeks with Inconsolata I’ve gone back to Consolas.

Consolas 10pt

Consolas is a mighty beautiful font. I still regard it as the most almost perfect awesome programmers font with the exception of not having an open font license.

Consolas was my main programming font from 2007 until very recent.

Consolas light

Consolas dark

Inconsolata 10.8pt

Inconsolata is quite similar to Consolas which the author also states as an inspirational source. Compared to Consolas it’s wider and has thinner lines.

Inconsolata is my current main programming font. The version I use is from the Google font directory.

Inconsolata light

Inconsolata dark

Meslo LG S 10pt

Meslo LG is a customized version of Apple’s Menlo font which in turn is a customized Bitstream Vera Sans Mono.

Meslo light

Meslo dark

Anonymous Pro 13px

Anonymous pro is another nice font, especially it’s bitmap versions.

Anonymous Pro light

Anonymous Pro dark

Terminus 12px

Terminus is a monospaced bitmap font and it’s very readable in small sizes. I have used it as my main terminal emulator font for ages. I don’t use it so much for programming because characters like () {} looks a tad too similar for fast reading.

Terminus light

Termonus dark