dwm

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

bar_launcher.c (1330B)


      1 #if BAR_STATUS2D_PATCH
      2 int
      3 width_launcher(Bar *bar, BarArg *a)
      4 {
      5 	int i, x = 0;
      6 
      7 	for (i = 0; i < LENGTH(launchers); i++) {
      8 		x += status2dtextlength(launchers[i].name) + lrpad;
      9 	}
     10 	return x;
     11 }
     12 
     13 int
     14 draw_launcher(Bar *bar, BarArg *a)
     15 {
     16 	int i, w = 0;;
     17 
     18 	for (i = 0; i < LENGTH(launchers); i++) {
     19 		w = status2dtextlength(launchers[i].name);
     20 		drawstatusbar(a, launchers[i].name);
     21 		a->x += w + lrpad;
     22 	}
     23 
     24 	return a->x ;
     25 }
     26 
     27 int
     28 click_launcher(Bar *bar, Arg *arg, BarArg *a)
     29 {
     30 	int i, x = 0;
     31 
     32 	for (i = 0; i < LENGTH(launchers); i++) {
     33 		x += status2dtextlength(launchers[i].name) + lrpad;
     34 		if (a->x < x) {
     35 		    spawn(&launchers[i].command);
     36 		    break;
     37 		}
     38 	}
     39 	return -1;
     40 }
     41 #else
     42 int
     43 width_launcher(Bar *bar, BarArg *a)
     44 {
     45 	int i, x = 0;
     46 
     47 	for (i = 0; i < LENGTH(launchers); i++) {
     48 		x += TEXTW(launchers[i].name);
     49 	}
     50 	return x;
     51 }
     52 
     53 int
     54 draw_launcher(Bar *bar, BarArg *a)
     55 {
     56 	int i, x = 0, w = 0;;
     57 
     58 	for (i = 0; i < LENGTH(launchers); i++) {
     59 		w = TEXTW(launchers[i].name);
     60 		drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, 0, True);
     61 		x += w;
     62 	}
     63 
     64 	return x;
     65 }
     66 
     67 int
     68 click_launcher(Bar *bar, Arg *arg, BarArg *a)
     69 {
     70 	int i, x = 0;
     71 
     72 	for (i = 0; i < LENGTH(launchers); i++) {
     73 		x += TEXTW(launchers[i].name);
     74 		if (a->x < x) {
     75 		    spawn(&launchers[i].command);
     76 		    break;
     77 		}
     78 	}
     79 	return -1;
     80 }
     81 #endif // BAR_STATUS2D_PATCH