static-httpd

Sitio web estático (HTML + CSS) que sostiene el blog del autor
Log | Files | Refs

index.html (6576B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      5 <meta name="viewport" content="width=device-width, initial-scale=1" />
      6 <title>Configuración de slstatus</title>
      7 <link rel="icon" type="image/png" href="/favicon.png" />
      8 <link rel="stylesheet" type="text/css" href="../article.css" />
      9 </head>
     10 <body>
     11 <header>
     12 <p class="title">Configuración de slstatus</p>
     13 <p class="date">22 de junio de 2026 • fjbalon</p>
     14 </header>
     15 <p>slstatus es un monitor de estado minimalista para dwm, desarrollado, evidentemente por suckless. Lo que hace es añadir información a la barra de estado, arriba a la derecha por defecto, de tal forma que el usuario puede, en dwm, configurar una vista de la fecha y hora, de la capacidad de batería, del estado del brillo y del volumen, de la IP de salida actual, etcétera. Lo que el usuario parametrice.</p>
     16 <p>Puede encontrar mi propia versión del código en mi servidor de git: <a href="https://templier.es/git/slstatus/">/git/slstatus/</a>.</p>
     17 <p>Su uso es extremadamente sencillo, siendo que por defecto; la configuración de <emb>config.h</emb> es la siguiente:</p>
     18 <pre><code>const unsigned int interval = 1000;
     19 static const char unknown_str[] = "n/a";
     20 #define MAXLEN 2048
     21 
     22 static const struct arg args[] = {
     23 	{ datetime, "%s",           "%F %T" },
     24 };</code></pre>
     25 <p>La configuración por defecto de <emb>datetime</emb> la he dejado con una configuración que me gusta algo más: <emb>{ datetime, " %s", "%d/%m/%y %H:%M" },</emb>, de tal forma que la fecha mostrada es <emb>22/07/26 16:59</emb>.</p>
     26 <p>Lo que más nos interesa por el momento es la estructura <emb>arg</emb>, que es un array de elementos a mostrar por pantalla. En un inicio, sólo mostrará la fecha y hora. Pero hay muchas más opciones ya programadas en el código base, como <emb>battery_perc</emb>. <emb>battery_remaining</emb> y <emb>battery_state</emb>, que muestra el porcentaje de batería, el cálculo del tiempo restante y el estado de la batería (en carga, en descarga, completa...), respectivamente.</p>
     27 <p>De tal forma añado, en mi caso, el siguiente contenido para su muestra en la barra de estado:</p>
     28 <pre><code>{ battery_state, "%s", "BAT0" },
     29 { battery_perc, "%s", "BAT0" },
     30 { battery_remaining, " %s", "BAT0" },</code></pre>
     31 <p>Por gusto personal he cambiado también el código de <emb>components/battery.c</emb>, para que al descargar muestre <emb>ϟ</emb> y al cargar, <emb>ϟϟ</emb>.</p>
     32 <pre><code class="diff"><span class="info">diff --git a/components/battery.c b/components/battery.c</span>
     33 <span class="hunk">@@ -56,8 +56,8 @@</span>
     34              char *state;
     35              char *symbol;
     36          } map[] = {
     37 <span class="del">-            { "Charging",    "+" },</span>
     38 <span class="del">-            { "Discharging", "-" },</span>
     39 <span class="add">+            { "Charging",    "ϟϟ" },</span>
     40 <span class="add">+            { "Discharging", "ϟ" },</span>
     41              { "Full",        "o" },
     42              { "Not charging", "o" },
     43          };</code></pre>
     44 
     45 <!--
     46  * battery_perc        battery percentage              battery name (BAT0)
     47  *                                                     NULL on OpenBSD/FreeBSD
     48  * battery_remaining   battery remaining HH:MM         battery name (BAT0)
     49  *                                                     NULL on OpenBSD/FreeBSD
     50  * battery_state       battery charging state          battery name (BAT0)
     51  *                                                     NULL on OpenBSD/FreeBSD
     52  * cat                 read arbitrary file             path
     53  * cpu_freq            cpu frequency in MHz            NULL
     54  * cpu_perc            cpu usage in percent            NULL
     55  * datetime            date and time                   format string (%F %T)
     56  * disk_free           free disk space in GB           mountpoint path (/)
     57  * disk_perc           disk usage in percent           mountpoint path (/)
     58  * disk_total          total disk space in GB          mountpoint path (/)
     59  * disk_used           used disk space in GB           mountpoint path (/)
     60  * entropy             available entropy               NULL
     61  * gid                 GID of current user             NULL
     62  * hostname            hostname                        NULL
     63  * ipv4                IPv4 address                    interface name (eth0)
     64  * ipv6                IPv6 address                    interface name (eth0)
     65  * kernel_release      `uname -r`                      NULL
     66  * keyboard_indicators caps/num lock indicators        format string (c?n?)
     67  *                                                     see keyboard_indicators.c
     68  * keymap              layout (variant) of current     NULL
     69  *                     keymap
     70  * load_avg            load average                    NULL
     71  * netspeed_rx         receive network speed           interface name (wlan0)
     72  * netspeed_tx         transfer network speed          interface name (wlan0)
     73  * num_files           number of files in a directory  path
     74  *                                                     (/home/foo/Inbox/cur)
     75  * ram_free            free memory in GB               NULL
     76  * ram_perc            memory usage in percent         NULL
     77  * ram_total           total memory size in GB         NULL
     78  * ram_used            used memory in GB               NULL
     79  * run_command         custom shell command            command (echo foo)
     80  * swap_free           free swap in GB                 NULL
     81  * swap_perc           swap usage in percent           NULL
     82  * swap_total          total swap size in GB           NULL
     83  * swap_used           used swap in GB                 NULL
     84  * temp                temperature in degree celsius   sensor file
     85  *                                                     (/sys/class/thermal/...)
     86  *                                                     NULL on OpenBSD
     87  *                                                     thermal zone on FreeBSD
     88  *                                                     (tz0, tz1, etc.)
     89  * uid                 UID of current user             NULL
     90  * up                  interface is running            interface name (eth0)
     91  * uptime              system uptime                   NULL
     92  * username            username of current user        NULL
     93  * vol_perc            OSS/ALSA volume in percent      mixer file (/dev/mixer)
     94  *                                                     NULL on OpenBSD/FreeBSD
     95  * wifi_essid          WiFi ESSID                      interface name (wlan0)
     96  * wifi_perc           WiFi signal in percent          interface name (wlan0)
     97 -->
     98 
     99 </body>
    100 </html>