Skip to content

Izder456/dotfiles

Repository files navigation

Iz’s OpenBSD Dotfiles

GitHub Repo stars Lines of code

Shameless Unixporn for internet points.

DISCLAIMER

  • I’m not responsible for any system breakage due to my code.
  • If you’re unsure, refer to THE LICENSE to see how seriously I take this.
  • Use with caution.

Crucial Information

  • While there is a setup script in this project, it’s not meant to be plug-and-play. It’s a bare-bones setup, that is fairly non-portable and will require some tinkering to work perfectly. If you want a solid experience, use Linux Mint. I don’t see this as a problem because I’m comfortable customizing it to my needs. If you need assistance with this, I expect that as a bare minimum you read this ORG-mode file and have basic understanding of the function of these configs. I try not to hand-hold people. You learn nothing by blindly copy-pasting. Take this as a word of caution.

Note:

  • My script doesn’t perform any performance tweaking. In the how-to section, I say to install the sysctl.conf file, but you should read the comments I put there. Users should refer to the FAQ, manpages, or the unofficial OpenBSD Handbook for more info for that. For more of a newb-friendly (albeit detailed) explanation video of some optimization tricks, Watch The OpenBSD Guy’s Video
  • For laptops, I highly recommend Solene%’s power management daemon obsdfreqd, Its a no-brainer. It’s defaults are quite sane. It sets throttling for CPU frequency to avoid overheating when on line power. As of 7.1, OpenBSD maxes the CPU when on line power, but from my personal experience, this makes my laptop hardware thermal throttle like hell. In theory- the idea is sane. However, in practice, it tends to have adverse affects that are dependent on hardware. As Solene% says, this is not meant to “replace” the kernel scheduler. It tries to “nudge” the existing scheduling system to be better suited for laptop hardware.

Table of Contents

How To Use

please read the DISCLAIMER, I am not your mom.

  1. Install OpenBSD on a machine with these specs
>=42GB Install Disklabel Size (minimum reccomended)
>=4GB in / (you need this cos /tmp resides here by default, and my icons and gtk themes will clone here during setup)
>=4GB in /usr (you can get by with 1 single root partiton too, but its probably more ideal to break things up for ramdisk purposes)
>=24GB in /usr/local (same here as /usr, but even more important)
4gb or more RAM
4 logical cores or more
OpenGL >=2.0 Capable GFX Card
  1. Switch to -CURRENT
# sysupgrade -sn
  1. Add :doas group
# groupadd doas
# usermod -G wheel,operator,doas [your username]
  1. Add user to staff login class
# usermod -L staff [your username]
  1. grab my doas and sysctl configs
# ftp -o /etc/doas.conf https://github.com/izder456/dotfiles/raw/main/doas.conf
# ftp -o /etc/sysctl.conf https://github.com/izder456/dotfiles/raw/main/sysctl.conf
  1. reboot, let sysupgrade finish, and merge changes:
# reboot
# sysmerge -d
  1. We Need Perl’s Rex Library
# pkg_add p5-Rex
  1. Download and run setup.pl as your regular user
$ cd $HOME
$ ftp https://github.com/izder456/dotfiles/raw/main/setup.ksh
$ ksh setup.ksh
  1. enable dbus (my StumpWM config needs it)
# rcctl enable messagebus
  1. Reboot again
# reboot

Automation

p5-Rex is an automation thingy I use. It’s definitely overkill, but I like perl. I split this up to the names of the files:

  • setup.ksh is the inital bootstrap script. I set a personal constraint that I can’t use any stuff outside of base OpenBSD for bootstrapping. for this reason, it must function with korn shell in vanilla OpenBSD 7.5 or higher, as that is the default shell on OpenBSD.
  • Rexfile is the config file for p5-Rex. It is perl code, but with a teeny bit of extensions. Think of it as an even more extensible ansible playbook, if that makes sense. You can manually run “tasks” with the rex command in your shell. You can see the tasks available to run with rex -T

Korn Shell

The initial setup for the system.

Boilerplate

#!/bin/ksh

# Constants
USERHOME=$HOME
GITHUB="https://github.com"
SLEEPTIME=2
LOG_FILE="/tmp/setup.log";

# Set PATH explicitly
export PATH='/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:$HOME/bin';

Menu

# Log setup messages with timestamp
function exception {
    error=$1
    echo "Error: $error"
    exit 1
}


function log {
    message=$1
    timestamp=$(date +"%Y%m%d%H%M%S")

    echo "[$timestamp] $message"
    echo "[$timestamp] $message" >> "$LOG_FILE" 2>&1 || exception "Could not write to $LOG_FILE"
}

# Clean unnecessary files
function clean {
    log "Removing Cruft..."
    rex remove_default_cruft
}

# Ensure Lisp environment is set up
function ensure_lisp {
    log "Quicklisp Setup"
    doas pkg_add -m sbcl rlwrap || exception "Could not install sbcl or rlwrap"
    ftp -o /tmp/quicklisp.lisp "https://beta.quicklisp.org/quicklisp.lisp" || exception "Failed to download quicklisp.lisp"
    ftp -o /tmp/quicklisp-setup.lisp "$GITHUB/izder456/dotfiles/raw/main/quicklisp-setup.lisp" || exception "Failed to download quicklisp-setup.lisp"
    sbcl --load /tmp/quicklisp.lisp --script /tmp/quicklisp-setup.lisp || exception "Failed to run quicklisp setup"
}

# Install port dependencies
function ports_deps {
    log "Installing port dependencies..."
    doas pkg_add -m -l ~/.pkglist || exception "Failed to install port dependencies"
}

# Install cargo dependencies
function cargo_deps {
    log "Installing cargo dependencies..."
    doas pkg_add rust || exception "Failed to install Rust"
    xargs cargo install < ~/.cargolist || exception "Failed to install cargo dependencies"
}

# Clone or update dotfiles repository and run setup scripts
function config_install {
    log "Cloning/Installing Dotfiles..."
    if [ -d "$USERHOME/.dotfiles" ]; then
        cd $USERHOME/.dotfiles || exception "Failed to change directory to .dotfiles" 
        git pull --recurse-submodules --depth 1 || exception "Failed to pull dotfiles"
    else
        git clone --depth 1 --recurse-submodules $GITHUB/Izder456/dotfiles.git $USERHOME/.dotfiles || exception "Failed to clone dotfiles"
    fi
    rex configure_gtk
    rex configure_icons
    $USERHOME/.dotfiles/dfm/dfm install
    doas cp ~/.dotfiles/doas.conf /etc/doas.conf
}

# Setup FiZSH shell
function setup_shell {
    log "Setting up FiZSH..."
    rex configure_default_shell
    rex compile_afetch
}

# Setup background images
function setup_backgrounds {
    log "Installing Backgrounds..."
    rex install_backgrounds
}

# Setup Emacs
function setup_emacs {
    log "Setting up Emacs..."
    rex configure_emacs
}

# Setup Enhanced Motif WM
function setup_emwm {
    log "Setting up Enhanced Motif WM..."
    rex configure_emwm
}

# Setup StumpWM
function setup_stumpwm {
    ensure_lisp
    log "Setting up StumpWM..."
    rex configure_stumpwm
}

# Miscellaneous setup tasks
function setup_misc {
    setup_shell
    log "Miscellaneous setup..."
    rex compile_shuf
    rex compile_slock
    rex compile_st
    rex compile_surf
    rex compile_nxbelld
    rex configure_apmd
    rex install_backgrounds
    rex update_xdg_user_dirs
}

# Setup XenoDM
function setup_xenodm {
    log "Setting up XenoDM..."
    rex configure_xenodm
}

# Check for internet connection
function is_internet_up {
    log "Checking internet connection..."
    nc -zw1 OpenBSD.org 443 || exception "You need internet for this dumdum!";
    log "Internet connection is up!"
}

# Ensure necessary tools are installed
function ensure_needed {
    log "Installing necessary tools: git and p5-Rex..."
    doas pkg_add -m p5-Rex git || exception "Failed to install git and p5-Rex"
    ftp -o $USERHOME/Rexfile $GITHUB/Izder456/dotfiles/raw/main/Rexfile || exception "Failed to download Rexfile"
}

# Ensure all prerequisites
function do_ensure {
    is_internet_up
    ensure_needed
}

do_ensure

# Menu header text

# Display menu and handle user input
function menu {
    while true; do
        clear
	
	echo 'Srcerizder Dotfiles Setup'
	echo 'Options:'
	echo '--------------------------'
	echo '1) Ports   4) StumpWM'
	echo '2) Cargo   5) Emacs'
	echo '3) Emwm    6) Xenodm'
	echo '7) Config  8) Misc'
	echo '9) Clean:'
	echo
	echo 'Other Options:'
	echo '----------------'
	echo 'a) All'
	echo 'r) Reload Menu'
	echo 'q) Quit'
	echo

	echo "Enter your selection: "
	read selection # Move the input prompt to the same line

	[ -z $selection ] && selection="r"
	
	case $selection in
	    1)
		echo "Selected Ports Deps..."; sleep $SLEEPTIME; ports_deps;
		;;
	    2)
		echo "Selected Cargo Deps..."; sleep $SLEEPTIME; cargo_deps;
		;;
	    3)
		echo "Selected Emwm Config..."; sleep $SLEEPTIME; setup_emwm;
		;;
	    4)
		echo "Selected StumpWM-Config..."; sleep $SLEEPTIME; setup_stupmwm;
		;;
	    5)
		echo "Selected Emacs-Config..."; sleep $SLEEPTIME; setup_emacs;
		;;
	    6)
		echo "Selected XenoDM-Config..."; sleep $SLEEPTIME; setup_emacs;
		;;
	    7)
		echo "Selected Install Configs..."; sleep $SLEEPTIME; config_install;
		;;
	    8)
		echo "Selected Misc Setup..."; sleep $SLEEPTIME; setup_misc;
		;;
	    9)
		echo "Selected Clean..."; sleep $SLEEPTIME; clean;
		;;
	    "a")
		echo "Running All...";
		sleep $SLEEPTIME; clean;
		config_install; ports_deps; cargo_deps;
		setup_emwm; setup_stumpwm; setup_emacs; setup_xenodm;
		setup_misc;
		;;
	    "r")
		continue;
		;;
	    "q")
		echo "";
		exit;
		;;
	    *)
		echo "Invalid selection";
		sleep $SLEEPTIME;
		;;
	esac
    done
}

menu

Rexfile

Boilerplate

use 5.36.0;
use Rex -feature => ['1.4'];

# No Magic
my $USERHOME = "$ENV{HOME}";
my $GITHUB   = "https://github.com";

# Set PATH explicitly
$ENV{'PATH'} =
  '/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:$HOME/bin';

Remove-Cruft

I don’t need some of these defaults

# task to clean home dir
task 'remove_default_cruft', sub {
  unlink(
    "$USERHOME/.cshrc",   "$USERHOME/.login",     "$USERHOME/.mailrc",
    "$USERHOME/.profile", "$USERHOME/.Xdefaults", "$USERHOME/.cvsrc"
  );
  system( 'doas', 'chmod', '0700', "$USERHOME" );
};

FiZSH-Setup

This is a zsh frontend, that emulates the functionality of fish

# Configures and sets up the default shell
task 'configure_default_shell', sub {
  my %plugins = (
    "zsh-openbsd"     => "$GITHUB/sizeofvoid/openbsd-zsh-completions.git",
    "zsh-completions" => "$GITHUB/zsh-users/zsh-completions.git",
    "zsh-fzf"         => "$GITHUB/Aloxaf/fzf-tab.git",
    "zsh-suggest"     => "$GITHUB/zsh-users/zsh-autosuggestions.git",
    "zsh-256"         => "$GITHUB/chrissicool/zsh-256color.git",
    "zsh-fsh"         => "$GITHUB/zdharma-continuum/fast-syntax-highlighting.git"
  );
  keys %plugins;
  while (my($k, $v) = each %plugins) {
    my $clonedir = "$USERHOME/.$k";
    my $cloneuri = "$v";
    if ( -d $clonedir ) {
      chdir "$clonedir";
      system( 'git', 'pull' );
    } else {
      system( 'git', 'clone', "$cloneuri", "$clonedir" );
    }
  }

  # Grab fizsh src setup
  if ( -d "$USERHOME/.fizsh" ) {
    chdir "$USERHOME/.fizsh";
  } else {
    system( 'git', 'clone', "$GITHUB/zsh-users/fizsh.git", "$USERHOME/.fizsh" );
    chdir "$USERHOME/.fizsh";
  }
  system( './configure' );
  system( 'make' );
  system( 'doas', 'make', 'install' );
  system( 'cp', "$USERHOME/.dotfiles/.fizshrc", "$USERHOME/.fizsh/.fizshrc" );
  system( 'chsh', '-s', '/usr/local/bin/fizsh' );
};

Icons and GTK stuffs

task 'configure_gtk', sub {
  my %gtk = (
    "gruvbox-plus-gtk" => "$GITHUB/SylEleuth/gruvbox-plus-gtk.git",
  );
  keys %gtk;
  while (my($k, $v) = each %gtk) {
    my $clonedir = "/tmp/$k";
    my $cloneuri = "$v";
    if ( -d "$clonedir" ) {
      chdir "$clonedir";
      system( 'git', 'pull', '--depth', '1' );
    } else {
      system( 'git', 'clone', '--depth', '1', "$cloneuri", "$clonedir" );
    }
    system( 'cp', '-R', "$clonedir/*", "$USERHOME/.dotfiles/.themes/" );
    unlink("$clonedir");
  }
};

task 'configure_icons', sub {
  my %icons = (
    "gruvbox-round-icons" => "$GITHUB/Fausto-Korpsvart/Gruvbox-GTK-Theme.git",
  );
  keys %icons;
  while (my($k, $v) = each %icons) {
    my $clonedir = "/tmp/$k";
    my $cloneuri = "$v";
    if ( -d "$clonedir" ) {
      chdir "$clonedir";
      system( 'git', 'pull', '--depth', '1' );
    } else {
      system( 'git', 'clone', '--depth', '1', "$cloneuri", "$clonedir" );
    }
    system( 'cp', '-R', "$clonedir/icons/*", "$USERHOME/.dotfiles/.icons/" );
    unlink("$clonedir");
  }
};

Emacs-Setup

I use Emacs, btw

# Configures and installs emacs
task 'configure_emacs', sub {
  if ( -d "$USERHOME/.emacs.d" ) {
    chdir "$USERHOME/.emacs.d";
  } else {
    system( 'ln', '-sf', "$USERHOME/.dotfiles/Emacs-Config", "$USERHOME/.emacs.d" );
  }
};

StumpWM-Setup

Yeah, this weird WM…

task 'configure_stumpwm', sub {
  if ( -d "$USERHOME/.stumpwm.d" ) {
    chdir "$USERHOME/.stumpwm.d";
  } else {
    system( 'ln', '-sf', "$USERHOME/.dotfiles/StumpWM-Config", "$USERHOME/.stumpwm.d" );
  }
};

Enhanced Motif WM Setup

Yeah, I sometime float things

task 'configure_emwm', sub {
    system( 'ln', '-sf', "$USERHOME/.dotfiles/Emwm-Config/.emwmrc", "$USERHOME/.emwmrc" );
    system( 'ln', '-sf', "$USERHOME/.dotfiles/Emwm-Config/.toolboxrc", "$USERHOME/.toolboxrc" );
    system( 'mkdir', '-p', "$USERHOME/.xresources.d" );
    system( 'ln', '-sf', "$USERHOME/.dotfiles/Emwm-Config/.xresources", "$USERHOME/.xresources.d/emwm" );
};

XenoDM/Background-Setup

Because XDM wasn’t cutting it…

# Installs backgrounds to /usr/local/share/backgrounds
task 'install_backgrounds', sub {
  system( 'doas', 'mkdir', '-p', '/usr/local/share/backgrounds' );
  system( 'doas',  'cp', '-R', glob("$USERHOME/.dotfiles/backgrounds/*"), '/usr/local/share/backgrounds' );
};

# Sets up Xenodm configuration
task 'configure_xenodm', sub {
  system( 'doas', 'cp', '-R', glob("$USERHOME/.dotfiles/XenoDM-Config/*"), '/etc/X11/xenodm/' );
};

APMD_AutoHook-Lock

Setup Laptop Slock shell-close autohook

task 'configure_apmd', sub {
  system( 'doas', 'mkdir', '/etc/apm' );
  system( 'doas', 'cp', '-R', glob("$USERHOME/.dotfiles/APM-Config/*"), '/etc/apm/' );
};

Extra-Packages

Extra stuff thats not in ports, cargo or base

# Compiles shuf re-implementation
task 'compile_shuf', sub {
  system( 'git', 'clone', "$GITHUB/ibara/shuf.git", "$USERHOME/.shuf" );
  chdir "$USERHOME/.shuf";
  system( './configure' );
  system( 'make' );
  system( 'doas', 'make', 'install' );
};

# Compiles in my Slock Setup
task 'compile_slock', sub {
  system( 'git', 'clone', "$GITHUB/Izder456/slock.git", "$USERHOME/.slock" );
  chdir "$USERHOME/.slock";
  system( 'make' );
  system( 'doas', 'make', 'install' );
};

# Compiles in my SURF Setup
task 'compile_surf', sub {
  system( 'git', 'clone', "$GITHUB/Izder456/surf.git", "$USERHOME/.surf-src" );
  chdir "$USERHOME/.surf-src";
  system( 'make' );
  system( 'doas', 'make', 'install' );
};

# Compiles in my ST Setup
task 'compile_st', sub {
  system( 'git', 'clone', "$GITHUB/Izder456/st.git", "$USERHOME/.st" );
  chdir "$USERHOME/.st";
  system( 'make' );
  system( 'doas', 'make', 'install' );
};

# Compiles afetch
task 'compile_afetch', sub {
  system( 'git', 'clone', "$GITHUB/13-CF/afetch.git", "$USERHOME/.afetch" );
  chdir "$USERHOME/.afetch";
  system( 'make' );
  system( 'doas', 'make', 'install' );
};

task 'compile_nxbelld', sub {
  $ENV{'AUTOCONF_VERSION'} = "2.69";
  $ENV{'AUTOMAKE_VERSION'} = "1.16";
  system( 'git', 'clone', "$GITHUB/dusxmt/nxbelld.git", "$USERHOME/.nxbelld" );
  chdir "$USERHOME/.nxbelld";
  system('autoreconf -i');
  system( './configure', '--prefix', "$USERHOME/.local");
  system( 'gmake' );
  system( 'gmake', 'install' );
};

Xdg-UserDirs

Setup Homedir Paths

# Updates XDG user directories
task 'update_xdg_user_dirs', sub {
  system( 'xdg-user-dirs-update' );
  system( 'mkdir', "$USERHOME/Projects" );
  system( 'doas', 'gdk-pixbuf-query-loaders', '--update-cache' );
};

Misc Stuffs

random scripts and configs that are maybe relevant possibly.

Quicklisp Install

You probably want this if you want to write with StumpWM and modules…

(quicklisp-quickstart:install :path "~/.quicklisp")
(ql:add-to-init-file)
(ql-dist:install-dist "http:https://dist.ultralisp.org/"
		      :prompt nil)
(ql:quickload '("clx"
		"cl-ppcre"
		"alexandria"
		"cl-fad"
		"xembed"
		"anaphora"
		"drakma"
		"slynk"))

USE:

(this is as a reference if you need to quickly set up quicklisp for x11/stumpwm hacking, and don’t wanna use all of my dotfiles. the script automates this for you)

$ ftp -o /tmp/quicklisp.lisp https://beta.quicklisp.org/quicklisp.lisp
$ ftp -o /tmp/quicklisp-setup.lisp https://github.com/Izder456/raw/main/quicklisp-setup.lisp
$ sbcl --load /tmp/quicklisp.lisp --script /tmp/quicklisp-setup.lisp

.Xsession/.Xresources/.Xprofile

The settings for X session, resources, and profile.

Xresources

.xresources

!!
! Includes
!!
#include ".xresources.d/colors"
#include ".xresources.d/apps"
	 
!!
! XWindow Stuffs
!!
*imLocale: en_US.UTF-8

!!
! Font Rendering Stuffs
!!
Xft.dpi: 96
Xft.rgba: rgb
Xft.antialias: true
Xft.autohint: false
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
*faceName: Spleen
*faceSize: 12

!!
! Pointer Stuffs
!!
Xcursor.size: 16
Xcursor.theme: Capitaine Cursors (Gruvbox) - White

Colors

!!
! Background Colors
!!

! Normal
*background: #282828
*foreground: #ebdbb2
! Hard-Dark
*.activeBackground: #1d2021
*.activeForeground: #32302f
! Highlight
*highlightColor: #fcf1c7

!!
! Gruvbox Colors
!!
! Black + DarkGrey
*color0:  #282828
*color8:  #928374
! DarkRed + Red
*color1:  #cc241d
*color9:  #fb4934
! DarkGreen + Green
*color2:  #98971a
*color10: #b8bb26
! DarkYellow + Yellow
*color3:  #d79921
*color11: #fabd2f
! DarkBlue + Blue
*color4:  #458588
*color12: #83a598
! DarkMagenta + Magenta
*color5:  #b16286
*color13: #d3869b
! DarkCyan + Cyan
*color6:  #689d6a
*color14: #8ec07c
! LightGrey + White
*color7:  #a89984
*color15: #ebdbb2

!!
! Gruvbox 256color
!!
! BrightBlue
*color24:  #076678
! BrightAqua
*color66:  #427b58
! BrightRed
*color88:  #9d0006
! BrightMagenta
*color96:  #8f3f71
! BrightGreen
*color100: #79740e
! DimBlue
*color109: #83a598
! DimAqua
*color108: #8ec07c
! DimRed
*color130: #af3a03
! DimYellow
*color136: #b57614
! DimGreen
*color142: #b8bb26
! DimRed
*color167: #fb4934
! DimMagenta
*color175: #d3869b
! Orange
*color208: #fe8019
! BrightYellow
*color214: #fabd2f
!! fg0-fg3
*color223: #ebdbb2
*color228: #f2e5bc
*color229: #fbf1c7
*color230: #f9f5d7
!! bg0-bg3
*color234: #1d2021
*color235: #282828
*color236: #32302f
*color237: #3c3836
!! Gray0-Gray7
*color239: #504945
*color241: #665c54
*color243: #7c6f64
*color244: #928374
*color245: #928374
*color246: #a89984
*color248: #bdae93
*color250: #d5c4a1

Apps

!!
! XMessage
!!
xmessage*background: #1d2021
xmessage*foreground: #fbf1c7
xmessage.borderWidth: 1
xmessage*borderColor: #ebdbb2
xmessage*message.scrollHorizontal: Never
xmessage*message.scrollVertical: Never
xmessage*timeout: 0
xmessage*printValue: false
xmessage*font:	     -misc-spleen-medium-r-normal--16-160-72-72-c-80-iso10646-1

!!
! XTerm
!!
*intensityStyles: true
*allowSendEvents: true
xterm*scrollBar: false
xterm*faceName: Spleen
xterm*faceSize: 12
xterm*renderFont: true
xterm*internalBorder: 12
xterm*letterSpace: 1
xterm*loginShell: true
xterm*savelines: 16384

!!
! XClock Stuffs
!!
XClock*Background: #32302f
XClock*Foreground: #ebdbb2		 

.xsession

#!/bin/ksh

# Define variables at the top for easy access
XMESG_WIDTH=512
XMESG_HEIGHT=128

# Set environment up, .xprofile isn't respected
# Set Default LOCALE
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# Enable HWACCEL for Firefox
export MOZ_ACCELERATED=1
export MOZ_WEBRENDER=1
# set qt apps to use kvantum widgets if avail
export QT_STYLE_OVERRIDE=kvantum
# make sdl mouse cursor lag go away
export SDL_VIDEO_X11_DGAMOUSE=0

# set XDG stuff
function xdg_runtime {
    export XDG_RUNTIME_DIR=/tmp/run/$(id -u)
    export XDG_CONFIG_HOME=$HOME/.config
    export XDG_CACHE_HOME=$HOME/.cache
    export XDG_DATA_DIR=$HOME/.local/share
    export XDG_STATE_HOME=$HOME/.local/state
    export XDG_CURRENT_DESKTOP=StumpWM
    export DESKTOP_SESSION=stumpwm
    if [ ! -d $XDG_RUNTIME_DIR ]; then
	mkdir -m 700 -p $XDG_RUNTIME_DIR
    fi
}

# Function to get screen dimensions
function get_screen_dimension {
    typeset dimension=$(xdpyinfo | awk '/dimensions/ {print $2}')
    case $1 in
         0) echo "${dimension%x*}" ;;
         1) echo "${dimension#*x}" ;;
         *) echo "Invalid argument. Use 0 for width or 1 for height." ;;
    esac
}

# Function to load environment
function load_environment {
    set -A files "$@"
    for file in "${file[@]}"; do
        if [ -f "$file" ]; then
            . "$file"
        fi
    done
}

# Function to load resources
function load_resources {
    set -A resources "$@"
    for resource in "${resources[@]}"; do
        if [ -f "$resource" ]; then
            xrdb -merge "$resource"
        fi
    done
}

# Function to manage autostarts
function manage_autostarts {
    for process in "$@"; do
        process_name="${process% *}"
        if pgrep "$process_name" > /dev/null; then
            pkill "$process_name"
        fi
        eval "$process"
    done
}

# Function to select a window manager
function select_wm {
    # WM Session Prompt
    typeset xwidth=$(get_screen_dimension 0)
    typeset xheight=$(get_screen_dimension 1)
    typeset xmesg_xpos=$((($xwidth - $XMESG_WIDTH) / 2))
    typeset xmesg_yoffset=$((($xheight - $XMESG_HEIGHT) / 2))
    xmessage "Please Choose a Session to load" \
    	    -buttons "StumpWM[]":1,"EMWM[]":2 \
    	    -geometry ${XMESG_WIDTH}x${XMESG_HEIGHT}+${xmesg_xpos}-${xmesg_yoffset}
    typeset choice=$?

    case ${choice} in
	1) wm=$(command -v stumpwm)
	   wm_args="--disable-ldb --lose-on-corruption"
	   ;;
	2) wm=$(command -v xmsm)
	   wm_args=""
	   ;;
    esac

    dbus-launch --exit-with-session "${wm}" "${wm_args}"
}

# Load in environment & resources
load_environment /etc/xprofile ~/.xprofile
load_resources ~/.xresources ~/.xresources.d/emwm

# Autostarts
manage_autostarts "picom -b" \
		  "~/.local/bin/nxbelld -t 150 -v100 -d200 -f ~/.local/sfx/Funk.wav -b " \
		  "feh --bg-fill --randomize /usr/local/share/backgrounds &" \
		  "sleep 5 && dunst &" \
		  "ulimit -Sc 0" \
		  "xidle -delay 5 -nw -program /usr/local/bin/slock -timeout 1800 &"

# Set XDG Stuffs
xdg_runtime

# Select Window Manager
select_wm

exit 0

picom.conf

##
# Opacity
##

opacity-rule = [
  "100:class_g = 'emacs' && focused",
  "85:class_g = 'emacs' && !focused",
  "100:class_g = 'st' && focused",
  "85:class_g = 'st' && !focused",
  "100:class_g = 'xterm' && focused",
  "85:class_g = 'xterm' && !focused",
];

##
# Wintypes
##

wintypes: {
  normal = { blur-background = true; };
  splash = { blur-background = false; };
};

##
# Fading
##

fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [ ];

##
# Misc
##
mark-wwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
vsync = true;
dbe = false;
sw-opti = true; 
refresh-rate = 0;
unredir-if-possible = true;
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];

##
# QT-Apps Fixes For Blurs
##
shadow-exclude = [
  "argb && (_NET_WM_WINDOW_TYPE@:a *= 'MENU' || _NET_WM_WINDOW_TYPE@:a *= 'COMBO')"
];
blur-background-exclude = [
  "(_NET_WM_WINDOW_TYPE@:a *= 'MENU' || _NET_WM_WINDOW_TYPE@:a *= 'COMBO')"
];


##
# Backend
##
backend = "xrender";
use-damage = true;

Dunstrc

[global]
    # Which monitor should the notifications be displayed on.
    monitor = 0

    # Display notification on focused monitor.  Possible modes are:
    #   mouse: follow mouse pointer
    #   keyboard: follow window with keyboard focus
    #   none: don't follow anything
    #
    # "keyboard" needs a window manager that exports the
    # _NET_ACTIVE_WINDOW property.
    # This should be the case for almost all modern window managers.
    #
    # If this option is set to mouse or keyboard, the monitor option
    # will be ignored.
    follow = none

    ### Geometry ###

    # dynamic width from 0 to 300
    # width = (0, 300)
    # constant width of 300
    width = (0, 350)
    # The maximum height of a single notification, excluding the frame.
    height = (0, 256)

    # Position the notification in the top right corner
    origin = bottom-right 

    # Offset from the origin
    offset = 0x0

    # Scale factor. It is auto-detected if value is 0.
    scale = 0

    # Maximum number of notification (0 means no limit)
    notification_limit = 3

    ### Progress bar ###

    # Turn on the progess bar. It appears when a progress hint is passed with
    # for example dunstify -h int:value:12
    progress_bar = true

    # Set the progress bar height. This includes the frame, so make sure
    # it's at least twice as big as the frame width.
    progress_bar_height = 10

    # Set the frame width of the progress bar
    progress_bar_frame_width = 1

    # Set the minimum width for the progress bar
    progress_bar_min_width = 150

    # Set the maximum width for the progress bar
    progress_bar_max_width = 300

    # Corner radius for the progress bar. 0 disables rounded corners.
    progress_bar_corner_radius = 0

    # Corner radius for the icon image.
    icon_corner_radius = 0

    # Show how many messages are currently hidden (because of
    # notification_limit).
    indicate_hidden = yes

    # The transparency of the window.  Range: [0; 100].
    # This option will only work if a compositing window manager is
    # present (e.g. xcompmgr, compiz, etc.). (X11 only)
    transparency = 0

    # Draw a line of "separator_height" pixel height between two
    # notifications.
    # Set to 0 to disable.
    # If gap_size is greater than 0, this setting will be ignored.
    separator_height = 2

    # Padding between text and separator.
    padding = 8

    # Horizontal padding.
    horizontal_padding = 10

    # Padding between text and icon.
    text_icon_padding = 0

    # Defines width in pixels of frame around the notification window.
    # Set to 0 to disable.
    frame_width = 1

    # Defines color of the frame around the notification window.
    frame_color = "#d5c4a1"

    # Size of gap to display between notifications - requires a compositor.
    # If value is greater than 0, separator_height will be ignored and a border
    # of size frame_width will be drawn around each notification instead.
    # Click events on gaps do not currently propagate to applications below.
    gap_size = 2

    # Define a color for the separator.
    # possible values are:
    #  * auto: dunst tries to find a color fitting to the background;
    #  * foreground: use the same color as the foreground;
    #  * frame: use the same color as the frame;
    #  * anything else will be interpreted as a X color.
    separator_color = foreground

    # Sort messages by urgency.
    sort = yes

    # Don't remove messages, if the user is idle (no mouse or keyboard input)
    # for longer than idle_threshold seconds.
    # Set to 0 to disable.
    # A client can set the 'transient' hint to bypass this. See the rules
    # section for how to disable this if necessary
    idle_threshold = 120

    ### Text ###

    font = Spleen 6x12 11

    # The spacing between lines.  If the height is smaller than the
    # font height, it will get raised to the font height.
    line_height = 0

    # Possible values are:
    # full: Allow a small subset of html markup in notifications:
    #        <b>bold</b>
    #        <i>italic</i>
    #        <s>strikethrough</s>
    #        <u>underline</u>
    #
    #        For a complete reference see
    #        <https://docs.gtk.org/Pango/pango_markup.html>.
    #
    # strip: This setting is provided for compatibility with some broken
    #        clients that send markup even though it's not enabled on the
    #        server. Dunst will try to strip the markup but the parsing is
    #        simplistic so using this option outside of matching rules for
    #        specific applications *IS GREATLY DISCOURAGED*.
    #
    # no:    Disable markup parsing, incoming notifications will be treated as
    #        plain text. Dunst will not advertise that it has the body-markup
    #        capability if this is set as a global setting.
    #
    # It's important to note that markup inside the format option will be parsed
    # regardless of what this is set to.
    markup = full

    # The format of the message.  Possible variables are:
    #   %a  appname
    #   %s  summary
    #   %b  body
    #   %i  iconname (including its path)
    #   %I  iconname (without its path)
    #   %p  progress value if set ([  0%] to [100%]) or nothing
    #   %n  progress value if set without any extra characters
    #   %%  Literal %
    # Markup is allowed
    format = "<b>%a</b>\n%s\n<i>%b</i> "

    # Alignment of message text.
    # Possible values are "left", "center" and "right".
    alignment = left

    # Vertical alignment of message text and icon.
    # Possible values are "top", "center" and "bottom".
    vertical_alignment = center

    # Show age of message if message is older than show_age_threshold
    # seconds.
    # Set to -1 to disable.
    show_age_threshold = 60

    # Specify where to make an ellipsis in long lines.
    # Possible values are "start", "middle" and "end".
    ellipsize = middle

    # Ignore newlines '\n' in notifications.
    ignore_newline = no

    # Stack together notifications with the same content
    stack_duplicates = true

    # Hide the count of stacked notifications with the same content
    hide_duplicate_count = false

    # Display indicators for URLs (U) and actions (A).
    show_indicators = yes

    ### Icons ###

    # Recursive icon lookup. You can set a single theme, instead of having to
    # define all lookup paths.
    enable_recursive_icon_lookup = false

    # Set icon theme (only used for recursive icon lookup)
    icon_theme = Gruvbox_Dark
    # You can also set multiple icon themes, with the leftmost one being used first.
    # icon_theme = "Adwaita, breeze"

    # Align icons left/right/top/off
    icon_position = left

    # Scale small icons up to this size, set to 0 to disable. Helpful
    # for e.g. small files or high-dpi screens. In case of conflict,
    # max_icon_size takes precedence over this.
    min_icon_size = 32

    # Scale larger icons down to this size, set to 0 to disable
    max_icon_size = 64

    # Paths to default icons (only neccesary when not using recursive icon lookup)
    #icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/

    ### History ###

    # Should a notification popped up from history be sticky or timeout
    # as if it would normally do.
    sticky_history = yes

    # Maximum amount of notifications kept in history
    history_length = 20

    ### Misc/Advanced ###

    # Browser for opening urls in context menu.
    browser = /usr/bin/xdg-open

    # Always run rule-defined scripts, even if the notification is suppressed
    always_run_script = true

    # Define the title of the windows spawned by dunst
    title = Dunst

    # Define the class of the windows spawned by dunst
    class = Dunst

    # Define the corner radius of the notification window
    # in pixel size. If the radius is 0, you have no rounded
    # corners.
    # The radius will be automatically lowered if it exceeds half of the
    # notification height to avoid clipping text and/or icons.
    corner_radius = 0

    # Ignore the dbus closeNotification message.
    # Useful to enforce the timeout set by dunst configuration. Without this
    # parameter, an application may close the notification sent before the
    # user defined timeout.
    ignore_dbusclose = false

    ### Wayland ###
    # These settings are Wayland-specific. They have no effect when using X11

    # Uncomment this if you want to let notications appear under fullscreen
    # applications (default: overlay)
    # layer = top

    # Set this to true to use X11 output on Wayland.
    force_xwayland = false

    ### Legacy

    # Use the Xinerama extension instead of RandR for multi-monitor support.
    # This setting is provided for compatibility with older nVidia drivers that
    # do not support RandR and using it on systems that support RandR is highly
    # discouraged.
    #
    # By enabling this setting dunst will not be able to detect when a monitor
    # is connected or disconnected which might break follow mode if the screen
    # layout changes.
    force_xinerama = false

    ### mouse

    # Defines list of actions for each mouse event
    # Possible values are:
    # * none: Don't do anything.
    # * do_action: Invoke the action determined by the action_name rule. If there is no
    #              such action, open the context menu.
    # * open_url: If the notification has exactly one url, open it. If there are multiple
    #             ones, open the context menu.
    # * close_current: Close current notification.
    # * close_all: Close all notifications.
    # * context: Open context menu for the notification.
    # * context_all: Open context menu for all notifications.
    # These values can be strung together for each mouse event, and
    # will be executed in sequence.
    mouse_left_click = close_current
    mouse_middle_click = do_action, close_current
    mouse_right_click = close_all

# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
    # Calculate the dpi to use on a per-monitor basis.
    # If this setting is enabled the Xft.dpi value will be ignored and instead
    # dunst will attempt to calculate an appropriate dpi value for each monitor
    # using the resolution and physical size. This might be useful in setups
    # where there are multiple screens with very different dpi values.
    per_monitor_dpi = false 


[urgency_low]
    # IMPORTANT: colors have to be defined in quotation marks.
    # Otherwise the "#" and following would be interpreted as a comment.
    background = "#282828"
    foreground = "#928374"
    timeout = 10
    # Icon for notifications with low urgency, uncomment to enable
    #default_icon = /path/to/icon

[urgency_normal]
    background = "#282828"
    foreground = "#ebdbb2"
    timeout = 10
    # Icon for notifications with normal urgency, uncomment to enable
    #default_icon = /path/to/icon

[urgency_critical]
    background = "#282828"
    foreground = "#fb4934"
    frame_color = "#fabd2f"
    timeout = 25
    # Icon for notifications with critical urgency, uncomment to enable
    #default_icon = /path/to/icon

mk.conf

This configures my ports/src build environment, it goes in /etc/mk.conf. This script does not install this, as ports aren’t enabled OOTB on OpenBSD. You need to manually add this.

#SUDO="/usr/bin/doas"
PORTSDIR_PATH=${PORTSDIR}:${PORTSDIR}/openbsd-wip:${PORTSDIR}/mystuff
WRKOBJDIR=/usr/obj
DISTDIR=/usr/distfiles
PACKAGE_REPOSITORY=/usr/packages

.exrc

for BSD Vi

If you install or use editors/vim, these settings are incompatible, and will break things. If you want a good text mode editor that isn’t BSD vi, use editors/neovim. I use editors/emacs for “real” editing, and BSD vi for everything else. Editor wars are stupid. Use what works for you.

" display current mode
set showmode
" show matching parens, brackets, etc
set showmatch
" display row/column info
set ruler
" autoindent tab = 2 space
set shiftwidth=2
" tab = 2 space
set tabstop=2
" display errors
set verbose
" enable horiz scroll
set leftright
" use extend regex
set extend
" case-less searching, unless uppercase
set iclower
" incremental searching
set searchincr
" print helpful messages (eg, 4 lines yanked)
set report=1

Sysctl.conf

The kernel parameters settings.

Very hardware specific see NOTE

# Open Kernel Limits
kern.maxthread=16385 # default 2620
kern.maxproc=32768   # default 1310
kern.maxfiles=65535  # default 7030

# Shared Memory
## this is useful for browsers, or other "thread-y" programs. Programs that eat up lots of processes and memory benifit from having more space to eat up memory. www/mozilla-firefox, for example, often goes OOM without these mods. These are taken as-is from that which debian linux sets. 
kern.shminfo.shmmax=2147483647 # default 33554432
kern.shminfo.shmall=536870912  # default 8192
kern.shminfo.shmmni=4096       # default 128
kern.shminfo.shmseg=2048       # default 128
	
# Semaphores (not as relevant, but still worth having in case)
##
kern.seminfo.semmns=4096 # default 60
kern.seminfo.semmni=4096 # default 10

# Allow Kernel Memory Access
kern.allowkmem=1 # default 0

# Enable Multithreading
## Danger! has security implications wrt spectre/meltdown.
## Keep this disabled, unless you have significant performance hits without it. OpenBSD has a tendancy to spin while waiting for kernel lock jobs to free on many CPU cores. Keeping SMT or "Hyperthreading" disabled helps minimize this from happening.
hw.smt=0 # default 0

# Network
## Enable IP Forwarding (default 0)
net.inet.ip.forwarding=0  # useful for if using VMM or some sort of local NAT
net.inet6.ip6.forwarding=0 # see above
## Faster Networking
### useful on crappy wifi, technically unnecessary, may be personal placebo.
### I took these params from the RootBSD youtube channel. I have zero adverse side-effects with these, so I keep them on.
net.inet.udp.recvspace=262144  # default 41600
net.inet.udp.sendspace=262144  # default 9216
net.inet.icmp.errppslimit=1000 # default 100

# Video/Audio enable/disable
# change these to =1 if you want microphone or webcam access globally, although its probably better to enable manually with sysctl(8) if paranoid
kern.audio.record=0
kern.video.record=0

pf config

This goes in /etc/pf.conf, use with caution

# See pf.conf(5) and /etc/examples/pf.conf

# Macros
## mod these to match your hardware. these are the drivers my hardware uses.
wifi_if = "{ iwm0 iwm1 iwn0 iwn1 bwi0 urtwn0 urtwn1 }"
eth_if = "{ em0 re0 }"

# a few teeny little changes.
set skip on lo
set block-policy drop
set state-policy if-bound
set fingerprints "/etc/pf.os"
set ruleset-optimization none
set optimization normal 
set timeout { tcp.closing 60, tcp.established 7200 }

# mitigate IP spoofing
antispoof quick for $wifi_if
antispoof quick for $eth_if 

# block all incoming traffic, useful on portable machines.
block all

# allow all regular traffic going out.
pass out inet

# allow icmp traffic. nice if you ping to test conns.
pass in proto icmp

Dfm-Install

dfm install script config

.fonts recurse
.git recurse
.icons recurse
.themes recurse
.moc recurse
.config recurse
.local recurse
.claws-mail recurse
LICENSE.txt skip
COPYING skip
README.org skip
quicklisp-setup.lisp skip
doas.conf skip
sysctl.conf skip
mk.conf skip
pf.conf skip
setup.pl skip
dfm skip
assets skip
backgrounds skip
Emacs-Config skip
Emwm-Config skip
StumpWM-Config skip
XenoDM-Config skip
APM-Config skip

Doas.conf

this is totally overkill fine now

permit persist :doas
permit nopass root

Cargo-list

The list of packages to be installed via Cargo.

cargo-upgrade-command dipc du-dust hyperfine onefetch sd tere tokei zoxide