-# Screen configuration file.
+# GNU screen configuration file.
+#
+# Features which are only available in (very) recent screen releases or in
+# current Git are marked with "(GIT)" so they can be removed by the setup
+# script on machines with older versions.
+#
+# (BATTERY) is only used on laptops, (ROOT) only if running as root.
+# Copyright (C) 2011-2013 Simon Ruderich
+#
+# This file is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file. If not, see <http://www.gnu.org/licenses/>.
+
+
+# Automatically lock the screen after 10 minutes of inactivity if running as
+# root.
+#idle 600 lockscreen # handled by setup script
# Don't display startup message.
startup_message off
-# Don't use visual bell.
-vbell off
+# Use visual bell instead of audible bell.
+vbell on
# Increase the scrollback buffer.
-defscrollback 10000
+defscrollback 50000
+
+# Ignore case when searching.
+ignorecase on
+
+# I prefer zsh as my shell. GNU screen displays a warning if the shell isn't
+# available.
+shell zsh
+
+# Don't "login" windows (= add them to the utmp database) by default. Not
+# useful for me and the "$" flag clutters the window flags (displayed with
+# %Lw).
+deflogin off
+
+
+# TERMINAL
# Enable 256 color mode.
term screen-256color
-# Allow bold colors, not sure why this is necessary. Otherwise normal and bold
-# colors are switched. Thanks to http://www.frexx.de/xterm-256-notes/.
+# Allow bold colors in XTerm (not necessary for Rxvt), not sure why this is
+# necessary. Otherwise normal and bold colors are switched. Thanks to
+# http://www.frexx.de/xterm-256-notes/.
attrcolor b ".I"
+
+# CAPTION AND HARDSTATUS
+
+# Use white on light blue background for highlighting and text messages (and
+# for window borders in split mode).
+sorendition = Bw
+
+# Display current battery charge if running on a laptop. Redisplay every 3
+# minutes.
+backtick 1 180 180 $HOME/.shell/bin/battery.pl -s BATTERY # (BATTERY)
+# Display current temperature if running on a laptop. Redisplay every minute.
+backtick 2 60 60 $HOME/.shell/bin/temperature.pl -s TEMPERATURE # (TEMPERATURE)
+
+# Make sure the temporary variable we use is empty. Thanks to
+# http://gist.github.com/133000 for the idea to use setenv and to TauPan in
+# #screen on Freenode (2010-03-10 16:11 CET) for reminding me of it and
+# searching it again.
+unsetenv s
+
+# Always display the caption.
+setenv s "$s%{= Bw}" # - white on light blue background, also reset all
+ # attributes (necessary so everything is displayed
+ # correctly)
+setenv s "$s%?%P" # - is copy mode enabled? (GIT)
+setenv s "$s%{= wB}" # - if so change colors to light blue on white (GIT)
+setenv s "$s%?" # - end if (GIT)
+setenv s "$s%3n" # - window number
+setenv s "$s " # - space
+setenv s "$s%t" # - window name
+caption always "$s"
+unsetenv s
# Always display the status line with open windows and the hostname.
-hardstatus alwayslastline "%w%=%H"
+setenv s "$s%Lw" # - number and names of windows, L displays window flags
+setenv s "$s%=" # - right align the following text
+setenv s "$s%l" # - load average
+setenv s "$s " # - space
+setenv s "$s%H" # - hostname
+setenv s "$s " # - space (TEMPERATURE)
+setenv s "$s%2`" # - temperature (TEMPERATURE)
+setenv s "$s " # - space (BATTERY)
+setenv s "$s%1`" # - battery status (BATTERY)
+hardstatus alwayslastline "$s"
+unsetenv s
+
+
+# BINDINGS
+
+# Remove some bindings I don't use to prevent using them accidentally. You
+# probably don't want to copy this.
+bind K # kill
+bind k # kill
+bind ^K # kill
+bind \\ # quit
+bind ^\ # quit
+bind ^Z # suspend
+bind z # suspend
+bind ^S # xoff
+bind s # xoff
+bind ^Q # xon
+bind q # xon
+bind ^G # visual bell
+bind D # power detach
+
+# Bindings for fast switching to windows 10 to 19. Thanks to skizzhg in
+# #screen on Freenode (2010-10-31 21:49 CET) for the suggestion.
+bind ; command -c window
+bind -c window 0 select 10
+bind -c window 1 select 11
+bind -c window 2 select 12
+bind -c window 3 select 13
+bind -c window 4 select 14
+bind -c window 5 select 15
+bind -c window 6 select 16
+bind -c window 7 select 17
+bind -c window 8 select 18
+bind -c window 9 select 19
+# And bindings for windows 20 to 29 with e.g. ;;1. Thanks to Kays in #irssi on
+# Freenode (2012-10-18 16:25 CEST) for the suggestion to use ;;.
+bind -c window ; command -c window2
+bind -c window2 0 select 20
+bind -c window2 1 select 21
+bind -c window2 2 select 22
+bind -c window2 3 select 23
+bind -c window2 4 select 24
+bind -c window2 5 select 25
+bind -c window2 6 select 26
+bind -c window2 7 select 27
+bind -c window2 8 select 28
+bind -c window2 9 select 29
# Run urlview on current screen content. Very useful to follow links. Make
# sure hardcopy_append is off before using this command.
-bind ^B eval "hardcopy $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"
+bind ^B eval "hardcopy $HOME/.tmp/screen-urlview" "screen urlview $HOME/.tmp/screen-urlview"
+
+
+# DIGRAPHS
+
+digraph (, 「
+digraph ), 」