parent
4857f2e1b0
commit
4d91f35c9f
|
@ -1,3 +1,8 @@
|
|||
/www-root
|
||||
|
||||
# only track org files
|
||||
/src/**/*
|
||||
!/src/**/*.org
|
||||
|
||||
theindex.*
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#+TITLE: Program Macros (Include File)
|
||||
#+AUTHOR: Mike Gerwitz
|
||||
#+EMAIL: mtg@gnu.org
|
||||
|
||||
# This file contains general includes for program definitions; it is not
|
||||
# intended to produce any output by itself.
|
||||
|
||||
#+NAME: prog-header
|
||||
#+HEADER: :var license=gplv3-header
|
||||
#+HEADER: :var years=(format-time-string "%Y")
|
||||
#+HEADER: :var desc="Missing description"
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(concat (print desc)
|
||||
"\n\nCopyright (C) " years " Mike Gerwitz"
|
||||
"\n\n" license)
|
||||
#+END_SRC
|
||||
|
||||
* Headers
|
||||
These are the licensing headers that I may use throughout my programs
|
||||
tangled from this document.
|
||||
|
||||
** GNU General Public License Version 3 or Later
|
||||
[[https://www.gnu.org/licenses/gpl.html][GPLv3+]] is recommended by both myself and the FSF for most software works:
|
||||
|
||||
#+NAME: gplv3-header
|
||||
#+BEGIN_EXAMPLE
|
||||
This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#+END_EXAMPLE
|
|
@ -0,0 +1,142 @@
|
|||
#+TITLE: X11 Configuration
|
||||
#+AUTHOR: Mike Gerwitz
|
||||
#+EMAIL: mtg@gnu.org
|
||||
|
||||
X11 is a version of the [[http://www.x.org/][X Window System]][fn::Yep, they have a one-letter
|
||||
domain name.] that is widely used as the graphical environment on many
|
||||
Unix-based systems. There are various implementations, but X.org is
|
||||
standard on most [[https://wiki.freedesktop.org/www/][free (as in freedom) desktops]].
|
||||
|
||||
|
||||
* Session Initialization
|
||||
The file =~/.xinitrc= is used by X11 when no other configuration script is
|
||||
provided (e.g. when running =startx= from the command line; see
|
||||
=xinit(1)=). This is how I usually start my session.
|
||||
|
||||
#+HEADER: :shebang "#!/bin/sh"
|
||||
#+HEADER: :exports none
|
||||
#+BEGIN_SRC sh :tangle .xinitrc :noweb yes :padline no
|
||||
# <<_inc/prog.org:prog-header("Executed when no display manager is used", "2014, 2015")>>
|
||||
##
|
||||
#+END_SRC
|
||||
|
||||
But if the session is started by some other means---the common case being a
|
||||
[[https://wiki.archlinux.org/index.php/Display_manager][display manager]]---then its own configuration file is used instead. To allow
|
||||
users to configure their environment, the script =.xprofile= is executed (if
|
||||
it exists) /before/ the window manager is started.
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xinitrc
|
||||
test -f ~/.xprofile && source ~/.xprofile
|
||||
#+END_SRC
|
||||
|
||||
Since the execution of =.xinitrc= implies that no display manager was used,
|
||||
invoke my window manager: XMonad.[fn::Recall that =exec= replaces the
|
||||
running process, meaning that the =.xinitrc= script will not linger.]
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xinitrc
|
||||
exec xmonad
|
||||
#+END_SRC
|
||||
|
||||
I share my configuration file between multiple environments, so to avoid
|
||||
frustration, I defer all X\nbsp{}configuration to =.xprofile=.
|
||||
|
||||
#+HEADER: :shebang "#!/bin/sh"
|
||||
#+HEADER: :exports none
|
||||
#+BEGIN_SRC sh :tangle .xprofile :noweb yes :padline no
|
||||
# <<_inc/prog.org:prog-header("Executed before window manager", "2014, 2015")>>
|
||||
##
|
||||
#+END_SRC
|
||||
|
||||
** Keyboard Layout
|
||||
My keyboard layout is largely a vanilla en_US layout with one important
|
||||
modification: I map the caps lock key to control (the original left-control
|
||||
key remains functional). The control key is very awkward to press and can
|
||||
quickly cause pain in the hand and wrist when using programs that make
|
||||
aggressive use of it (such as Emacs). The caps lock key is a key that is
|
||||
rarely used and in a position that is exceptionally easy to press, so it is
|
||||
often remapped.[fn::Some [[http://ergoemacs.org/emacs/swap_CapsLock_Ctrl.html][argue against]] such a remapping. While I see the
|
||||
merit of some of the arguments, I have been using Caps Lock as my control
|
||||
key for years quite comfortably. Further, since my Control keys still work,
|
||||
I will use them when it makes ergonomic sense to do so.]
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
setxkbmap -option ctrl:nocaps
|
||||
#+END_SRC
|
||||
|
||||
I used to do additional keyboard layout customization in the past, but I've
|
||||
found that many of my changes were not all that useful. If there are
|
||||
additional layout changes, they're performed via =.xmodmap=:
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
xmodmap ~/.xmodmap
|
||||
#+END_SRC
|
||||
|
||||
** Mouse
|
||||
The default mouse cursor for X11 is a black "x". Changing it to =arrow=
|
||||
yields the conventional arrow cursor.
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
xsetroot -cursor_name arrow
|
||||
#+END_SRC
|
||||
|
||||
Mouse speed is controlled by two parameters: acceleration and
|
||||
threshold. Once the mouse movement reaches the provided threshold within
|
||||
10ms, its movement is multiplied by the given acceleration---this allows the
|
||||
use to make precision movements when the mouse is moved slowly, while still
|
||||
being able to rapidly move the cursor from one point to another.
|
||||
|
||||
I don't have much rationale for my chosen values; they just work well for
|
||||
me. I use the mouse primarily for web browsing, but otherwise my work is
|
||||
almost entirely in a terminal.
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
xset mouse 5/0.1
|
||||
#+END_SRC
|
||||
|
||||
** Root
|
||||
The X root window is the background window that you see underneath all
|
||||
other windows. Most people refer to this as the "desktop", but without
|
||||
software to actually produce a desktop, the root is non-interactive. I have
|
||||
no desktop.[fn::For example, GNOME has Nautilus as both its desktop and
|
||||
file manager.]
|
||||
|
||||
The default root renders a 1x1px-checkered background, which is useful for
|
||||
showing that X is actually running, but not very appealing. Since I use a
|
||||
tiling window manager (XMonad), I never see my root unless I switch to a
|
||||
workspace with no windows, so I just set it to black.
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
xsetroot -bg black
|
||||
#+END_SRC
|
||||
|
||||
** Resources
|
||||
|
||||
=.Xresources= is the file traditionally used to provide key-value pairs for
|
||||
configuring X11 programs (such as fonts, colors, menus, and other
|
||||
features). I prefer a more modular approach: I instead have an
|
||||
=.Xresources.d= directory, which contains resource files that will be
|
||||
merged; this will take precedence over any =.Xresources= file if there are
|
||||
key conflicts.
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
xrd="$HOME/.Xresources.d"
|
||||
test -f ~/.Xresources && xrdb -merge ~/.Xresources
|
||||
test -d "$xrd" && {
|
||||
for xr in "$xrd"/*; do
|
||||
xrdb -merge "$xr"
|
||||
done
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
** Screensaver
|
||||
I use =xscreensaver= with my own daemon script that watches for status
|
||||
changes to perform certain actions. Since I share this configuration on
|
||||
multiple systems, I permit an opt-out by touching =.noscreensaver=.
|
||||
|
||||
#+BEGIN_SRC sh :tangle .xprofile
|
||||
# screensaver can be disabled by creating ~/.noscreensaver (not managed)
|
||||
test -f ~/.noscreensaver || {
|
||||
xscreensaver &
|
||||
xscreensaver-watchd 2>~/.xscreensaver-watch.log &
|
||||
}
|
||||
#+END_SRC
|
45
xinitrc
45
xinitrc
|
@ -1,45 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Executed when X session begins
|
||||
#
|
||||
# Copyright (C) 2014 Mike Gerwitz
|
||||
#
|
||||
# This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
setxkbmap -option ctrl:nocaps
|
||||
xmodmap ~/.xmodmap
|
||||
xset mouse 5/0.1
|
||||
xsetroot -cursor_name arrow
|
||||
|
||||
# .Xresources will be included by convention, but .Xresources.d should be used
|
||||
# instead; the latter will override the former
|
||||
xrd="$HOME/.Xresources.d"
|
||||
test -f ~/.Xresources && xrdb -merge ~/.Xresources
|
||||
test -d "$xrd" && {
|
||||
for xr in "$xrd"/*; do
|
||||
xrdb -merge "$xr"
|
||||
done
|
||||
}
|
||||
|
||||
# .xprofile is *not* managed by software (such as Puppet) and may therefore
|
||||
# be used for system-specific configuration
|
||||
test -f ~/.xprofile && source ~/.xprofile
|
||||
|
||||
# screensaver can be disabled by creating ~/.noscreensaver (not managed)
|
||||
test -f ~/.noscreensaver || {
|
||||
xscreensaver &
|
||||
xscreensaver-watchd 2>~/.xscreensaver-watch.log &
|
||||
}
|
||||
|
||||
exec xmonad
|
Loading…
Reference in New Issue