dotfiles

personal configuration files and scripts
git clone https://tongong.net/git/dotfiles.git
Log | Files | Refs | README

pkgs.c (446B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 
      4 #include "../util.h"
      5 #include "pkgs.h"
      6 
      7 #define ICON " "
      8 #define MAX_CHARS_PER_LINE  5
      9 
     10 size_t pkgsu(char *str, int sigval)
     11 {
     12     char output[MAX_CHARS_PER_LINE];
     13 
     14     getcmdout((char *[]){"sh", "-c", "pacman -Qu | wc -l", NULL},
     15               output, MAX_CHARS_PER_LINE);
     16 
     17     return SPRINTF(str, ICON "%d", atoi(output));
     18 }
     19 
     20 void pkgsc(int button)
     21 {
     22     TERMCMD("bash", "-c", "pacman -Qu && read");
     23 }