Boot fixes, scratch windows

This commit is contained in:
Ian Keane 2026-08-09 14:31:49 -04:00
parent 8aa1f8a8a6
commit d3de780583
9 changed files with 740 additions and 0 deletions

14
config/autofs/auto.master Normal file
View file

@ -0,0 +1,14 @@
#
# auto.master - autofs mount map
#
# Generated from dotfiles. See /etc/auto.master(5).
#
# /mnt is managed by autofs - media share mounted on demand via Tailscale
/mnt /etc/auto.mnt --timeout=300
# Default entries
/misc /etc/auto.misc
/net -hosts
+dir:/etc/auto.master.d
+auto.master

3
config/autofs/auto.mnt Normal file
View file

@ -0,0 +1,3 @@
# autofs map for /mnt
# Mounts NFS share from tower via Tailscale IP on demand
media -fstype=nfs,nolock,soft,timeo=30 100.73.64.64:/mnt/user/media

22
config/mpd/mpd.conf Normal file
View file

@ -0,0 +1,22 @@
# MPD configuration
# Music is on NFS share at /mnt/media — MPD only starts if that's mounted
music_directory "/mnt/media/Music"
playlist_directory "/mnt/media/Music/playlists"
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/log"
pid_file "/var/run/mpd/mpd.pid"
state_file "~/.config/mpd/state"
user "green"
bind_to_address "localhost"
port "6600"
audio_output {
type "pulse"
name "PulseAudio Output"
}
# Also try pipewire via pulse compatibility layer
# If pure pipewire is needed, switch type to "pipewire"

64
config/mpd/rc.mpd Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
# rc.mpd - Music Player Daemon for Slackware
# Only starts if /mnt/media is mounted (NFS share must be available)
MPD=/usr/bin/mpd
CONF=/home/green/.config/mpd/mpd.conf
PIDFILE=/var/run/mpd/mpd.pid
start() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
echo "mpd is already running"
return
fi
echo "Starting mpd..."
mkdir -p /var/run/mpd
chown green:users /var/run/mpd
# Ensure user runtime dir exists (normally created by pam_systemd on login,
# but we start before login so we create it manually)
mkdir -p /run/user/1000
chown green:users /run/user/1000
chmod 700 /run/user/1000
# Wait for Tailscale to have connectivity to tower specifically
echo "Waiting for Tailscale connectivity to tower..."
for i in $(seq 1 30); do
tailscale ping --c 1 100.73.64.64 &>/dev/null && break
sleep 1
done
# Now trigger autofs mount
echo "Waiting for /mnt/media/Music..."
for i in $(seq 1 15); do
ls /mnt/media/Music &>/dev/null && break
sleep 1
done
if ! ls /mnt/media/Music &>/dev/null; then
echo "WARNING: /mnt/media/Music not accessible after wait, starting MPD anyway"
fi
sudo -u green XDG_RUNTIME_DIR=/run/user/1000 $MPD $CONF
echo "mpd started"
}
stop() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
echo "Stopping mpd..."
sudo -u green $MPD --kill $CONF
else
echo "mpd is not running"
fi
}
status() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
echo "mpd is running (pid $(cat $PIDFILE))"
else
echo "mpd is not running"
fi
}
case "$1" in
start) start ;;
stop) stop ;;
restart) stop; sleep 1; start ;;
status) status ;;
*) echo "Usage: $0 {start|stop|restart|status}" ;;
esac

View file

@ -54,6 +54,12 @@
(:float t t :class "alsamixer-scratch")
(:float t t :class "ncmpcpp-scratch"))
(define-frame-preference "scratch-emacs-1"
(0 t t :title "scratch-emacs-1"))
(define-frame-preference "scratch-emacs-2"
(0 t t :title "scratch-emacs-2"))
(define-frame-preference "Emacs"
(1 t t :restore "emacs-editing-dump" :title "...xdvi")
(0 t t :create "emacs-dump" :class "Emacs"))
@ -326,3 +332,60 @@ If PERSISTENT is t, smart-kill will hide the window instead of killing it."
(define-key *top-map* (kbd "s-2") "gselect 2")
(define-key *top-map* (kbd "s-3") "gselect 3")
(define-key *top-map* (kbd "s-4") "gselect 4")
;;; Fullscreen scratchpad groups
;;
;; Each scratchpad lives in its own hidden group. Pressing the binding
;; switches to it (spawning the window on first visit). Pressing again
;; returns to wherever you came from. We track the previous group ourselves
;; rather than relying on gother, which is unreliable when windows spawn async.
(defun toggle-scratchpad-group (group-name command &key window-title)
(let* ((screen (current-screen))
(current (current-group))
(target (find-group screen group-name))
(existing (when window-title
(find-if (lambda (w) (string= (window-name w) window-title))
(screen-windows screen)))))
(if (eq current target)
(when *scratchpad-previous-group*
(switch-to-group *scratchpad-previous-group*))
(progn
(setf *scratchpad-previous-group* current)
(when (and existing (not (eq (window-group existing) target)))
(move-window-to-group existing target))
(switch-to-group target)
(unless existing
(run-shell-command command))))))
(run-commands "gnewbg scratch-term-1"
"gnewbg scratch-term-2"
"gnewbg scratch-emacs-1"
"gnewbg scratch-emacs-2")
(defcommand scratch-term-1 () ()
"Toggle fullscreen persistent terminal (wezterm)."
(toggle-scratchpad-group "scratch-term-1"
"wezterm start --class scratch-term-1"))
(defcommand scratch-term-2 () ()
"Toggle second fullscreen persistent terminal (wezterm)."
(toggle-scratchpad-group "scratch-term-2"
"wezterm start --class scratch-term-2"))
(defcommand scratch-emacs-1 () ()
"Toggle fullscreen persistent emacsclient frame."
(toggle-scratchpad-group "scratch-emacs-1"
"emacsclient -c --frame-parameters '((name . \"scratch-emacs-1\"))'"
:window-title "scratch-emacs-1"))
(defcommand scratch-emacs-2 () ()
"Toggle second fullscreen persistent emacsclient frame (leetcode)."
(toggle-scratchpad-group "scratch-emacs-2"
"emacsclient -c --frame-parameters '((name . \"scratch-emacs-2\"))'"
:window-title "scratch-emacs-2"))
(define-key *top-map* (kbd "C-Return") "scratch-term-1")
(define-key *top-map* (kbd "C-\\") "scratch-term-2")
(define-key *top-map* (kbd "s-e") "scratch-emacs-1")
(define-key *top-map* (kbd "s-L") "scratch-emacs-2")

46
config/tailscale/rc.tailscale Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
# rc.tailscale - Tailscale VPN daemon for Slackware
TAILSCALED=/usr/sbin/tailscaled
STATEDIR=/var/lib/tailscale
PIDFILE=/var/run/tailscaled.pid
start() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
echo "tailscaled is already running"
return
fi
echo "Starting tailscaled..."
$TAILSCALED --state=$STATEDIR/tailscaled.state \
--socket=/var/run/tailscale/tailscaled.sock \
--port=41641 \
&>/var/log/tailscaled.log &
echo $! > $PIDFILE
echo "tailscaled started (pid $(cat $PIDFILE))"
}
stop() {
if [ -f "$PIDFILE" ]; then
echo "Stopping tailscaled..."
kill "$(cat $PIDFILE)" 2>/dev/null
rm -f "$PIDFILE"
else
echo "tailscaled is not running"
fi
}
status() {
if [ -f "$PIDFILE" ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
echo "tailscaled is running (pid $(cat $PIDFILE))"
else
echo "tailscaled is not running"
fi
}
case "$1" in
start) start ;;
stop) stop ;;
restart) stop; sleep 1; start ;;
status) status ;;
*) echo "Usage: $0 {start|stop|restart|status}" ;;
esac