XCOMM!SHELL_CMD XCOMM XHASH $NetBSD: Xsession.in,v 1.20 2022/05/29 12:40:36 nia Exp $ XCOMM redirect errors to a file in user's home directory if we can errfile="$HOME/.xsession-errors" if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ) then exec > "$errfile" 2>&1 else mktemp="MKTEMP_COMMAND" if [ "x$mktemp" != "x" -a -x "$mktemp" ] then for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" do if ef="$( umask 077 && $mktemp "$errfile.XXXXXX" 2> /dev/null)" then exec > "$ef" 2>&1 mv "$ef" "$errfile" 2> /dev/null break fi done else XCOMM Since this system doesn't have a mktemp command to allow secure XCOMM creation of files in shared directories, no fallback error log XCOMM is being used. See https://bugs.freedesktop.org/show_bug.cgi?id=5898 XCOMM XCOMM for errfile in "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" XCOMM do XCOMM if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ) XCOMM then XCOMM exec > "$errfile" 2>&1 XCOMM break XCOMM fi XCOMM done exec > /dev/null 2>&1 fi fi case $# in 1) case $1 in failsafe) exec BINDIR/xterm -geometry 80x24-0-0 ;; esac esac XCOMM The startup script is not intended to have arguments. startup=$HOME/.xsession resources=$HOME/.Xresources fontsize=$(/usr/X11R7/libexec/ctwm_font_size) if ! [ -n "$fontsize" ]; then fontsize=16 fi if [ -s "$startup" ]; then if [ -x "$startup" ]; then exec "$startup" else exec /bin/sh "$startup" fi else if [ -f $HOME/.profile ]; then . $HOME/.profile fi if [ -r "$resources" ]; then BINDIR/xrdb -load "$resources" else BINDIR/xrdb -load - <<EOF #ifdef COLOR *customization: -color #endif *VT100.foreground: grey90 *VT100.background: black Bitmap*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Editres*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Viewres*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* XCalc*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* XClipboard*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* XConsole*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* XFontSel*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* XLoad*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Xedit*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Xfd*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Xgc*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Xmag*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Xmessage*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* Xmh*font: -*-spleen-medium-r-*-*-$fontsize-*-*-*-*-*-*-* EOF if [ $fontsize -gt 18 ]; then XCOMM XCOMM For HiDPI displays, the font size returned by ctwm_font_size will XCOMM generally be a multiple of 16. 96 is our standard DPI, and many XCOMM applications want to scale by integer increments or don't handle XCOMM non-integer scaling gracefully, so we want to scale by multiples XCOMM of 96. XCOMM BINDIR/xrdb -merge - <<EOF Xft.dpi: $((96 * (fontsize / 16))) *VT100.faceName: xft:Monospace:pixelsize=$fontsize EOF elif [ $fontsize -gt 13 ]; then XCOMM XCOMM For non-HiDPI cases, use the standard misc-fixed font in xterm XCOMM since it has bold variants, and seems to have caused fewer XCOMM complaints than alternatives in the community so far. XCOMM XCOMM Using bitmap instead of TrueType fonts offers us some minor XCOMM performance gains on very slow machines. XCOMM BINDIR/xrdb -merge - <<EOF *VT100.font: -misc-fixed-medium-r-normal-*-18-*-*-*-*-*-iso10646-1 *VT100.fontBold: -misc-fixed-bold-r-normal-*-18-*-*-*-*-*-iso10646-1 *VT100.utf8Fonts.font: -misc-fixed-medium-r-normal-*-18-*-*-*-*-*-iso10646-1 *VT100.utf8Fonts.fontBold: -misc-fixed-bold-r-normal-*-18-*-*-*-*-*-iso10646-1 EOF else BINDIR/xrdb -merge - <<EOF *VT100.font: -misc-fixed-medium-r-normal-*-13-*-*-*-*-*-iso10646-1 *VT100.fontBold: -misc-fixed-bold-r-normal-*-13-*-*-*-*-*-iso10646-1 *VT100.utf8Fonts.font: -misc-fixed-medium-r-normal-*-13-*-*-*-*-*-iso10646-1 *VT100.utf8Fonts.fontBold: -misc-fixed-bold-r-normal-*-13-*-*-*-*-*-iso10646-1 EOF fi fi BINDIR/xsetroot -cursor_name left_ptr BINDIR/xsetroot -solid 'rgb:00/22/44' BINDIR/uxterm & BINDIR/xclock -digital -strftime '%a %Y-%m-%d %H:%M' \ -face "spleen:pixelsize=$fontsize" -g +0+0 & exec BINDIR/ctwm -W fi