Actualización README.md

Se añade un índice del contenido del repositorio para poder ubicar rápidamente lo que se necesite consultar
This commit is contained in:
Tuxliban Torvalds 2021-07-10 01:22:37 -05:00
parent fe2076daba
commit f78d13be96
48 changed files with 32 additions and 3357 deletions

393
Chroot.md
View file

@ -1,393 +0,0 @@
# **GUÍA CHROOT VOID LINUX**
## Autores
### Telegram
* @tenshalito Tuxliban Torvalds
* @lumaro Luis
-----
### **ÍNDICE**
* [Indroducción](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#1-introducci%C3%B3n)
* [Preparar el sistema de archivos](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#2-preparar-el-sistema-de-archivos)
* [Crear punto de montaje para el nuevo sistema de archivos (raíz)](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#3-crear-punto-de-montaje-para-el-nuevo-sistema-de-archivos-ra%C3%ADz)
* [Instalación del sistema](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#4-instalaci%C3%B3n-del-sistema)
* [XBPS](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#4-1-xbps)
* [Tarball rootfs](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#4-2-tarball-rootfs)
* [Configuración](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-configuraci%C3%B3n)
* [Configurar jaula chroot](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-1-configurar-jaula-chroot)
* [Instalación de sistema (ROOTFS)](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-1-1-instalaci%C3%B3n-de-sistema-rootfs)
* [Configuración de la instalación](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-2-configuraci%C3%B3n-de-la-instalaci%C3%B3n)
* [Crear la contraseña para la cuenta de root](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-3-crear-la-contrase%C3%B1a-para-la-cuenta-de-root)
* [Establecer permisos para la cuenta de root](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-4-establecer-permisos-para-la-cuenta-de-root)
* [Configurar el fichero fstab](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#5-5-configurar-el-fichero-fstab)
* [Instalación del kernel](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#6-instalaci%C3%B3n-del-kernel)
* [Configurar archivos de arranque](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#6-1-configurar-archivos-de-arranque)
* [Instalación de GRUB](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#7-instalaci%C3%B3n-de-grub)
* [Para sistemas BIOS](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#para-sistemas-bios=)
* [Finalización](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#8-finalizaci%C3%B3n)
* [Referencias](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Chroot.md#9-referencias)
-----
## 1. Introducción
El método de instalación mediante chroot en lugar de la instalación por defecto mediante el menú basado en ncurses, nos aportará un mayor control sobre los paquetes y configuración que se instalarán en nuestro sistema.
Chroot o *Change root* es una utilidad de Unix empleada principalmente para crear un nuevo entorno conocido como "jaula chroot", separado lógicamente del directorio raíz del sistema principal. Uno de los usos principales del enjaulamiento es crear un sistema Linux independiente encima del sistema huesped que se utiliza para llevar a cabo esta tarea. Explicado y expuesto el método, se expondrá la medología para realizar este tipo de instalación montando la jaula Chroot desde distintas fuentes para adquirir nuestro sistema.
Void permite al usuario poder instalar el sistema a través de dos métodos siguiendo la metodología de chroot. El primero es realizarlo utilizando el gestor de paquetes XBPS y descargar el sistema base y paquetes apoyándose de un sistema host (Glibc o Musl) y el segundo método es hacerlo descomprimiendo un tarball de ROOTFS obteniendo un sistema host que permita ingresar a una jaula chroot. Un tercer método, fuera del alcance de esta guía es compilando desde fuentes todo el sistema mediante XBPS-SRC, instalación más compleja que merece una guía a parte.
Antes de comenzar el proceso de instalación, debemos fijarnos si el comando se debe ejecutar como root, precedido de #, o bien como usuario del sistema, precedido por $. Aclarado esto, estamos preparados para abordar la instalación.
-----
## 2. Preparar el sistema de archivos
Antes de comenzar con la instalación del sistema, es necesario llevar a cabo el proceso de particionamiento del disco. En nuestro caso nos apoyaremos de crear las particiones de la herramienta [cfdisk](https://man.voidlinux.org/cfdisk.8) que está incluída en las ISOs que distribuye Void.
Para nuestro ejemplo consideraremos que el sistema estará compuesto de cuatro particiones:
1. /boot
2. /
3. /home
4. swap
Ante cualquier duda sobre qué tamaño asignar a la partición swap, en este [link](https://docs.voidlinux.org/installation/live-images/partitions.html#swap-partitions) podrán ver algunas recomendaciones.
**NOTA:** En sistemas de arranque UEFI será necesario contar con una partición de por lo menos unos 200 MB y estar formateada en FAT32.
Procedemos a formatear las particiones:
`# mkfs.vfat /dev/sdaX` ← Partición para /boot
`# mkfs.ext4 /dev/sdaY` ← Partición para /
`# mkfs.ext4 /dev/sdaZ` ← Partición para /home
`# mkswap /dev/sdaW` ← Partición para swap
-----
## 3. Crear punto de montaje para el nuevo sistema de archivos (raíz)
Dado que esta guía se basa en el supuesto de que la tabla de particiones es tipo GPT, entonces será necesario de un punto de montaje especial para el sistema EFI. Para ello montaremos primero la partición que se ha designado para el sistema raíz:
# mount /dev/sdaY /mnt
Crear el punto de montaje para el sistema EFI y montar la partición
# mkdir -p /mnt/boot/efi
# mount /dev/sdaX /mnt/boot/efi
Activar el área de intercambio (swap)
# swapon /dev/sdaW
Montar la partición que se ha designado para el home del usuario:
# mkdir /mnt/home
# mount /dev/sdaZ /mnt/home
**Nota:** Después de haber montado todas las particiones que usaremos en el sistema, opcionalmente se puede exportar a texto plano cómo están distribuidas las particiones para que cuando estemos en la jaula chroot terminemos de editarlo y usarlo como nuestro fstab de forma sencilla:
# lsblk -o NAME,UUID,MOUNTPOINT,FSTYPE > /mnt/etc/fstab
-----
## 4. Instalación del sistema
Como se mencionó anteriormente, Void Linux puede instalarse mediante chroot siguiendo dos métodos: a través de XBPS descargando el sistema del repositorio o descomprimiendo un tarball que ya contiene un sistema base.
### 4.1 XBPS
Si escogió este método, tendrá que elegir el mirror más cercano a usted. Para ver cuáles están disponibles consulte este [artículo](https://docs.voidlinux.org/xbps/repositories/mirrors/index.html)
**NOTA:** Si desea instalar la versión de *Void + Glibc*, añadir al final del mirror seleccionado `/current`; si desea instalar la versión de *Void + Musl* añadir al final del mirror seleccionado `/current/musl`.
Cabe mencionar que Musl es una implementación de libc que se esfuerza por ser liviana, rápida, simple y correcta. Void admite oficialmente musl al usarlo en su base de código para todas las plataformas de destino (aunque los paquetes binarios no están disponibles para i686). Además, todos los paquetes compatibles de los repositorios oficiales están disponibles con binarios vinculados a musl además de sus equivalentes glibc. En caso de que opten por instalar la versión compilada para musl, tener en cuenta, que algunos binarios de los repositorios *non-free*, no estarán disponibles para esta versión, por lo tanto si busca una mejor compatibilidad se recomienda altamente instalar la versión con glibc. Por ejemplo si desea utilizar los drivers privativos de Nvidia.
Para comenzar a descargar el sistema, es necesario indicarle a *XBPS* qué arquitectura se necesita, es decir *x86_64, x86_64-musl o para i686*. ¡Claro, Void Linux también da soporte para arquitecturas de 32 Bits!
Dependiendo de la aquitectura que haya elegido y tomando como ejemplo que se seleccionó el mirror de Alemania, proceder del siguiente modo:
1. Para la versión con glibc:
`export XBPS_ARCH=x86_64 && xbps-install -S -R https://alpha.de.repo.voidlinux.org/current -r /mnt base-minimal`
2. Para la versión con musl:
`export XBPS_ARCH=x86_64-musl && xbps-install -S -R https://alpha.de.repo.voidlinux.org/current/musl -r /mnt base-minimal`
**NOTA 1:** Void Linux provee al usuario de tres opciones para tomar como base la construcción del sistema:
1. *base-minimal:* Metapaquete con las herramientas mínimas para el sistema
2. *base-system:* Metapaquete del sistema base que viene con las ISO's que provee Void
3. *base-voidstrap:* Conjunto de herramientas necesarias para crear contenedores o jaulas chroot
**NOTA 2:** Si se instaló el paquete *base-minimal*, quizá desee instalar algunos paquetes extras para que el sistema funcione correctamente, es decir, paquetes que brinden funciones como soporte de wifi, detección de periféricos, etc.
**NOTA 3:** Algunas de las funciones que desearía habilitar si optó por el paquete *base-minimal* se consigue instalando paquetes como los siguientes:
* nano/vim - editor de texto cli de su preferencia
* less paginador de archivos de texto
* man-pages manuales
* e2fsprogs Utilidades de sistema de archivos para ext2, ext3 y ext4 (badbloks, blkid, fsck)
* procps-ng Utilidades para monitorizar el sistema y sus procesos (free, pkill, top, etc)
* pciutils Conjunto de programas para enumerar dispositivos PCI (lspci)
* usbutils Utilidades para mostrar información de buses USB (lsusb)
* iproute2 Programas para redes básicas y avanzadas en IPV4 (ip, bridge, ifstat,etc)
* util-linux Diversos programas de utilidad (blkid, dmesg,kill, mkfs, mount, etc)
* kbd Fuentes de consola y utilidades de teclado (setfont, fgconsole, loadkeys, etc)
* wifi-firmware - Metapaquete con driver para tarjetas *ipw2100, ipw2200, zd1211*
* ethtool Utilidades para examinar controladores y hardware de red
* kmod Utilidades para cargar módulos del núcleo (depmod, lsmod, modprobe, etc)
* traceroute - Rastrea la ruta tomada por los paquetes a través de una red IPv4 / IPv6
* iputils - Utilidades eficaces para redes Linux (incluido ping)
**NOTA 4:** Al instalar *base-system* tener en cuenta que se tiene menos control de los paquetes instalados para el sistema ya que de manera predeterminada instala los metapaquetes *linux, linux-firmware, wifi-firmware*, además de un paquete que no es de mucha utilidad: *void-artwork*
Por lo tanto, con una instalación mínima es posible escoger qué paquetes realmente necesita y no tener en el sistema paquetes que nunca utilizará (*linux-firmware-amd linux-firmware-nvidia linux-firmware-intel ipw2100-firmware ipw2200-firmware zd1211-firmware*) o una versión de kernel que reemplazará después.
### 4.2 Tarball rootfs
Descargar del siguiente [link](https://alpha.de.repo.voidlinux.org/live/current/) la versión que desea instalar: glibc o musl.
**NOTA:** Para la arquitectura de i686 no está disponible una versión con musl
Una vez seleccionado el tarball proceder a descomprimirlo en la partición que será asignda para el directorio raíz:
# tar xvf <ROOTFS_VERSIÓN>.tar.xz -C /path
**NOTA:** Reemplazar *path* por la ruta que han definido para la construcción del sistema
-----
## 5. Configuración
A partir de estos pasos y exceptuando la instalación base del sistema usando un tarball, la metodología aplicará a ambos métodos, tanto para XBPS como para ROOTFS.
### 5.1 Configurar jaula chroot
Montar los directorios **sys dev proc** para el correcto funcionamiento de la jaula chroot:
# for i in sys dev proc; do $(mount --rbind /$i /mnt/$i && mount --make-rslave /mnt/$i); done
También será necesario copiar el fichero resolv.conf del sistema anfitrión ya que contiene la configuración de DNS necesarios para que XBPS descargue los paquetes más recientes dentro de la jaula recien creada:
# cp /etc/resolv.conf /mnt/etc
Se procede a ingresar a la jaula chroot y para mayor comodidad se cambia el prompt para recordarnos que lo estamos usando. Así mismo, se establece a *bash* como shell de trabajo durante la instalación y configuración,
# PS1='(chroot) # ' chroot /mnt /bin/bash
#### 5.1.1 Instalación de sistema (ROOTFS)
Debido a que los tarball no tienen una fecha de publicación reciente, suelen estar desactualizados, por lo que una vez que se ha extraido el contenido en la partición que se utilizará como directorio raíz, hay que proceder a actualizar los paquetes:
# xbps-install -uy xbps
# xbps-install -Suy
### 5.2 Configuración de la instalación
Crear el hostname para la nueva instalación:
# echo HOSTNAME > /etc/hostname
Editar el fichero rc.conf del sistema que se está configurando. Para que el sistema lea esas configuraciones será necesario eliminar '#' que está al inicio de cada una de las líneas respectivas.
Para llevar a cabo esta tarea, utilice el editor [VI](https://man.voidlinux.org/nvi.1) que viene incluído en el chroot. Para introducir texto presione la tecla **i** de insertar o la tecla **a** de añadir. Para salir del modo edición presione la tecla **Esc**
# vi /etc/rc.conf
HOSTNAME="foo"
HARDWARECLOCK="UTC"
TIMEZONE="America/Mexico_City" <-- Ejemplo para México / "Europe/Madrid" <-- Ejemplo para España
KEYMAP="la-latin" <-- Distribución de teclado para español latinoamericano / "es" <-- Distribución para español
Una vez haya finalizado de editar, para guardar los cambios presione las teclas **:wq** y después la tecla **Enter**
Para conocer más zonas horarias (TIMEZONE) liste las ubicaciones con:
# ls -l /usr/share/zoneinfo/
Como se darán cuenta, mostrará directorios con los continentes disponibles, por lo que deben de ubicar la ruta completa para reemplazarla en el ejemplo que se muestra arriba.
La distribución de teclado para las consolas virtuales en español España se añade reemplazando *la-latin* por **es**.
NOTA: Si se optó por instalar la versión de Void con glibc, hay que editar el fichero */etc/default/libc.locales* y descomentar quitando el símbolo **#** del entorno de [locales](https://docs.voidlinux.org/config/locales.html) que desee. Se recomienta altamente utilizar las opciones UTF.
LANG=es_MX.UTF-8 <-- Configuración para México
LANG=es_ES.UTF-8 <-- Configuración para España
Generar los archivos locales (sólo para glibc)
# xbps-reconfigure -f glibc-locales
### 5.3 Crear la contraseña para la cuenta de root
# passwd
### 5.4 Establecer permisos para la cuenta de root
# chown root:root /
# chmod 755 /
### 5.5 Configurar el fichero fstab
#### 5.5.1 Modo avanzado
El fichero fstab (File System TABle) es el encargado de montar las particiones en cada inicio del sistema. Su configuración inicial se puede generar tomando como base las particiones que se tengan montadas en el fichero */proc/monts*, así que se procederemos a copiar dicho fichero en nuestra jaula chroot:
# cp /proc/mounts /etc/fstab
**NOTA:** Una vez que se ha copiado el fichero hay que editarlo y eliminar las líneas que hacen referencia a *proc, sys, devtmpfs* y *pts*.
Con ayuda de la herramienta [blkid](https://man.voidlinux.org/blkid.8) podremos identificar el UUID de cada una de las particiones que serán parte de nuestro sistema. Ejecutamos el programa así:
# blkid
Si tiene más de un disco duro conectado, entonces especificar cuál es el que se desea analizar. Por ejemplo:
# blkid /dev/sda
# blkid /dev/sdc
El sistema devolverá algo parecido a esto:
```
/dev/sda1: UUID="7EE1-A537" TYPE="vfat" PARTLABEL="EFI" PARTUUID="b35386b0-30d8-4d9d-9bc1-b02e78a2c708"
/dev/sda2: UUID="39b09ece-b3c5-4d72-b8a2-7f1611504820" TYPE="ext4" PARTLABEL="GRUB" PARTUUID="824a24e5-5795-4a98-9977-1e534e480fa6"
/dev/sda3: UUID="b7c453a3-332b-4feb-9e57-29a3c08f6fb5" TYPE="ext4" PARTLABEL="tmp" PARTUUID="12e852ce-79cc-4447-a8a0-d93c41b1967a"
/dev/sda4: UUID="95abee86-9bcf-40d6-83bd-2afd30e78e90" PARTLABEL="swap" PARTUUID="e4f25f1c-f74b-487b-9413-0f43a1ac1a99"
```
Ahora que ya se conoce la UUID de cada una de las particiones reemplazarlas en nuestro fstab para que quede de la siguiente manera:
```
# <UUID> <dir> <type> <options> <dump> <pass>
UUID=39b09ece-b3c5-4d72-b8a2-7f1611504820 / ext2 defaults 0 1 # Partición raíz
UUID=7EE1-A537 /boot/efi vfat defaults 0 2 # Partición de arranque
UUID=b7c453a3-332b-4feb-9e57-29a3c08f6fb5 /home ext4 defaults 0 2 # Partición home
UUID=95abee86-9bcf-40d6-83bd-2afd30e78e90 none swap sw 0 0 # Área de intercambio
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0 # Sistema de archivos virtual para almacenar archivos en memoria RAM
```
Al configurar el fstab (File System TABle), es necesario asignar el valor de 1 para la entrada de la partición del directorio raíz (columna pass) y asignar un 2 para las demás particiones exeptuando a la partición swap y para tmpfs (ver más detalles [aquí](https://man.voidlinux.org/fsck.8))
La ventaja de configurar el fstab de este modo es que las particiones serán detectadas por el sistema incluso si tuvieran un nombre y se les modificara más adelante.
#### 5.5.2 Modo sencillo
Ahora procederemos a terminar de editar el fichero fstab. Como recordarán, antes de ingresar a la jaula chroot se creó un fichero en texto plano que contiene información que usaremos para definir las particiones que usará el sistema. Procedemos a abrir el fichero y a editarlo:
# vi /etc/fstab
Comenzamos añadiendo una almohadilla **#** al inicio de la palabra *NAME* para que no sea leída por el sistema y se procede a eliminar las líneas que no se utilizarán teniendo cuidado de no borrar las que se usarán para el sistema:
```
#NAME UUID MOUNTPOINT FSTYPE
loop0 squashfs # Eliminar línea
loop1 xxxxx /run/rootfsbase ext # Eliminar línea
sda xxxxx iso9660 # Eliminar línea
sda1 xxxxx /run/initramfs/live iso9660 # Eliminar línea
sda2 ... # Eliminar línea
sdb xxxxx # Eliminar línea
sdb1 xxxxx /mnt/boot/efi vfat
sdb2 xxxxx /mnt ext4
sdb3 xxxxx [SWAP] swap
sdb4 xxxxx /mnt/home ext4
sdb5 xxxxx xxxxx xxx
```
Para la creación del fichero fstab y fácil lectura nos apoyaremos de usar columnas. Para ello nos aseguraremos de tener en la primera línea los siguientes nombres: UUID MOUNTPOINT FSTYPE OPTIONS DUMP PASS y procedemos a hacer lo siguiente:
1. Eliminar la columna **NAME** que corresponde al nombre y número de partición
2. Añadir **UUID=** antes de la serie alfanumérica que corresponde a cada uuid
3. Colocar a la partición raíz **/** en la parte superior
4. Eliminar la palabra **mnt** de la columna *MOUNTPOINT*
5. Reemplazar *[SWAP]* por **none**
6. Añadir la palabra **defaults** en la columna *OPTIONS* para todas las particiones exceptuando a la partición SWAP a la cual se le añadirá `rw,noatime,discard`
7. En la columna *PASS* añadir **1** para la partición raíz; **0** (cero) para la partición swap, así como para el directorio `/tmp`; y añadir **2** para la partición `/boot /home` o cualquier otra que también hayan definido
8. Añadir una línea adicional para montar al directorio **/tmp** en la ram. En la columna **UUID** poner `tmpfs` en lugar de UUID
Tras haber realizado lo anterior, el resultado debería verse similar a este ejemplo:
```
#UUID MOUNTPOINT FSTYPE OPTIONS DUMP PASS
UUID=xxxx / ext4 defaults 0 1 # Partición raíz
UUID=xxxx /boot/efi vfat defaults 0 2 # Partición sistema EFI
UUID=xxxx none swap rw,noatime,discard 0 0 # Partición swap
UUID=xxxx /home ext4 defaults 0 2 # Partición home
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0 # Partición de tmp montada en la ram
```
-----
## 6. Instalación del kernel
Si no eligió instalar el paquete *base-system* entonces puede continuar con este paso, de lo contrario omitirlo y continuar con el siguiente punto ya que el paquete *base-system* ya incluye un kernel.
# xbps-install linuxX.XX dracut
**NOTA:** Si compilará módulos para el kernel entonces también será necesario instalar los *headers* de la misma versión del kernel que desee:
# xbps-install linux-headersX.XX
Reemplazar X.XX por la serie del kernel que desea instalar
**NOTA:** Si su sistema necesita firmware adicional, es el momento de instalarlo, en otro caso puede que el sistema no arranque correctamente por falta de dichos controladores:
# xbps-install linux-firmware-XXX
Dependiendo de su sistema, tendrá que instalar un paquete o varios, las opciones de firmware son *linux-firmware-amd linux-firmware-intel linux-firmware-network linux-firmware-nvidia*
### 6.1 Configurar archivos de arranque
# xbps-install -fy linuxX.XX
-----
## 7. Instalación de GRUB
Usar el comando [grub-install](https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html) para instalar GRUB en el disco de arranque:
### 7.1 Para sistemas BIOS
```
# xbps-install -y grub
# grub-install --target=i386-pc /dev/sdX
```
### 7.2 Para sistemas EFI
```
# xbps-install -y grub-x86_64-efi
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void"
```
-----
## 8. Finalización
Utilice el comando [xbps-reconfigure](https://man.voidlinux.org/xbps-reconfigure.1) para asegurar que todos los paquete que se han instalado han sido configurados apropiadamente:
# xbps-reconfigure -fa
El comando anterior hará que dracut genere un initramfs el cual hará que grub genere una configuración de trabajo. En este punto la instalación del sistema ya está completa, por lo que lo único que resta es salir de la jaula chroot y reiniciar el sistema:
# exit
# umount -R /mnt
# shutdown -r now
-----
## 9. Referencias
* GNU Operating System (s.f.) Installing GRUB using grub-install. Sitio web de Manual Page Search Parameters:https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html
* Void Linux (2009). FSCK(8). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/fsck.8
* Void Linux (2014). CFDISK(8). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/cfdisk.8
* Void Linux (2019). XBPS-RECONFIGURE(1). Sitio web de Manual Page Search Parameters:https://man.voidlinux.org/xbps-reconfigure.1
* Void Linux (2020). Download installable base live images and rootfs tarballs. Sitio web de Download: https://alpha.de.repo.voidlinux.org/live/current/
* Void Linux (s.f.). Mirrors. Sitio web de Handbook's Void: https://docs.voidlinux.org/installation/live-images/partitions.html#swap-partitions
* Void Linux (s.f.). Partition notes. Sitio web de Handbook's Void: https://docs.voidlinux.org/installation/live-images/partitions.html#swap-partitions
* Void Linux. (2013). BLKID(8). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/blkid.8

View file

@ -1,272 +0,0 @@
# CREATING A GLIBC CONTAINER IN VOID MUSL
-----
## Authors
Telegram
* @tenshalito Tuxliban Torvalds
* @lumaro Lumaro
-----
## Introduction
When the Musl version of Void is installed, some users may have noticed that there are some programs that cannot be used natively due to the incompatibility of the standard Glibc and Musl C libraries. (Anonymous, 2015).
Musl is a lighter, faster, simpler, free implementation of the C standard, striving for compliance and security.
Void officially supports Musl for all platforms except i686. All packages provided through the official repositories are available with Musl binaries, in addition to their Glibc equivalents.
As Glibc is almost a standard in most GNU / Linux distributions, it is almost 100% sure that the software is compiled with it. Fortunately, Void offers the user to choose which C standard they want to install: Musl and Glibc, as well as the installation mode: Void-live or chroot, through tarball or through the download of the different system bases available from the repository: base -chroot, base-minimal, base-system, or base-voidstrap.
-----
## Creating the sandbox (container)
As mentioned above, if the Musl version is used in Void (or another distro that supports this library) they will not be able to run binaries that do not have an open source license or similar. It will even be impossible to try running i686 (32-bit) architecture programs.
Therefore, when creating a container, the options or advantages that we will have is that you can run all the packages available for the Void + Glibc version, or install development tools to do and undo whatever you want without fear of breaking the main system.
As mentioned on the Void site, with the base-voidstrap metapackage an isolated environment will be created in a directory of our system (Void, 2017). Therefore, we proceed with the following steps:
1.- Create the directory to be used as the container:
```
sudo mkdir -p /glibc
```
2.- Download and install the base-voidstrap metapackage in the directory created in the previous step:
```
sudo env XBPS_ARCH=x86_64 xbps-install --repository=http://alpha.de.repo.voidlinux.org/current -r /glibc -S base-voidstrap
```
You may wonder what does the command line above mean?
3.- Well, it means the following:
* **sudo:** Required to be able to scale write permissions to the root directory.
* **env:** Because sudo is being used, this command is required to execute run xbps-install with the environment variables modified without being affected by those that are set by default by the system.
* **XBPS_ARCH=x86_64:** When using the version of Void with Musl, you must download the version of Glibc also for 64-bit architectures. So with this version it will also be possible to run 32-bit programs.
* **--repository=http://alpha.de.repo.void.linux.org/current:** The mirror that will be used to download the necessary packages. It can be modified and configured by someone who is closer to the user.
* **-r /glibc:** It is the "root" directory where the executables will be stored.
* **base-voidstrap:** It's the metapackage used to create containers. Contains basic programs for minimalist operation.
4.- When executing the command line of step two, the system will ask the user if they want to import the fingerprint of the package that they want to install.
![01](Images/01.png)
 *You have to accept to continue with the installation*
![02](Images/02.png)
***Author's note:** I replaced sudo with doas*
5.- Once you have configured and installed the necessary packages, you have to create a C program that will help us execute the container binaries.
6.- For obvious reasons, and to identify what we will execute, the name we will give to this program will be glibc.c
![03](Images/03.png)
*We create a file with that name and then we will proceed to edit*
7.- The program called glibc.c will create a new mount namespace. In turn, the rest of the root directory will be reused(Alejandroliu, 2019).
![04](Images/04.png)
```
#define _GNU_SOURCE
#include <stdio.h>
#include <sched.h>
#include <sys/mount.h>
#include <unistd.h>
#define e(n,f) if (-1 == (f)) {perror(n);return(1);}
#define SRC "/glibc"
int main(int argc, const char const *argv[]) {
        const char const *shell[] = { "/bin/sh", NULL };
        // move glibc stuff in place
        e("unshare",unshare(CLONE_NEWNS));
        e("mount",mount(SRC "/usr", "/usr", NULL, MS_BIND, NULL));
        e("mount",mount(SRC "/var/db/xbps", "/var/db/xbps", NULL, MS_BIND, NULL));
        // drop the rights suid gave us
        e("setuid",setreuid(getuid(),getuid()));
        e("setgid",setregid(getgid(),getgid()));
        argv++;
        if (!argv[0]) argv = shell;
        e("execv",execvp(argv[0], argv));
}
```
8.- Now the next step is to compile and install the program.
a) We compile the code as follows:
```
gcc -s -o glibc glibc.c
```
![05](Images/05.png)
*Note: It will show us these warnings that, for our purposes, are not serious.*
b) Put the binary in a directory that appears within our path. In this case it will be in the root directory of the system executables:
```
doas cp glibc /usr/bin
```
![06](Images/06.png)
c) Now for the binary to work correctly you have to change its ownership to administrator (root)
```
doas chown root:root /usr/bin/glibc
```
![07](Images/07.png)
d) The user or group ID is set on execution and is assigned execution permissions:
```
doas chmod +sx /usr/bin/glibc
```
![08](Images/08.png)
*Including the + sign adds the specified properties*
9.- Now we install a package that cannot be natively run in Musl such as MEGAsync, openshot or dropbox (precompiled binary from the official dropbox site)
a) First we enter the container calling the binary that we previously created.
**Note:** In case you have configured bash or another shell as default, when you write the name of the glibc binary in the console, it will automatically change to dash
```
glibc
```
b) We proceed to change from user to administrator (root) in order to update the system (if updates are available), or install packages
```
su
xbps-install -Su
```
![09](Images/09.png)
c) For this example we will install MEGAsync which, according to your template, cannot be built for use with Musl (Johnnynator, 2019)
![10](Images/10.png)
*In the template it is clearly appreciated that both for musl and ppc, this package cannot be built*
```
xbps-install --repository=/path/ foo
```
**Author's note:** replace /path with the absolute path of the package you want to install in case you have created a binary using xbps-src and replace foo with the package name
![11](Images/11.png)
*We proceed to install the package that was previously built using xbps-src*
![12](Images/12.png)
d) Now to run the binary it can be done in two ways:
I. Run it from the container:
i. We leave the administrator account with exit or with the key combination *ctrl d*
ii. We run it from the console emulator
```
megasync
```
![13](Images/13.png)
*If you want to leave the program in the background, just add an & at the end of the command line*
II. Run it from the host system (Musl)
i. Directly from the host system console emulator write:
```
glibc megasync
```
![14](Images/14.png)
*As in the previous case, if you want to leave the process in the background add a **&***
**Another example of running Vivalvi in Void Musl**
![15](Images/15.png)
-----
## Endnotes
* The installation and execution process of compiled binaries for the Glibc library will be the same.
* If desired, you can add shortcuts or keyboard shortcuts, but the process will depend on the configuration and desktop that the user has.
-----
## Anexxes
If you want to install the following packages, install their respective dependencies as well
1. Telegram
```
# xbps-install libdrm libICE libSM
```
2. Brave
```
# xbps-install nss at-spi2-atk libgbm alsa-lib gtk+3
```
3. Palemoon
```
# xbps-install libvpx alsa-lib dbus-glib libXt gtk+
```
4. Zoom meeting
```
# xbps-install fontconfig glib libpulseaudio libSM libX11 libxcb libXcomposite libXfixes libXi libXcursor xcb-util-keysyms xcb-util-image nss libxshmfence libXrender libXrandr qt5-quickcontrols qt5-script mesa mesa-dri libxslt
```
5. Dropbox
```
# xbps-install libglapi libxshmfence libXxf86vm qt5dxcb-plugin
```
-----
## References
* Alejandroliu. (2019). Void Glibc in Musl. Github [Website]: https://github.com/alejandroliu/0ink.net/blob/master/snippets/void-glibc-in-musl/glibc.c
* Anonymous. (August 16th, 2015). Difference between Musl and non-Musl ISOs? Reddit [Website]. https://www.reddit.com/r/voidlinux/comments/3h8aug/difference_between_musl_and_nonmusl_isos/
* Jonnynator. (2019). Megasync/template. Github [Website]:  https://github.com/void-linux/void-packages/blob/master/srcpkgs/MEGAsync/template
* Voidlinux (2017). The Advent of Void: Day 4: containers. Voidlinux [Website]: https://voidlinux.org/news/2017/12/advent-containers.html
-----
GUIDE TO CREATING A GLIBC CONTAINER IN VOID MUSL by [Tuxliban Torvalds in collaboration with Lumaro ](https://www.dropbox.com/s/4nbh5f1xva84h1m/Contenedor_Void.pdf?dl=0)is distributed under a [Creative Commons Attribution Share-Alike 4.0 International License.](http://creativecommons.org/licenses/by-sa/4.0/)
Based on a work in https://github.com/alejandroliu/0ink.net/blob/master/snippets/void-glibc-in-musl/glibc.c

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

View file

@ -1,693 +0,0 @@
# **Guía de instalación *postinstall* para Void Linux**
## Autores
### Telegram
* @tenshalito Tuxliban Torvalds
* @lumaro Luis
-----
## **ÍNDICE**
* [Creación de usuario normal](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#1-creaci%C3%B3n-de-usuario-normal)
* [Establecer contraseña de usuario](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#1-1-establecer-contrase%C3%B1a-de-usuario)
* [Permisos administrativos para la cuenta de usuario](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-permisos-administrativos-para-la-cuenta-de-usuario)
* [2.1 sudo](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-1-sudo)
* [2.1.1 Usuario normal con permisos de superusuario](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-1-1-usuario-normal-con-permisos-de-superusuario)
* [2.1.2 Añadir usuario al grupo wheel](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-1-2-a%C3%B1adir-usuario-al-grupo-wheel)
* [2.2 doas](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-doas)
* [2.2.1 Instalación](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-1-instalaci%C3%B3n)
[2.2.1.1 Eliminar sudo (opcional)](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-1-1-eliminar-sudo-opcional)
* [2.2.2 Usuario normal con permisos de superusuario](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-2-usuario-normal-con-permisos-de-superusuario)
* [2.2.3 Activar persistencia en doas](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-3-activar-persistencia-en-doas)
* [2.2.4 No ingresar la contraseña](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-4-no-ingresar-la-contrase%C3%B1a)
* [2.2.5 Permisos específicos para usuarios](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-5-permisos-espec%C3%ADficos-para-usuarios)
* [2.2.6 Negar la ejecución de comandos](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#2-2-6-negar-la-ejecuci%C3%B3n-de-comandos)
* [3. Sevicios de runit](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#3-sevicios-de-runit)
* [4. Conexión a internet](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#4-conexi%C3%B3n-a-internet)
* [4.1 Ethernet](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#4-1-ethernet)
* [4.2 Conexión inalámbrica](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#4-2-conexi%C3%B3n-inal%C3%A1mbrica)
* [4.2.1 wpa_supplicant](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#4-2-1-wpa_supplicant)
* [4.2.2 NetworkManager](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#4-2-2-networkmanager)
* [5. Configuración de mirrors y repositorios](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#5-configuraci%C3%B3n-de-mirrors-y-repositorios)
* [5.1 Selección de mirror](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#5-1-selecci%C3%B3n-de-mirror)
* [5.2 Instalación de repositorios](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#5-2-instalaci%C3%B3n-de-repositorios)
* [6. Interfaz gráfica de usuario](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-interfaz-gr%C3%A1fica-de-usuario)
* [6.1 Instalar xorg (servidor gráfico)](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-1-instalar-xorg-servidor-gr%C3%A1fico)
* [6.1.1 Drivers de video](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-1-1-drivers-de-video)
* [6.2 Window manager](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-2-window-manager)
* [6.3 Entorno de escritorio](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-entorno-de-escritorio)
* [6.3.1 Cinnamon Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-1-cinnamon-desktop)
* [6.3.2 Enlightenment Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-2-enlightenment-desktop)
* [6.3 3 LXDE Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-3-lxde-desktop)
* [6.3.4 LXQT Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-4-lxqt-desktop)
* [6.3.5 MATE Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-5-mate-desktop)
* [6.3.6 XFCE Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-6-xfce-desktop)
* [6.3.7 Budgie Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-7-budgie-desktop)
* [6.3.8 GNOME Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-8-gnome-desktop)
* [6.3.9 PLASMA Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-9-plasma-desktop)
* [6.3.10 Lumina Desktop](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-3-10-lumina-desktop)
* [6.4 Instalar un gestor de inicio](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-4-instalar-un-gestor-de-inicio)
* [6.4.1 GDM](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-4-1-gdm)
* [6.4.2 LightDM](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-4-2-lightdm)
* [6.4.3 LXDM](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-4-3-lxdm)
* [6.4.4 SDDM](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-4-4-sddm)
* [6.4.5 SLIM](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-4-5-slim)
* [6.5 Inicio manual a través del comando startx](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-5-inicio-manual-a-trav%C3%A9s-del-comando-startx)
* [6.6 Autologin e inicio automático de X11](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-6-autologin-e-inicio-autom%C3%A1tico-de-x11)
* [6.7 Configuración de teclado](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-7-configuraci%C3%B3n-de-teclado)
* [6.8 Panel táctil (opcional)](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#6-8-panel-t%C3%A1ctil-opcional)
* [7. Ajustar brillo de pantalla](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#7-ajustar-brillo-de-pantalla)
* [7.1 Brillo de pantalla](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#7-1-brillo-de-pantalla)
* [7.2 Instalación](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#7-2-instalaci%C3%B3n)
* [7.3 Uso de light](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#7-3-uso-de-light)
* [8 Fuentes](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Postinstall.md#8-fuentes)
-----
## 1. Creación de usuario normal
Para añadir la cuenta de nuestro usuario se requiere del programa [useradd](https://man.voidlinux.org/useradd.8). Con ayuda de éste agregaremos nuestra cuenta a los grupos que sean necesarios, también debemos definir la contraseña de esta cuenta. Procedemos a crear la cuenta y añadirla a varios grupos del siguiente modo. Para un correcto funcionamiento del sistema, prestad atención a los grupos en los que debe estar presente el usuario:
# useradd -m -s /bin/bash -U -G wheel,disk,lp,audio,video,optical,storage,scanner,network,xbuilder USUARIO
**NOTA:** Al crear el nombre del usuario asegurarse de que sea con letras **minúsculas**.
Vamos a explicar, brevemente, el significado de cada comando y opción:
1. *useradd:* Comando para crear un nuevo usuario o actualizar información predeterminada del nuevo usuario
2. *-m:* crea el directorio *home* del usuario en caso de que no exista
3. *-s:* asignará la shell predeterminada a la cuenta que se está creando
4. */bin/bash:* Shell seleccionada para el usuario. Aquí puedes asignar otras como *zsh*, *fish*, *oksh*, *loksh* o *mksh* siempre y cuando se instale previamente el shell ya que de manera predeterminada el sistema solo tiene instalados a *dash* y *bash*.
5. *-U:* crea un nuevo grupo con el mismo nombre para del usuario, y agrega al usuario a este grupo
6. *-G:* grupos suplementarios a los que el usuario también formará parte. Cada uno de ellos debe estar separado por una coma y sin espacios entre ellos.
7. *wheel:* grupo utilizado para otorgar permisos administrativos temporales teniendo acceso de lectura y escritura a archivos del sistema
8. *disk:* acceso a dispositivos de alamacenamiento como disquetes, discos duros, ópticos, etc
9. *lp:* acceso a impresoras
10. *audio:* acceso directo al hardware de sonido para todas las sesiones
11. *video:* acceso a dispositivos de captura de video, aceleración de hardware, framebuffer, etc
12. *optical:* acceso a dispositivos óticos como unidades de CD o DVD
13. *storage:* acceso a unidades extraibles como pendrives USB o reproductores MP3; así mismo, permite al usuario montar los dispositivos de almacenamiento
14. *scanner:* acceso a hardware de scáner
15. *network:* grupo necesario para, generalmente, otorgar acceso a NetworkManager o wpa_supplicant para la gestión de las redes
16. *xbuilder:* grupo para poder utilizar el binario `xbps-uchroot` en la construcción de paquetes con `xbps-src`
17. *USUARIO:* reemplazar con el nombre que deseen para la cuenta o cuentas que vayan a a hacer
**NOTA:** Si pretende utilizar *QEMU* para virtualizar otros sistemas, entonces no olvide añadir a su usuario al grupo **`kvm`**
### 1.1 Establecer contraseña de usuario
# passwd USUARIO
-----
## 2. Permisos administrativos para la cuenta de usuario
En los sistemas *unix like*, de manera predeterminada, la cuenta que puede ejercer permisos administrativos siempre es *root*. Para que la cuenta de usuario común pueda ejecutar tareas administrativas como *root*, es necesario otorgarle los permisos necesarios y utilizar una herramienta que permita la escalada de privilegios desde un usuario común a *root*.
Void permite hacer este tipo de tareas a través de dos herramientas: [sudo](https://man.voidlinux.org/sudo.8) y [opendoas](https://github.com/Duncaen/OpenDoas)
### 2.1 sudo
`sudo` es el administrador de sistema predeterminado para delegar permisos de administración en casi todos los sistemas *unix like*.
Para configurar los permisos hay que editar el fichero `/etc/sudoers` y es altamente recomendable utilizar [visudo](https://jlk.fjfi.cvut.cz/arch/manpages/man/visudo.8) y no directamente a otros editores como *nano, vim, mousepad, kate, etc* porque en caso de algún error de sintaxis hará que `sudo` quede inutilizable. Al editarlo con `visudo` éste bloqueará el archivo y guardará los cambios en un archivo temporal para verificar que la sintaxis sea la correcta y después pueda copiarlo al archivo `/etc/sudoers`
De manera predederminada *visudo* tiene asignado a *VI*, sin embargo, es posible cambiarlo por un editor más amigable exportando la variable del editor antes de llamar a visudo. Por ejemplo:
# EDITOR=nano visudo
#### 2.1.1 Usuario normal con permisos de superusuario
Para permitir que la cuenta de usuario normal pueda realizar la escalada de permisos de administrador, es necesario añadir la siguiente línea a la configuración de *sudoers*
# visudo
USUARIO ALL=(ALL) ALL
#### 2.1.2 Añadir usuario al grupo wheel
Para permitir que todos los usuarios miembros del grupo *wheel* puedan ejecutar tareas administrativas descomentarla quitando **#**, al inicio de la línea
# visudo
%wheel ALL=(ALL) ALL
### 2.2 doas
El comando `doas` es simple en su diseño, constrastando con la complejidad del diseño de `sudo`. Para la mayoría de las personas (como @tenshalito y @lumaro), es más que suficiente para las tareas administrativas del sistema.
#### 2.2.1 Instalación
# xbps-install opendoas
##### 2.2.1.1 Eliminar sudo (opcional)
Una vez instalado `doas` se puede eliminar a *sudo* para dejar que el primero se encargue de la escalada de privelagios a *root* para la administración del sistema.
Como *sudo* forma parte del metapaquete `base-system` no es posible eliminarlo de la forma habitual, ya que el sistema mostrará un aviso de conflicto impidiendo su eliminación. Para eliminar *sudo* (o cualquier otro programa que forme parte de `base-system`) hay que añadir la excepción a una lista de paquetes ignorados por **xbps** del siguiente modo.
# echo "ignorepkg=sudo" > /etc/xbps.d/10-ignore.conf
# xbps-remove sudo
**NOTA:** En caso de que el paquete que se desee eliminar tenga dependencias, añadir el *flag* `-R` para eliminar de manera recursiva las dependencias no necesitadas por otros paquetes. Ejemplo:
# xbps-remove -R foo
#### 2.2.2 Usuario normal con permisos de superusuario
Para configurarlo basta con crear y editar el fichero `/etc/doas.conf` del siguiente modo:
# touch /etc/doas.conf
# echo "permit :wheel" > /etc/doas.conf
Lo anterior permitirá que todos los usuarios que se encuentren en el grupo *wheel* puedan ejecutar comandos con permisos de administración.
#### 2.2.3 Activar persistencia en doas
Algo que diferencia a `doas` respecto a `sudo` es que éste último se caracteriza de la persistencia que permite a sus usuarios ingresar la contraseña una vez y no ingresarla de nuevo por un periodo de tiempo corto. Si desea hacer esto con `doas`, entonces añada esto a su configuración:
# echo "permit persist :wheel" >> /etc/doas.conf
#### 2.2.4 No ingresar la contraseña
Si desea nunca tener que ingresar su contraseña añada lo siguiente a la configuración:
# echo "permit nopass :wheel" >> /etc/doas.conf
#### 2.2.5 Permisos específicos para usuarios
Si desea agregar a un usuario en específico para ejecutar tareas administrativas, entonces la configuración debe quedar así:
```
permit nopass USUARIO # No solicitar ingresar contraseña al usuario especificado
permit USUARIO # Solicitar contraseña para tareas que requieran escalar permisos
```
#### 2.2.6 Negar la ejecución de comandos
Si fuera necesario **negar la ejecución de comandos** que requieran permisos de administrador (en caso de que compartan su equipo), pueden hacer una regla sencilla como esta:
```
permit :wheel # Usuarios del grupo wheel pueden escalar permisos
deny USUARIO # Usuario tiene restringida la escalada de permisos incluso si estuviera en el grupo wheel
```
Si sólo se desea restringir la ejecución de por ejemplo reiniciar el sistema entonces se haría así:
```
permit :wheel
deny USUARIO cmd /bin/reboot
```
Para mayor información sobre cómo funciona `doas` consulte los manuales de [doas](https://man.openbsd.org/doas) y [doas.conf](https://man.openbsd.org/doas.conf.5)
-----
## 3. Sevicios de runit
Ahora que ya tiene el sistema funcionando, es un buen momento para revisar qué servicios están ejecutándose actualmente y ver cuáles no necesita. Si no está seguro acerca de un servicio en partícular mejor déjelo activo, sin embargo, las siguientes son relativemente seguras eliminar:
1. Probablemente no necesite tener seis *tty*, por lo que podría eliminarlas y dejar por lo menos una activa para poder iniciar sesión. Como recomendación podría dejar activadas sólo dos *tty's* y eliminar las demás:
```
# rm /var/service/{agetty-tty3,agetty-tty4,agetty-tty5,agetty-tty6}
```
2. Si no planea conectarse a través de *ssh* desde otra computadora, entonces puede elimiar el servicio
```
# rm /var/service/sshd
```
3. Si está utilizando una configuración de red estática, puede eliminar el servicio de *dhcpcd*
```
# rm /var/service/dhcpcd
```
-----
## 4. Conexión a internet
### 4.1 Ethernet
Para una conexión rápida es necesario activar el servicio `dhcpcd`
# ln -s /etc/sv/dhcpcd /var/service
### 4.2 Conexión inalámbrica
Antes de establecer la conexión es necesario revisar que las interfaces no se encuentren bloqueadas, por lo que en caso de estar bloquedas se habilitan con ayuda de [rfkill](https://man.voidlinux.org/rfkill.8):
# rfkill unblock all
#### 4.2.1 wpa_supplicant
**NOTA:** Si instaló el sistema a través de una instalación mínima mediante *base-minimal* o con *base-voidstrap*, entonces instale `wpa_supplicant`.
# xbps-install wpa_supplicant
Si instaló el sistema desde una ISO live o desde una instalación normal desde el paquete *base-system*, entonces no es necesario instalar `wpa_supplicant` ya que viene incluído en las opciones antes mencionadas.
Identificar interfaz:
$ ip link
A continuación, encontrar el ssid (nombre) de las redes inalámbricas disponibles:
# iw dev INTERFAZ scan | grep -i ssid
Configuración wpa_supplicant:
```
# cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-INTERFAZ.conf
$ wpa_passphrase {ssid} {password} | sudo tee -a /etc/wpa_supplicant/wpa_supplicant-INTERFAZ.conf
```
Activar el servicio de wpa_supplicant y de dhcpcd (de ser necesario, instálelo):
# ln -s /etc/sv/{dhcpcd,wpa_supplicant} /var/service/
Establecer conexión:
# wpa_supplicant -B -D wext -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
**NOTA:** *wlp2s0* es el nombre de la interfaz wifi, en su sistema posiblemente sea distinto.
#### 4.2.2 NetworkManager
Instalar el programa:
# xbps-install NetworkManager
Crear una regla *polkit* en el siguiente directorio `/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules` que contenga lo siguiente:
```
polkit.addRule(function(action, subject) {
if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
return polkit.Result.YES;
}
});
```
Por ejemplo usando *vim*
# vim /etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules
En caso de que su usuario aún no se encuentre en el grupo *network*, añádalo del siguiente modo:
# gpasswd -a USUARIO network
Desactive los servicios de *dhcpcd* y *wpa_supplicant* en caso de que esté activos ya que ellos y *NetworkManager* son mutuamente excluyentes:
# rm -fr /var/service/{dhcpcd,wpa_supplicant}
Active los siguientes servicios:
# ln -s /etc/sv/{NetworkManager,dbus} /var/service/
Conectarse a la red de su preferencia usando *nmtui*. Le ofrecerá una cómoda interfaz gráfica en modo ncurses
$ nmtui
-----
## 5. Configuración de mirrors y repositorios
### 5.1 Selección de mirror
Dependiendo de la ubicación del usuario, cambiar los mirrors ayudarán seriamente con las velocidades de descarga de los paquetes. Los siguientes son mirrors que se sincronizan directamente desde el *build-master* y, por lo tanto, siempre tendrá los últimos paquetes disponibles.
| **Repositorio** | **Ubicación** |
| :--- | :--- |
| https://alpha.de.repo.voidlinux.org/ | UE: Finlandia |
| https://mirrors.servercentral.com/voidlinux/ | USA: Chicago |
| https://alpha.us.repo.voidlinux.org/ | USA: Kansas, City |
Una vez detectado el mirror más cercano a su localización, proceda a reemplazar el mirror predeterminado en caso de ser necesario.
Primero hay que crear el siguiente directorio que servirá para guardar los mirrors:
# mkdir -p /etc/xbps.d
Después copiar las configuraciones predeterminadas al directorio previamente creado:
# cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
Ahora reemplazar el contenido del mirror predeterminado por el que hayan elegido:
# sed -i 's|https://alpha.de.repo.voidlinux.org|<repositorio>|g' /etc/xbps.d/*-repository-*.conf
Por último, sincronizar el índice del repositorio remoto
# xbps-install -Sf
### 5.2 Instalación de repositorios
Independientemente del repositorio principal que viene activado en una instalación vanilla, Void también proporciona otros dos repositorios para poder ampliar los paquetes disponibles para instalar software, **nonfree** para paquetes cuyas licencias son *no libres*; **multilib** el cual contiene librerías de 32 bits para sistemas de 64 bits.
Para instalar los repositorios proseguir del siguiente modo:
1. Repositorio *nonfree*
```
# xbps-install void-repo-nonfree
# xbps-install void-repo-multilib-nonfree
```
**Nota:** El repositorio *multilib-nonfree* no está disponible para la versión de Void + Musl
2. Repositorio *multilib*
```
# xbps-install void-repo-multilib
```
**Nota:** El repositorio *multilib-nonfree* no está disponible para la versión de Void + Musl
-----
## 6. Interfaz gráfica de usuario
Los siguientes pasos le ayudarán a ejecutar una configuración básica para un WM o para un entorno de escritorio. Los pasos son esencialmente los mismos
### 6.1 Instalar xorg (servidor gráfico)
El paquete *xorg* es un metapaquete que instala todo lo relacionado con Xorg. Dicho paquete le dará un inicio "rápido", pero también llenará su sistema de paquetes innecesarios. Una buena práctica sería instalar el paquete *xorg-minimal* para tener menos dependencias, pero será necesario especificar el controlador de video; o si lo prefiere, instalar todo manualmente para que sepa lo que se instala en el sistema:
# xbps-install xorg-server xauth xinit xf86-input-libinput xf86-video-XXX
#### 6.1.1 Drivers de video
Para identificar qué tipo de tarjeta tenemos instalada en nuestro equipo escribir lo siguiente en la consola:
$ lspci | grep VGA
1. AMD Raedon: `xf86-video-amdgpu`
2. ATI Raedon: `xf86-video-ati`
3. Open source NVIDIA: `xf86-video-noveau`
4. Intel: `xf86-video-intel`
5. Driver genérico: `xf86-video-vesa`
**NOTA:** Tenga en cuenta que el driver `xf86-video-intel` no se requiere en procesadores basados en *Sandy Brige* o en más nuevos
También puede optar por utilizar el driver [modesetting](https://wiki.archlinux.org/index.php/Kernel_mode_setting) que viene incluído en el kernel. Si se decide por esta opción, asegúrese de tener instalado también el paquete `mesa-dri`
### 6.2 Window manager
Existen diferentes tipos de WM que manejan las ventanas de manera diferente. Los más comunes que se suelen usar en Void son los siguientes:
1. Flotante: openbox
2. Tiling: bspwm, i3wm, sway (Wayland)
3. Dynamic: awesome, dwm
### 6.3 Entorno de escritorio
Void Linux cuenta en sus repositorios oficiales con soporte para varios entornos de escritorio. De manera oficial soporta a los siguientes:
1. Cinnamon
2. Enlightenment
3. lxde
4. lxqt
5. Mate
6. xfce
De manera no oficial dispone de:
1. Budgie
2. Gnome
3. Plasma
4. Lumina
#### 6.3.1 Cinnamon Desktop
El escritorio Cinnamon es una bifurcación de GNOME Shell, desarrollado por el proyecto [Linux Mint](https://github.com/linuxmint/cinnamon). Se caracteriza por ser un escritorio que apuesta por mantener la ligereza de su predecesor GNOME 2. Para instalar este entorno de escritorio proceder del siguiente modo:
```
# xbps-install cinnamon gnome-terminal lightdm lightdm-gtk-greeter dbus
# ln -s /etc/sv/{lightdm, dbus} /var/service/
```
**NOTA:** Se sabe que Cinnamon [actúa de manera extraña](https://www.reddit.com/r/voidlinux/comments/i21a7e/void_linux_musl_cinnamon_doesnt_work_properly) al ejecutarlo desde Musl. Esto también afecta a la imagen en vivo, void-live-x86_64-musl- <date> -cinnamon.iso
#### 6.3.2 Enlightenment Desktop
Para instalar el escritorio proceder del siguiente modo:
```
# xbps-install enlightenment lxdm lxterminal dbus
# ln -s /etc/sv/{lxdm, dbus} /var/service/
```
#### 6.3 3 LXDE Desktop
El escritorio lxde es uno de los más ligeros y una buena opción para aquellos equipos que se ven limitados en hardware. Para instalarlo proceder de la siguiente manera:
```
# xbps-install lxde dbus
# ln -s /etc/sv/{lxdm, dbus} /var/service/
```
#### 6.3.4 LXQT Desktop
El escritorio [lxqt es otro de los proyectos que apuesta por la ligereza](https://lxqt.github.io/), pero sin sacrificar lo estético. Es el resultado de la fusión de Razor-Qt y LXDE. Para instalarlo proceder del siguiente modo:
```
# xbps-install lxqt lxqt-l10n dbus lxdm
# ln -s /etc/sv/{lxdm, dbus} /var/service/
```
#### 6.3.5 MATE Desktop
El [escritorio Mate](https://git.mate-desktop.org/) está basado en Gnome 2 y se encuentra en constante desarrollo para ofrecer a sus usuarios un entorno atractivo e intuitivo. Para instalar el escritorio proceder del siguiente modo:
```
# xbps-install mate dbus ligtdm lightdm-gtk-greeter
# ln -s /etc/sv/{lightdm, dbus} /var/service/
```
Opcionalmente también podría optar por instalar el paquete `mate-extra` el cual le brindará al usuario una mejor experiencia al proporcionarle por ejemplo salvapantallas, visor de documentos, visor de imágenes, calculadora, terminal, etc
#### 6.3.6 XFCE Desktop
El [escritorio xfce](https://www.xfce.org/) se caracteriza por ser también uno de que consumen poco recursos del sistema sin dejar de ser visualmente atractivo y, por supuesto, sencillo de usar. Para instalarlo proceder del siguiente modo:
```
# xbps-install xfce4 dbus lxdm
# ln -s /etc/sv/{lxdm, dbus} /var/service/
```
Opcionalmente también podría instalar el paquete `xfce4-plugins` el cual le brindará al usuario una amplia gama de plugins para el panel, notificaciones o herramientas del sistema.
#### 6.3.7 Budgie Desktop
El escritorio budgie está basado en Gnome 3 y es desarrollado por el [projecto Solus](http://solus-project.com). Para instalar el escritorio proceder del siguiente modo:
```
# xbps-install budgie-desktop gnome-terminal dbus gdm
# ln -s /etc/sv/{gdm, dbus} /var/service/
```
#### 6.3.8 GNOME Desktop
Para instalar el [escritorio](https://www.gnome.org) proceder del siguiente modo:
```
# xbps-install gnome dbus gdm
# ln -s /etc/sv/{gdm, dbus} /var/service/
```
#### 6.3.9 PLASMA Desktop
Para instalar el [escritorio](https://kde.org/) proceder del siguiente modo:
```
# xbps-install kde5 dbus
# ln -s /etc/sv/{sddm, dbus} /var/service/
```
Opcionalmente también puede instalar el paquete `kde-5-baseapp` el cual le proveerá de un editor de texto plano, un gestor de archivos y un emulador de consola
#### 6.3.10 Lumina Desktop
El [escritorio Lumina](https://lumina-desktop.org/faq/) tiene la particularidad de caracterizarse por no requerir ninguno de los marcos de implementación de escritorio de uso común (dbus, policykit, consolekit, systemd, hald, etc.) Para instalar el escritorio proceder del siguiente modo:
```
# xbps-install lumina slim
# ln -s /etc/sv/slim /var/service/
```
### 6.4 Instalar un gestor de inicio
Void provee distintos *Display Managers* o Gestor de Inicio para poder iniciar sesión en el escritorio que hayamos instalado de manera gráfica.
Algunos escritorios tienen sus DM el cual lo instala de manera automática, sin embargo, es posible reemplazarlo por otro que sea del agrado del usuario. A continución se mencionarán los más comunes
#### 6.4.1 GDM
Para instalarlo y activarlo proceder del siguiente modo:
```
# xbps-install gdm
# ln -s /etc/sv/gdm /var/service/
```
#### 6.4.2 LightDM
Para instalarlo y activarlo proceder del siguiente modo:
```
# xbps-install lightdm lightdm-gtk-greeter
# ln -s /etc/sv/lightdm /var/service/
```
#### 6.4.3 LXDM
Para instalarlo y activarlo proceder del siguiente modo:
```
# xbps-install lxdm
# ln -s /etc/sv/lxdm /var/service/
```
#### 6.4.4 SDDM
Para instalarlo y activarlo proceder del siguiente modo:
```
# xbps-install sddm
# ln -s /etc/sv/sddm /var/service/
```
#### 6.4.5 SLIM
Para instalarlo y activarlo proceder del siguiente modo:
```
# xbps-install slim
# ln -s /etc/sv/slim /var/service/
```
### 6.5 Inicio manual a través del comando **startx**
Para iniciar sesión a través del comando *startx* es necesario tener instalado el paquete `xinit` y tenerlo configurado correctamente. Para ello, primeramente será necesario crear un fichero llamado xinitrc y guardarlo en nuestro directorio *home* con la característica de oculto.
$ touch ~/.xinitrc
Ahora, dependiendo del escritorio se haya instalado, habrá que añadir la linea correspondiente para poder iniciar X11
```
exec mate-session # Para iniciar Mate-Desktop
exec startxfce4 # Para iniciar XFCE
exec startlxde # Para iniciar LXDE
exec startkde # Para iniciar KDE-Plasma
exec gnome-session # Para iniciar Gnome
exec cinnamon-session # Para iniciar Cinnamon
exec startlxqt # Para iniciar LXQT
```
### 6.6 Autologin e inicio automático de X11
Crear un servicio de autologin para runit
# cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
El nombre del servicio que se vaya a crear es necesario que termine con el nombre válido de alguna de las consolas virtuales activadas. De lo contrario el servicio no funcionará.
Ahora hay que editar el siguiente fichero `/etc/sv/agetty-autologin-tty1/conf` para añadir lo siguiente:
```
GETTY_ARGS="--autologin USUARIO --noclear"
BAUD_RATE=38400
TERM_NAME=linux
```
Si se inició sesión en la consola virtual uno (tty1), ahora es un buen momento para cambiar a otra para continuar con la configuración.
Desactivar el servicio de la tty1 y activar el servicio para el autologin:
```
# rm /var/service/agetty-tty1
# ln -s /etc/sv/agetty-autologin-tty1 /var/service
```
Ahora, cada vez que el sistema inicie, el autologin a la consola virtual uno será de forma automática pero no en X11, por lo tanto, para conseguirlo añadir en el archivo de perfil de su shell en uso (bash de manera predeterminada) lo siguiente:
```
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
exec startx
fi
```
### 6.7 Configuración de teclado
Para establecer de forma permanente la distribución de nuestro teclado en X11, es necesario agregar un archivo de configuración en el que se defina la clase de entrada preferida estableciendo la opción *XkbLayout*. Para ello, será necesario crear el siguiente directorio: `/etc/X11/xorg.conf.d/10-keyboard-user.conf`
```
Section "InputClass"
Identifier "system-keyboard"
MatchDriver "libinput"
MatchIsKeyboard "on"
Option "XkbLayout" "latam" # Para la distribución de español latinoamericano. Si se desea la distribución para español España, reemplazar *latam* por *es*
Option "XkbOption" "grp:alt_shift_toggle" # Alternar distribución de teclado en caso de tener definido dos opciones
```
**NOTA:** Si no sabe qué tipo de distribución de teclado tiene, revisar los siguientes ejemplos:
1. [Distribución de teclado en español latinoamericano](https://tecnovortex.com/wp-content/uploads/2010/05/kb-latinoamericano.png)
2. [Distribución de teclado en español España](https://tecnovortex.com/wp-content/uploads/2010/05/kb-spanish-1024x341.png)
### 6.8 Panel táctil (opcional)
Para habilitar el pánel táctil (touchpad) de las computadoras portátiles basta con añadir la configuración al mismo directorio en el que se definió la configuración del teclado, con la diferencia de que el fichero tendrá un nombre similar a `15-touchpad.conf` al que se le añadirá lo siguiente:
```
Section "InputClass"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on" # Activar comportamientos al hacer clic
Option "NaturalScrolling" "true" # Desplazamiento natural (inverso)
Option "ScrollMethod" "foo" # Método utilizado para el scroll: edge para desplazamiento de borde (vertical) y twofinger para hacerlo con dos dedos
Option "DisableWhileTyping" "true" # Desactivat touchpad mientras se escribe
```
-----
## 7. Ajustar brillo de pantalla
Después de haber instalado Void, lo más probable es que el brillo de la pantalla sea demasiado alto. Para arreglarlo, a continuación se indicará cómo solucionar ese tipo de problemas.
### 7.1 Brillo de pantalla
Para cambiar el brillo de la pantalla existen varias utilidades, entre las más comunes se encuentran *xbacklight, brighnessctl, brillo, light*, sin embargo, el programa que se recomendará en esta sección será [light](https://github.com/haikarainen/light) debido a que entre sus diversas funciones, también nos permitirá realizar los ajustes de intensidad de brillo de pantalla tanto en X11, como en modo totalmente CLI y además, también es posible utilizar este program sin ninguna restricción en la versión de Void Musl.
### 7.2 Instalación
Para instalar el programa basta con lo siguiente:
```
# xbps-install light
```
### 7.3 Uso de *light*
Para efectos de uso concretos sólo se usarán tres comandos de ajuste del brillo: disminuir, aumentar y definir. Ejemplos:
```
light -A 5 # Incrementa la intensidad de brillo de la pantalla en intervalos de 5%
light -U 5 # Reduce la intensidad de brillo de la pantalla en intervalos de 5%
light -S 80 # Ajusta la intensidad del brillo de la pantalla al 80%
```
Para ver las otras opciones que soporta *light* consulta su [manual](https://github.com/haikarainen/light)
Una vez se conoce los comandos básicos, lo que que falta es definir los atajos de teclado que se utilizarán para realizar los cambios del brillo.
-----
## 8 Fuentes
* Haikarainen. (2020). Light. Sitio web de Github: https://github.com/haikarainen/light
* Void Linux. (2021). DOAS(1). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/doas
* Void Linux. (2020). DOAS.CONF(5). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/doas.conf.5
* Void Linux. (2020). SUDO(8). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/sudo
* Void Linux. (2020). SUDOERS(5). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/sudoers.5
* Void Linux. (2020). USERADD(8). Sitio web de Manual Page Search Parameters: https://man.voidlinux.org/useradd

View file

@ -1,4 +1,33 @@
# tutoriales_void
# Tutoriales para Void Linux
Este repositorio contendrá guías de ayuda para poder sacar un mejor provecho de esta maravillosa distribución de gnu/linux.
En lo posible se procurará tener en español el contenido que se vaya agregando.
# ÍNDICE
* Tutoriales
* [Contenedor para ejecutar programas compilados con la librería C glibc en una instalación de Void con Musl](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Gu%c3%adas/Container%20Void/Guide.md)
* [Guía de instalación mínima chroot](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Gu%c3%adas/Chroot.md)
* [Guía Postinstall](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Gu%c3%adas/Postinstall.md)
* Plantillas personalizadas
* [Tutorial de cómo construir e instlar los paquetes](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/README.md)
* [ Busybox-static](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/busybox-static/template)
* [Dash-static](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/dash-static/template)
* [DWM](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/dwm-custom/template)
* [Herbe](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/herbe/template)
* [Icecat(Pendiente de actualizar)](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/icecat/template)
* [Libreoffice](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/libreoffice-custom/update)
* [Linix4.14](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/linux4.14-custom/template)
* [Loksh-static](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/loksh-static/template)
* [Minimal-custom](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/minimal-custom/template)
* [Nnn-static](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/nnn-static/template)
* [Oksh-static](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/oksh-static/template)
* [Palemoon](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/palemoon/template)
* [Scron](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/scron/template)
* [Sdhcp](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/sdhcp/template)
* [Slstatus](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/slstatus-custom/template)
* [St](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/st-custom/template)
* [Surf](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/surf/template)
* [Tiramisu](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/tiramisu/template)
* [Xnotify](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/xnotify/template)
* [Zoom](https://git.disroot.org/tuxliban/tutoriales_void/src/branch/master/Plantillas/zoom/template)
Este repositorio contendrá guías de ayuda para poder sacar un mejor provecho de esta maravillosa dustribución de gnu/linux.
En lo posible se procurará tener en español el contenido que se vaya agregando

View file

@ -1,42 +0,0 @@
# Plantillas que no están disponibles en el repositorio oficial de Void Linux.
Para instalar estos paquetes proceder del siguiente modo:
1. Clonar el repositorio oficial de paquetes de Void:
```
$ git clone git://github.com/void-linux/void-packages.git
$ cd void-packages
$ ./xbps-src binary-bootstrap
```
2. Crear un directorio con el nombre del correspondiente paquete a instalar:
```
$ mkdir srcpkgs/foo
```
3. Copiar la plantilla al directorio que ha creado
```
$ cp /path/<template> ~/path/void-packages/srcpkgs/foo/
```
4. Construir el binario usando **xbps-src**
```
$ ./xbps-src pkg foo
```
5. Para instalar el paquete una vez ha sido empaquetado, proceder del siguiente modo:
```
# xbps-install --repository hostdir/binpkgs foo
```
6. Alternativamente podrá instalar el paquete usando el comando **xi** que viene incluído en el paquete **xtools**. Si no lo tiene, instálelo
```
# xbps-install xtools
# xi foo
```

View file

@ -1,20 +0,0 @@
# Template file for 'bashtop'
pkgname=bashtop
version=0.9.25
revision=1
depends="bash>=4.4 coreutils grep sed gawk procps-ng>=3.1.15"
short_desc="Resource monitor for processor, memory, disks, network, processes"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="Apache-2.0"
homepage="https://github.com/aristocratos/bashtop"
distfiles="https://github.com/aristocratos/${pkgname}/archive/v${version}.tar.gz"
checksum=676126df13a860df578a3a130783e0abb1c0b7628dddcfd7591069b832e8d8ad
# Desactivar la opción de revisar actualizaciones disponibles
pre_install() {
vsed -i bashtop -e '/^update_check=/s/true/false/'
}
do_install() {
vbin ${pkgname}
}

View file

@ -1,17 +0,0 @@
# Template file for 'bpytop'
pkgname=bpytop
version=1.0.26
revision=1
build_style=gnu-makefile
depends="python3>=3.6 python3-psutil>=5.7.0"
short_desc="Resource monitor for processor, memory, disks, network, processes"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="Apache-2.0"
homepage="https://github.com/aristocratos/bpytop"
distfiles="https://github.com/aristocratos/${pkgname}/archive/v${version}.tar.gz"
checksum=f0ff729a8e14d2112f3a45a461cb3025895aee28b0c0e52d54c387aa6a80e586
# Desactivar la opción de revisar actualizaciones disponibles
pre_install() {
vsed -i bpytop.py -e '/^update_check=/s/$update_check/false/'
}

View file

@ -1,29 +0,0 @@
From dd3282f27eadb2f3de1c6910895c3834163a958c Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnieder@gmail.com>
Date: Mon, 26 Sep 2011 16:30:15 -0500
Subject: [SHELL] Disable sh -c "command" -> sh -c "exec command" optimization
It is causing ocamlbuild and the darcs testsuite to fail. Back it
out until we understand the problem better.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
src/main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/main.c b/src/main.c
index 65e236be..1614ffbb 100644
--- src/main.c
+++ src/main.c
@@ -171,7 +171,7 @@ state2:
state3:
state = 4;
if (minusc)
- evalstring(minusc, sflag ? 0 : EV_EXIT);
+ evalstring(minusc, 0);
if (sflag || minusc == NULL) {
state4: /* XXX ??? - why isn't this before the "if" statement */
--
1.7.7.rc1

View file

@ -1,26 +0,0 @@
# Template file for 'dash'
pkgname=dash
version=0.5.11.2
revision=1
build_style=gnu-configure
hostmakedepends="bison"
short_desc="POSIX-compliant Unix shell, much smaller than GNU bash"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="BSD-3-Clause"
homepage="http://gondor.apana.org.au/~herbert/dash/"
distfiles="http://gondor.apana.org.au/~herbert/dash/files/$pkgname-$version.tar.gz"
checksum=00fb7d68b7599cc41ab151051c06c01e9500540183d8aa72116cb9c742bd6d5f
register_shell="/usr/bin/sh /usr/bin/dash /bin/sh /bin/dash"
alternatives="
sh:sh:/usr/bin/dash
sh:sh.1:/usr/share/man/man1/dash.1"
# Construir vinculado estáticamente
do_configure() {
./configure --prefix=/usr --enable-FEATURE=yes --enable-static
}
post_install() {
vlicense COPYING
}

View file

@ -1 +0,0 @@
ignore="*md5sum*"

View file

@ -1,202 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
#include <X11/keysymdef.h>
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 8; /* snap pixel */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 1; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "Ubuntu Mono:size=8" };
static const char dmenufont[] = "Ubuntu Condensed:size=13";
static const char col_01[] = "#1c1f22"; /* Color de la barra de estado en reposo*/
static const char col_02[] = "#1c1f22"; /* Color del borde de pantalla desenfocada */
static const char col_03[] = "#ffffff"; /* Color de las letras de la barra de estado */
static const char col_04[] = "#02ff00"; /* Color del nombre y etiqueta que está en uso */
static const char col_05[] = "#ffffff"; /* Color del borde de la ventana enfocada */
static const char col_06[] = "#1c1f22"; /* Color barra de estado cuando está en uso */
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_03, col_01, col_02 },
[SchemeSel] = { col_04, col_06, col_05 },
};
/* tagging */
//static const char *tags[] = { "", "", "", "", "", "", "" };
static const char *tags[] = { "", "", "", "", "", "" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Nnn", NULL, NULL, 1 << 0, 0, -1 },
{ "Gimp", NULL, NULL, 1 << 3, 0, -1 },
{ "IceCat", NULL, NULL, 1 << 1, 0, -1 },
{ "Brave", NULL, NULL, 1 << 1, 0, -1 },
{ "Google Chrome", NULL, NULL, 1 << 6, 0, -1 },
{ "Galculator", NULL, NULL, 0, 1, -1 },
{ "Openshot-qt", NULL, NULL, 1 << 3, 0, -1 }, // Editor de videos
{ "Telegram", NULL, NULL, 1 << 2, 0, -1 },
{ "Lxappearance", NULL, NULL, 0, 1, -1 },
{ "Thunderbird", NULL, NULL, 1 << 2, 0, -1 },
{ "Thunderbird", NULL, "Filtros de mensajes", 1 << 2, 1, -1 },
{ "Libreoffice", NULL, "Abrir", 0, 1, -1 },
};
/* layout(s) */
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const Layout layouts[] = {
/* symbol arrange function */
{ "T", tile }, /* first entry is default */
{ "F", NULL }, /* no layout function means floating behavior */
{ "M", monocle },
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_01, "-nf", col_03, "-sb", col_06, "-sf", col_04, NULL };
static const char *termcmd[] = { "st", "-t", "Enter the Void", NULL }; /* Emulador de consola */
/* Comandos personalizados */
static const char *menucmd[] = { "menu-apagar.sh", NULL };
static const char *screencastcmd[] = { "gvideo.sh", NULL };
static const char *nnncmd[] = { "st", "-T", "Administrador de archivos", "-e", "nnn", NULL };
static const char *icecatcmd[] = { "icecat", NULL };
static const char *bravecmd[] = { "glibc", "brave", NULL };
static const char *chrome[] = { "glibc", "google-chrome", NULL };
static const char *telegramcmd[] = { "glibc","telegram", NULL };
static const char *gimpcmd[] = { "gimp", NULL };
static const char *openshotcmd[] = { "glibc", "openshot-qt", NULL };
static const char *mocpcmd[] = { "st", "-e", "mocp", "-T", "yellow_red_theme", NULL };
static const char *mocp_play[] = { "mocp", "-p", "-t", "shuffle", NULL };
static const char scratchpadname[] = "scratchpad";
static const char *scratchpadcmd[] = { "st", "-t", "scratchpad", "-g", "140x40+400+220", NULL };
static const char *dropboxcmd[] = { "glibc", "dropbox", "start", NULL };
static const char *thunderbirdcmd[] = { "thunderbird", NULL };
static const char *toggle_wificmd[] = { "wifi.sh", "-toggle", NULL };
/* Control de volumen ALSA */
static const char *volupcmd[] = { "amixer", "-q", "sset", "Master", "5%+", NULL };
static const char *voldowncmd[] = { "amixer", "-q", "sset", "Master", "5%-", NULL };
static const char *mutecmd[] = { "amixer", "-q", "-D", "default", "sset", "Master", "toggle", NULL }; /* Alternar silencio/sonido */
/* Control del brillo de pantalla */
static const char *brightnessup[] = { "light", "-A", "2.5"};
static const char *brightnessdown[] = { "light", "-U", "2.5"};
static Key keys[] = {
/* modifier key function argument */
{ 0, XK_F12, togglescratch, {.v = scratchpadcmd} },
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_u, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
/* Atajos personalizados */
// { MODKEY, XK_F1, spawn, {.v = nnncmd } },
{ MODKEY, XK_F1, spawn, {.v = nnncmd } },
{ ControlMask, XK_F1, spawn, {.v = chrome } },
{ MODKEY, XK_F2, spawn, {.v = icecatcmd } },
{ ControlMask, XK_F2, spawn, {.v = bravecmd } },
{ MODKEY, XK_F3, spawn, {.v = telegramcmd } },
{ ControlMask, XK_F3, spawn, {.v = thunderbirdcmd } },
{ MODKEY, XK_F4, spawn, {.v = gimpcmd } },
{ ControlMask, XK_F4, spawn, {.v = openshotcmd } },
{ MODKEY, XK_x, spawn, {.v = menucmd } }, // Atajo menú Apagar
{ MODKEY, XK_v, spawn, {.v = screencastcmd } }, // Grabar pantalla
{ ControlMask, XK_m, spawn, SHCMD("usb.sh -m") }, // Montar usb
{ ControlMask, XK_u, spawn, SHCMD("usb.sh -u") }, // Desmontar usb
{ MODKEY|ShiftMask, XK_u, spawn, SHCMD("usb.sh -U") }, // Desmontar último usb
{ MODKEY, XK_F10, spawn, {.v = mocpcmd } },
{ ControlMask, XK_F10, spawn, {.v = mocp_play } },
{ MODKEY, XK_F11, spawn, {.v = dropboxcmd } },
{ ControlMask, XK_F12, spawn, {.v = toggle_wificmd } },
/* Modos de captura de pantalla */
{ 0, XK_Print, spawn, SHCMD("ss_void.sh -P") }, // Captura de pantalla en el portapapeles
{ ShiftMask, XK_Print, spawn, SHCMD("ss_void.sh -S") }, // Captura de área seleccionada en el portapapeles
{ ControlMask, XK_Print, spawn, SHCMD("ss_void.sh -g") }, // Guardar captura de pantalla
{ MODKEY|ShiftMask, XK_Print, spawn, SHCMD("ss_void.sh -s")}, // Guardar área seleccionada
/* Atajos multimedia */
{ 0, XF86XK_AudioPlay, spawn, SHCMD("mocp -G") },
{ 0, XF86XK_AudioPrev, spawn, SHCMD("mocp -r") },
{ 0, XF86XK_AudioNext, spawn, SHCMD("mocp -f") },
{ 0, XF86XK_AudioMute, spawn, {.v = mutecmd } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldowncmd } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volupcmd } },
/* Ajustar brillo de la pantalla */
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = brightnessup} },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = brightnessdown} },
/* ---------------------------------------------------------------------------------------------- */
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

View file

@ -1,90 +0,0 @@
diff -up a/config.def.h b/config.def.h
--- a/config.def.h 2019-06-06 21:23:27.006661784 +0200
+++ b/config.def.h 2019-06-20 15:05:59.083102462 +0200
@@ -58,11 +58,14 @@ static const Layout layouts[] = {
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
+static const char scratchpadname[] = "scratchpad";
+static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2019-06-06 21:23:27.023328450 +0200
+++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200
@@ -213,6 +213,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
+static void togglescratch(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -273,6 +274,8 @@ static Window root, wmcheckwin;
/* configuration, allows nested code to access above variables */
#include "config.h"
+static unsigned int scratchtag = 1 << LENGTH(tags);
+
/* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
c->bw = borderpx;
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
+ if (!strcmp(c->name, scratchpadname)) {
+ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
+ c->isfloating = True;
+ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
+ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
+ }
+
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
@@ -1661,6 +1672,7 @@ spawn(const Arg *arg)
{
if (arg->v == dmenucmd)
dmenumon[0] = '0' + selmon->num;
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
@@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg)
}
void
+togglescratch(const Arg *arg)
+{
+ Client *c;
+ unsigned int found = 0;
+
+ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
+ if (found) {
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
+ if (newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
+ focus(NULL);
+ arrange(selmon);
+ }
+ if (ISVISIBLE(c)) {
+ focus(c);
+ restack(selmon);
+ }
+ } else
+ spawn(arg);
+}
+
+void
toggletag(const Arg *arg)
{
unsigned int newtags;

View file

@ -1,30 +0,0 @@
From 9102fdb9c670218373bbe83c891c8e8138d6a6f4 Mon Sep 17 00:00:00 2001
From: redacted <redacted@example.com>
Date: Tue, 23 Apr 2019 00:39:27 +0100
Subject: [PATCH] added noborder patch
---
dwm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dwm.c b/dwm.c
index 4465af1..685eca1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1282,6 +1282,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
wc.border_width = c->bw;
+ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
+ && !c->isfullscreen && !c->isfloating) {
+ c->w = wc.width += c->bw * 2;
+ c->h = wc.height += c->bw * 2;
+ wc.border_width = 0;
+ }
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);
--
2.21.0

View file

@ -1,746 +0,0 @@
From 4001ccae7b1a41bdcb247b0cf095a51af7b68c28 Mon Sep 17 00:00:00 2001
From: Igor Gevka <igor.gevka@gmail.com>
Date: Sun, 16 Feb 2020 15:03:10 -0800
Subject: [PATCH] [PATCH] Implements a system tray for dwm.
Original author: Jan Christoph Ebersbach <jceb@e-jc.de>, inspired by http://code.google.com/p/dwm-plus
URL: http://dwm.suckless.org/patches/systray
dwm 6.2 port by Igor Gevka <igor.gevka@gmail.com>
---
config.def.h | 4 +
dwm.c | 404 +++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 382 insertions(+), 26 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..2d824d1 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,6 +3,10 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
+static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
+static const unsigned int systrayspacing = 2; /* systray spacing */
+static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
+static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
diff --git a/dwm.c b/dwm.c
index 4465af1..3e361fa 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,12 +57,30 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+
+/* XEMBED messages */
+#define XEMBED_EMBEDDED_NOTIFY 0
+#define XEMBED_WINDOW_ACTIVATE 1
+#define XEMBED_FOCUS_IN 4
+#define XEMBED_MODALITY_ON 10
+
+#define XEMBED_MAPPED (1 << 0)
+#define XEMBED_WINDOW_ACTIVATE 1
+#define XEMBED_WINDOW_DEACTIVATE 2
+
+#define VERSION_MAJOR 0
+#define VERSION_MINOR 0
+#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+ NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -141,6 +159,12 @@ typedef struct {
int monitor;
} Rule;
+typedef struct Systray Systray;
+struct Systray {
+ Window win;
+ Client *icons;
+};
+
/* function declarations */
static void applyrules(Client *c);
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
@@ -169,8 +193,10 @@ static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
+static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
+static unsigned int getsystraywidth();
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void grabkeys(void);
@@ -188,13 +214,16 @@ static void pop(Client *);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
+static void removesystrayicon(Client *i);
static void resize(Client *c, int x, int y, int w, int h, int interact);
+static void resizebarwin(Monitor *m);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
+static void resizerequest(XEvent *e);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
-static int sendevent(Client *c, Atom proto);
+static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
@@ -206,6 +235,7 @@ static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void sigchld(int unused);
static void spawn(const Arg *arg);
+static Monitor *systraytomon(Monitor *m);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *);
@@ -223,18 +253,23 @@ static int updategeom(void);
static void updatenumlockmask(void);
static void updatesizehints(Client *c);
static void updatestatus(void);
+static void updatesystray(void);
+static void updatesystrayicongeom(Client *i, int w, int h);
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
+static Client *wintosystrayicon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
/* variables */
+static Systray *systray = NULL;
static const char broken[] = "broken";
static char stext[256];
static int screen;
@@ -257,9 +292,10 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[MapRequest] = maprequest,
[MotionNotify] = motionnotify,
[PropertyNotify] = propertynotify,
+ [ResizeRequest] = resizerequest,
[UnmapNotify] = unmapnotify
};
-static Atom wmatom[WMLast], netatom[NetLast];
+static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
@@ -439,7 +475,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
- else if (ev->x > selmon->ww - TEXTW(stext))
+ else if (ev->x > selmon->ww - TEXTW(stext) - getsystraywidth())
click = ClkStatusText;
else
click = ClkWinTitle;
@@ -482,6 +518,11 @@ cleanup(void)
XUngrabKey(dpy, AnyKey, AnyModifier, root);
while (mons)
cleanupmon(mons);
+ if (showsystray) {
+ XUnmapWindow(dpy, systray->win);
+ XDestroyWindow(dpy, systray->win);
+ free(systray);
+ }
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++)
@@ -512,9 +553,57 @@ cleanupmon(Monitor *mon)
void
clientmessage(XEvent *e)
{
+ XWindowAttributes wa;
+ XSetWindowAttributes swa;
XClientMessageEvent *cme = &e->xclient;
Client *c = wintoclient(cme->window);
+ if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
+ /* add systray icons */
+ if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
+ if (!(c = (Client *)calloc(1, sizeof(Client))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Client));
+ if (!(c->win = cme->data.l[2])) {
+ free(c);
+ return;
+ }
+ c->mon = selmon;
+ c->next = systray->icons;
+ systray->icons = c;
+ if (!XGetWindowAttributes(dpy, c->win, &wa)) {
+ /* use sane defaults */
+ wa.width = bh;
+ wa.height = bh;
+ wa.border_width = 0;
+ }
+ c->x = c->oldx = c->y = c->oldy = 0;
+ c->w = c->oldw = wa.width;
+ c->h = c->oldh = wa.height;
+ c->oldbw = wa.border_width;
+ c->bw = 0;
+ c->isfloating = True;
+ /* reuse tags field as mapped status */
+ c->tags = 1;
+ updatesizehints(c);
+ updatesystrayicongeom(c, wa.width, wa.height);
+ XAddToSaveSet(dpy, c->win);
+ XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
+ XReparentWindow(dpy, c->win, systray->win, 0, 0);
+ /* use parents background color */
+ swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa);
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ /* FIXME not sure if I have to send these events, too */
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_FOCUS_IN, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ XSync(dpy, False);
+ resizebarwin(selmon);
+ updatesystray();
+ setclientstate(c, NormalState);
+ }
+ return;
+ }
if (!c)
return;
if (cme->message_type == netatom[NetWMState]) {
@@ -567,7 +656,7 @@ configurenotify(XEvent *e)
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
resizeclient(c, m->mx, m->my, m->mw, m->mh);
- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
+ resizebarwin(m);
}
focus(NULL);
arrange(NULL);
@@ -652,6 +741,11 @@ destroynotify(XEvent *e)
if ((c = wintoclient(ev->window)))
unmanage(c, 1);
+ else if ((c = wintosystrayicon(ev->window))) {
+ removesystrayicon(c);
+ resizebarwin(selmon);
+ updatesystray();
+ }
}
void
@@ -695,19 +789,23 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int x, w, sw = 0;
+ int x, w, sw = 0, stw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
+ if(showsystray && m == systraytomon(m))
+ stw = getsystraywidth();
+
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
+ sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
+ drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
}
+ resizebarwin(m);
for (c = m->clients; c; c = c->next) {
occ |= c->tags;
if (c->isurgent)
@@ -728,7 +826,7 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
- if ((w = m->ww - sw - x) > bh) {
+ if ((w = m->ww - sw - stw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
@@ -739,7 +837,7 @@ drawbar(Monitor *m)
drw_rect(drw, x, 0, w, bh, 1, 1);
}
}
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
+ drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
}
void
@@ -776,8 +874,11 @@ expose(XEvent *e)
Monitor *m;
XExposeEvent *ev = &e->xexpose;
- if (ev->count == 0 && (m = wintomon(ev->window)))
+ if (ev->count == 0 && (m = wintomon(ev->window))) {
drawbar(m);
+ if (m == selmon)
+ updatesystray();
+ }
}
void
@@ -862,10 +963,17 @@ getatomprop(Client *c, Atom prop)
unsigned long dl;
unsigned char *p = NULL;
Atom da, atom = None;
+ /* FIXME getatomprop should return the number of items and a pointer to
+ * the stored data instead of this workaround */
+ Atom req = XA_ATOM;
+ if (prop == xatom[XembedInfo])
+ req = xatom[XembedInfo];
- if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
+ if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req,
&da, &di, &dl, &dl, &p) == Success && p) {
atom = *(Atom *)p;
+ if (da == xatom[XembedInfo] && dl == 2)
+ atom = ((Atom *)p)[1];
XFree(p);
}
return atom;
@@ -899,6 +1007,16 @@ getstate(Window w)
return result;
}
+unsigned int
+getsystraywidth()
+{
+ unsigned int w = 0;
+ Client *i;
+ if(showsystray)
+ for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
+ return w ? w + systrayspacing : 1;
+}
+
int
gettextprop(Window w, Atom atom, char *text, unsigned int size)
{
@@ -1003,7 +1121,7 @@ killclient(const Arg *arg)
{
if (!selmon->sel)
return;
- if (!sendevent(selmon->sel, wmatom[WMDelete])) {
+ if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) {
XGrabServer(dpy);
XSetErrorHandler(xerrordummy);
XSetCloseDownMode(dpy, DestroyAll);
@@ -1091,6 +1209,12 @@ maprequest(XEvent *e)
{
static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest;
+ Client *i;
+ if ((i = wintosystrayicon(ev->window))) {
+ sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
+ resizebarwin(selmon);
+ updatesystray();
+ }
if (!XGetWindowAttributes(dpy, ev->window, &wa))
return;
@@ -1215,6 +1339,16 @@ propertynotify(XEvent *e)
Window trans;
XPropertyEvent *ev = &e->xproperty;
+ if ((c = wintosystrayicon(ev->window))) {
+ if (ev->atom == XA_WM_NORMAL_HINTS) {
+ updatesizehints(c);
+ updatesystrayicongeom(c, c->w, c->h);
+ }
+ else
+ updatesystrayiconstate(c, ev);
+ resizebarwin(selmon);
+ updatesystray();
+ }
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
updatestatus();
else if (ev->state == PropertyDelete)
@@ -1265,6 +1399,20 @@ recttomon(int x, int y, int w, int h)
return r;
}
+void
+removesystrayicon(Client *i)
+{
+ Client **ii;
+
+ if (!showsystray || !i)
+ return;
+ for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
+ if (ii)
+ *ii = i->next;
+ free(i);
+}
+
+
void
resize(Client *c, int x, int y, int w, int h, int interact)
{
@@ -1272,6 +1420,14 @@ resize(Client *c, int x, int y, int w, int h, int interact)
resizeclient(c, x, y, w, h);
}
+void
+resizebarwin(Monitor *m) {
+ unsigned int w = m->ww;
+ if (showsystray && m == systraytomon(m))
+ w -= getsystraywidth();
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
+}
+
void
resizeclient(Client *c, int x, int y, int w, int h)
{
@@ -1344,6 +1500,19 @@ resizemouse(const Arg *arg)
}
}
+void
+resizerequest(XEvent *e)
+{
+ XResizeRequestEvent *ev = &e->xresizerequest;
+ Client *i;
+
+ if ((i = wintosystrayicon(ev->window))) {
+ updatesystrayicongeom(i, ev->width, ev->height);
+ resizebarwin(selmon);
+ updatesystray();
+ }
+}
+
void
restack(Monitor *m)
{
@@ -1433,26 +1602,36 @@ setclientstate(Client *c, long state)
}
int
-sendevent(Client *c, Atom proto)
+sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
{
int n;
- Atom *protocols;
+ Atom *protocols, mt;
int exists = 0;
XEvent ev;
- if (XGetWMProtocols(dpy, c->win, &protocols, &n)) {
- while (!exists && n--)
- exists = protocols[n] == proto;
- XFree(protocols);
+ if (proto == wmatom[WMTakeFocus] || proto == wmatom[WMDelete]) {
+ mt = wmatom[WMProtocols];
+ if (XGetWMProtocols(dpy, w, &protocols, &n)) {
+ while (!exists && n--)
+ exists = protocols[n] == proto;
+ XFree(protocols);
+ }
+ }
+ else {
+ exists = True;
+ mt = proto;
}
if (exists) {
ev.type = ClientMessage;
- ev.xclient.window = c->win;
- ev.xclient.message_type = wmatom[WMProtocols];
+ ev.xclient.window = w;
+ ev.xclient.message_type = mt;
ev.xclient.format = 32;
- ev.xclient.data.l[0] = proto;
- ev.xclient.data.l[1] = CurrentTime;
- XSendEvent(dpy, c->win, False, NoEventMask, &ev);
+ ev.xclient.data.l[0] = d0;
+ ev.xclient.data.l[1] = d1;
+ ev.xclient.data.l[2] = d2;
+ ev.xclient.data.l[3] = d3;
+ ev.xclient.data.l[4] = d4;
+ XSendEvent(dpy, w, False, mask, &ev);
}
return exists;
}
@@ -1466,7 +1645,7 @@ setfocus(Client *c)
XA_WINDOW, 32, PropModeReplace,
(unsigned char *) &(c->win), 1);
}
- sendevent(c, wmatom[WMTakeFocus]);
+ sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
}
void
@@ -1555,6 +1734,10 @@ setup(void)
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
+ netatom[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False);
+ netatom[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False);
+ netatom[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False);
+ netatom[NetSystemTrayOrientationHorz] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION_HORZ", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
@@ -1562,6 +1745,9 @@ setup(void)
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+ xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
+ xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
+ xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -1570,6 +1756,8 @@ setup(void)
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
+ /* init system tray */
+ updatesystray();
/* init bars */
updatebars();
updatestatus();
@@ -1701,7 +1889,18 @@ togglebar(const Arg *arg)
{
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ resizebarwin(selmon);
+ if (showsystray) {
+ XWindowChanges wc;
+ if (!selmon->showbar)
+ wc.y = -bh;
+ else if (selmon->showbar) {
+ wc.y = 0;
+ if (!selmon->topbar)
+ wc.y = selmon->mh - bh;
+ }
+ XConfigureWindow(dpy, systray->win, CWY, &wc);
+ }
arrange(selmon);
}
@@ -1796,11 +1995,18 @@ unmapnotify(XEvent *e)
else
unmanage(c, 0);
}
+ else if ((c = wintosystrayicon(ev->window))) {
+ /* KLUDGE! sometimes icons occasionally unmap their windows, but do
+ * _not_ destroy them. We map those windows back */
+ XMapRaised(dpy, c->win);
+ updatesystray();
+ }
}
void
updatebars(void)
{
+ unsigned int w;
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
@@ -1811,10 +2017,15 @@ updatebars(void)
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
+ w = m->ww;
+ if (showsystray && m == systraytomon(m))
+ w -= getsystraywidth();
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
+ if (showsystray && m == systraytomon(m))
+ XMapRaised(dpy, systray->win);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
}
@@ -1990,6 +2201,121 @@ updatestatus(void)
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, "dwm-"VERSION);
drawbar(selmon);
+ updatesystray();
+}
+
+void
+updatesystrayicongeom(Client *i, int w, int h)
+{
+ if (i) {
+ i->h = bh;
+ if (w == h)
+ i->w = bh;
+ else if (h == bh)
+ i->w = w;
+ else
+ i->w = (int) ((float)bh * ((float)w / (float)h));
+ applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
+ /* force icons into the systray dimensions if they don't want to */
+ if (i->h > bh) {
+ if (i->w == i->h)
+ i->w = bh;
+ else
+ i->w = (int) ((float)bh * ((float)i->w / (float)i->h));
+ i->h = bh;
+ }
+ }
+}
+
+void
+updatesystrayiconstate(Client *i, XPropertyEvent *ev)
+{
+ long flags;
+ int code = 0;
+
+ if (!showsystray || !i || ev->atom != xatom[XembedInfo] ||
+ !(flags = getatomprop(i, xatom[XembedInfo])))
+ return;
+
+ if (flags & XEMBED_MAPPED && !i->tags) {
+ i->tags = 1;
+ code = XEMBED_WINDOW_ACTIVATE;
+ XMapRaised(dpy, i->win);
+ setclientstate(i, NormalState);
+ }
+ else if (!(flags & XEMBED_MAPPED) && i->tags) {
+ i->tags = 0;
+ code = XEMBED_WINDOW_DEACTIVATE;
+ XUnmapWindow(dpy, i->win);
+ setclientstate(i, WithdrawnState);
+ }
+ else
+ return;
+ sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0,
+ systray->win, XEMBED_EMBEDDED_VERSION);
+}
+
+void
+updatesystray(void)
+{
+ XSetWindowAttributes wa;
+ XWindowChanges wc;
+ Client *i;
+ Monitor *m = systraytomon(NULL);
+ unsigned int x = m->mx + m->mw;
+ unsigned int w = 1;
+
+ if (!showsystray)
+ return;
+ if (!systray) {
+ /* init systray */
+ if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
+ systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
+ wa.event_mask = ButtonPressMask | ExposureMask;
+ wa.override_redirect = True;
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ XSelectInput(dpy, systray->win, SubstructureNotifyMask);
+ XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1);
+ XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa);
+ XMapRaised(dpy, systray->win);
+ XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
+ if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
+ sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
+ XSync(dpy, False);
+ }
+ else {
+ fprintf(stderr, "dwm: unable to obtain system tray.\n");
+ free(systray);
+ systray = NULL;
+ return;
+ }
+ }
+ for (w = 0, i = systray->icons; i; i = i->next) {
+ /* make sure the background color stays the same */
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
+ XMapRaised(dpy, i->win);
+ w += systrayspacing;
+ i->x = w;
+ XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
+ w += i->w;
+ if (i->mon != m)
+ i->mon = m;
+ }
+ w = w ? w + systrayspacing : 1;
+ x -= w;
+ XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh);
+ wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh;
+ wc.stack_mode = Above; wc.sibling = m->barwin;
+ XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
+ XMapWindow(dpy, systray->win);
+ XMapSubwindows(dpy, systray->win);
+ /* redraw background */
+ XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
+ XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
+ XSync(dpy, False);
}
void
@@ -2057,6 +2383,16 @@ wintoclient(Window w)
return NULL;
}
+Client *
+wintosystrayicon(Window w) {
+ Client *i = NULL;
+
+ if (!showsystray || !w)
+ return i;
+ for (i = systray->icons; i && i->win != w; i = i->next) ;
+ return i;
+}
+
Monitor *
wintomon(Window w)
{
@@ -2110,6 +2446,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+Monitor *
+systraytomon(Monitor *m) {
+ Monitor *t;
+ int i, n;
+ if(!systraypinning) {
+ if(!m)
+ return selmon;
+ return m == selmon ? m : NULL;
+ }
+ for(n = 1, t = mons; t && t->next; n++, t = t->next) ;
+ for(i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next) ;
+ if(systraypinningfailfirst && n < systraypinning)
+ return mons;
+ return t;
+}
+
void
zoom(const Arg *arg)
{
--
2.17.1

View file

@ -1,26 +0,0 @@
# Template file for 'dwm'
pkgname=dwm
version=6.2
revision=5
makedepends="libXinerama-devel libXft-devel freetype-devel"
short_desc="Dynamic window manager for X"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="http://dwm.suckless.org"
distfiles="https://dl.suckless.org/dwm/dwm-${version}.tar.gz"
checksum=97902e2e007aaeaa3c6e3bed1f81785b817b7413947f1db1d3b62b8da4cd110e
patch_args="-Np1"
do_build() {
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
sed -i "/CFLAGS/s|\${CPPFLAGS}|& $CFLAGS|g" config.mk
sed -i "/LDFLAGS/s|\-s|$LDFLAGS|g" config.mk
make CC=$CC INCS="-I. -I${XBPS_CROSS_BASE}/usr/include/freetype2" LIBS="-lX11 -lXinerama -lXft -lfontconfig"
}
do_install() {
make PREFIX=/usr DESTDIR=$DESTDIR install
vinstall README 644 usr/share/doc/$pkgname
vinstall ${FILESDIR}/dwm.desktop 644 usr/share/xsessions
vlicense LICENSE
}

View file

@ -1,95 +0,0 @@
diff --git a/config.def.h b/config.def.h
index 86b7e76..d545925 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,18 +2,18 @@ static const char *background_color = "#3e3e3e";
static const char *border_color = "#ececec";
static const char *font_color = "#ececec";
static const char *font_pattern = "monospace:size=10";
-static const unsigned line_spacing = 5;
-static const unsigned int padding = 15;
+static unsigned line_spacing = 5;
+static unsigned int padding = 15;
-static const unsigned int width = 450;
-static const unsigned int border_size = 2;
-static const unsigned int pos_x = 30;
-static const unsigned int pos_y = 60;
+static unsigned int width = 450;
+static unsigned int border_size = 2;
+static unsigned int pos_x = 30;
+static unsigned int pos_y = 60;
enum corners { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
enum corners corner = TOP_RIGHT;
-static const unsigned int duration = 5; /* in seconds */
+static unsigned int duration = 5; /* in seconds */
#define DISMISS_BUTTON Button1
#define ACTION_BUTTON Button3
diff --git a/herbe.c b/herbe.c
index 51d3990..574e967 100644
--- a/herbe.c
+++ b/herbe.c
@@ -1,5 +1,6 @@
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
+#include <X11/Xresource.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -15,6 +16,13 @@
#define EXIT_FAIL 1
#define EXIT_DISMISS 2
+#define XRES_STR(name) \
+ if (XrmGetResource(db, "herbe." #name, "*", &type, &val)) \
+ name = val.addr
+#define XRES_INT(name) \
+ if (XrmGetResource(db, "herbe." #name, "*", &type, &val)) \
+ name = strtoul(val.addr, 0, 10)
+
Display *display;
Window window;
int exit_code = EXIT_DISMISS;
@@ -107,6 +115,28 @@ int main(int argc, char *argv[])
if (!(display = XOpenDisplay(0)))
die("Cannot open display");
+ XrmInitialize();
+
+ char *res_man = XResourceManagerString(display);
+ XrmDatabase db = XrmGetStringDatabase(res_man);
+
+ char *type;
+ XrmValue val;
+
+ XRES_STR(background_color);
+ XRES_STR(border_color);
+ XRES_STR(font_color);
+ XRES_STR(font_pattern);
+
+ XRES_INT(line_spacing);
+ XRES_INT(padding);
+ XRES_INT(width);
+ XRES_INT(border_size);
+ XRES_INT(pos_x);
+ XRES_INT(pos_y);
+ XRES_INT(corner);
+ XRES_INT(duration);
+
int screen = DefaultScreen(display);
Visual *visual = DefaultVisual(display, screen);
Colormap colormap = DefaultColormap(display, screen);
@@ -214,7 +244,8 @@ int main(int argc, char *argv[])
XftDrawDestroy(draw);
XftColorFree(display, visual, colormap, &color);
XftFontClose(display, font);
+ XrmDestroyDatabase(db);
XCloseDisplay(display);
return exit_code;
-}
\ No newline at end of file
+}

View file

@ -1,22 +0,0 @@
# Template file for 'herbe'
pkgname=herbe
version=1.0.0
revision=1
build_style=gnu-makefile
makedepends="libXft-devel freetype-devel"
short_desc="Daemon-less notifications without D-Bus. Minimal and lightweight"
maintainer="tuxliban <tenshalito@gmail.com>"
license="MIT"
homepage="https://github.com/dudik/herbe"
distfiles="${homepage}/archive/${version}.tar.gz"
checksum=78e454159050c86e030fb5a6cf997ac914345210cdf5a4ca4d7600c5296b7f76
patch_args="-Np1"
do_build() {
CFLAGS="-I ${XBPS_CROSS_BASE}/usr/include/freetype2"
}
do_install() {
make PREFIX=/usr DESTDIR=$DESTDIR install
vlicense LICENSE
}

View file

@ -1,51 +0,0 @@
# Template file for 'palemoon'
pkgname=palemoon
version=29.2.1
revision=1
_release=1
archs="i686 x86_64"
hostmakedepends="curl python3-html2text tar xz"
depends="libvpx alsa-lib dbus-glib libXt gtk+"
short_desc="Open-source web browser based on Firefox focusing on efficiency"
maintainer="tuxliban <tenshalito@gmail.com>"
license="LGPL-2.1-or-later MPL-2.0-or-later GPL-3.0-or-later"
homepage="https://www.palemoon.org"
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
_debarch=amd64
checksum=695db94a6db9fa410f961a9c93452e5568eef14ff9d4cb91e1b033cdb6ccc7a4
else
_debarch=i386
checksum=e5d3de94e8059f6d40925fedc68ecae3851494a8702e3839822927791fb2ddef
fi
distfiles="https://download.opensuse.org/repositories/home:/stevenpusser/Debian_10/${_debarch}/${pkgname}_${version}-${_release}.gtk2_${_debarch}.deb"
_licenseURL="https://www.palemoon.org/redist.shtml"
do_extract() {
ar x ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname}_${version}-${_release}.gtk2_${_debarch}.deb
tar xf data.tar.xz
}
do_install() {
vinstall usr/share/applications/${pkgname}.desktop 0644 \
usr/share/applications
# Crear directorio en path falso ($DESTDIR) para el paquete
vmkdir opt
vmkdir usr/bin
# Mover archivos de forma recursiva
vcopy usr/lib/palemoon opt
ln -s /opt/palemoon/palemoon "${DESTDIR}/usr/bin/palemoon"
for res in 16 32 48 128; do
vinstall usr/share/icons/hicolor/${res}x${res}/apps/${pkgname}.png 0644 \
usr/share/icons/hicolor/${res}x${res}/apps ${pkgname}.png
done
}
post_install() {
curl ${_licenseURL} | html2text | sed '1,57d' > EULA.md
vlicense EULA.md
}

View file

@ -1,2 +0,0 @@
#!/bin/sh
exec scrond -n 2>&1

View file

@ -1,34 +0,0 @@
# Template file for 'scron'
pkgname=scron
version=0.4
revision=3
wrksrc=${pkgname}
build_style=gnu-makefile
short_desc="Simple cron daemon"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="https://git.disroot.org/tuxliban/scron"
distfiles="${homepage}/archive/${version}.tar.gz"
checksum=eec79d97efbc5237f171fd43610b4aca20833c687721e795bfa9600d7845f3b6
provides="cron-daemon-0_1"
alternatives="
crond:crond:/etc/sv/scron
crond:crond:/usr/bin/scrond
"
pre_build() {
# STFU gcc
sed -i 's|BSD_SOURCE|DEFAULT_SOURCE|g' Makefile
sed -i 's|^CC|#CC|g' Makefile
sed -i 's|^CFLAGS|#CFLAGS|g' Makefile
sed -i 's|^LDFLAGS|#LDFLAGS|g' Makefile
}
do_install() {
vbin crond scrond
vsv scron
vlicense LICENSE
# vdoc README
vman scron.1
}

View file

@ -1,65 +0,0 @@
include config.mk
.POSIX:
.SUFFIXES: .c .o
HDR = util.h arg.h
LIB = \
util/strlcpy.o \
util/eprintf.o
SRC = sdhcp.c
OBJ = $(SRC:.c=.o) $(LIB)
BIN = $(SRC:.c=)
MAN = $(SRC:.c=.1)
all: options binlib
options:
@echo sdhcp build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
binlib: util.a
$(MAKE) bin
bin: $(BIN)
$(OBJ): $(HDR) config.mk
.o:
@echo LD $@
@$(LD) -o $@ $< util.a $(LDFLAGS)
.c.o:
@echo CC $<
@$(CC) -c -o $@ $< $(CFLAGS)
util.a: $(LIB)
@echo AR $@
@$(AR) -r -c $@ $(LIB)
@ranlib $@
install: all
@echo installing executables to $(DESTDIR)$(PREFIX)/bin
@mkdir -p $(DESTDIR)$(PREFIX)/bin
@cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
@cd $(DESTDIR)$(PREFIX)/bin && chmod 755 $(BIN)
@echo installing manual pages to $(DESTDIR)$(MANPREFIX)/man1
@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
@for m in $(MAN); do sed "s/VERSION/$(VERSION)/g" < "$$m" > $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
@cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
uninstall:
@echo removing executables from $(DESTDIR)$(PREFIX)/bin
@cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
@echo removing manual pages from $(DESTDIR)$(MANPREFIX)/man1
@cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN)
clean:
@echo cleaning
@rm -f $(BIN) $(OBJ) util.a
.PHONY: all options clean install uninstall

View file

@ -1,24 +0,0 @@
# Template file for 'sdhcp'
pkgname=sdhcp
version=0.1
revision=1
wrksrc=${pkgname}
build_style=gnu-makefile
#hostmakedepends="git"
short_desc="IPv4 simple dhcp client"
maintainer="tuxliban <tenshalito@gmail.com>"
license="MIT"
homepage="https://git.disroot.org/tuxliban/sdhcp"
distfiles="${homepage}/archive/${version}.tar.gz"
checksum=318b0c2a1d6236c43995372fcc3c0d190896b6cd4ca8ca67ccbc963a2eba7c7f
#do_fetch() {
# git clone git://git.2f30.org/sdhcp.git ${wkrsrc} --depth 1
# cd ${wrksrc}
# git checkout master
#}
do_build() {
[ -e ${FILESDIR}/Makefile ] && cp ${FILESDIR}/Makefile Makefile
export CFLAGS=${CFLAGS}
}

View file

@ -1,252 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <string.h>
#include "../util.h"
#if defined(__linux__)
#include <limits.h>
#include <stdint.h>
#include <unistd.h>
static const char *
pick(const char *bat, const char *f1, const char *f2, char *path,
size_t length)
{
if (esnprintf(path, length, f1, bat) > 0 &&
access(path, R_OK) == 0) {
return f1;
}
if (esnprintf(path, length, f2, bat) > 0 &&
access(path, R_OK) == 0) {
return f2;
}
return NULL;
}
const char *
battery_perc(const char *bat)
{
int perc;
char path[PATH_MAX];
if (esnprintf(path, sizeof(path),
"/sys/class/power_supply/%s/capacity", bat) < 0) {
return NULL;
}
if (pscanf(path, "%d", &perc) != 1) {
return NULL;
}
return bprintf("%d", perc);
}
const char *
battery_state(const char *bat)
{
static struct {
char *state;
char *symbol;
} map[] = {
{ "Charging", "" },
{ "Discharging", "" },
{ "Full", "" },
};
size_t i;
char path[PATH_MAX], state[12];
if (esnprintf(path, sizeof(path),
"/sys/class/power_supply/%s/status", bat) < 0) {
return NULL;
}
if (pscanf(path, "%12s", state) != 1) {
return NULL;
}
for (i = 0; i < LEN(map); i++) {
if (!strcmp(map[i].state, state)) {
break;
}
}
return (i == LEN(map)) ? "" : map[i].symbol;
}
const char *
battery_remaining(const char *bat)
{
uintmax_t charge_now, current_now, m, h;
double timeleft;
char path[PATH_MAX], state[12];
if (esnprintf(path, sizeof(path),
"/sys/class/power_supply/%s/status", bat) < 0) {
return NULL;
}
if (pscanf(path, "%12s", state) != 1) {
return NULL;
}
if (!pick(bat, "/sys/class/power_supply/%s/charge_now",
"/sys/class/power_supply/%s/energy_now", path,
sizeof(path)) ||
pscanf(path, "%ju", &charge_now) < 0) {
return NULL;
}
if (!strcmp(state, "Discharging")) {
if (!pick(bat, "/sys/class/power_supply/%s/current_now",
"/sys/class/power_supply/%s/power_now", path,
sizeof(path)) ||
pscanf(path, "%ju", &current_now) < 0) {
return NULL;
}
if (current_now == 0) {
return NULL;
}
timeleft = (double)charge_now / (double)current_now;
h = timeleft;
m = (timeleft - (double)h) * 60;
return bprintf("%juh %jum", h, m);
}
return "";
}
#elif defined(__OpenBSD__)
#include <fcntl.h>
#include <machine/apmvar.h>
#include <sys/ioctl.h>
#include <unistd.h>
static int
load_apm_power_info(struct apm_power_info *apm_info)
{
int fd;
fd = open("/dev/apm", O_RDONLY);
if (fd < 0) {
warn("open '/dev/apm':");
return 0;
}
memset(apm_info, 0, sizeof(struct apm_power_info));
if (ioctl(fd, APM_IOC_GETPOWER, apm_info) < 0) {
warn("ioctl 'APM_IOC_GETPOWER':");
close(fd);
return 0;
}
return close(fd), 1;
}
const char *
battery_perc(const char *unused)
{
struct apm_power_info apm_info;
if (load_apm_power_info(&apm_info)) {
return bprintf("%d", apm_info.battery_life);
}
return NULL;
}
const char *
battery_state(const char *unused)
{
struct {
unsigned int state;
char *symbol;
} map[] = {
{ APM_AC_ON, "+" },
{ APM_AC_OFF, "-" },
};
struct apm_power_info apm_info;
size_t i;
if (load_apm_power_info(&apm_info)) {
for (i = 0; i < LEN(map); i++) {
if (map[i].state == apm_info.ac_state) {
break;
}
}
return (i == LEN(map)) ? "?" : map[i].symbol;
}
return NULL;
}
const char *
battery_remaining(const char *unused)
{
struct apm_power_info apm_info;
if (load_apm_power_info(&apm_info)) {
if (apm_info.ac_state != APM_AC_ON) {
return bprintf("%uh %02um",
apm_info.minutes_left / 60,
apm_info.minutes_left % 60);
} else {
return "";
}
}
return NULL;
}
#elif defined(__FreeBSD__)
#include <sys/sysctl.h>
const char *
battery_perc(const char *unused)
{
int cap;
size_t len;
len = sizeof(cap);
if (sysctlbyname("hw.acpi.battery.life", &cap, &len, NULL, 0) == -1
|| !len)
return NULL;
return bprintf("%d", cap);
}
const char *
battery_state(const char *unused)
{
int state;
size_t len;
len = sizeof(state);
if (sysctlbyname("hw.acpi.battery.state", &state, &len, NULL, 0) == -1
|| !len)
return NULL;
switch(state) {
case 0:
case 2:
return "+";
case 1:
return "-";
default:
return "?";
}
}
const char *
battery_remaining(const char *unused)
{
int rem;
size_t len;
len = sizeof(rem);
if (sysctlbyname("hw.acpi.battery.time", &rem, &len, NULL, 0) == -1
|| !len
|| rem == -1)
return NULL;
return bprintf("%uh %02um", rem / 60, rem % 60);
}
#endif

View file

@ -1,81 +0,0 @@
/* See LICENSE file for copyright and license details. */
/* interval between updates (in ms) */
const unsigned int interval = 1000;
/* text to show if no value can be retrieved */
static const char unknown_str[] = "n/a";
/* maximum output string length */
#define MAXLEN 2048
/*
* function description argument (example)
*
* battery_perc battery percentage battery name (BAT0)
* NULL on OpenBSD/FreeBSD
* battery_state battery charging state battery name (BAT0)
* NULL on OpenBSD/FreeBSD
* battery_remaining battery remaining HH:MM battery name (BAT0)
* NULL on OpenBSD/FreeBSD
* cpu_perc cpu usage in percent NULL
* cpu_freq cpu frequency in MHz NULL
* datetime date and time format string (%F %T)
* disk_free free disk space in GB mountpoint path (/)
* disk_perc disk usage in percent mountpoint path (/)
* disk_total total disk space in GB mountpoint path (/")
* disk_used used disk space in GB mountpoint path (/)
* entropy available entropy NULL
* gid GID of current user NULL
* hostname hostname NULL
* ipv4 IPv4 address interface name (eth0)
* ipv6 IPv6 address interface name (eth0)
* kernel_release `uname -r` NULL
* keyboard_indicators caps/num lock indicators format string (c?n?)
* see keyboard_indicators.c
* keymap layout (variant) of current NULL
* keymap
* load_avg load average NULL
* netspeed_rx receive network speed interface name (wlan0)
* netspeed_tx transfer network speed interface name (wlan0)
* num_files number of files in a directory path
* (/home/foo/Inbox/cur)
* ram_free free memory in GB NULL
* ram_perc memory usage in percent NULL
* ram_total total memory size in GB NULL
* ram_used used memory in GB NULL
* run_command custom shell command command (echo foo)
* swap_free free swap in GB NULL
* swap_perc swap usage in percent NULL
* swap_total total swap size in GB NULL
* swap_used used swap in GB NULL
* temp temperature in degree celsius sensor file
* (/sys/class/thermal/...)
* NULL on OpenBSD
* thermal zone on FreeBSD
* (tz0, tz1, etc.)
* uid UID of current user NULL
* uptime system uptime NULL
* username username of current user NULL
* vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer)
* wifi_perc WiFi signal in percent interface name (wlan0)
* wifi_essid WiFi ESSID interface name (wlan0)
*/
static const struct arg args[] = {
/* function format argument */
{ run_command, "%s ","get_song.sh" }, // Indicador de pista de música
// { run_command, " ☀ %s%% ", "light -G" }, // Brillo de pantalla
{ cpu_perc, "| %2s%% ", NULL }, // Uso del cpu
// { ram_perc, "| %2s%% ", NULL }, // Uso de la ram
// { keyboard_indicators, "| NUM:%s ", "n?" }, // Indicador de teclado numérico
{ temp, "|  %s° ", "/sys/class/thermal/thermal_zone1/temp" }, // Temperatura
// { battery_state, "|  %s", "BAT1" }, // Estado de la batería
// { battery_perc, "%s%% ", "BAT1" }, // Porcentaje batería
// { wifi_perc, "|  %s%% ", "wlan0" }, // Calidad conexión wifi
{ run_command, "| %s ", "volume.sh" }, // Indicador de volumen
// { num_files, "|  %s ", "/home/skynet/.local/share/Trash/files/" }, // Papelera de reciclaje
// { num_files, "|  %s ", "/home/skynet/Datos/.Trash-1000/files/" }, // Papelera de reciclaje
{ datetime, "%s ", "|  %a %e %B  %R" }, // Fecha y hora
{ battery_state, "| %s","BAT1" }, // Estado de la bateria
};

View file

@ -1,31 +0,0 @@
# Template file for 'slstatus'
pkgname=slstatus
version=20201130
revision=1
wrksrc="${pkgname}"
build_style=gnu-makefile
hostmakedepends="git pkg-config"
makedepends="alsa-lib-devel libX11-devel"
short_desc="Suckless status monitor for dwm"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="ISC"
homepage="https://tools.suckless.org/slstatus/"
do_fetch() {
git clone https://github.com/drkhsh/slstatus.git ${wkrsrc} --depth 1
cd ${wrksrc}
git checkout master
}
pre_build() {
# Archivo de configuración
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
# Modulo de bateria personalizado
[ -e ${FILESDIR}/battery.c ] && cp ${FILESDIR}/battery.c components/battery.c
sed -i -e 's|^CFLAGS *=|override CFLAGS +=|g' \
-e 's|^LDFLAGS *=|override LDFLAGS +=|g' config.mk
}
post_install() {
vlicense LICENSE
}

View file

@ -1,41 +0,0 @@
# Template file for 'st'
pkgname=st
version=0.8.2
revision=2
wrksrc=${pkgname}
build_style=gnu-makefile
make_use_env=compliant
hostmakedepends="git pkg-config"
makedepends="fontconfig-devel libX11-devel libXft-devel"
depends="ncurses st-terminfo-${version}_${revision}"
short_desc="Simple terminal implementation for X"
maintainer="Tuxliban Torvalds <tenshalito@gmail.com>"
license="MIT"
homepage="https://st.suckless.org"
do_fetch(){
git clone https://github.com/tuxliban/st.git ${wkrsrc} --depth 1
cd ${wrksrc}
git checkout master
}
pre_build() {
sed -i 's|Ubuntu Mono:pixelsize=11|Ubuntu Mono:pixelsize=13|g' config.h
[ -e ${FILESDIR}/config.h ] && cp ${FILESDIR}/config.h config.h
# We will use tic after install. See INSTALL.
sed -i '/tic/d' Makefile
}
post_install() {
vinstall st.info 644 usr/share/terminfo/s st.terminfo
vdoc README
vlicense LICENSE
}
st-terminfo_package() {
short_desc+=" - terminfo data"
archs=noarch
pkg_install() {
vmove usr/share/terminfo
}
}

View file

@ -1,13 +0,0 @@
# Template file for 'tiramisu'
pkgname=tiramisu
version=1.0
revision=1
build_style=gnu-makefile
hostmakedepends="pkg-config"
makedepends="libglib-devel"
short_desc="Desktop notifications, the UNIX way"
maintainer="tuxliban <tenshalito@gmail.com>"
license="MIT"
homepage="https://github.com/Sweets/tiramisu"
distfiles="${homepage}/archive/${version}.tar.gz"
checksum=4681788288c17aa1fd75b972c3d9661a13c164d810520fc838837a748baf669e

View file

@ -1,30 +0,0 @@
static struct Config config = {
/* fonts, separate different fonts with comma */
.titlefont = "ubuntu:size=10:style=bold",
.bodyfont = "ubuntu:size=9",
/* colors */
.background_color = "#263238",
.foreground_color = "#ececec",
.border_color = "#ececec",
/* geometry and gravity (see the manual) */
.geometryspec = "250x0-5+25",
.gravityspec = "NE",
/* size of border, gaps and image (in pixels) */
.border_pixels = 1,
.gap_pixels = 5,
.image_pixels = 0, /* if 0, the image will fit the notification */
.leading_pixels = 5, /* space between title and body texts */
.padding_pixels = 10, /* space around content */
/* text alignment, set to LeftAlignment, CenterAlignment or RightAlignment */
.alignment = RightAlignment,
/* set to nonzero to shrink notification width to its content size */
.shrink = 0,
/* time, in seconds, for a notification to stay alive */
.sec = 15
};

View file

@ -1,26 +0,0 @@
# Template file for 'xnotify'
pkgname=xnotify
version=0.8.1
revision=1
build_style=gnu-makefile
makedepends="imlib2-devel libX11-devel libXft-devel libXinerama-devel"
short_desc="Simple yet powerful notification launcher without dbus"
maintainer="tuxliban <tenshalito@gmail.com>"
license="MIT"
homepage="https://github.com/phillbush/xnotify"
distfiles="${homepage}/archive/v${version}.tar.gz"
checksum=bb409c37e898674843d5279eb990b3da73cdbf00bc2dc2f8aa36fc0235e3ca7b
pre_build() {
if [ -e ${FILESDIR}/config.h ]; then
cp ${FILESDIR}/config.h config.h
fi
}
do_build() {
export CFLAGS=${CFLAGS}
}
post_install() {
vlicense LICENSE
}