config.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * function description argument (example)
  3. *
  4. * battery_perc battery percentage battery name (BAT0)
  5. * NULL on OpenBSD/FreeBSD
  6. * battery_state battery charging state battery name (BAT0)
  7. * NULL on OpenBSD/FreeBSD
  8. * battery_remaining battery remaining HH:MM battery name (BAT0)
  9. * NULL on OpenBSD/FreeBSD
  10. * bspwm_ws bspwm workspaces for lemonbar NULL
  11. * cpu_perc cpu usage in percent NULL
  12. * cpu_freq cpu frequency in MHz NULL
  13. * datetime date and time format string (%F %T)
  14. * disk_free free disk space in GB mountpoint path (/)
  15. * disk_perc disk usage in percent mountpoint path (/)
  16. * disk_total total disk space in GB mountpoint path (/")
  17. * disk_used used disk space in GB mountpoint path (/)
  18. * entropy available entropy NULL
  19. * gid GID of current user NULL
  20. * hostname hostname NULL
  21. * ipv4 IPv4 address interface name (eth0)
  22. * ipv6 IPv6 address interface name (eth0)
  23. * kernel_release `uname -r` NULL
  24. * keymap layout of current keymap NULL
  25. * load_avg load average NULL
  26. * netspeed_rx receive network speed interface name (wlan0)
  27. * netspeed_tx transfer network speed interface name (wlan0)
  28. * num_files number of files in a directory path
  29. * (/home/foo/Inbox/cur)
  30. * ram_free free memory in GB NULL
  31. * ram_perc memory usage in percent NULL
  32. * ram_total total memory size in GB NULL
  33. * ram_used used memory in GB NULL
  34. * run_command custom shell command command (echo foo)
  35. * swap_free free swap in GB NULL
  36. * swap_perc swap usage in percent NULL
  37. * swap_total total swap size in GB NULL
  38. * swap_used used swap in GB NULL
  39. * temp temperature in degree celsius NULL on OpenBSD
  40. * NULL or thermal zone
  41. * on Linux
  42. * (hwmon0, hwmon1, etc.)
  43. * thermal zone on FreeBSD
  44. * (tz0, tz1, etc.)
  45. * uid UID of current user NULL
  46. * uptime system uptime NULL
  47. * username username of current user NULL
  48. * vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer)
  49. * wifi_perc WiFi signal in percent interface name (wlan0)
  50. * wifi_essid WiFi ESSID interface name (wlan0)
  51. *
  52. * EXTRA INFO:
  53. *
  54. * - every arg must ends with `END`
  55. *
  56. * - if you want to run function once (for example `hostname`),
  57. * then set interval to `ONCE`
  58. *
  59. * EXTRA CONFIGS IN:
  60. * - components_config.h
  61. */
  62. /* for usleep */
  63. #define SEC * 1000
  64. #define MIN * 60 SEC
  65. #define ONCE ((unsigned int) -1) /* to run */
  66. /* text to show if no value can be retrieved */
  67. static const char unknown_str[] = "n/a";
  68. /* maximum output string length */
  69. #define MAXLEN 256
  70. /*
  71. * if you want to change buffer size for each segment,
  72. * then change `BUFF_SZ` in util.h
  73. */
  74. static const char IFC[] = "wlan0"; /* wifi interface */
  75. static struct arg_t args[] = {
  76. /* function format argument interval (in ms) */
  77. #if USE_X
  78. /* { bspwm_ws, " [ %s ]%%{r}", NULL, 0, END }, */
  79. #endif
  80. { disk_perc, " [# %s%%", "/", 25 SEC, END },
  81. { disk_free, " %s]", "/", 25 SEC, END },
  82. { cpu_perc, "-[ %3s%%]", NULL, 1 SEC, END },
  83. { load_avg, "-[%s]", NULL, 3 SEC, END },
  84. { ram_used, "-[﬙ %s]", NULL, 3 SEC, END },
  85. { vol_perc, "-[%s]", NULL, 0, END },
  86. { wifi_essid, "-[直 \"%s\"", IFC, 2 SEC, END },
  87. { wifi_perc, " %3s%%]", IFC, 2 SEC, END },
  88. { battery_state, "-[%s", "BAT0", 2 SEC, END },
  89. { battery_perc, " %3s%%]", "BAT0", 1 MIN, END },
  90. { datetime, "-[ %s]", "%H:%M:%S", 1 SEC, END },
  91. #if USE_X && USE_XKB
  92. { keymap, "-[ %s] ", NULL, 0, END },
  93. #endif
  94. };