#!/usr/bin/zsh # 1. Fetch credentials (Enpass logic remains the same) TOWER=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif: Tower" 2>&1) TOWERUN=$(echo "$TOWER" | grep -Po "(?<=login: )\w+") # Helper function to wait for a clipboard change wait_for_copy() { # We use wl-paste --watch but kill it after the first event # This mimics the 'clipnotify' behavior of pausing the script timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1 } # 2. Start the process echo "https://tower.scarif.space" | wl-copy mkdir -p "$HOME/Tower" # Launch Nextcloud (Standard NixOS/Wayland path) nextcloud & # 3. The Sequence # Wait for you to paste the URL, then copy the username wait_for_copy echo "$TOWERUN" | wl-copy # Wait for you to paste the username, then copy the password wait_for_copy enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort copy "Scarif: Tower" # 4. Finalize read -s -k $'?Press enter when you have synced Nextcloud... \n' # Clear clipboard for security wl-copy --clear # Symbolic links (NixOS usually manages fonts via config, but manual links still work) ln -s "$HOME/Tower/Library/Pictures/Wallpapers/7680x2160" "$HOME/.local/share/wallpapers"