Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .config/river/init
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ riverctl map normal Super F2 spawn "amixer -q set Master 5%+"
riverctl map normal Super F3 spawn "amixer -q set Master toggle" # Mute

# Area screenshot with notification
# shellcheck disable=SC2016
riverctl map normal Super Print spawn 'grim -g "$(slurp)" ~/Pictures/screenshot-$(date +"%Y%m%d%H%M%S").png'

# Area to clipboard with notification
# shellcheck disable=SC2016
riverctl map normal None Print spawn 'grim -g "$(slurp)" - | wl-copy'

# Tiling layout control
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ShellCheck CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: "-s sh -a -o all -f gcc -e SC3040"
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.11.0
hooks:
- id: shellcheck
entry: sh -c 'shellcheck -s sh -a -o all -f gcc -e SC3040 "${@}"' --
language: system
types: [shell]
pass_filenames: true

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: detect-private-key
20 changes: 10 additions & 10 deletions postinstall-neovim.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#!/bin/bash
set -euxo pipefail

printf "🚀 Setting up Neovim plugins...\n"
printf '🚀 Setting up Neovim plugins...\n'

# Function to check command success
check_success() {
if [ $? -eq 0 ]; then
printf "✅ $1\n"
printf '✅ %s\n' "$1"
else
printf "❌ $1 failed!\n"
printf '❌ %s failed!\n' "$1"
exit 1
fi
}

# Install vim-plug
if [ ! -f ~/.local/share/nvim/site/autoload/plug.vim ]; then
printf "📥 Installing vim-plug...\n"
mkdir -vp '~/.local/share/nvim/site/autoload/'
printf '📥 Installing vim-plug...\n'
mkdir -vp -- ~/'.local/share/nvim/site/autoload/'
wget -q --show-progress -O ~/.local/share/nvim/site/autoload/plug.vim \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
check_success "vim-plug installation"
fi

# Clean, install, and update plugins
printf "🔧 Setting up plugins...\n"
printf '🔧 Setting up plugins...\n'
nvim --headless +PlugClean! +PlugInstall +PlugUpdate +qa
check_success "Plugin installation"
check_success 'Plugin installation'

# Optional: Install coc.nvim extensions
printf "📦 Setting up coc.nvim extensions...\n"
nvim --headless "+CocInstall -sync coc-json coc-tsserver" +qa 2>/dev/null || true
printf '📦 Setting up coc.nvim extensions...\n'
nvim --headless '+CocInstall -sync coc-json coc-tsserver' +qa 2>/dev/null || true

printf "🎉 Neovim setup complete! All plugins installed.\n"
printf '🎉 Neovim setup complete! All plugins installed.\n'
16 changes: 10 additions & 6 deletions postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ set -euo pipefail

set +u
#Try to get effective user from: 1.env; 2.arg; 3.login
if [[ -n "${SUDO_USER}" ]]; then
if [ -n "${SUDO_USER}" ]; then
TARGET_USER="${SUDO_USER}"
elif [[ -n "${1}" ]]; then
elif [ -n "${1}" ]; then
TARGET_USER="${1}"
else
TARGET_USER="$(logname 2> /dev/null || whoami)"
fi

if [[ "${TARGET_USER}" == "root" ]]; then
read -p "Enter username of primary nonroot user: " TARGET_USER
if [ "${TARGET_USER}" = "root" ]; then
printf '%s\n' 'Enter username of primary nonroot user: '
IFS= read -r TARGET_USER
fi
set -u

# Install packages
xbps-install vpm neovim opendoas keepassxc psmisc zsh nnn fff tlp git wget btop dejavu-fonts-ttf font-inconsolata-otf noto-fonts-ttf font-awesome6 nerd-fonts-symbols-ttf wqy-microhei alsa-utils cifs-utils rdesktop ffmpeg6 mpv mpd mpc tmux mesa-dri mesa-vaapi intel-video-accel mesa-vulkan-intel intel-media-driver libva-utils glxinfo river wlr-randr elogind seatd wlroots yambar fuzzel swaybg swayimg grim slurp foot alacritty textadept lite-xl pcmanfm firefox zathura zathura-pdf-poppler

# Add river launcher to /etc/profile
# shellcheck disable=SC2016
printf '\nif [ "$(tty)" = "/dev/tty1" ]; then \n export XDG_RUNTIME_DIR=/tmp/river-runtime\n export MOZ_ENABLE_WAYLAND=1\n export WINIT_UNIX_BACKEND=wayland\n export TERM=xterm\n mkdir -p "${XDG_RUNTIME_DIR}"\n chmod 700 "${XDG_RUNTIME_DIR}"\n\n exec dbus-run-session river\nfi\n' >> /etc/profile

# Setup doas with no password for wheel
Expand All @@ -34,13 +36,14 @@ ln -s /etc/sv/elogind /var/service

# Add seatd service and group
ln -s /etc/sv/seatd /var/service
usermod -a -G _seatd $TARGET_USER
usermod -a -G _seatd "${TARGET_USER}"

# Add autologin
cp -va /etc/sv/agetty-tty1 /etc/sv/agetty-autologin
ln -s /etc/sv/agetty-autologin /var/service
sed -i 'N;/^[[:space:]]*exec.*\n.*/d' /etc/sv/agetty-autologin/run
printf "\nif [ \"${tty}\" = 'tty1' ]; then\n exec agetty --autologin ${TARGET_USER} --noclear \"${tty}\" \"${BAUD_RATE}\" linux\nelse\n exec chpst -P ${GETTY} ${GETTY_ARGS} \"${tty}\" \"${BAUD_RATE}\" \"${TERM_NAME}\"\nfi\n" >> /etc/sv/agetty-autologin/run
# shellcheck disable=SC2016
printf '\nif [ "${tty}" = "tty1" ]; then\n exec agetty --autologin "${TARGET_USER}" --noclear "${tty}" "${BAUD_RATE}" linux\nelse\n exec chpst -P "${GETTY}" "${GETTY_ARGS}" "${tty}" "${BAUD_RATE}" "${TERM_NAME}"\nfi\n' >> /etc/sv/agetty-autologin/run

# Add swapfile (btrfs)
truncate -s 0 /swapfile
Expand All @@ -62,6 +65,7 @@ mkdir -vp /mnt/games
printf '//truenas/games/ /mnt/games cifs credentials=/etc/smb-credentials,uid=1000,iocharset=utf8,file_mode=0644,dir_mode=0755 0 0\n' >> /etc/fstab

# Install oh-my-zsh
# shellcheck disable=SC2312
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Install neovim plugins
Expand Down