- 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.
- These are highly personal, use with caution.
- 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 or GhostBSD. 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 entire 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.
- My script doesn’t perform any performance tweaking. I say to install the sysctl.conf file in *How To Use but you should read the comments I put there. Users should refer to the FAQ, or the manpages 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.
Please read the *DISCLAIMER, I am not your mother.
- Install OpenBSD on a machine with these specs
>=32GB install disk size with default partitioning (minimum reccomended)
4gb or more RAM
2 logical cores or more
OpenGL >=2.0 Capable GFX Card
- Switch to -CURRENT
# sysupgrade -sn
- Add
:doasgroup
# groupadd doas
# usermod -G wheel,operator,doas [your username]
- grab my doas, desktop class and sysctl configs
READ THESE FILES, and edit them as needed. they are documented in this README.org
# ftp -o /etc/doas.conf https://codeberg.org/izder456/dotfiles/raw/branch/main/doas.conf
# ftp -o /etc/sysctl.conf https://codeberg.org/izder456/dotfiles/raw/branch/main/sysctl.conf
# ftp -o /etc/login.conf.d/desktop https://codeberg.org/izder456/dotfiles/raw/branch/main/login.conf.d/desktop
- add your user to the desktop class
# usermod -L desktop [your username]
- reboot, let sysupgrade finish, and merge changes:
# reboot
# sysmerge -d
- Download and run
setup.kshas your regular user
READ THIS FILE: it, and its accompanying Rexfile are documented in this README.org
Choose the a option for the smoothest experience. You will need to be ready to type your doas password a lot.
$ cd $HOME
$ ftp https://codeberg.org/Izder456/dotfiles/raw/branch/main/setup.ksh
$ ksh setup.ksh
- Reboot again
# reboot
I use the dfm install script, see the dfm dir in this repo. This is the 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
login.conf.d skip
doas.conf skip
sysctl.conf skip
mk.conf skip
pf.conf skip
hostname.veb0 skip
hostname.vport0 skip
relayd.conf skip
vm.conf skip
torrc skip
setup.pl skip
setup.ksh skip
dfm skip
assets skip
backgrounds skip
Emacs-Config skip
Emwm-Config skip
FVWM-Config skip
StumpWM-Config skip
XenoDM-Config skip
APM-Config skipp5-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.kshis 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, the initial bootstrap must function with korn shell in vanilla OpenBSD 7.5 or higher, as that is the default shell on OpenBSD, and includes some nice primitives that POSIX sh lacks.Rexfileis 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 therexcommand in your shell. You can see the tasks available to run withrex -T. Besides, mysetup.kshsorta automates some basic tasks for you.
The initial setup for the system.
The list of packages to be installed via Cargo.
cargo-update cargo-cache tere zoxideYou 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://dist.ultralisp.org/"
:prompt nil)
(ql:quickload '("clx"
"cl-ppcre"
"alexandria"
"cl-fad"
"xembed"
"anaphora"
"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://codeberg.org/Izder456/dotfiles/raw/branch/main/quicklisp-setup.lisp
$ sbcl --load /tmp/quicklisp.lisp --script /tmp/quicklisp-setup.lisp#!/bin/ksh
# Constants
USERHOME=$HOME
CODEBERG="https://codeberg.org"
SLEEPTIME=2
LOG_FILE="$HOME/setup.log"
# Set PATH explicitly
export PATH='/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:$HOME/bin'
# Throw an error!
function exception {
error=$1
echo "Error: $error"
exit 1
}
# Log setup messages with timestamp
function log {
message=$1
stdout=${2:-1} # Default to logging to stdout if not specified
timestamp=$(date +"%Y%m%d%H%M%S")
if [[ $stdout -eq 1 ]]; then
echo "$message"
fi
echo "[$timestamp] $message" >> "$LOG_FILE" 2>&1 || exception "Could not write to $LOG_FILE"
}# check for config sanity
for configfile in "/etc/doas.conf" "/etc/sysctl.conf"; do
if [ -f $configfile ]; then
grep -q "pickles" "${configfile}" && \
exception "Pickles error. Please read the config file you just installed." || \
echo "Pickles are fine. Thanks for reading."
else
exception "Did you read the readme? Install the doas.conf and sysctl.conf and read them over."
fi
done# Clean unnecessary files
function clean {
log "Removing Cruft..."
rex remove_default_cruft
}
# Ensure Lisp environment is set up
function ensure_lisp {
log "Quicklisp Setup"
if [[ "${quicklisp}" == "on" ]]; then
log "quicklisp set on."
log "Installing quicklisp and related deps..."
if [ -d $HOME/.quicklisp ]; then
log "Quicklisp install dir found... removing that..."
printf "Press any key..."
read
rm -Rvf $HOME/.quicklisp
fi
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 "$CODEBERG/izder456/dotfiles/raw//branch/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"
elif [[ "${quicklisp}" == "off" ]]; then
log "quicklisp set off."
log "Skipping..."
else
exception "Invalid quicklisp setting. how did we get here?"
fi
}
# Install port dependencies
function ports_deps {
log "Installing port dependencies..."
if [[ "${pkglite}" == "off" ]]; then
log "pkglite set off."
log "Installing full package set."
doas pkg_add -m -l ~/.pkglist || exception "Failed to install port dependencies"
elif [[ "${pkglite}" == "on" ]]; then
log "pkglite set on."
log "Installing lite package set."
doas pkg_add -m -l ~/.pkglistlite || exeption "Failed to install port dependencies"
else
exception "Invalid pkglite setting. how did we get here?"
fi
}
# Install cargo dependencies
function cargo_deps {
if [[ "${rustdeps}" == "on" ]]; then
log "rustdeps set on."
log "Installing cargo dependencies."
doas pkg_add rust || exception "Failed to install Rust"
xargs cargo install < ~/.cargolist || exception "Failed to install rust dependencies"
elif [[ "${rustdeps}" == "off" ]]; then
log "rustdeps set off."
log "Skipping..."
else
exception "Invalid rustdep setting. how did we get here?"
fi
}
function setup_gtkicons {
log "Setting up gtk themes..."
rex configure_gtk
log "Setting up icon themes..."
rex configure_icons
}
# 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_TRACE=1 git pull --recurse-submodules --depth 1 --verbose || exception "Failed to pull dotfiles"
else
GIT_TRACE=1 git clone --recurse-submodules --depth 1 --single-branch --verbose $CODEBERG/Izder456/dotfiles.git $USERHOME/.dotfiles || exception "Failed to clone dotfiles"
fi
if [[ "${gtkicons}" == "on" ]]; then
log "gtkicons set on"
setup_gtkicons
elif [[ "${gtkicons}" == "off" ]]; then
log "gtkicons set off"
log "Skipping..."
else
exception "Invalid gtkicons setting. how did we get here?"
fi
$USERHOME/.dotfiles/dfm/dfm install
}
# Setup ZSH shell
function setup_shell {
log "Setting up FiZSH..."
rex configure_default_shell
rex compile_afetch
}
# Setup URxvt
function setup_urxvt {
log "Setting up urxvt..."
rex configure_urxvt
}
# 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_fvwm {
log "Setting up FVWM..."
rex configure_fvwm
}
# 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 configure_apmd
rex install_backgrounds
rex update_xdg
}
# 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, git-lfs and p5-Rex..."
doas pkg_add -m p5-Rex git git-lfs || exception "Failed to install git, git-lfs and p5-Rex"
log "Setting up git-lfs..."
git lfs install
ftp -o $USERHOME/Rexfile $CODEBERG/Izder456/dotfiles/raw/branch/main/Rexfile || exception "Failed to download Rexfile"
}
# Ensure all prerequisites
function do_ensure {
echo "Log file is at ${LOG_FILE}"
echo "Refer to it for debugging"
printf "Press any key..."
read
is_internet_up
ensure_needed
}
do_ensure# Default states
pkglite="off" # set full package set by default
gtkicons="on" # set downloading gtk themes and icons enabled by default
rustdeps="on" # set rust/cargo deps by default
quicklisp="on" # install/set up quicklisp and dependencies
# Function to confirm toggles
function confirm_toggles {
log ''
log 'Current toggles:'
log "pkglite: $pkglite"
log "gtkicons: $gtkicons"
log "rustdeps: $rustdeps"
log "quicklisp: $quicklisp"
log ''
printf "Are these settings correct? (y/N) "
}
# Function to prompt for toggles
function toggle_prompt {
log ''
log 'Fine tuned toggles:'
log '---------------------------------------------------------'
log ' Key: '
log ' - pkglite means: "lite packages" '
log ' - gtkicons means: "gtk themes and icons" '
log ' - rustdeps means: "rust deps on supported archs" '
log ' - quicklisp means: "common lisp deps needed for stumpwm"'
log '---------------------------------------------------------'
while true; do
confirm_toggles # Confirm toggles with the end user.
read confirmation
if [[ "$confirmation" == "y" ]]; then
break
else
# Loop through each variable and prompt user to set its value directly
for toggle in pkglite gtkicons rustdeps quicklisp; do
eval current_value=\$$toggle
# Adjust capitalization of the prompt dynamically
if [ "$current_value" = "on" ]; then
default_prompt="ON/off"
else
default_prompt="on/OFF"
fi
while true; do
# Prompt user
printf "Turn $toggle on or off? ($default_prompt): "
read answer
# Handle user input
case "$answer" in
"on"|"ON"|"y"|"Y")
eval "$toggle=on"
log "$toggle set to on." 0
break
;;
"off"|"OFF"|"n"|"N")
eval "$toggle=off"
log "$toggle set to off." 0
break
;;
"")
# Keep current value if no input is given
log "Keeping $toggle as $current_value." 0
break
;;
*)
log "Invalid input. Please enter 'on' or 'off', or press Enter to keep the current value." 0
;;
esac
done
done
fi
done
}This is the menuing system I hacked together. All it does is run rex tasks we defined in the functions we wrote earlier. If you do choose to not grab gtk/icons, the full package list, or rust deps, know that you will only get a barebones install. Coming back later to get the rest is perfectly a.o.k.
# Display menu and handle user input
function menu {
while true; do
clear
echo 'Srcerizder Dotfiles Setup'
echo 'Options:'
echo '---------------------------------------'
echo '0) Packages (lite) 1) Packages (all)'
echo '2) StumpWM 3) FVWM'
echo '4) Emacs 5) XenoDM'
echo '6) Rust Packages 7) GTK/Icons'
echo '8) Misc. Config 9) Misc. Software'
echo
echo 'Other Options:'
echo '----------------'
echo 'a) All (recommended)'
echo 'r) Reload Menu'
echo 'q) Quit'
echo
printf "Enter your selection: "
read selection # Move the input prompt to the same line
[ -z $selection ] && selection="r"
# reset these vars incase the user selected otherwise and it failed.
pkglite="off" # set full package set by default
gtkicons="on" # set downloading gtk themes and icons enabled by default
rustdeps="on" # set rust/cargo deps by default
quicklisp="on" # install/set up quicklisp and dependencies
case $selection in
0)
echo "Selected Lite Package List Install..."; sleep $SLEEPTIME; pkglite="on"; ports_deps;
;;
1)
echo "Selected Full Package List Install..."; sleep $SLEEPTIME; pkglite="off"; ports_deps
;;
2)
echo "Selected StumpWM Config..."; sleep $SLEEPTIME; quicklisp="on"; setup_stupmwm;
;;
3)
echo "Selected FVWM Config..."; sleep $SLEEPTIME; setup_fvwm;
;;
4)
echo "Selected Emacs Config..."; sleep $SLEEPTIME; setup_emacs;
;;
5)
echo "Selected XenoDM Config..."; sleep $SLEEPTIME; setup_xenodm;
;;
6)
echo "Selected Rust Deps..."; sleep $SLEEPTIME; cargo_deps;
;;
7)
echo "Selected GTK Theme/Icon Theme Setup..."; sleep $SLEEPTIME; setup_gtkicon;
;;
8)
echo "Selected Misc. Configs..."; sleep $SLEEPTIME; config_install;
;;
9)
echo "Selected Misc. Software..."; sleep $SLEEPTIME; setup_misc;
;;
"a")
echo "Running All...";
toggle_prompt; # let the use toggle what they wish
sleep $SLEEPTIME; clean;
config_install; ports_deps; cargo_deps;
setup_fvwm; setup_stumpwm; setup_urxvt; setup_emacs; setup_xenodm;
setup_misc;
;;
"r")
continue;
;;
"q")
echo "";
exit;
;;
*)
echo "Invalid selection";
sleep $SLEEPTIME;
;;
esac
done
}
menuuse 5.36.0;
use Rex -feature => ['1.4'];
# No Magic
my $USERHOME = "$ENV{HOME}";
my $CODEBERG = "https://codeberg.org";
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';
# Generic function to clone or update a Git repository
sub sync_repo {
my ($repo, $dest) = @_;
if (is_dir($dest)) {
say "Updating $dest...";
run "git -C $dest pull";
} else {
say "Cloning $repo into $dest...";
run "git clone --depth 1 $repo $dest";
}
}
# Generic function to build and install from source
sub build_and_install {
my ($repo, $dest, $commands) = @_;
sync_repo($repo, $dest);
chdir $dest;
for my $cmd (@$commands) {
run $cmd;
}
};
# Generic function to create symlinks
sub create_symlink {
my ($source, $dest) = @_;
run "ln -sf $source $dest";
};I don’t need some of these defaults
# Remove default files task
task 'remove_default_cruft', sub {
for my $file (qw(.cshrc .login .mailrc .profile .Xdefaults .cvsrc)) {
my $filepath = "$USERHOME/$file";
unlink $filepath if -e $filepath;
}
say "Setting home directory permissions...";
run "chmod 0700 $USERHOME";
};This is my fallback terminal
# Setup urxvt extensions
task 'configure_urxvt', sub {
my $urxvtdir = "$USERHOME/.urxvt/ext";
my %perls = (
"resize-font" => "$GITHUB/simmel/urxvt-resize-font/raw/master/resize-font",
"clipboard" => "$GITHUB/xyb3rt/urxvt-perls/raw/master/deprecated/clipboard"
);
mkdir $urxvtdir unless is_dir($urxvtdir);
for my $key (keys %perls) {
my $dest = "$urxvtdir/$key";
run "ftp -o $dest $perls{$key}";
}
};# Setup ZSH plugins
task 'configure_default_shell', sub {
my $zshdir = "$USERHOME/.zshrc.d";
mkdir $zshdir unless is_dir($zshdir);
my %plugins = (
"openbsd" => "$GITHUB/sizeofvoid/openbsd-zsh-completions.git",
"completions" => "$GITHUB/zsh-users/zsh-completions.git",
"fzf-comp" => "$GITHUB/lincheney/fzf-tab-completion.git",
"suggest" => "$GITHUB/zsh-users/zsh-autosuggestions.git",
"substring" => "$GITHUB/zsh-users/zsh-history-substring-search.git",
"fzf" => "$GITHUB/Aloxaf/fzf-tab.git",
"fsh" => "$GITHUB/zdharma-continuum/fast-syntax-highlighting.git",
"autopair" => "$GITHUB/hlissner/zsh-autopair",
"defer" => "$GITHUB/romkatv/zsh-defer",
"vim-mode" => "$GITHUB/softmoth/zsh-vim-mode"
);
for my $key (keys %plugins) {
sync_repo($plugins{$key}, "$zshdir/$key");
}
run "chsh -s /usr/local/bin/zsh";
};# GTK Themes
task 'configure_gtk', sub {
my $tmp_dir = "/tmp/gruvbox-plus-gtk";
sync_repo("$GITHUB/SylEleuth/gruvbox-plus-gtk.git", $tmp_dir);
run "mkdir -p $USERHOME/.dotfiles/.themes";
run "cp -R $tmp_dir/* $USERHOME/.dotfiles/.themes/";
run "rm -rf $tmp_dir";
run "fc-cache -fv";
};
# GTK Icons
task 'configure_icons', sub {
my $tmp_dir = "/tmp/gruvbox-round-icons";
sync_repo("$GITHUB/Fausto-Korpsvart/Gruvbox-GTK-Theme.git", $tmp_dir);
run "mkdir -p $USERHOME/.dotfiles/.icons";
run "cp -R $tmp_dir/icons/* $USERHOME/.dotfiles/.icons/";
run "rm -rf $tmp_dir";
};I use Emacs, btw
# Emacs setup
task 'configure_emacs', sub {
create_symlink("$USERHOME/.dotfiles/Emacs-Config", "$USERHOME/.emacs.d");
};Yeah, this weird WM…
# StumpWM setup
task 'configure_stumpwm', sub {
create_symlink("$USERHOME/.dotfiles/StumpWM-Config", "$USERHOME/.stumpwm.d");
};Yeah, I sometimes float things
# Enhanced Motif WM setup
task 'configure_fvwm', sub {
create_symlink("$USERHOME/.dotfiles/FVWM-Config/.fvwmrc", "$USERHOME/.fvwmrc");
};Because XDM wasn’t cutting it…
# XenoDM setup
task 'install_backgrounds', sub {
run "doas mkdir -p /usr/local/share/backgrounds";
run "doas cp -R $USERHOME/.dotfiles/backgrounds/* /usr/local/share/backgrounds";
};
task 'configure_xenodm', sub {
run "chmod +x $USERHOME/.dotfiles/XenoDM-Config/Xsetup_* $USERHOME/.dotfiles/XenoDM-Config/GiveConsole";
run "doas cp -R $USERHOME/.dotfiles/XenoDM-Config/* /etc/X11/xenodm/";
};Setup Laptop Slock shell-close autohook
# APMD setup
task 'configure_apmd', sub {
run "doas mkdir -p /etc/apm";
run "doas cp -R $USERHOME/.dotfiles/APM-Config/* /etc/apm/";
};Extra stuff thats not in ports, cargo or base
# Compile and install various packages
task 'compile_shuf', sub {
build_and_install("$GITHUB/ibara/shuf.git", "$USERHOME/.shuf", ["./configure", "make", "doas make install"]);
};
task 'compile_slock', sub {
build_and_install("$CODEBERG/Izder456/slock.git", "$USERHOME/.slock", ["make", "doas make install"]);
};
task 'compile_surf', sub {
build_and_install("$CODEBERG/Izder456/surf.git", "$USERHOME/.surf-src", ["make", "doas make install"]);
};
task 'compile_st', sub {
build_and_install("$CODEBERG/Izder456/st.git", "$USERHOME/.st", ["make", "doas make install"]);
};
task 'compile_afetch', sub {
build_and_install("$GITHUB/13-CF/afetch.git", "$USERHOME/.afetch", ["make", "doas make install"]);
};Setup Homedir Paths & Enable dbus
# XDG setup
task 'update_xdg', sub {
run "xdg-user-dirs-update";
run "mkdir -p $USERHOME/Projects";
run "doas gdk-pixbuf-query-loaders --update-cache";
run "doas rcctl enable messagebus";
};The settings for X session, resources, and profile. The .xsession file also starts a window manager selector program using xmessage
!!
! Includes
!!
#include ".xresources.d/colors"
#include ".xresources.d/apps"
!!
! XWindow Stuffs
!!
*imLocale: en_US.UTF-8
*lookAndFeel: motif
*shapeStyle: Rectangle
!!
! Font Rendering Stuffs
!!
Xft.dpi: 96
Xft.rgba: rgb
Xft.antialias: true
Xft.autohint: false
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
*faceName: fixed
*faceSize: 14
*background: #282828
! regular contrast: *background: #282828
! soft contrast: *background: #32302f
! high contrast: *background: #1d2021
*foreground: #ebdbb2
! regular contrast: *foreground: #ebdbb2
! soft-contrast: *foreground: #f2e5bc
! high contrast: *foreground #f9f5d7
! 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
!!
! XMessage
!!
xmessage*background: #1d2021
xmessage*foreground: #fbf1c7
xmessage.borderWidth: 1
xmessage*borderColor: #ebdbb2
xmessage*timeout: 0
xmessage*printValue: false
xmessage*font: -misc-fixed-*-*-*-*-15-*-*-*-*-*-*-*
xmessage*ShapeStyle: Rectangle
xmessage*Buttons: motif
xmessage*Command.highlightThickness: 1
xmessage*Command.borderWidth: 1
xmessage*Command.shapeStyle: Rectangle
!!
! SSH-Askpass
!!
SshAskpass*background: #1d2021
SshAskpass*foreground: #fcf1c7
SshAskpass.borderWidth: 1
SshAskpass*borderColor: #ebdbb2
SshAskpass*font: -misc-fixed-*-*-*-*-15-*-*-*-*-*-*-*
SshAskpass*ShapeStyle: Rectangle
SshAskpass*internalBorder: 12
SshAskpass*Button.background: #1d2021
SshAskpass*Button.foreground: #fcf1c7
SshAskpass*Button.highlightThickness: 1
SshAskpass*Button.borderWidth: 1
SshAskpass*Button.borderColor: #ebdbb2
SshAskpass*Button.shapeStyle: Rectangle
SshAskpass*Text.background: #1d2021
SshAskpass*Text.foreground: #fcf1c7
SshAskpass*Text.borderColor: #ebdbb2
SshAskpass*Text.borderWidth: 1
SshAskpass*shadowThickness: 1
SshAskpass*highlightThickness: 1
!!
! XTerm
!!
*allowSendEvents: true
xterm*scrollBar: false
xterm*faceName: fixed
xterm*faceSize: 14
xterm*renderFont: true
xterm*internalBorder: 12
xterm*letterSpace: 1
xterm*loginShell: true
xterm*savelines: 16384
xterm*eightBitInput: false
xterm.vt100.translations: #override \
Ctrl Shift <Key> equal: larger-vt-font() \n\
Ctrl <Key> minus: smaller-vt-font() \n\
Ctrl <Key> 0: set-vt-font(d) \n\
Ctrl Shift <Key> C: copy-selection(CLIPBOARD) \n\
Ctrl Shift <Key> V: insert-selection(CLIPBOARD)
!!
! Urxvt
!!
URxvt.font: xft:fixed:antialias=False:pixelsize=15,\
xft:Symbols Nerd Font Mono:pixelsize=15,\
xft:Symbola:pixelsize=15
URxvt.boldFont: xft:fixed:antialias=False:pixelsize=15,\
xft:Symbols Nerd Font Mono:pixelsize=15,\
xft:Symbola:bold:pixelsize=15
URxvt.italicFont: xft:fixed:antialias=False:pixelsize=15,\
xft:Symbols Nerd Font Mono:pixelsize=15,\
xft:Symbola:italic:pixelsize=15
URxvt.boldItalicFont: xft:fixed:antialias=False:pixelsize=15,\
xft:Symbols Nerd Font Mono:pixelsize=15,\
xft:Symbola:italic:bold:pixelsize=15
URxvt.perl-lib: ~/.urxvt/ext
URxvt.perl-ext-common: default,clipboard,resize-font
URxvt.copyCommand: xclip -i -selection clipboard
URxvt.pasteCommand: xclip -o -selection clipboard
URxvt.keysym.C-C: perl:clipboard:copy
URxvt.keysym.C-V: perl:clipboard:paste
URxvt.keysym.C-A-V: perl:clipboard:paste_escaped
URxvt.depth: 32
URxvt.fading: 5
URxvt.background: [95]#282828
URxvt.loginShell: true
URxvt.letterSpace: 0
URxvt.lineSpace: 0
URxvt.geometry: 240x120
URxvt.internalBorder: 14
URxvt.borderWidth: 0
URxvt.externalBorder: 0
URxvt.cursorBlink: true
URxvt.cursorUnderline: false
URxvt.urgentOnBell: true
URxvt.iso14755: false
URxvt.saveLines: 65535
URxvt.scrollBar: false
URxvt.keysym.C-minus: resize-font:smaller
URxvt.keysym.C-plus: resize-font:bigger
URxvt.keysym.C-equal: resize-font:equal
URxvt.keysym.Control-Up: \033[1;5A
URxvt.keysym.Control-Down: \033[1;5B
URxvt.keysym.Control-Right: \033[1;5C
URxvt.keysym.Control-Left: \033[1;5D
!!
! XClock Stuffs
!!
XClock*Background: #32302f
XClock*Foreground: #ebdbb2
PS: You can optionally put an ~/.autostart script with a bunch of programs in it. It will be ran with /bin/sh so you don’t need a she-bang or anything. For the case of stumpwm, you may want to change the defaults for the toggles, such at dunst for example, if you so choose to run dunst on startup. By default, we wait 10 seconds before running it.
#!/bin/ksh
readonly XMESG_WIDTH=512
readonly XMESG_HEIGHT=128
# Hardware acceleration and style overrides
export MOZ_ACCELERATED=1
export MOZ_WEBRENDER=1
export QT_STYLE_OVERRIDE=kvantum
export SDL_VIDEO_X11_DGAMOUSE=0
# Function to ensure XDG environment variables are set
function xdg_runtime {
export XDG_RUNTIME_DIR=/tmp/run/user/$(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
[ -n "${selected_wm}" ] && export XDG_CURRENT_DESKTOP="${selected_wm}"
[ ! -d "$XDG_RUNTIME_DIR" ] && mkdir -m 700 -p "$XDG_RUNTIME_DIR"
}
# Get screen width (0) or height (1)
function get_screen_dimension {
typeset dimension=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | head -n1)
case $1 in
0) echo "${dimension%x*}" ;;
1) echo "${dimension#*x}" ;;
*) echo "Invalid argument. Use 0 for width or 1 for height." ;;
esac
}
# Load files if they exist
function load_environment {
set -A files "$@"
for file in "${files[@]}"; do
[ -f "$file" ] && . "$file"
done
}
# Merge X resources
function load_resources {
set -A resources "$@"
for resource in "${resources[@]}"; do
[ -f "$resource" ] && xrdb -merge "$resource"
done
}
# Run a list of background processes, killing any previous instance
function run_commands {
set -A commands "$@"
for cmd in "${commands[@]}"; do
typeset pname="${cmd%% *}"
pkill "$pname" 2>/dev/null
eval "$cmd" &
done
}
# Play a random startup WAV sound from directory
function play_startup_sound {
if command -v aucat &>/dev/null; then
sleep 1
aucat -i $(find "$1" -type f -name '*.wav' | sort -R | head -n1)
fi
}
# Set default input/output volume
function set_default_volume {
sndioctl input.level=0.45
sndioctl output.level=1.00
}
# Helper to calculate xmessage position
function get_centered_geometry {
typeset xwidth=$(get_screen_dimension 0)
typeset xheight=$(get_screen_dimension 1)
typeset xpos=$(( (xwidth - XMESG_WIDTH) / 2 ))
typeset ypos=$(( (xheight - XMESG_HEIGHT) / 2 ))
echo "${XMESG_WIDTH}x${XMESG_HEIGHT}+${xpos}-${ypos}"
}
# Prompt to choose a window manager
function select_wm {
typeset geometry=$(get_centered_geometry)
xmessage "Please Choose a Session to load" \
-buttons "StumpWM[]":1,"FVWM[]":2 \
-default "StumpWM[]" \
-geometry "$geometry"
case $? in
1) echo "stumpwm" ;;
2) echo "fvwm" ;;
*) echo "stumpwm" ;;
esac
}
# Load env and resources
load_environment /etc/profile ~/.profile
load_resources ~/.Xresources ~/.xresources.d/emwm
# Select WM
selected_wm=$(select_wm)
# Resolve WM binary
case "$selected_wm" in
stumpwm) wm=$(command -v stumpwm) ;;
fvwm) wm=$(command -v fvwm) ;;
esac
wm_args=""
# Disable core dumps
ulimit -Sc 0
# Cleanup stray processes trap
trap 'pkill -U $(id -u) -P $$' EXIT INT TERM
trap 'kill -- -$AUTOSTART_GRP' EXIT INT TERM
# XDG + GPG Setup
xdg_runtime
# Autostart common services
(
run_commands \
"picom -b" \
"emacs --daemon" \
"nxbelld -t 150 -v100 -d200 -f ~/.local/alert/Funk.wav -b" \
"feh --bg-fill --randomize /usr/local/share/backgrounds" \
"xidle -delay 5 -nw -program /usr/local/bin/slock -timeout 1800" \
"dunst --startup_notification true"
[ -f ~/.autostart ] && (sleep 10 && sh ~/.autostart)
) &
AUTOSTART_GRP=$!
# Set volumes
set_default_volume
# Play startup SFX
(play_startup_sound ~/.local/sfx/) &
# DBus
if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
eval `dbus-launch --sh-syntax --exit-with-x11`
fi
# Launch WM
if ! exec "$wm" $wm_args; then
echo "Failed to launch window manager $wm."
exit 1
fi
exit 0Add custom shit to ~/.zprofile if any
# ZSH
export ENV=~/.zprofile
# Locale
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# Editors
if command -v aee >/dev/null; then
export EDITOR="aee"
export VISUAL="aee"
elif command -v ee >/dev/null; then
export EDITOR="ee"
export VISUAL="ee"
elif command -v nvi >/dev/null; then
export EDITOR="nvi"
export VISUAL="nvi"
else
export EDITOR="vi"
export VISUAL="vi"
fi
# Pager
export PAGER=less
export MANPAGER=less
# Java
export JAVA_HOME=/usr/local/jdk-17
export PATH=$PATH:$JAVA_HOME/bin
# Erlang
export PATH=$PATH:/usr/local/lib/erlang27/bin
# Go
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# Ruby
export GEM_HOME="$HOME/.gems"
export PATH=$PATH:$GEM_HOME/bin
# Cargo
export PATH=$HOME/.cargo/bin:$PATH
# Local
export PATH=$HOME/.local/bin:$PATH
# OS-specific PATH additions
case "$(uname)" in
OpenBSD)
export PATH=/usr/ports/infrastructure/bin:/usr/games:$PATH
;;
Linux)
export PATH=/usr/sbin:/sbin:$PATH
;;
esac#!/usr/bin/env zsh
# Load env
[[ -f ~/.profile ]] && source ~/.profile
##
# Check if TTY if on OpenBSD
##
if [[ "$(uname)" == "OpenBSD" ]]; then
if [[ "$(tty)" == "/dev/ttyC"* ]]; then
export TERM=wsvt25
fi
fi
##
# Prompt
##
setopt prompt_subst
autoload -Uz colors vcs_info
colors
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "+"
zstyle ':vcs_info:git:*' unstagedstr "*"
zstyle ':vcs_info:git:*' formats ' git:(%b%u%c)'
zstyle ':vcs_info:git:*' actionformats ' git:(%b|%a%u%c)'
function precmd {
vcs_info
local color
case "$(uname)" in
OpenBSD) color="%F{yellow}" ;;
FreeBSD) color="%F{green}" ;;
*) color="%F{blue}" ;;
esac
local char=$([[ $EUID -eq 0 ]] && echo "%F{red}#%f" || echo "%F{white}$%f")
PROMPT="${color}%~%f${vcs_info_msg_0_} ${char} "
}
##
# Lazy Loading
##
source ~/.zshrc.d/defer/zsh-defer.plugin.zsh
##
# Autoload zmv
##
zsh-defer autoload -Uz zmv
##
# Setup Completions
##
zsh-defer autoload -U compinit
zsh-defer compinit
zsh-defer autoload -U bashcompinit
zsh-defer bashcompinit
# We don't need to load OpenBSD completions on non-OpenBSD Systems
if [[ "$(uname)" == "OpenBSD" ]]; then
fpath=($HOME/.zshrc.d/openbsd/completions $HOME/.zshrc.d/completions/src $fpath)
else
fpath=($HOME/.zshrc.d/completions/src $fpath)
fi
setopt MENU_COMPLETE
setopt AUTO_LIST
setopt COMPLETE_IN_WORD
zsh-defer eval "$(register-python-argcomplete pipx)"
##
# Autopair
##
zsh-defer source ~/.zshrc.d/autopair/autopair.zsh
zsh-defer autopair-init
##
# Suggestions
##
zsh-defer source ~/.zshrc.d/suggest/zsh-autosuggestions.plugin.zsh
##
# Syntax Highlight
##
zsh-defer source ~/.zshrc.d/fsh/fast-syntax-highlighting.plugin.zsh
##
# History substring search
##
zsh-defer source ~/.zshrc.d/substring/zsh-history-substring-search.plugin.zsh
HISTFILE="$HOME/.zshrc.d/.history"
HISTSIZE=100
SAVEHIST=100
##
# Vim-mode
##
MODE_INDICATOR=""
VIM_MODE_TRACK_KEYMAP=no
VIM_MODE_INITIAL_KEYMAP=viins
zsh-defer source ~/.zshrc.d/vim-mode/zsh-vim-mode.plugin.zsh
##
# FZF-Zsh
##
if command -v fzf &> /dev/null; then
zsh-defer source ~/.zshrc.d/fzf/fzf-tab.plugin.zsh
zsh-defer source ~/.zshrc.d/fzf-comp/zsh/fzf-zsh-completion.sh
fi
##
# Alias for muscle memory
##
if command -v doas &> /dev/null; then
alias sudo="doas"
alias su="echo 'did you mean to run doas -s? '"
elif command -v sudo &> /dev/null; then
alias doas="sudo"
alias su="echo 'did you mean to run sudo -i? '"
fi
##
# Alias for CD
##
if command -v zoxide &> /dev/null; then
zsh-defer eval "$(zoxide init --cmd cd zsh)"
fi
##
# Alias for listing files
##
if command -v eza &> /dev/null; then
alias ls="eza --icons=never -Hh"
alias la="eza --icons=never -ah"
alias ll="eza --icons=never -lh"
alias lh="eza --icons=never -lAh"
alias tree="eza --icons=never -Th"
elif command -v colorls &> /dev/null; then
alias ls="colorls -G -Hh"
alias la="colorls -G -ah"
alias ll="colorls -G -lh"
alias lh="colorls -G -lAh"
elif command -v ls &> /dev/null; then
alias ls="ls -Hh"
alias la="ls -ah"
alias ll="ls -lh"
alias lh="ls -lAh"
fi
##
# Alias for parsing
##
if command -v bat &> /dev/null; then
export BAT_THEME=ansi
alias cat="bat -pp"
alias bat="bat -p"
fi
if command -v rg &> /dev/null; then
alias rgrep="rg"
fi
##
# Alias for editing
##
alias edit=$EDITOR
alias vedit=$VISUAL
##
# Alias for media
##
alias audio-dlp="yt-dlp -x --audio-quality 0 --audio-format vorbis \
--concurrent-fragments 5"
alias video-dlp="yt-dlp --write-subs --sub-format srt --remux-video mkv \
--embed-subs --concurrent-fragments 5"
alias tidal-dlp="tidal-dl -o /home/izder456/Music -q Master -r P1080 -l "
##
# Tere config
##
function tere {
local result=$(command tere "$@")
[ -n "$result" ] && cd -- "$result"
}
##
# Binds
##
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5A" previous-history
bindkey "^[[1;5B" next-history
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
##
# the r/unixporn rite of passage
##
if command -v exfetch &> /dev/null; then
exfetch
fi
zsh-defer . $HOME/.shellrc.load##
# Opacity
##
opacity-rule = [
"100:class_g = 'emacs' && focused",
"85:class_g = 'emacs' && !focused",
"100:class_g = 'st' && focused",
"95:class_g = 'st' && !focused",
"100:class_g = 'XTerm' && focused",
"95:class_g = 'XTerm' && !focused",
"100:class_g = 'URxvt' && focused",
"85:class_g = 'URxvt' && !focused",
];
##
# Wintypes
##
wintypes: {
normal = { blur-background = true; };
splash = { blur-background = false; };
};
##
# Misc
##
unredir-if-possible = true;
use-damage = true;
vsync = true;
##
# Shadows
##
shadow = false;
##
# QT-Apps Fixes For Blurs
##
blur-background-exclude = [
"(_NET_WM_WINDOW_TYPE@:a *= 'MENU' || _NET_WM_WINDOW_TYPE@:a *= 'COMBO')",
];
##
# Backend
##
backend = "glx";
[global]
monitor = 0
follow = keyboard
width = 300
height = 256
origin = bottom-right
offset = 0x0
scale = 0
notification_limit = 3
progress_bar = true
progress_bar_height = 10
progress_bar_frame_width = 1
progress_bar_min_width = 150
progress_bar_max_width = 300
progress_bar_corner_radius = 0
icon_corner_radius = 0
indicate_hidden = yes
transparency = 0
separator_height = 2
padding = 8
horizontal_padding = 10
text_icon_padding = 0
frame_width = 1
frame_color = "#d5c4a1"
gap_size = 2
separator_color = foreground
sort = yes
idle_threshold = 120
font = Spleen 8x16 12
line_height = 0
markup = full
format = "<b>%a</b>\n%s\n<i>%b</i> "
alignment = left
vertical_alignment = center
show_age_threshold = 60
ellipsize = middle
ignore_newline = no
stack_duplicates = true
hide_duplicate_count = false
show_indicators = yes
enable_recursive_icon_lookup = false
icon_theme = Gruvbox_Dark
icon_position = left
min_icon_size = 32
max_icon_size = 64
sticky_history = yes
history_length = 20
browser = /usr/bin/xdg-open
always_run_script = false
title = Dunst
class = Dunst
corner_radius = 0
ignore_dbusclose = true
force_xinerama = false
mouse_left_click = do_action, open_url
mouse_middle_click = context
mouse_right_click = close_current
[experimental]
per_monitor_dpi = false
[urgency_low]
background = "#282828"
foreground = "#928374"
timeout = 10
[urgency_normal]
background = "#282828"
foreground = "#ebdbb2"
timeout = 10
[urgency_critical]
background = "#282828"
foreground = "#fb4934"
frame_color = "#fabd2f"
timeout = 25
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
The kernel parameters settings. Everything is commented, so uncomment as needed. Very hardware specific see *Note:
# shared memory is a method of sharing a common memory space for inter-processes communication (IPC)
# modern browsers, multimedia apps, databases, games, containers, vms
#kern.shminfo.shmall=3781250 # total number of pages, 1 page per 4096 bytes. ill put 1966080 pages for my 16gb tp ((16GB-512M)/4096)
#kern.shminfo.shmmax=536870912 # cap for each shm segment, for safety, ill set it dividing my memory by 16. 512mb is enough (db shared_buffer, browser cache).
#kern.shminfo.shmmni=2048 # max number of segments in a system (enough space for multitasks, containers, vms)
#kern.shminfo.shmseg=2048 # max number of segments a single process can attach to (allows browsers/multimedia with many tabs/processes use multiple segments)
# IPC semaphores (sync between processes)
#kern.seminfo.semmns=4096 # total semaphores
#kern.seminfo.semmni=1024 # total sets of semaphores, 1024 x average semaphores per set should equal to SEMMNS
# Max processes and open file descriptors (enough for me. browsers, compiling, multitasking)
#kern.maxproc=8192
#kern.maxfiles=16384
# Vnode is a kernel abstraction of a file system, it represents a file system object (good for caching)
#kern.maxvnodes=100000 # max tracked filesystem objects by the kernel (open files, dirs, sockets, etc.)
# Network tuning
#kern.somaxconn=1024 # max number of pending TCP connections in listen queue (useful on p2p, modern browsers open tons of connections), 1024 feels enough for me
#net.inet.udp.recvspace=262144 # UDP receive and send buffers, useful for streaming and calls
#net.inet.udp.sendspace=262144
#net.inet.tcp.mssdflt=1460 # max segment size to ethernet MTU
#net.inet.tcp.keepidle=300 # reduce idle keepalive time to detect dead connections faster
#net.inet.ip.ifq.maxlen=4096 # increase interface queue max length for better burst handling
#net.inet6.ip6.ifq.maxlen=4096 # for ipv6
#hw.smt=1 # enable hyperthreading, check https://www.openbsd.org/faq/faq10.html before
#net.inet.ip.forwarding=1 # ipv4 forwarding
#net.inet6.ip6.forwarding=1 # ipv6 forwarding
pickles # remove this line if you read this whole file.
this is totally overkill
fine now
# Change this top line to nopass instead of persist if you wanna avoid typing your password alot
permit keepenv persist :doas
# allow root to doas, cos well, it's root
permit keepenv nopass root
# these are useful for PORTS_PRIVSEP in mk.conf. see the bsd.port.mk(5)
permit keepenv nopass :operator as _pbuild
permit keepenv nopass :operator as _pfetch
pickles # remove this line if you read this whole file.
TODO: Testing on automation needed
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.
PORTSDIR_PATH=${PORTSDIR}:${PORTSDIR}/openbsd-wip:${PORTSDIR}/mystuff
SUDO=doas
PORTS_PRIVSEP=Yes
.include "/usr/ports/infrastructure/templates/mk.conf.template"
These go in /etc, use with caution. They are not installed by setup.ksh or Rexfile, you will need to grab these manually.
set skip on lo
set block-policy drop
set optimization normal
block in log
pass out quick
# Multicast junk
pass proto udp to 224.0.0.251 port mdns allow-opts
pass inet6 proto udp to ff02::fb port mdns allow-opts
pass proto udp to 239.255.255.250 port ssdp allow-opts
pass inet6 proto udp to { ff02::c, ff05::c, ff08::c } port ssdp allow-opts
# ICMP
pass inet proto icmp
pass inet6 proto icmp6
# vmm NAT
match out on egress from { vport0:network } nat-to (egress)
add vport0
up
inet 10.0.1.1 255.255.255.0
up
Be sure to enable vmd(8) using rcctl(8)
switch "uplink" {
interface veb0
}
vm "example" {
disable # change to "enable" if you want it to run on startup
memory 512M
cdrom "/path/to/openbsd/install77.iso"
disk "/path/to/vm/disk.qcow2"
interface { switch "uplink" }
owner youruser
}