CUSTOMX(7) Miscellaneous Information Manual CUSTOMX(7)

customxcustomization X

First, read about The X Window System in FAQ. The simplest ~/.xsession file can look like this.

# Set background color
xsetroot -solid darkgrey &

# Start window manager
exec cwm
The & at the end of the line ensures that the program runs in the background. After running xenodm(1), the login form will appear. After successful login, the window manager will be displayed.

The status bar is a panel that displays current information about the computer, network, etc. We will use xterm to display the bar and write the information to the terminal using a shell script.

# Launch status bar
exec xterm -geometry 191x1+0+0 -fa "monaco" -fs 10 -bg "black" -fg "white" \
-name termbar -class termbar -T termbar -e ~/bar.sh &
The ~/dev/dotfiles/sh/bar.sh script for displaying information can look like this.
#!/bin/sh
# status bar for X

# Restart itself
trap 'exec $0' HUP
trap 'tput cnorm; exit 1' INT QUIT TERM

# Hide cursor
tput civis

# Get keyboard layout
function kbd {
  echo -n "$(setxkbmap -query | awk '/^layout:/ {print $2}')"
}

while true; do
  BAT=$(apm -l)
  NET="em0"
  HOST=$(hostname)
  DATE=$(date +"%a %b %e %H:%M")

  # Move cursor to left
  tput cup 1 1
  printf "$HOST"
  # Move cursor to right
  tput cup 1 96
  printf "$NET $BAT%% $(kbd) $DATE"
  sleep 2
done
And .cwmrc file look like this.
# Set font name and size
fontname "monaco:pixelsize=14:regular"

# Remove border
borderwidth 1

# Autogroup
autogroup 3 "xterm,XTerm"

ignore termbar
autogroup 0 termbar

# Add top gap due status bar
gap 20 0 0 0

Add these lines to ~/.xsession configuration file.

# Load configuration file
xrdb -merge ~/.Xresources
Create ~/.Xresources file and put these lines.
XTerm*faceName: Monaco*
XTerm*faceSize: 10
XTerm*scrollBar: false
XTerm*internalBorder: 20

! Load ~/.profile file
XTerm*loginShell: true

XTerm*selectToClipboard: true
XTerm*VT100*translations: #override \n\
  Ctrl Shift <Key>V: insert-selection(CLAIPBOARD) \n\
  Ctrl Shift <Key>C: select-end(CLIPBOARD)

Add following lines to ~/.cwmrc.

# Key bindings
bind-key CMS-p "/home/puffy/kbd.sh"
And shell script for switching keyboard layout.
#!/bin/sh
# Switch keyboard script

_uskbd="us"
_czkbd="cz"

[[ "$(setxkbmap -query | awk '/^layout:/ { print $2 }')" == "$_uskbd" ]] \
  && setxkbmap -layout $_czkbd \
  || setxkbmap -layout $_uskbd
April 11, 2023 OpenBSD 7.4