Switch desktop environment from Hyprland to Pantheon

Configures Pantheon (LightDM + gala) for daily use on this ASUS TUF
Gaming A15 (FA507NU), and drops everything that only existed to serve
the previous Hyprland/Quickshell setup:

- desktop.nix: services.desktopManager.pantheon instead of
  programs.hyprland + greetd; comfy laptop touchpad defaults.
- drivers.nix: NVIDIA PRIME render offload between the AMD Radeon 680M
  (drives the panel) and the RTX 4050 Max-Q (offload-only), using this
  machine's real PCI bus IDs; asusd/supergfxd for ASUS-specific laptop
  control.
- apps.nix / scripts.nix: removed Hyprland/Quickshell-only packages and
  scripts (kitty, rofi, quickshell, mako, hyprlock, hyprpaper/mpvpaper,
  the Quickshell theme-picker scripts, cursor/wallpaper/display
  helpers) — Pantheon ships its own Files/Terminal/Screenshot/
  notifications/theming natively. Kept the DE-agnostic scripts (vault
  toggle, metadata stripping, brightness control, Wi-Fi hotspot,
  telemetry, weather).
- theme.nix and default-apps.nix deleted entirely — Pantheon owns
  GTK/icon theming itself, no more live dconf/CSS generation pipeline
  needed.
- Deleted hyprland/ and dotfiles/ (kitty, mako, quickshell, rofi).

Verified with `nixos-rebuild build`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RpiovBQL6k5MTDMN3Ln9nL
This commit is contained in:
Nexoniarz 2026-08-31 19:52:59 +02:00
commit 6bcd5e15ad
15 changed files with 766 additions and 0 deletions

View file

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Brightness control abstraction: prefers the kernel backlight class (laptop
# panels, via brightnessctl); falls back to DDC/CI over I2C (external
# monitors, via ddcutil) when no backlight device exists. Keeps the rest of
# the config (Quickshell's brightness popup) hardware-agnostic.
set -euo pipefail
has_backlight() {
[ -n "$(ls -A /sys/class/backlight 2>/dev/null)" ]
}
case "${1:-get}" in
get)
if has_backlight; then
brightnessctl -m | cut -d, -f4 | tr -d '%'
else
ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}'
fi
;;
set)
pct="${2:?usage: brightness-ctl set <0-100>}"
if has_backlight; then
brightnessctl set "${pct}%" > /dev/null
else
ddcutil setvcp 10 "$pct" > /dev/null
fi
;;
up|down)
# brightnessctl takes a relative step directly, but ddcutil's
# setvcp only takes an absolute value — so the DDC/CI path (this
# machine's AOC 27G2G8 has no backlight device, so it always takes
# this path) has to read the current level and clamp the step
# itself.
step="${2:-5}"
if has_backlight; then
if [ "$1" = "up" ]; then
brightnessctl set "+${step}%" > /dev/null
else
brightnessctl set "${step}%-" > /dev/null
fi
else
cur=$(ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}')
cur="${cur:-50}"
if [ "$1" = "up" ]; then
new=$(( cur + step > 100 ? 100 : cur + step ))
else
new=$(( cur - step < 0 ? 0 : cur - step ))
fi
ddcutil setvcp 10 "$new" > /dev/null
fi
;;
*)
echo "usage: brightness-ctl [get|set <0-100>|up [step]|down [step]]" >&2
exit 1
;;
esac

View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Starts a Wi-Fi hotspot with explicit security/band control — the simple
# `nmcli device wifi hotspot` one-liner doesn't expose those.
# hotspot-start <ssid> <password> <wpa2|wpa3> <auto|bg|a>
set -euo pipefail
ssid="${1:?usage: hotspot-start <ssid> <password> <wpa2|wpa3> <auto|bg|a>}"
password="${2:?password required}"
security="${3:-wpa2}"
band="${4:-auto}"
iface=$(nmcli -t -f DEVICE,TYPE device | awk -F: '$2=="wifi"{print $1; exit}')
if [ -z "$iface" ]; then
echo "No Wi-Fi device found" >&2
exit 1
fi
# Idempotent: drop any previous Hotspot profile from an earlier run first.
nmcli connection delete Hotspot >/dev/null 2>&1 || true
key_mgmt="wpa-psk"
[ "$security" = "wpa3" ] && key_mgmt="sae"
nmcli connection add type wifi ifname "$iface" con-name Hotspot autoconnect no ssid "$ssid" > /dev/null
nmcli connection modify Hotspot 802-11-wireless.mode ap
if [ "$band" != "auto" ]; then
nmcli connection modify Hotspot 802-11-wireless.band "$band"
fi
nmcli connection modify Hotspot wifi-sec.key-mgmt "$key_mgmt"
nmcli connection modify Hotspot wifi-sec.psk "$password"
nmcli connection modify Hotspot ipv4.method shared
nmcli connection up Hotspot

View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "Usage: strip-metadata <file_or_directory>"
exit 1
fi
TARGET="$1"
echo "[*] Stripping metadata from: $TARGET"
# Remove all embedded metadata while keeping original filenames
if command -v exiftool &> /dev/null; then
exiftool -all= -overwrite_original -r "$TARGET"
echo "[+] Exif metadata removed."
else
echo "[!] Warning: exiftool is not installed."
fi
# Reset timestamps (atime and mtime) to Epoch (1970-01-01 00:00:00)
echo "[*] Resetting timestamps..."
find "$TARGET" -exec touch -t 197001010000.00 {} +
echo "[+] Operation completed successfully."

View file

@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Single-shot system telemetry snapshot — CPU/RAM/GPU/VRAM/disk usage — as
# one JSON object, so the Quickshell System panel can poll this on a Timer
# instead of spawning half a dozen separate processes every tick.
set -euo pipefail
# --- CPU ---
# /proc/stat's first line ("cpu ...") is cumulative jiffies since boot —
# computing instantaneous usage needs two samples across a short gap, so
# both reads happen inside this one invocation rather than needing
# cross-poll state kept on the QML side.
read_cpu() {
read -r _ user nice system idle iowait irq softirq steal _ < /proc/stat
echo "$((user + nice + system + irq + softirq + steal)) $((user + nice + system + idle + iowait + irq + softirq + steal))"
}
read -r cpu_busy1 cpu_total1 <<< "$(read_cpu)"
sleep 0.2
read -r cpu_busy2 cpu_total2 <<< "$(read_cpu)"
cpu_busy_delta=$((cpu_busy2 - cpu_busy1))
cpu_total_delta=$((cpu_total2 - cpu_total1))
cpu_pct=0
[ "$cpu_total_delta" -gt 0 ] && cpu_pct=$((100 * cpu_busy_delta / cpu_total_delta))
# --- RAM ---
mem_total_kb=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
mem_avail_kb=$(awk '/^MemAvailable:/{print $2}' /proc/meminfo)
mem_used_kb=$((mem_total_kb - mem_avail_kb))
# --- GPU / VRAM ---
# NVIDIA checked first via nvidia-smi (works regardless of which DRM card
# index the driver landed on); AMD falls back to the card0 sysfs counters
# directly — whichever's actually present decides which branch fires, so
# this works unmodified on either machine.
gpu_pct=-1
vram_used_mb=-1
vram_total_mb=-1
if command -v nvidia-smi > /dev/null 2>&1 && nvidia-smi -L > /dev/null 2>&1; then
nv_out="$(nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits -i 0 2>/dev/null | tr -d ' ')"
IFS=',' read -r gpu_pct vram_used_mb vram_total_mb <<< "$nv_out"
elif [ -e /sys/class/drm/card0/device/gpu_busy_percent ]; then
gpu_pct="$(cat /sys/class/drm/card0/device/gpu_busy_percent 2>/dev/null || echo -1)"
if [ -e /sys/class/drm/card0/device/mem_info_vram_used ]; then
vram_used_mb=$(($(cat /sys/class/drm/card0/device/mem_info_vram_used) / 1024 / 1024))
vram_total_mb=$(($(cat /sys/class/drm/card0/device/mem_info_vram_total) / 1024 / 1024))
fi
fi
# --- Disks (root + home) ---
# Positional ($NF for mountpoint), not header-text matching — `df -h`'s
# header is locale-translated (verified live: "System plików"/"%uż." under
# this machine's pl_PL locale, not "Filesystem"/"Use%"), so matching on
# English header text would silently find nothing.
disks_json="$(df -h 2>/dev/null | awk '
NR == 1 { next }
$NF == "/" || $NF == "/home" {
gsub(/%/, "", $5)
printf "%s{\"mount\":\"%s\",\"size\":\"%s\",\"used\":\"%s\",\"avail\":\"%s\",\"pct\":\"%s\"}", (n++ ? "," : ""), $NF, $2, $3, $4, $5
}
')"
printf '{"cpuPct":%s,"memUsedKb":%s,"memTotalKb":%s,"gpuPct":%s,"vramUsedMb":%s,"vramTotalMb":%s,"disks":[%s]}\n' \
"$cpu_pct" "$mem_used_kb" "$mem_total_kb" "$gpu_pct" "$vram_used_mb" "$vram_total_mb" "$disks_json"

30
modules/scripts/vault-toggle.sh Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
CIPHER_DIR="/run/media/nexoniarz/Lukas/.vault_cipher"
MOUNT_DIR="$HOME/Vault"
mkdir -p "$CIPHER_DIR" "$MOUNT_DIR"
if mountpoint -q "$MOUNT_DIR"; then
echo "[*] Synchronizing buffers and unmounting Vault..."
sync
if fusermount -u "$MOUNT_DIR"; then
echo "[+] Vault unmounted successfully."
else
echo "[!] Failed to unmount Vault. Check if any application is using $MOUNT_DIR"
exit 1
fi
else
echo "[*] Mounting Vault..."
if [ ! -f "$CIPHER_DIR/gocryptfs.conf" ]; then
echo "[!] Container not initialized. Initializing new gocryptfs vault..."
gocryptfs -init "$CIPHER_DIR" || exit 1
fi
if gocryptfs -allow_other "$CIPHER_DIR" "$MOUNT_DIR"; then
echo "[+] Vault mounted successfully at $MOUNT_DIR"
else
echo "[!] Mount failed."
exit 1
fi
fi

View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Fetches current weather + a short hourly forecast from Open-Meteo (free,
# no API key/account needed) for either the machine's IP-geolocated
# position (default, via ip-api.com — also free/keyless) or an explicitly
# named city, and prints one combined JSON object.
set -euo pipefail
city="${1:-}"
if [ -n "$city" ]; then
encoded="$(jq -sRr @uri <<< "$city")"
geo="$(curl -s "https://geocoding-api.open-meteo.com/v1/search?count=1&name=$encoded")"
lat="$(jq -r '.results[0].latitude // empty' <<< "$geo")"
lon="$(jq -r '.results[0].longitude // empty' <<< "$geo")"
place="$(jq -r '.results[0].name // empty' <<< "$geo")"
country="$(jq -r '.results[0].country // empty' <<< "$geo")"
else
ipgeo="$(curl -s "http://ip-api.com/json/")"
lat="$(jq -r '.lat // empty' <<< "$ipgeo")"
lon="$(jq -r '.lon // empty' <<< "$ipgeo")"
place="$(jq -r '.city // empty' <<< "$ipgeo")"
country="$(jq -r '.country // empty' <<< "$ipgeo")"
fi
if [ -z "$lat" ] || [ -z "$lon" ]; then
echo '{"error":"location lookup failed"}'
exit 0
fi
weather="$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=$lat&longitude=$lon&current=temperature_2m,weather_code,wind_speed_10m,precipitation&hourly=temperature_2m,weather_code,precipitation_probability&timezone=auto&forecast_days=2")"
jq --arg place "$place" --arg country "$country" '. + {place: $place, country: $country}' <<< "$weather"