This commit is contained in:
DarthMooMancer
2025-08-10 00:29:55 -04:00
parent 4d0d0b5c0a
commit b9d3e91567
14 changed files with 65 additions and 204 deletions
@@ -1,11 +0,0 @@
#!/bin/bash
variant=$(setxkbmap -query | awk '/variant:/ { print $2 }')
if [[ "$variant" == "colemak_dh" ]]; then
setxkbmap us
layout="qwe"
else
setxkbmap us -variant colemak_dh
layout="cdh"
fi
@@ -1,63 +0,0 @@
#!/bin/bash
set -e
REBUILD=false
# Parse flags
while getopts ":f" opt; do
case $opt in
f)
REBUILD=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
shift $((OPTIND - 1))
APP="$1"
APP_DIR="/home/andrew/dotfiles/.config/suckless/$APP"
CONFIG_FILE="$APP_DIR/config.h"
if [[ -z "$APP" ]]; then
echo "Usage:
edit-suckless.sh [ option ] < suckless-app >"
echo "Options:
-f [ force rebuild even if no changes were made ]"
exit 1
fi
if [[ ! -f "$CONFIG_FILE" ]]; then
echo "Config file not found: $CONFIG_FILE"
exit 1
fi
OLD_DIR="$(pwd)"
cd "$APP_DIR" || {
echo "Failed to cd into $APP_DIR"
exit 1
}
# Hash before edit
BEFORE_HASH=$(sha256sum config.h | cut -d ' ' -f1)
# Edit file
nvim config.h
# Hash after edit
AFTER_HASH=$(sha256sum config.h | cut -d ' ' -f1)
if [[ "$BEFORE_HASH" != "$AFTER_HASH" || "$REBUILD" == true ]]; then
echo "Rebuilding $APP..."
make
doas make install
make clean
pkill dwm
else
echo "No changes detected. Skipping rebuild."
fi
cd "$OLD_DIR"