dwm

Kris's build of dwm
git clone git clone https://git.krisyotam.com/krisyotam/dwm.git
Log | Files | Refs | README | LICENSE

bar_layoutmenu.c (273B)


      1 void
      2 layoutmenu(const Arg *arg) {
      3 	FILE *p;
      4 	char c[3], *s;
      5 	int i;
      6 
      7 	if (!(p = popen(layoutmenu_cmd, "r")))
      8 		 return;
      9 	s = fgets(c, sizeof(c), p);
     10 	pclose(p);
     11 
     12 	if (!s || *s == '\0' || c[0] == '\0')
     13 		 return;
     14 
     15 	i = atoi(c);
     16 	setlayout(&((Arg) { .v = &layouts[i] }));
     17 }
     18