diff --git a/README-en.md b/README-en.md index 37a61dc..5150556 100644 --- a/README-en.md +++ b/README-en.md @@ -54,21 +54,24 @@ for example) and repeated safely: 6. `sistema` (system): copies `sistema/` into `/`, sets up `wpa_supplicant.conf` so wheel users can use `wpa_cli` without root and save networks, enables the runit services (dbus, turnstiled, - wpa_supplicant, dhcpcd, bluetoothd, acpid, chronyd, tlp, automontaje, - cupsd), removes NetworkManager, elogind and polkitd (if something asks for - polkit, like udisks2 or libvirt, D-Bus starts it on its own) and adds the - user to the audio, video, input, network, bluetooth, lpadmin (printer - management) and `_pipewire` (realtime priority for audio without rtkit) - groups. `doas.conf` is checked with `doas -C` before it is installed with - mode 400. + wpa_supplicant, dhcpcd, bluetoothd, acpid, openntpd, tlp, automontaje, + cupsd), removes NetworkManager, elogind, chronyd, avahi-daemon (the printer + has a fixed IP) and polkitd (if something asks for polkit, like libvirt, + D-Bus starts it on its own) and adds the user to the audio, video, input, + network, bluetooth, lpadmin (printer management) and `_pipewire` (realtime + priority for audio without rtkit) groups. `doas.conf` is checked with `doas + -C` before it is installed with mode 400. 7. `quitar` (remove): uninstalls what the repo no longer uses because something else replaces it: sudo (doas), feh (xwallpaper and nsxiv), gammastep (sct), autorandr (`pantallas`), blueman and pavucontrol (the `bluetooth` and `volumen` scripts), pinentry-gtk (pinentry-dmenu), vlc (mpv), btop, NetworkManager and tlp-rdw (wpa_supplicant, dhcpcd and the - `wifi` script), rtkit and elogind (turnstile). sudo can be removed thanks - to `sistema/etc/xbps.d/sin-sudo.conf` (base-system depends on it), and it - is only removed once `/etc/doas.conf` is installed. + `wifi` script), rtkit, elogind (turnstile), xss-lock (`inactivo`, with + xssstate), chrony (openntpd), avahi and nss-mdns (also removed from + `/etc/nsswitch.conf`) and nemo with upower (yazi; gvfs and udisks2 go with + nemo). sudo can be removed thanks to `sistema/etc/xbps.d/sin-sudo.conf` + (base-system depends on it), and it is only removed once `/etc/doas.conf` + is installed. Afterwards, log out and back in (for the groups) and run `startx`. @@ -88,9 +91,9 @@ elogind is systemd's logind on its own, and it is not needed here: - Devices (sound, video, input, bluetooth) are reached through the user's groups, not through the ACLs elogind gave the active session. -What stops working: mounting disks from a file manager (udisks2 asks polkit -for an active session, and there is none). USB sticks are mounted by -`automontaje`. +What stops working: mounting disks from a graphical file manager (udisks2 +asked polkit for an active session; now there is neither a file manager nor +udisks2). USB sticks are mounted by `automontaje`. ## Rebuilding after changing the config @@ -201,8 +204,9 @@ preserveonrestart patches). when the SSH key is already unlocked (so pinentry never pops up) and retries every hour. `marcadores ya` uploads it right away. To restore: Firefox > Bookmarks > Manage bookmarks > Import and Backup > Restore. -- After 30 minutes idle the screen locks with slock (`xss-lock`) and one - minute later it turns off. +- After 30 minutes idle the screen locks with slock (`inactivo`, which + watches the X screensaver with `xssstate`) and one minute later it turns + off. Videos that ask to keep the screen on (mpv, Firefox) prevent it. - USB sticks and SD cards: the `automontaje` service (runit, as root) mounts them in `/mnt/LABEL`, or `/mnt/sdXY` if they have no label, and unmounts them when removed, with a notification. FAT, exFAT and NTFS are owned by @@ -210,6 +214,10 @@ preserveonrestart patches). wrote to, run `sync` (or `doas umount /mnt/...`). - User folders in English and without accents (`user-dirs.dirs`): Documents, Downloads and Images. +- Folders ("Open folder" in Firefox, `xdg-open`) open in yazi inside st + (`home/.local/share/applications/yazi-st.desktop`). +- `ex file...` extracts almost anything with `bsdtar` (a `.bashrc` + function). ## Notes diff --git a/README.md b/README.md index 9f3360e..724192e 100644 --- a/README.md +++ b/README.md @@ -51,20 +51,22 @@ Hace siete pasos, que también se pueden lanzar por separado 6. `sistema`: copia `sistema/` en `/`, prepara `wpa_supplicant.conf` para que los de wheel usen `wpa_cli` sin root y guarden redes, activa los servicios de runit (dbus, turnstiled, wpa_supplicant, dhcpcd, bluetoothd, acpid, - chronyd, tlp, automontaje, cupsd), quita NetworkManager, elogind y polkitd - (si algo pide polkit, como udisks2 o libvirt, D-Bus lo arranca solo) y - añade el usuario a los grupos audio, video, input, network, bluetooth, - lpadmin (para gestionar impresoras) y `_pipewire` (prioridad de tiempo real - para el audio sin rtkit). `doas.conf` se valida con `doas -C` antes de - instalarlo con modo 400. + openntpd, tlp, automontaje, cupsd), quita NetworkManager, elogind, chronyd, + avahi-daemon (la impresora va por IP fija) y polkitd (si algo pide polkit, + como libvirt, D-Bus lo arranca solo) y añade el usuario a los grupos audio, + video, input, network, bluetooth, lpadmin (para gestionar impresoras) y + `_pipewire` (prioridad de tiempo real para el audio sin rtkit). `doas.conf` + se valida con `doas -C` antes de instalarlo con modo 400. 7. `quitar`: desinstala lo que el repo ya no usa porque lo sustituye otra cosa: sudo (doas), feh (xwallpaper y nsxiv), gammastep (sct), autorandr (`pantallas`), blueman y pavucontrol (scripts `bluetooth` y `volumen`), pinentry-gtk (pinentry-dmenu), vlc (mpv), btop, NetworkManager y tlp-rdw - (wpa_supplicant, dhcpcd y el script `wifi`), rtkit y elogind (turnstile). - sudo se puede quitar gracias a `sistema/etc/xbps.d/sin-sudo.conf` - (base-system depende de él), y solo se quita si `/etc/doas.conf` ya está - instalado. + (wpa_supplicant, dhcpcd y el script `wifi`), rtkit, elogind (turnstile), + xss-lock (`inactivo`, con xssstate), chrony (openntpd), avahi y nss-mdns + (también los quita de `/etc/nsswitch.conf`) y nemo con upower (yazi; con + nemo se van gvfs y udisks2). sudo se puede quitar gracias a + `sistema/etc/xbps.d/sin-sudo.conf` (base-system depende de él), y solo se + quita si `/etc/doas.conf` ya está instalado. Después hay que cerrar sesión y volver a entrar (por los grupos) y lanzar `startx`. @@ -85,9 +87,9 @@ elogind es el logind de systemd por separado, y aquí sobra: - Los dispositivos (sonido, vídeo, entrada, bluetooth) van por los grupos del usuario, no por las ACL que ponía elogind a la sesión activa. -Lo que deja de ir: montar discos desde un gestor de archivos (udisks2 pide a -polkit una sesión activa, que ya no hay). Las memorias USB las monta -`automontaje`. +Lo que deja de ir: montar discos desde un gestor de archivos gráfico (udisks2 +pedía a polkit una sesión activa; ya no hay ni gestor ni udisks2). Las +memorias USB las monta `automontaje`. ## Recompilar tras cambiar la configuración @@ -198,8 +200,9 @@ ventanas (parches restartsig y preserveonrestart). con la clave SSH desbloqueada (para no sacar pinentry) y lo reintenta cada hora. `marcadores ya` la sube en el momento. Para restaurar: Firefox > Marcadores > Administrar marcadores > Importar y respaldar > Restaurar. -- Tras 30 minutos sin tocar nada se bloquea con slock (`xss-lock`) y un - minuto después se apaga la pantalla. +- Tras 30 minutos sin tocar nada se bloquea con slock (`inactivo`, que mira + el salvapantallas de X con `xssstate`) y un minuto después se apaga la + pantalla. Los vídeos que piden no apagarla (mpv, Firefox) lo evitan. - Memorias USB y tarjetas SD: el servicio `automontaje` (runit, como root) las monta en `/mnt/ETIQUETA`, o en `/mnt/sdXY` si no tienen etiqueta, y las desmonta al sacarlas, con una notificación. FAT, exFAT y NTFS quedan a @@ -207,6 +210,10 @@ ventanas (parches restartsig y preserveonrestart). memoria en la que se ha escrito, `sync` (o `doas umount /mnt/...`). - Carpetas del usuario en inglés y sin tildes (`user-dirs.dirs`): Documents, Downloads e Images. +- Las carpetas ("Abrir carpeta" en Firefox, `xdg-open`) se abren en yazi + dentro de st (`home/.local/share/applications/yazi-st.desktop`). +- `ex archivo...` descomprime casi cualquier cosa con `bsdtar` (función de + `.bashrc`). ## Notas diff --git a/home/.bashrc b/home/.bashrc index dcff353..2723258 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -3,8 +3,15 @@ # ===================================================================== # --- 1. Entorno y Rutas --- -# Priorizar binarios locales y scripts de usuario -export PATH="$HOME/.local/bin:/usr/local/bin:$PATH" +# Priorizar binarios locales y scripts de usuario. Si ya estaban (un bash +# dentro de otro), se quitan antes para no repetirlos. +for d in /usr/local/bin "$HOME/.local/bin"; do + PATH=":$PATH:" + PATH=${PATH//:$d:/:} + PATH=${PATH#:} + PATH="$d:${PATH%:}" +done +export PATH export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) export GPG_TTY=$(tty) gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1 @@ -71,27 +78,20 @@ alias esp32='doas chmod a+rw /dev/ttyUSB0' # --- 5. Funciones Útiles --- -# Comando 'ex': Descomprime LITERALMENTE CUALQUIER COSA -# Uso: ex archivo.zip | ex archivo.tar.gz +# ex: descomprime lo que sea. bsdtar se entiende con tar (gz, bz2, xz, zst), +# zip, 7z, rar e iso; los comprimidos sueltos, con su herramienta. +# Uso: ex archivo.zip [otro.tar.gz ...] ex() { - if [ -f "$1" ]; then - case $1 in - *.tar.bz2) tar xjf "$1" ;; - *.tar.gz) tar xzf "$1" ;; - *.bz2) bunzip2 "$1" ;; - *.rar) unrar x "$1" ;; - *.gz) gunzip "$1" ;; - *.tar) tar xf "$1" ;; - *.tbz2) tar xjf "$1" ;; - *.tgz) tar xzf "$1" ;; - *.zip) unzip "$1" ;; - *.Z) uncompress "$1";; - *.7z) 7z x "$1" ;; - *) echo "'$1' formato no reconocido por la función ex()" ;; + for f; do + case $f in + *.tar|*.tar.*|*.t?z|*.tbz2|*.zip|*.7z|*.rar|*.iso) bsdtar -xf "$f" ;; + *.gz) gunzip -k "$f" ;; + *.bz2) bunzip2 -k "$f" ;; + *.xz) unxz -k "$f" ;; + *.zst) unzstd "$f" ;; + *) echo "ex: no sé descomprimir '$f'" >&2 ;; esac - else - echo "'$1' no es un archivo válido" - fi + done } # Forzar IPv4 en Nix (IPv6 del sistema está roto) diff --git a/home/.config/mimeapps.list b/home/.config/mimeapps.list index 9d96999..8e6f10b 100644 --- a/home/.config/mimeapps.list +++ b/home/.config/mimeapps.list @@ -1,4 +1,5 @@ [Default Applications] +inode/directory=yazi-st.desktop x-scheme-handler/http=firefox.desktop x-scheme-handler/https=firefox.desktop x-scheme-handler/chrome=firefox.desktop @@ -11,6 +12,7 @@ application/x-extension-xhtml=firefox.desktop application/x-extension-xht=firefox.desktop [Added Associations] +inode/directory=yazi-st.desktop; x-scheme-handler/http=firefox.desktop; x-scheme-handler/https=firefox.desktop; x-scheme-handler/chrome=firefox.desktop; diff --git a/home/.local/bin/inactivo b/home/.local/bin/inactivo new file mode 100755 index 0000000..1e831a9 --- /dev/null +++ b/home/.local/bin/inactivo @@ -0,0 +1,12 @@ +#!/bin/sh +# Bloquea con slock cuando salta el salvapantallas de X (xset s en .xinitrc: +# 30 minutos sin tocar nada). Mira el estado con xssstate cada 5 s. Los +# vídeos que piden no apagar la pantalla (mpv, Firefox) paran el salvapantallas +# y así tampoco bloquea. Al suspender ya bloquea el hook de zzz. + +while :; do + if [ "$(xssstate -s)" = on ] && ! pgrep -x slock >/dev/null; then + slock + fi + sleep 5 +done diff --git a/home/.local/share/applications/yazi-st.desktop b/home/.local/share/applications/yazi-st.desktop new file mode 100644 index 0000000..1224d55 --- /dev/null +++ b/home/.local/share/applications/yazi-st.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=yazi +Comment=Carpetas con yazi en st (para xdg-open y Firefox) +Exec=st -e yazi %f +Terminal=false +MimeType=inode/directory; +NoDisplay=true diff --git a/home/.xinitrc b/home/.xinitrc index 5c004a1..12b8624 100644 --- a/home/.xinitrc +++ b/home/.xinitrc @@ -35,10 +35,10 @@ luz & bateria & marcadores & -# Bloquear con slock tras 30 minutos sin tocar nada, y apagar la pantalla un -# minuto después. Al suspender ya bloquea el hook de zzz (--ignore-sleep). +# Bloquear con slock tras 30 minutos sin tocar nada (salvapantallas de X, +# lo vigila inactivo) y apagar la pantalla un minuto después. xset s 1800 1800 xset dpms 0 0 1860 -xss-lock --ignore-sleep -- slock & +inactivo & exec dwm diff --git a/install.sh b/install.sh index 6794881..92d6ddc 100755 --- a/install.sh +++ b/install.sh @@ -18,27 +18,28 @@ PAQUETES=" libXrender-devel xorgproto imlib2-devel zlib-devel libxcrypt-devel xorg xinit setxkbmap xrandr dbus turnstile - picom dunst libnotify xwallpaper nsxiv maim xclip sct xss-lock + picom dunst libnotify xwallpaper nsxiv maim xclip sct xssstate pipewire wireplumber libspa-bluetooth alsa-pipewire - wpa_supplicant dhcpcd bluez acpid chrony tlp + wpa_supplicant dhcpcd bluez acpid openntpd tlp cups cups-filters hplip font-firacode nerd-fonts-symbols-ttf papirus-icon-theme papirus-folders sassc gnome-themes-extra qt5ct qt6ct opendoas gnupg pinentry-dmenu firefox thunderbird mpv neovim git fuse-sshfs unzip - yazi file ffmpeg 7zip jq poppler fd ripgrep fzf zoxide resvg ImageMagick + yazi file bsdtar ffmpeg 7zip jq poppler fd ripgrep fzf zoxide resvg ImageMagick " SUCKLESS="dwm st dmenu slstatus slock scroll clipmenu" # Tema GTK Everforest, en una versión fija para que siempre salga igual GTK_TEMA_REPO=https://github.com/Fausto-Korpsvart/Everforest-GTK-Theme GTK_TEMA_COMMIT=9b8be4d6648ae9eaae3dd550105081f8c9054825 -SERVICIOS="dbus turnstiled wpa_supplicant dhcpcd bluetoothd acpid chronyd tlp automontaje cupsd" +SERVICIOS="dbus turnstiled wpa_supplicant dhcpcd bluetoothd acpid openntpd tlp automontaje cupsd" # La red la llevan wpa_supplicant y dhcpcd. polkitd no hace falta como -# servicio: si algo lo pide (udisks2, libvirt), D-Bus lo arranca. turnstiled -# sustituye a elogind. -SERVICIOS_FUERA="NetworkManager polkitd elogind" +# servicio: si algo lo pide (libvirt), D-Bus lo arranca. turnstiled sustituye +# a elogind y openntpd a chronyd. avahi-daemon (mDNS) no hace falta: la +# impresora va por IP fija. +SERVICIOS_FUERA="NetworkManager polkitd elogind chronyd avahi-daemon" # _pipewire da prioridad de tiempo real al audio sin rtkit # (/etc/security/limits.d/25-pw-rlimits.conf, de pipewire). GRUPOS="audio video input network bluetooth lpadmin _pipewire" @@ -46,11 +47,14 @@ GRUPOS="audio video input network bluetooth lpadmin _pipewire" # nsxiv), gammastep (sct), autorandr (pantallas), blueman y pavucontrol # (scripts bluetooth y volumen), pinentry-gtk (pinentry-dmenu), vlc (mpv), # NetworkManager (wpa_supplicant, dhcpcd y el script wifi), rtkit (el grupo -# _pipewire) y elogind (turnstile; Xorg arranca como root con Xorg.wrap y la -# tapa y los botones ya los lleva acpid). +# _pipewire), elogind (turnstile; Xorg arranca como root con Xorg.wrap y la +# tapa y los botones ya los lleva acpid), xss-lock (inactivo, con xssstate), +# chrony (openntpd), avahi y nss-mdns (nada los usa) y nemo con upower (yazi; +# con nemo se van gvfs y udisks2). QUITAR=" sudo feh gammastep autorandr blueman pavucontrol pinentry-gtk gtk-engine-murrine vlc btop NetworkManager tlp-rdw rtkit elogind + xss-lock chrony avahi nss-mdns nemo upower " msg() { printf '\033[1;32m==>\033[0m %s\n' "$*"; } @@ -260,6 +264,12 @@ quitar() { # shellcheck disable=SC2086 root xbps-remove -Ry $fuera + # Sin nss-mdns, "mdns" sobra en la línea hosts de nsswitch.conf + if grep -q '^hosts:.*mdns' /etc/nsswitch.conf; then + root sed -i '/^hosts:/s/ mdns[a-z0-9_]*\( \[NOTFOUND=return\]\)\{0,1\}//g' \ + /etc/nsswitch.conf + fi + # Lo que puso aquí una versión anterior de sistema/ para elogind if [ -e /etc/elogind/logind.conf.d/10-acpid.conf ]; then root rm /etc/elogind/logind.conf.d/10-acpid.conf