Jelajahi Sumber

add fcitx with userspace service file
add gsettings loader script with systemd service file
move lxpolit to systemd autostart

change transmission daemon to launcher fully from userspace
eliminate root level override and global transmission instance

add launchers for ffxiv, path of exile, path of building, genshin impact, monster hunter, and ppsspp
these may require some tweaking

add utilities for gif2png, pdf2png, and an updated one-time-password script that copies

fully revamp virtualbox/vagrant/packer scripts for fresh build
separate directory in preparation for libvirt implementation

swap iptables for nftables; keep iptables package as a dependency for systemd and iproute2
ideally iptables will be deprecated in the future and a full transition will occur

add/move some notes to errors
update readme surrounding building and execution

break packages apart into groups; may need further refinement in the future
reduce aur installs by switching to new native packages

fix mkinitcpio command and loader config syntax (add .conf instead of implied)
add sync and pacman cleanup operations as the final steps

add exclusion of mounted disks when asking which to install to
may require further refinement to look at partitions and exclude parent disks
finish implementing hibernation (now adds to kernel options)
add hostname to top level configuration
remove virtualbox logic from base scripts and into tertiary/packer/vagrant scripts

fix packer build to generate tar so symlinks are retained

rename config from youtube-dl to yt-dlp

Casey DeLorme 2 tahun lalu
induk
melakukan
b7b09acaa9
34 mengubah file dengan 729 tambahan dan 181 penghapusan
  1. 64 36
      arch.sh
  2. 48 0
      install/etc/nftables.conf
  3. 5 0
      install/etc/skel/.bash_profile
  4. 0 1
      install/etc/skel/.config/openbox/autostart
  5. 1 0
      install/etc/skel/.config/systemd/user/default.target.wants/transmission.service
  6. 13 0
      install/etc/skel/.config/systemd/user/fcitx5.service
  7. 10 0
      install/etc/skel/.config/systemd/user/gsettings.service
  8. 12 0
      install/etc/skel/.config/systemd/user/lxpolkit.service
  9. 12 0
      install/etc/skel/.config/systemd/user/transmission.service
  10. 1 0
      install/etc/skel/.config/systemd/user/xsession.target.wants/fcitx5.service
  11. 1 0
      install/etc/skel/.config/systemd/user/xsession.target.wants/lxpolkit.service
  12. 0 0
      install/etc/skel/.config/yt-dlp/config
  13. 3 0
      install/etc/systemd/system/connman.service.d/disable_dns_proxy.conf
  14. 43 0
      install/usr/local/bin/directory-thumbnailer
  15. 3 0
      install/usr/local/bin/ffxiv
  16. 13 0
      install/usr/local/bin/genshin-impact
  17. 15 0
      install/usr/local/bin/gif2png
  18. 15 0
      install/usr/local/bin/load-gsettings
  19. 50 0
      install/usr/local/bin/mh
  20. 18 0
      install/usr/local/bin/otp
  21. 3 0
      install/usr/local/bin/pob
  22. 3 0
      install/usr/local/bin/poe
  23. 4 0
      install/usr/local/bin/psp
  24. 4 0
      install/usr/share/thumbnailers/directory.thumbnailer
  25. 11 0
      notes/errors.md
  26. 48 0
      notes/file-browsers.md
  27. 0 79
      packer.json
  28. 10 5
      readme.md
  29. 19 19
      setup/install.sh
  30. 209 38
      todo.md
  31. 0 0
      virtualbox/Vagrantfile
  32. 87 0
      virtualbox/packer.json
  33. 1 0
      virtualbox/upload/.gitignore
  34. 3 3
      virtualbox/vagrant.sh

+ 64 - 36
arch.sh

@@ -50,30 +50,68 @@ pacman-key --populate archlinux
 
 # add sublime text source
 curl -O https://download.sublimetext.com/sublimehq-pub.gpg && pacman-key --add sublimehq-pub.gpg && pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg
-#[ $(grep -c "sublime-text" /etc/pacman.conf) -eq 0 ] && echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64" | tee -a /etc/pacman.conf
+[ $(grep -c "sublime-text" /etc/pacman.conf) -eq 0 ] && echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64" | tee -a /etc/pacman.conf
 
-# put all packages into an environment variable that we can add to
-export PACKAGES="sudo bash-completion man-db tmux gvim linux-firmware linux-headers dkms smartmontools cryptsetup usbutils btrfs-progs gvfs gvfs-mtp gvfs-afc android-udev dmidecode parted pkgfile pkgconf bison gcc gcc-libs cmake ccache ncurses xmlstarlet jq at bc cronie iptables rsync dhcpcd inetutils net-tools openssh sshfs ntp wget curl wireless_tools bluez bluez-utils lzop unzip p7zip xz unrar unace lrzip arj git mercurial subversion bzr postgresql mesa lib32-mesa dbus polkit xorg-server xorg-server-devel xorg-xinit xorg-xinput xorg-xdpyinfo xorg-xprop xdotool xsel patchelf libpng12 lib32-libpng12 pulseaudio libpulse lib32-libpulse openal lib32-openal giflib lib32-giflib mpg123 lib32-mpg123 v4l-utils lib32-v4l-utils opencl-icd-loader lib32-opencl-icd-loader libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs arandr feh hsetroot openbox archlinux-xdg-menu picom xarchiver innoextract pavucontrol pasystray xdg-utils xdg-user-dirs tint2 conky pcmanfm gmrun rxvt-unicode urxvt-perls gnome-themes-extra gnome-icon-theme arc-gtk-theme gtk-engines gtk-engine-murrine lxappearance graphicsmagick imagemagick lame libwebp libid3tag libvorbis vorbis-tools faac x264 x265 libexif ffmpeg ffmpegthumbnailer tumbler joyutils evtest lm_sensors lshw gparted psensor gparted hardinfo fontconfig ttf-bitstream-vera ttf-droid ttf-dejavu ttf-liberation ttf-hanazono mpv openshot gimp krita transmission-cli evince viewnior virtualbox-host-modules-arch virtualbox vagrant python-pip python-setuptools sublime-text stress lxsession yt-dlp firefox obs-studio dia mednafen mame ppsspp lutris wine-staging winetricks steam discord libva-mesa-driver lib32-libva-mesa-driver lib32-mesa-vdpau vulkan-tools vulkan-icd-loader lib32-vulkan-icd-loader oath-toolkit openconnect"
+# Core tools
+export PACKAGES="linux linux-headers linux-firmware base-devel mkinitcpio sudo bash-completion man-db tmux gvim dkms dmidecode at bc cronie lm_sensors lshw stress"
 
-# conditionally add wireless networking packages
-[ -d "/sys/class/net/${active_network_device}/wireless" ] && PACKAGES="$PACKAGES connman wpa_supplicant openvpn ethtool iwd pptpclient"
+# Conditional CPU unicode
+[ $(grep -c "Intel" /proc/cpuinfo) -gt 0 ] && PACKAGES="${PACKAGES} intel-ucode"
+[ $(grep -c "AMD" /proc/cpuinfo) -gt 0 ] && PACKAGES="${PACKAGES} amd-ucode"
 
-# add CPU unicode package based on model
-[ $(grep -c "Intel" /proc/cpuinfo) -gt 0 ] && PACKAGES="$PACKAGES intel-ucode"
-[ $(grep -c "AMD" /proc/cpuinfo) -gt 0 ] && PACKAGES="$PACKAGES amd-ucode"
+# Conditional laptop packages
+if [ -e /sys/class/power_supply/BAT0 ]; then
+	PACKAGES="${PACKAGES} xf86-input-synaptics acpid acpilight tlp"
+	sed -i "s/panel_items = LTSC/panel_items = LTSBC/g" /srv/arch-desktop/install/etc/skel/.config/tint2/tint2rc
+fi
+
+# Storage
+PACKAGES="${PACKAGES} btrfs-progs smartmontools usbutils gvfs gvfs-mtp gvfs-afc android-udev parted postgresql transmission-cli python-pip python-setuptools"
+
+# Compression
+PACKAGES="${PACKAGES} cryptsetup lzop unzip p7zip xz unrar unace lrzip arj innoextract"
+
+# networking packages
+PACKAGES="${PACKAGES} nftables iptables dnsmasq rsync dhcpcd inetutils net-tools openssh sshfs ntp wget curl wireless_tools bluez bluez-utils oath-toolkit openconnect openvpn ethtool pptpclient"
+
+# conditional networking packages
+[ -d "/sys/class/net/${active_network_device}/wireless" ] && PACKAGES="${PACKAGES} connman wpa_supplicant iwd"
+
+# programming packages
+PACKAGES="${PACKAGES} pkgfile pkgconf bison gcc gcc-libs cmake ccache ncurses xmlstarlet jq git mercurial subversion bzr patchelf packer vagrant"
+
+# multimedia dependencies
+PACKAGES="${PACKAGES} mesa lib32-mesa dbus polkit giflib lib32-giflib mpg123 lib32-mpg123 v4l-utils lib32-v4l-utils lame libwebp libid3tag libvorbis vorbis-tools faac x264 x265 libpng12 lib32-libpng12 pulseaudio libpulse lib32-libpulse openal lib32-openal opencl-icd-loader lib32-opencl-icd-loader libva lib32-libva gst-plugins-base-libs lib32-gst-plugins-base-libs graphicsmagick imagemagick joyutils evtest libexif ffmpeg lxsession yt-dlp wine-staging winetricks fcitx5 fcitx5-mozc fcitx5-configtool fcitx5-gtk fcitx5-qt"
+
+# GUI theme
+PACKAGES="${PACKAGES} gnome-themes-extra gnome-icon-theme arc-gtk-theme"
+
+# Xorg dependencies
+PACKAGES="${PACKAGES} xorg-server xorg-server-devel xorg-xinit xorg-xinput xorg-xdpyinfo xorg-xprop xdotool xsel arandr "
+
+# openbox Environment
+PACKAGES="${PACKAGES} openbox gtk3 lib32-gtk3 feh hsetroot archlinux-xdg-menu picom pavucontrol pasystray xdg-utils xdg-user-dirs tint2 conky pcmanfm-gtk3 gmrun gtk-engines gtk-engine-murrine lxappearance ffmpegthumbnailer tumbler libva-mesa-driver lib32-libva-mesa-driver lib32-mesa-vdpau vulkan-tools vulkan-icd-loader lib32-vulkan-icd-loader "
 
-# add appropriate GPU related packages
+# fonts
+PACKAGES="${PACKAGES} fontconfig ttf-bitstream-vera ttf-droid ttf-dejavu ttf-liberation ttf-hanazono ttf-font-awesome"
+
+# GUI software
+PACKAGES="${PACKAGES} rxvt-unicode urxvt-perls virtualbox-host-dkms virtualbox xarchiver gparted psensor hardinfo steam discord mpv openshot gimp krita firefox obs-studio dia mednafen mame ppsspp lutris sublime-text evince viewnior"
+
+# conditional GPU packages
 if [ $(lspci | grep -i "vga" | grep -ci "amd") -gt 0 ]; then
 	PACKAGES="$PACKAGES xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon mesa-vdpau"
 
 	# update modules to load
 	[ $(grep -c "amd" /etc/mkinitcpio.conf) -eq 0 ] && sed -i 's/MODULES=(\(.*\))/MODULES=(\1 amdgpu radeon)/' /etc/mkinitcpio.conf
-elif [ $(lspci | grep -i "vga" | grep -ci "intel") -gt 0 ]; then
+fi
+if [ $(lspci | grep -i "vga" | grep -ci "intel") -gt 0 ]; then
 	PACKAGES="$PACKAGES xf86-video-intel vulkan-intel lib32-vulkan-intel mesa-vdpau"
 
 	# update modules to load
 	[ $(grep -c "amd" /etc/mkinitcpio.conf) -eq 0 ] && sed -i 's/MODULES=(\(.*\))/MODULES=(\1 i915)/' /etc/mkinitcpio.conf
-elif [ $(lspci | grep -i "vga" | grep -ci "nvidia") -gt 0 ]; then
+fi
+if [ $(lspci | grep -i "vga" | grep -ci "nvidia") -gt 0 ]; then
 	PACKAGES="$PACKAGES nvidia-dkms libglvnd lib32-libglvnd opencl-nvidia lib32-opencl-nvidia xf86-video-nouveau nvidia-utils lib32-nvidia-utils mesa-vdpau nvidia-settings"
 
 	# update modules to load
@@ -83,14 +121,8 @@ elif [ $(lspci | grep -i "vga" | grep -ci "nvidia") -gt 0 ]; then
 	echo -e "[Trigger]\nOperation=Install\nOperation=Upgrade\nOperation=Remove\nType=Package\nTarget=nvidia\n\n[Action]\nDepends=mkinitcpio\nWhen=PostTransaction\nExec=/usr/bin/mkinitcpio -P" > /etc/pacman.d/hooks/nvidia.hook
 fi
 
-# conditionally install laptop packages
-if [ -e /sys/class/power_supply/BAT0 ]; then
-	PACKAGES="$PACKAGES xf86-input-synaptics acpid acpilight tlp"
-	sed -i "s/panel_items = LTSC/panel_items = LTSBC/g" /srv/arch-desktop/install/etc/skel/.config/tint2/tint2rc
-fi
-
 # install all packages
-pacman -Syu --noconfirm "$PACKAGES"
+pacman -Syu --noconfirm $PACKAGES
 
 # install base configuration files from repository
 [ -d /srv/arch-desktop/install ] || git clone https://git.caseydelorme.com/cdelorme/arch-desktop /srv/arch-desktop
@@ -134,12 +166,6 @@ if ! which gifduration &> /dev/null; then
 	chmod a+rx /usr/local/bin/gifduration
 fi
 
-# install packer
-if ! which packer &> /dev/null; then
-	curl -Lfs "https://releases.hashicorp.com/packer/1.3.5/packer_1.3.5_linux_amd64.zip" > /tmp/packer.zip
-	unzip /tmp/packer.zip -d /usr/local/bin/
-fi
-
 # install 64bit flash projector
 if ! which flashplayer &> /dev/null; then
 	curl -Lfs "https://fpdownload.macromedia.com/pub/flashplayer/updaters/32/flash_player_sa_linux.x86_64.tar.gz" > /tmp/flash.tar.gz
@@ -208,14 +234,10 @@ if [[ -n "$username" && -n "$password" ]]; then
 	su $username -c 'grep "gvm" ~/.bash_profile &> /dev/null || echo -e "\n# load gvm\n! which gvm &> /dev/null && . ~/.gvm/scripts/gvm" >> ~/.bash_profile'
 	su $username -c ". ~/.gvm/scripts/gvm && gvm install go1.17.3 -B && gvm use go1.17.3 --default"
 
-	# setup user-space transmission
+	# configure user-space transmission
 	if [ ! -f "/etc/systemd/system/transmission.service.d/local.conf" ]; then
 		su $username -c "cd && mkdir -p ~/transmission/{done,incomplete}"
 		su $username -c 'cd && tmp=$(mktemp) && jq ".[\"download-dir\"] = \"${HOME}/transmission/done\"" $HOME/.config/transmission-daemon/settings.json | jq ".[\"incomplete-dir\"] = \"${HOME}/transmission/incomplete\"" | jq ".[\"watch-dir\"] = \"$(xdg-user-dir DOWNLOAD)\"" > $tmp && mv $tmp $HOME/.config/transmission-daemon/settings.json'
-		mkdir -p /etc/systemd/system/transmission.service.d
-		echo "[Service]" > "/etc/systemd/system/transmission.service.d/local.conf"
-		echo "User=${username}" >> "/etc/systemd/system/transmission.service.d/local.conf"
-		systemctl daemon-reload
 	fi
 fi
 
@@ -227,11 +249,11 @@ ln -sf /usr/local/bin/disk-maintenance /etc/cron.weekly/disk-maintenance
 ln -sf /usr/bin/vim /usr/local/bin/vi
 
 # enable services for next reboot
-systemctl enable iptables
+systemctl enable nftables
+systemctl enable dnsmasq
 systemctl enable ntpd
 systemctl enable sshd
 systemctl enable bluetooth
-systemctl enable transmission
 systemctl enable postgresql
 systemctl enable cronie
 which tlp &> /dev/null && systemctl enable tlp
@@ -242,8 +264,8 @@ which acpid &> /dev/null && systemctl enable acpid
 export active_network_device=$(ip addr | awk '/state UP/ {print $2}' | sed 's/.$//')
 [ ! -d "/sys/class/net/${active_network_device}/wireless" ] && (systemctl enable dhcpcd@${active_network_device} || echo "failed to enable dhcp service")
 
-# build the init module
-mkinitcpio -p linux || echo "mkinitcpio failed?"
+# (re)build vmlinux image
+mkinitcpio -p linux
 
 # install the bootloader
 bootctl install
@@ -254,12 +276,18 @@ echo "linux vmlinuz-linux" >> /boot/loader/entries/arch.conf
 [ -f /boot/intel-ucode.img ] && echo "initrd /intel-ucode.img" >> /boot/loader/entries/arch.conf
 [ -f /boot/amd-ucode.img ] && echo "initrd /amd-ucode.img" >> /boot/loader/entries/arch.conf
 echo "initrd /initramfs-linux.img" >> /boot/loader/entries/arch.conf
-echo "options root=PARTUUID=$(blkid -s PARTUUID -o value $(mount | grep ' / '|cut -d' ' -f 1)) rw quiet loglevel=3" >> /boot/loader/entries/arch.conf
-[[ $(lspci | grep -i " vga" | grep -ci " nvidia") -gt 0 && $(grep -c "nvidia" /boot/loader/entires/arch.conf) -eq 0 ]] && sed -i 's/rw/rw nvidia-dkm.modeset=1/' /boot/loader/entires/arch.conf
+export boot_options="options root=PARTUUID=$(blkid -s PARTUUID -o value $(mount | grep ' / '|cut -d' ' -f 1)) rw quiet loglevel=3"
+[ "$enable_hibernation" = "y" ] && [ -n "$resume_uuid" ] && boot_options="${boot_options} resume=UUID=${resume_uuid}"
+[[ $(lspci | grep -i " vga" | grep -ci " nvidia") -gt 0 && $(grep -c "nvidia" /boot/loader/entires/arch.conf) -eq 0 ]] && boot_options="${boot_options} nvidia-dkm.modeset=1"
+echo "$boot_options" >> /boot/loader/entries/arch.conf
 
 # set boot loader entry as default
 sed -i '/^default/d' /boot/loader/loader.conf
-echo "default arch" >> /boot/loader/loader.conf
+echo "default arch.conf" >> /boot/loader/loader.conf
 
 # check boot loader configuration
 bootctl status
+
+# cleanup pacman cache to minimize image
+yes | pacman -Scc
+sync

+ 48 - 0
install/etc/nftables.conf

@@ -0,0 +1,48 @@
+flush ruleset
+
+table inet firewall {
+
+    # allow all outbound traffic
+    chain outbound {
+        type filter hook output priority 0; policy accept;
+    }
+
+    # accept ip4 icmp with rate limit
+    chain inbound_ipv4 {
+        icmp type echo-request limit rate 5/second accept
+    }
+
+    # accept neighbor discovery and ip6 icmp with rate limit
+    chain inbound_ipv6 {
+        icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept
+        icmpv6 type echo-request limit rate 5/second accept
+    }
+
+    # drop all inbound traffic that does not pass filters
+    chain inbound {
+        type filter hook input priority 0; policy drop;
+
+        # Allow traffic from established and related packets, drop invalid
+        ct state vmap { established: accept, related: accept, invalid: drop }
+
+        # Allow loopback traffic
+        iifname lo accept
+
+        # Jump to chain according to layer 3 protocol using a verdict map
+        meta protocol vmap { ip: jump inbound_ipv4, ip6: jump inbound_ipv6 }
+
+        # allow http and https traffic
+        tcp dport { 80, 443 } accept
+
+        # rate limit new ssh connections
+        tcp dport ssh ct state new limit rate 4/minute accept
+
+        # log all denied traffic (including ssh)
+        log prefix "[nftables] Inbound Denied: " counter drop
+    }
+
+    # do not act as a router; drop all forward requests
+    chain forward {
+        type filter hook forward priority 0; policy drop;
+    }
+}

+ 5 - 0
install/etc/skel/.bash_profile

@@ -6,5 +6,10 @@ export PATH=/usr/local/bin:$PATH
 # add Xresources symlink if not exists
 [ ! -f "$HOME/.Xresources" ] && ln -s "$HOME/.Xdefaults" "$HOME/.Xresources"
 
+# fcitx IME support
+export GTK_IM_MODULE=fcitx
+export QT_IM_MODULE=fcitx
+export XMODIFIERS=@im=fcitx
+
 # if bashrc exists and the terminal has stdin load it
 test -t 0 && . "$HOME/.bashrc"

+ 0 - 1
install/etc/skel/.config/openbox/autostart

@@ -5,4 +5,3 @@ xrdb -merge "$HOME/.Xresources"
 hsetroot -solid "#001E27"
 (update-desktop-database) &
 (xdg-user-dirs-update) &
-(lxpolkit) &

+ 1 - 0
install/etc/skel/.config/systemd/user/default.target.wants/transmission.service

@@ -0,0 +1 @@
+../transmission.service

+ 13 - 0
install/etc/skel/.config/systemd/user/fcitx5.service

@@ -0,0 +1,13 @@
+[Unit]
+Description=fcitx IME system
+PartOf=graphical-session.target
+
+[Service]
+Type=simple
+Environment=export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx
+ExecStart=/usr/bin/fcitx5 --replace
+Restart=on-failure
+RestartSec=3
+
+[Install]
+WantedBy=xsession.target

+ 10 - 0
install/etc/skel/.config/systemd/user/gsettings.service

@@ -0,0 +1,10 @@
+[Unit]
+Description=GTK settings loader
+PartOf=graphical-session.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/local/bin/load-gsettings
+
+[Install]
+WantedBy=xsession.target

+ 12 - 0
install/etc/skel/.config/systemd/user/lxpolkit.service

@@ -0,0 +1,12 @@
+[Unit]
+Description=polkit loader
+PartOf=graphical-session.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/lxpolkit
+Restart=on-failure
+RestartSec=3
+
+[Install]
+WantedBy=xsession.target

+ 12 - 0
install/etc/skel/.config/systemd/user/transmission.service

@@ -0,0 +1,12 @@
+[Unit]
+Description=Transmission BitTorrent Daemon
+After=network.target
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/transmission-daemon -f --log-error
+ExecReload=/bin/kill -s HUP $MAINPID
+NoNewPrivileges=true
+
+[Install]
+WantedBy=default.target

+ 1 - 0
install/etc/skel/.config/systemd/user/xsession.target.wants/fcitx5.service

@@ -0,0 +1 @@
+../fcitx5.service

+ 1 - 0
install/etc/skel/.config/systemd/user/xsession.target.wants/lxpolkit.service

@@ -0,0 +1 @@
+../lxpolkit.service

+ 0 - 0
install/etc/skel/.config/youtube-dl/config → install/etc/skel/.config/yt-dlp/config


+ 3 - 0
install/etc/systemd/system/connman.service.d/disable_dns_proxy.conf

@@ -0,0 +1,3 @@
+[Service]
+ExecStart=
+ExecStart=/usr/bin/connmand -n --nodnsproxy

+ 43 - 0
install/usr/local/bin/directory-thumbnailer

@@ -0,0 +1,43 @@
+ cat /usr/local/bin/directory-thumbnailer
+#!/bin/bash
+IFS=$'\n\t'
+
+# not enough args
+if [ $# -lt 3 ]; then
+	exit 1
+fi
+
+# extract args for execution
+size="$1"
+in="$2"
+out="$3"
+
+# pre-flight check that $in is not a home user folder (we don't want to modify those)
+if [ "$HOME" = "$(dirname $in)" ]; then
+	exit 0
+fi
+
+# fine image files that we can extract
+# @todo: add support for video files
+files=()
+for f in "$(find "$in" -maxdepth 1 -type f -exec file {} \; | grep -o -P '^.+: \w+ image' | sort -n | head -4 | cut -d':' -f1)"; do
+	files+=($f)
+done
+[ ${#files[*]} -gt 0 ] || exit 1
+
+# extract theme or use gnome as default
+config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
+icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+icon_theme="${icon_theme:-gnome}"
+
+# @todo: add behavior to try to get appropriate size first, else fallback to assumed largest/last
+folder_icon=$(find "/usr/share/icons/$icon_theme" -name "folder.*" | sort -d | tail -1)
+
+# check if folder icon exists
+# @todo: consider using known gnome folder icon as fallback
+if [ ! -f "$folder_icon" ]; then
+	exit 1
+fi
+
+# generate the thumbnail
+convert -background none "$folder_icon" -resize $size <(montage -geometry "$(($size * 60 / 200))x$(($size * 60 / 300))+2+2" -alpha on -background none -tile 2 ${files[*]} png:-) -gravity center -composite "$out" 2>/dev/null

+ 3 - 0
install/usr/local/bin/ffxiv

@@ -0,0 +1,3 @@
+#!/bin/bash -ex
+lutris lutris:rungame/final-fantasy-xiv-online
+

+ 13 - 0
install/usr/local/bin/genshin-impact

@@ -0,0 +1,13 @@
+#!/bin/bash -xa
+# @note: assumes lutris wine 6.14-3 has been installed, feel free to edit as needed
+export PATH="/home/cdelorme/.local/share/lutris/runners/wine/lutris-6.14-3-x86_64/bin:$PATH"
+export WINEPREFIX="${HOME}/games/pc/genshin-impact/lutris"
+export GAMEPATH="${WINEPREFIX}/drive_c/Program Files/Genshin Impact/Genshin Impact game"
+export WINEDEBUG=-all
+#export DXVK_HUD=fps
+export MANGOHUD=1
+
+if [ "$1" != "env" ]; then
+	cd "$GAMEPATH"
+	wine explorer /desktop=gi,1920x1080 cmd /c launcher.bat
+fi

+ 15 - 0
install/usr/local/bin/gif2png

@@ -0,0 +1,15 @@
+#!/bin/bash
+extract_gif_to_png()
+{
+	local bname="$(basename $1)"
+	local dname="${bname%.*}"
+	if [ -d "$dname" ]; then
+		echo "directory ($dname) already exists..."
+		return
+	fi
+	mkdir -p "$dname"
+	convert -coalesce "$bname" "${dname}/%03d.png"
+}
+
+extract_gif_to_png "$1"
+

+ 15 - 0
install/usr/local/bin/load-gsettings

@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# usage: import-gsettings
+config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
+if [ ! -f "$config" ]; then exit 1; fi
+
+gnome_schema="org.gnome.desktop.interface"
+gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
+font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
+gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
+gsettings set "$gnome_schema" icon-theme "$icon_theme"
+gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
+gsettings set "$gnome_schema" font-name "$font_name"

+ 50 - 0
install/usr/local/bin/mh

@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# mh command for simplified operations
+#
+# mh save
+# mh restore
+# mh kill
+#
+# can utilize save/restore to save-scum decoration farming
+# can utilize kill to stop processes when failed to cease
+#
+# save includes timestamps to avoid potential
+#
+# current implementation uses hard-coded user id; not portable
+# future implementations should either save/restore for all ids, or ask/compute
+
+export steam_game_id="582010"
+export save_path="${HOME}/games/mhworld/saves"
+export steam_user_id="48081292"
+export full_path="${HOME}/.local/share/Steam/userdata/${steam_user_id}/${steam_game_id}/remote/SAVEDATA1000"
+
+mhsave() {
+	mkdir -p "$save_path"
+	local save_file="${save_path}/$(date +%Y%m%d%H%M%S)"
+	cp "$full_path" "$save_file"
+	ln -sf "$save_file" "${save_path}/latest"
+}
+
+mhrestore() {
+	[ ! -f "${save_path}/latest" ] && return
+	cp -L "${save_path}/latest" "$full_path"
+}
+
+case "$1" in
+	run)
+		steam "steam://rungameid/${steam_game_id}" &> /dev/null &
+		;;
+	save)
+		mhsave
+		;;
+	restore)
+		mhrestore
+		;;
+	kill)
+		ps aux | grep -i monster | awk '{print $2}' | xargs kill -9 &> /dev/null
+		;;
+	*)
+		echo "unable to process command..."
+		;;
+esac

+ 18 - 0
install/usr/local/bin/otp

@@ -0,0 +1,18 @@
+#!/bin/bash -eu
+# uses graphics magick to extract images from a pdf as png
+
+if ! which gm &>/dev/null; then
+	echo "requires gm convert..." && exit 1
+elif [ -z "${1:-}" ] || [ ! -f "$1" ]; then
+	echo "No file supplied..." && exit 1
+fi
+
+base=$(basename "$1")
+out=${base%.*}
+if [ -n "${2:-}" ] && [[ ! -f "$2" || -d "$2" ]]; then
+	out="$2"
+fi
+
+mkdir -p "$out"
+gm convert -density 300 "$1" +adjoin ${out}/%d.png
+

+ 3 - 0
install/usr/local/bin/pob

@@ -0,0 +1,3 @@
+#!/bin/bash
+lutris lutris:rungame/path-of-building
+

+ 3 - 0
install/usr/local/bin/poe

@@ -0,0 +1,3 @@
+#!/bin/bash
+steam steam://run/238960
+

+ 4 - 0
install/usr/local/bin/psp

@@ -0,0 +1,4 @@
+#!/bin/bash
+# alias to launch PPSSPPSDL
+/usr/bin/PPSSPPSDL
+

+ 4 - 0
install/usr/share/thumbnailers/directory.thumbnailer

@@ -0,0 +1,4 @@
+[Thumbnailer Entry]
+TryExec=/usr/local/bin/directory-thumbnailer
+Exec=/usr/local/bin/directory-thumbnailer %s %i %o
+MimeType=inode/directory;

+ 11 - 0
notes/errors.md

@@ -13,3 +13,14 @@ These are known errors that are non-disruptive:
 	- _non-disruptive; cannot resolve without compiling my own copy of the tty package, not worth the effort..._
 
 I am keeping track of these as I have not found a way to "solve" (eg. silence) them sanely.
+
+
+## notes
+
+While my experience with arch users is generally stellar, I did encounter some problems while creating this project.
+
+- There was a GPG signature issue with AUR where pinned comments said RTFM and they would ban any comments asking for clearer instructions.  While the arch wiki is usually packed with good information, in this case it was extremely difficult to track down the solution among the myriad of outdated notes.
+- The `makepkg` command does not run as root.  This complicated automating installation of common AUR packages, such as themes, cursors, and icons.  the suggestion to use the `nobody` user breaks when packages have tests, and creating a temporary user to build and install is just very messy.  I would love to see this restriction lifted in future iterations and replaced with a simple warning.
+- While I did not originally like the transition to systemd for the init system, I am hugely fond of `systemd-boot`.
+- The default clipboard used by `rxvt` is PRIMARY, and the UI clipboard is usually both PRIMARY and CLIPBOARD, but when renaming a file with pcmanfm the copy only goes to CLIPBOARD.  While I could find no way to force both to mirror or `rxvt` to use CLIPBOARD I did manage to find `ctrl+alt+v` works for pasting from CLIPBOARD in `rxvt`.
+- There is a bug in the current release (0.8.0-1) of pasystray where it ignores the gtk icon theme resulting in a dark black icon on a dark grey task bar.  _This should be fixed in coming updates._

+ 48 - 0
notes/file-browsers.md

@@ -0,0 +1,48 @@
+
+# file browsers
+
+I have tried dolphin, nemo, nautilus, thunar, and pcmanfm.
+
+Out of all of them I sit between pcmanfm and thunar, with a heavy lean towards pcmanfm.
+
+
+## pcmanfm
+
+I am convinced that pcmanfm was written by some savant genius, because they managed to pack more configurable features than any other file browser I tested with fewer dependencies and significantly better performance.
+
+When testing in a virtual machine the performance difference is immediately visible.  The speed it launches, the speed it loads directory contents, and more measurably consuming significantly less memory and CPU at idle.
+
+**If `libfm` offered directory thumbnails I would never have a reason to look at another file browser, but alas the 1-line change required has never been accepted to the mainline repository.**
+
+
+## thunar
+
+I went out of my way to test this for directory thumbnail support.
+
+In addition to supporting that functionality it also had very few dependencies and offered comparable performance to pcmanfm.
+
+However, it has an almost no configuration options, and what it does have lives in the ether somewhere with xfce-settings being the only way to tweak it.  _This means no portable text-file configuration, which is a major red flag in my book._
+
+The second red flag came when I saw it had tight integrations with other `thunar-X` packages, like `thunar-volman` for managing mounted volumes.  _I didn't thoroughly test this, but it does not bode well when basic functionality included with pcmanfm requires another package in thunar._
+
+Finally, and this was the nail in the coffin, was the fact that the maximum icon size was tiny.  Like miniscule.  Working on 4k displays the icon size of 512x512 works on pcmanf, but you can barely get 128x128 on thunar.  I tried to find documentation on whether this was configurable but found nothing beyond suggestions to use `xfce-settings`, yet another dependency.
+
+In the end, while it's memory consumption was only slightly above pcmanfm, it offered a fraction of the features, required other packages for full functionality, and did not offer the configuration options I wanted.
+
+
+## the rest
+
+By far dolphin was the most bloated between the massive number of dependencies, and memory use at idle.  However it has the largest feature set, and may even be more customizable if I wanted to learn how to get qt configurations and themes working.
+
+Nautilus is the gnome equivalent of dolpin, being only slightly less bloated, and not really giving me anything extra that pcmanfm couldn't.
+
+I liked nemo, but features advertised, like directory thumbnails, simply didn't work.
+
+
+# conclusions
+
+I think pcmanfm is the best file browser, hands down.
+
+I would love directory thumbnail support, but it excels in so many other areas that it would be impossible for me to recommend anything else.
+
+_I have heard of `spacefm`, a fork, but it only works with an aur package, and I'd rather not go to third-party package installation for core functionality if I can help it._

+ 0 - 79
packer.json

@@ -1,79 +0,0 @@
-{
-	"variables": {
-		"iso_url": "https://mirrors.kernel.org/archlinux/iso/{{isotime \"2006.01\"}}.01/archlinux-{{isotime \"2006.01\"}}.01-x86_64.iso",
-		"iso_checksum_url": "https://mirrors.kernel.org/archlinux/iso/{{isotime \"2006.01\"}}.01/sha1sums.txt",
-		"root_password": "arch",
-		"username": "vagrant",
-		"password": "vagrant"
-	},
-	"builders": [
-		{
-			"headless": true,
-			"type": "virtualbox-iso",
-			"iso_url": "{{ user `iso_url` }}",
-			"iso_checksum_url": "{{ user `iso_checksum_url` }}",
-			"iso_checksum_type": "sha1",
-			"vm_name": "arch-desktop",
-			"guest_os_type": "ArchLinux_64",
-			"guest_additions_mode": "disable",
-			"virtualbox_version_file": "",
-			"vboxmanage": [
-				["modifyvm", "{{.Name}}", "--firmware", "efi"],
-				["modifyvm", "{{.Name}}", "--memory", "1024"],
-				["modifyvm", "{{.Name}}", "--accelerate3d", "on"]
-			],
-			"boot_wait": "5s",
-			"boot_command": [
-				"<enter><wait40s>",
-				"printf \"{{user `root_password`}}\\n{{user `root_password`}}\\n\" | passwd<enter>",
-				"systemctl start sshd.service<enter>"
-			],
-			"disk_size": 65536,
-			"iso_interface": "sata",
-			"hard_drive_interface": "sata",
-			"output_directory": "dist/arch-desktop",
-			"ssh_username": "root",
-			"ssh_password": "{{user `root_password`}}",
-			"ssh_timeout": "20m",
-			"shutdown_command": "systemctl poweroff"
-		}
-	],
-	"provisioners": [
-		{
-			"type": "file",
-			"source": "arch.sh",
-			"destination": "arch.sh"
-		},
-		{
-			"type": "file",
-			"source": "install",
-			"destination": "install"
-		},
-		{
-			"type": "shell",
-			"skip_clean": true,
-			"expect_disconnect": true,
-			"environment_vars": [
-				"AUTOREBOOT=y",
-				"DEBUG=y",
-				"enable_hibernation=y",
-				"root_password={{user `root_password`}}",
-				"username={{user `username`}}",
-				"password={{user `password`}}"
-			],
-			"script": "setup/install.sh"
-		},
-		{
-			"type": "shell",
-			"script": "setup/packer.sh",
-			"pause_before": "10s"
-		}
-	],
-	"post-processors": [
-		{
-			"type": "vagrant",
-			"compression_level": 9,
-			"output": "dist/arch-desktop.box"
-		}
-	]
-}

+ 10 - 5
readme.md

@@ -19,18 +19,22 @@ Additionally, if attempting to upgrade hardware the lack of up to date drivers d
 _Finally, having now used Arch as my main system for nearly 6 months I am shocked at how stable it is._
 
 
-## usage
+## builds
+
+You can build locally using [`packer`](https://www.vagrantup.com/), and [`vagrant`](https://www.packer.io/).
 
-If you want to test my build locally, you can do so by installing [`virtualbox`](https://www.virtualbox.org/), [`packer`](https://www.vagrantup.com/), and [`vagrant`](https://www.packer.io/).
+_The image produced will take up over 5GB, and any time you rebuild you may need to run `vagrant box remove arch-desktop` to ensure it updates the image._
 
-Simply run these commands; the first will build the base image and the second will launch a VM using that base image:
+The first supported VM system is [`virtualbox`](https://www.virtualbox.org/), and can be tested like this:
 
+	cd virtualbox
 	packer build packer.json
 	vagrant up
 
-_This may require a combined total of 5GB of disk space for the installation image and outputs, and uses the user name and password of `vagrant`._
 
-If you are actually doing an installation, you can run these commands from the arch installation terminal:
+## usage
+
+If you are installing on real hardware you can run these commands from the arch installation terminal:
 
 	pacman -S git
 	git clone https://git.caseydelorme.com/cdelorme/arch-desktop.git
@@ -63,3 +67,4 @@ Finally, while I am not a fan of how `systemd` forced proliferation into all lin
 - [packer-arch by elasticdog](https://github.com/elasticdog/packer-arch)
 - [touchpad configuration](http://add4jhf.blogspot.com/2013/09/touch-pad-deactivation-while-typing-and.html)
 - [yay AUR Package Manager](https://github.com/Jguer/yay)
+- [Wayland](https://www.fosskers.ca/en/blog/wayland)

+ 19 - 19
setup/install.sh

@@ -21,8 +21,10 @@ while [[ ! "$enable_hibernation" =~ ^[yn]$ ]]; do read -p "would you like to ena
 while [ -z "$root_password" ]; do read -p "please enter a root password: " -s root_password && echo ""; done
 while [ -z "$username" ]; do read -p "please enter your username: " username; done
 while [ -z "$password" ]; do read -p "please enter your password: " -s password && echo ""; done
+export hostname=${hostname:-arch}
 
 # export environment variables for arch.sh automation
+export enable_hibernation
 export root_password
 export username
 export password
@@ -38,16 +40,16 @@ timedatectl set-ntp true
 timedatectl status
 
 # if more than one disk exists ask which to use:
-export disk=$(lsblk -l | grep disk | awk '{print $1}')
+export disk=$(lsblk -l | grep disk | awk '{if (!$7) print $1;}')
 if [ $(echo "$disk" | wc -l) -gt 1 ]; then
 	echo -e "multiple disks found:\n$disk"
 	read -p "please enter the name of the disk you want to use: " disk
+fi
 
-	# make sure the disk exists or terminate
-	if [ ! -b "/dev/${disk}" ]; then
-		echo "unable to locate disk: /dev/${disk}"
-		exit 1
-	fi
+# make sure the disk exists or terminate
+if [ ! -b "/dev/${disk}" ]; then
+	echo "unable to locate disk: /dev/${disk}"
+	exit 1
 fi
 
 # assume sane default for swap, or intelligently size for hibernation
@@ -73,40 +75,38 @@ export partitions=( $(lsblk -l -xNAME "/dev/${disk}" | grep part | awk '{print $
 
 # format the partitions
 mkfs.fat -F32 -nEFI "/dev/${partitions[0]}"
-mkswap -Larch "/dev/${partitions[1]}"
+mkswap -Lswap "/dev/${partitions[1]}"
 mkfs.btrfs -fLarch "/dev/${partitions[2]}"
 
 # enable and mount partitions with appropriate settings
 swapon "/dev/${partitions[1]}"
-mount -o "noatime,compress=lzo,space_cache,autodefrag,ssd" "/dev/${partitions[2]}" /mnt
+export resume_uuid="$(lsblk -no UUID "/dev/${partitions[1]}")"
+mount -t btrfs -o "noatime,compress=lzo,autodefrag,ssd" "/dev/${partitions[2]}" /mnt
 mkdir /mnt/boot
 mount "/dev/${partitions[0]}" /mnt/boot
 
 # install base and base-devel package sets, and generate the fstab
-pacstrap /mnt base base-devel
+pacstrap /mnt base
+# pacstrap /mnt base base-devel linux linux-headers linux-firmware
 genfstab -Up /mnt > /mnt/etc/fstab
 
 # this assumes that arch.sh and install/ exist and will copy them to continue
 # @note: would prefer to copy to `/tmp` but `/mnt/tmp` from iso is a separate tmpfs
 mkdir -p /mnt/srv/arch-desktop
-cp -r install /mnt/srv/arch-desktop/
-cp arch.sh /mnt/srv/arch-desktop/
+cp -r ./ /mnt/srv/arch-desktop
+# cp -r install /mnt/srv/arch-desktop/
+# cp arch.sh /mnt/srv/arch-desktop/
 
 # proceed to automate arch-chroot installation and push output to a log file that gets copied to the new disk
 arch-chroot /mnt /srv/arch-desktop/arch.sh | tee arch-install.log
 cp arch-install.log /mnt/arch-install.log
 
-# if virtualized enable ssh as root for automation support
-if [ $(dmesg | grep -ci "hypervisor") -gt 0 ]; then
-	sed -i "/^#\?PermitRootLogin/d" /mnt/etc/ssh/sshd_config
-	sed -i "/^#\?PasswordAuthentication/d" /mnt/etc/ssh/sshd_config
-	echo "PasswordAuthentication yes" >> /mnt/etc/ssh/sshd_config
-	echo "PermitRootLogin yes" >> /mnt/etc/ssh/sshd_config
-fi
-
 # if auto-reboot is enabled then unmount and automatically reboot
 if [ -n "$AUTOREBOOT" ]; then
 	sync
 	umount -R /mnt
+	echo "installation complete, rebooting in 5 seconds..."
 	(sleep 5 && systemctl reboot) &
+else
+	echo "installation complete, run 'systemctl reboot' when ready..."
 fi

+ 209 - 38
todo.md

@@ -1,41 +1,212 @@
 
 # todo
 
-- investigate shift+insert & middle mouse click overrides for urxvt to use CLIPBOARD instead of PRIMARY
-- fix disk check to ignore the active/mounted partition(s)
-	- _We don't want to see the installation media as target for installation_
-	- verify installation does not bork USB installer(s)
-		- _need to test on a real machine for this?_
-- triple check calculation of swap partition size for hibernation
-	- conditional check to ensure swap file exists and is of appropriate size to automatically add `resume=` boot option
-		- _test hibernate on a real system?_
-- investigate potentially useful aur libraries:
-	- https://aur.archlinux.org/packages/ncurses5-compat-libs
-	- https://aur.archlinux.org/packages/lib32-ncurses5-compat-libs/
-- switch to systemd user-space `transmission` to eliminate potential configuration conflicts
-	- _this also eliminates root permission concerns_
-
-- replace `virtualbox` in packer.json with `kvm`/`qemu`
-	- _remove virtualbox related commands/packages from `install/packer.sh`_
-
-- Create a branch to test `sway`/`wayland` packages as an alternative to `openbox`
-	- _basically relearn entire desktop environment and new hotkeys..._
-	- https://wiki.archlinux.org/index.php/Sway
-	- https://www.reddit.com/r/swaywm/comments/eksf1p/steam_now_fully_works_under_sway/
-	- _Test multiple proton/wine games on this setup_
-
-- experiment with alternative file browsers
-	- dolphin
-	- nautilus
-	- thunar
-	- nemo
-- _testing for thumbnailing speed, and folder thumbnail support to expedite file browsing_
-	- _may depend on wayland compatibility?_
-
-- experiment with `fcitx-mozc` for IME support
-
-- look at replacing `startx`/`xinit` with `systemd` userspace xorg
-	- https://wiki.archlinux.org/index.php/Systemd/User#Xorg_as_a_systemd_user_service
-	- https://lists.freedesktop.org/archives/systemd-devel/2014-March/017552.html
-		- _appears to be some caveats, including loading specific applications at launch?_
-		- at one point I documented a tool called `dex` to launch `.desktop` from cli, may not be needed though?
+Major working update plus plans for big changes.
+
+
+## libvirt
+
+Create a `libvirt` branch to test this setup process!
+
+Create `libvirt/` and write up the libvirt/kvm/qemu/ovmf-uefi implementation again!
+
+Copy the files back to my laptop to test it there, since I already have libvirt setup.
+
+I'll need to get back to a working state with the packer.json and Vagrantfile for libvirt as well, thankfully I kept the branch and diffs!
+
+https://bbs.archlinux.org/viewtopic.php?id=238615
+
+
+
+## sway
+
+Create a `sway` branch to test building a minimal install with a brand new window manager and removing xorg packages!
+
+This will likely require significant refinement, as I'll need to test configurations on real hardware to validate multi-monitor behavior.
+
+Further, it will require some time to get used to it, but from rudimentary tests I have been able to run every game of interest on it, and with significantly increased performance!
+
+References:
+
+https://www.fosskers.ca/en/blog/wayland
+https://wiki.archlinux.org/title/Sway#Manage_Sway-specific_daemons_with_systemd
+https://wiki.archlinux.org/title/Sway#Application_launchers
+https://github.com/swaywm/sway/issues/1174
+https://www.youtube.com/watch?v=hRIGYUWQfYU
+https://www.youtube.com/watch?v=YWgZrES4t3U
+https://github.com/swaywm/sway/wiki#program-launchers
+https://github.com/lyfeyaj/sublime-text-imfix
+https://www.reddit.com/r/swaywm/comments/eksf1p/steam_now_fully_works_under_sway/
+
+Installed packages:
+
+	sway
+	alacritty
+	wofi
+	waybar
+	xorg-xwayland
+	xorg-xlsclients
+	qt5-wayland
+	glfw-wayland
+	grim
+	slurp
+	xdg-desktop-portal-wlr
+	libpipewire02
+	ttf-font-awesome
+	wl-clipboard
+	lxsession-gtk3
+
+Next create a config for sway:
+
+	mkdir -p ~/.config/sway
+	cp /etc/sway/config ~/.config/sway/config
+
+_I'm still tinkering with one using `wofi` for `$menu` and waybar, but it's not nearly ready._
+
+Migrate as many hotkeys from `rc.xml` as possible to sway config
+
+Added to `~/.bash_profile`:
+
+	export MOZ_ENABLE_WAYLAND=1
+	export SDL_VIDEODRIVER="wayland"
+
+_The `SDL_VIDEODRIVER` is for steam, and may break in many games, so I'll need to add overrides for incompatible titles using `SDL_VIDEODRIVER=x11` in steam launch commands, or if more games fail than no I can invert my setup so I add the override for games that I know work with wayland._
+
+Switch to waybar in sway config (_this is a massive improvement over the default_):
+
+	bar {
+		swaybar_command waybar
+	}
+
+_I need to research how to fully customize waybar, because it has a **lot** of data and could be refined!_
+
+I need to test wayland native alternatives to `urxvt` and `pcmanfm`; one recommendation is `alacritty` as a `urxvt` replacement, and `pcmanfm-gtk3` is supposedly wayland-compatible without xwayland.  Needs to be tested.
+
+I also need to test a base install with **no** GUI packages and manually installing the sway dependencies to ensure a minimal build.
+
+Add logic to sway config that starts sway-session target:
+
+	exec_always "systemctl --user import-environment; systemctl --user start sway-session.target"
+
+
+_Delete legacy userspace service files, and edit/change others for sway-session compatibility._
+
+Create new systemd service files for:
+
+- update-desktop-database (oneshot)
+- xdg-user-dirs-update (oneshot)
+- gtk3-settings (oneshot)
+
+_Verify whether we can delete `.Xdefaults` and `.Xresources`, as both should be legacy xorg specific; eg. urxvt._
+
+Replace `/usr/local/bin/screenshot`:
+
+	grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y%m%d_%H%M%S%N.png')"
+
+Replace `/usr/local/bin/screenshot-selection`:
+
+	dimensions=$(slurp 2>/dev/null)
+	if [ $? -eq 0 ]; then
+		grim -g "$dimensions" "$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y%m%d_%H%M%S%N.png')"
+	else
+		grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" "$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y%m%d_%H%M%S%N.png')"
+	fi
+
+Replace `/usr/local/bin/wallpaper`:
+
+	#!/bin/bash
+
+	# set sane defaults
+	[ -z "$wallpaper_sleep_for" ] && wallpaper_sleep_for="180"
+	[ -z "$wallpaper_path" ] && wallpaper_path="$(xdg-user-dir PICTURES)/wallpaper"
+	mkdir -p "$wallpaper_path"
+
+	# validate wallpaper path
+	[ $(find "$wallpaper_path" -type f | wc -l) -gt 0 ] || exit 1
+
+	# there can be only one
+	while [ $(ps aux | grep -v 'grep' | grep -c "$0") -gt 2 ]; do
+		kill $(ps aux | grep -v 'grep' | grep -v $$ | grep "$0" | awk '{print $2}') &> /dev/null
+	done
+
+	# infinitely change wallpaper
+	while true; do
+		sway_outputs=( $(swaymsg -t get_outputs | jq -r '.[].name') )
+		for op in "${sway_outputs[@]}"; do
+			wp="$(find $wallpaper_path -type f | sort -R | tail -1)"
+			swaymsg "output $op bg $wp" fit \#001E27
+		done
+		sleep $wallpaper_sleep_for
+	done
+
+- research firefox auto-configuration _or_ copying configuration files (_eg. if plain text can add to dot-files_):
+	- https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
+	- verify if it remembers workspaces when re-opened
+
+- test/fix multimedia keys for volume change support (_may require actual hardware; would also consider popup icons?_)
+	- https://www.reddit.com/r/swaywm/comments/bwwxg0/xf86_audio_keys/
+
+- add `yad` to packages as a wayland-native `zenity` alternative
+	- add messages to waybar for battery
+	- add messages to pash for volume changes?
+
+- install `cmst` from aur and try it out as an option for wifi support
+	- https://aur.archlinux.org/packages/cmst/
+
+- investigate using `scratchpad` feature of `sway` for persistent terminal with toggle hotkey
+- investigate creating workspace affinities for things like fullscreen games so it automates placement/movement
+
+- set sway config to load userspace `.d` directory for custom settings
+	- touchpad-specific configuration; we may be able to add a default if we can identify ideal settings...
+	- display-specific configuration
+
+- on real hardware I'll need to test/refine sway config hotkeys for better navigation
+	- test creating workspace "affinity" for games and videos etc... so they open into a desirable placement?
+	- multi-monitor support and configuration; I'll need hotkeys that move applications between displays
+		- supposedly each monitor is treated as a separate workspace, so this might work well
+			- https://www.reddit.com/r/swaywm/comments/gr7yvt/assigning_workspaces_to_specific_outputs/
+			- https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/
+			- https://www.reddit.com/r/swaywm/comments/ftuiqa/is_it_possible_to_set_my_starting_workspace/
+	- test left/right arrow navigation; both changing workspaces and also displays
+		- _can this be used for all workspaces or only numbered?_
+		- _Does it loop?_
+
+
+### testing
+
+- sway launched without any issues
+- waybar is awesome, basically replaces both tint2 AND conky at the same time
+	- can we resize and adjust what is displayed?
+	- can we add cmst and launch from right click?
+	- can we auto-hide/show with modifier keys so fullscreen apps work?
+- wofi is very fast and very clean, but it seems to be pulling from `.desktop` and not raw command line
+	- can we disable history so when it cannot find something it doesn't launch the last thing it had?
+	- _figure out how to add and run raw cli commands and we'd be set!_
+	- can use mod+d for apps and mod+space for terminal commands!
+	- I can also load a custom css to style it very nicely
+- alacritty is fast and works great so far, need to test unicode character support, but if so it might be time...
+	- _can possibly dump `.Xdefaults`?_
+- firefox ran without xwayland, so it's native!! Woohoo!
+- wine, and specifically genshin, ran natively without using xwayland?  Holy shit!
+- sublime text loaded and is wayland native (eg. no xlsclients)
+- Resolution was resolved, but adaptive sync only works with display port not hdmi sadly
+	- _genshin now perfectly launches filling the screen without waybar, so maybe it's a non-issue?_
+- used mozilla gum_test to verify webcam, mic, and screen sharing worked
+- I should also investigate get_inputs to see what config options I have there!
+	- _namely for mouse and touchpad fine-tuning defaults; if they aren't already_
+
+https://developers.redhat.com/blog/2016/10/28/what-comes-after-iptables-its-successor-of-course-nftables
+https://wiki.nftables.org/wiki-nftables/index.php/Main_differences_with_iptables
+https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables
+https://ungleich.ch/en-us/cms/blog/2018/08/18/iptables-vs-nftables/
+https://github.com/swaywm/sway/issues/3319
+https://github.com/swaywm/sway/blob/master/config.in
+https://github.com/jdonofrio728/swaywm-bg-changer/blob/master/swaywm-bg-changer
+https://github.com/jdonofrio728/swaywm-bg-changer
+https://www.reddit.com/r/swaywm/comments/ehqsuw/autochanging_background_for_sway/
+https://github.com/swaywm/sway/issues/5006
+https://wiki.archlinux.org/title/Polkit
+https://forums.centos.org/viewtopic.php?t=70139
+https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
+https://www.reddit.com/r/swaywm/comments/epp0r4/unable_to_configure_the_cursor_theme/
+https://wiki.archlinux.org/title/x_resources

+ 0 - 0
Vagrantfile → virtualbox/Vagrantfile


+ 87 - 0
virtualbox/packer.json

@@ -0,0 +1,87 @@
+{
+	"variables": {
+        "iso_url": "https://mirrors.kernel.org/archlinux/iso/{{isotime \"2006.01\"}}.01/archlinux-{{isotime \"2006.01\"}}.01-x86_64.iso",
+        "iso_checksum_url": "https://mirrors.kernel.org/archlinux/iso/{{isotime \"2006.01\"}}.01/sha1sums.txt",
+		"root_password": "arch",
+		"username": "vagrant",
+		"password": "vagrant"
+	},
+	"builders": [{
+		"headless": true,
+		"type": "virtualbox-iso",
+		"iso_url": "{{ user `iso_url` }}",
+		"iso_checksum": "file:{{ user `iso_checksum_url` }}",
+		"vm_name": "arch-desktop",
+		"guest_os_type": "ArchLinux_64",
+		"guest_additions_mode": "disable",
+		"virtualbox_version_file": "",
+		"firmware": "efi",
+		"gfx_controller": "vmsvga",
+		"gfx_accelerate_3d": false,
+		"gfx_vram_size": 32,
+		"memory": 1024,
+		"cpus": 2,
+		"boot_wait": "5s",
+		"boot_command": [
+			"<enter><wait60s>",
+			"printf \"{{user `root_password`}}\\n{{user `root_password`}}\\n\" | passwd<enter>",
+			"systemctl is-active --quiet sshd.service || systemctl start sshd.service<enter>"
+		],
+		"iso_interface": "sata",
+		"hard_drive_interface": "sata",
+		"output_directory": "dist/arch-desktop",
+		"ssh_username": "root",
+		"ssh_password": "{{user `root_password`}}",
+		"ssh_timeout": "20m",
+		"shutdown_command": "systemctl poweroff"
+	}],
+	"provisioners": [
+		{
+			"type": "shell-local",
+			"command": "rm -rf upload/arch-desktop.tar && tar cf upload/arch-desktop.tar ../install ../arch.sh ../setup vagrant.sh"
+		},
+		{
+			"type": "file",
+			"source": "upload",
+			"destination": "upload"
+		},
+		{
+			"type": "shell",
+			"inline": [
+				"mv upload/arch-desktop.tar .",
+				"tar xf arch-desktop.tar",
+				"rm -rf upload",
+				"rm arch-desktop.tar"
+			]
+		},
+		{
+			"type": "shell-local",
+			"command": "rm -rf upload/arch-desktop.tar"
+		},
+		{
+			"type": "shell",
+			"skip_clean": true,
+			"expect_disconnect": true,
+			"environment_vars": [
+				"DEBUG=y",
+				"enable_hibernation=y",
+				"hostname=vagrant",
+				"root_password={{user `root_password`}}",
+				"username={{user `username`}}",
+				"password={{user `password`}}"
+			],
+			"script": "../setup/install.sh"
+		},
+		{
+			"type": "shell",
+			"inline": ["arch-chroot /mnt /srv/arch-desktop/vagrant.sh"]
+		}
+	],
+	"post-processors": [
+		{
+			"type": "vagrant",
+			"compression_level": 9,
+			"output": "dist/arch-desktop.box"
+		}
+	]
+}

+ 1 - 0
virtualbox/upload/.gitignore

@@ -0,0 +1 @@
+arch-desktop.tar

+ 3 - 3
setup/packer.sh → virtualbox/vagrant.sh

@@ -1,14 +1,14 @@
 #!/usr/bin/bash -x
 
-# re-secure ssh
+# adjust ssh for vagrant
 sed -i "/^#\?PasswordAuthentication/d" /etc/ssh/sshd_config
 sed -i "/^#\?PermitRootLogin/d" /etc/ssh/sshd_config
 echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
 
 # install VirtualBox Guest Additions
-# https://wiki.archlinux.org/index.php/VirtualBox
-pacman -S --noconfirm linux-headers virtualbox-guest-utils virtualbox-guest-modules-arch nfs-utils
+# @link: https://wiki.archlinux.org/index.php/VirtualBox
+pacman -Sy --noconfirm virtualbox-guest-utils nfs-utils
 echo -e 'vboxguest\nvboxsf\nvboxvideo' > /etc/modules-load.d/virtualbox.conf
 
 # enable related virtualization and networking services