diff options
| author | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
|---|---|---|
| committer | coasteen <coasteen@proton.me> | 2026-07-09 10:42:28 +0330 |
| commit | 8cbadb61604667b407b53ee1258433994fa4765a (patch) | |
| tree | 97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwm/patch/bar_launcher.c | |
Diffstat (limited to 'dwm/patch/bar_launcher.c')
| -rwxr-xr-x | dwm/patch/bar_launcher.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/dwm/patch/bar_launcher.c b/dwm/patch/bar_launcher.c new file mode 100755 index 0000000..a06096d --- /dev/null +++ b/dwm/patch/bar_launcher.c @@ -0,0 +1,81 @@ +#if BAR_STATUS2D_PATCH +int +width_launcher(Bar *bar, BarArg *a) +{ + int i, x = 0; + + for (i = 0; i < LENGTH(launchers); i++) { + x += status2dtextlength(launchers[i].name) + lrpad; + } + return x; +} + +int +draw_launcher(Bar *bar, BarArg *a) +{ + int i, w = 0;; + + for (i = 0; i < LENGTH(launchers); i++) { + w = status2dtextlength(launchers[i].name); + drawstatusbar(a, launchers[i].name); + a->x += w + lrpad; + } + + return a->x ; +} + +int +click_launcher(Bar *bar, Arg *arg, BarArg *a) +{ + int i, x = 0; + + for (i = 0; i < LENGTH(launchers); i++) { + x += status2dtextlength(launchers[i].name) + lrpad; + if (a->x < x) { + spawn(&launchers[i].command); + break; + } + } + return -1; +} +#else +int +width_launcher(Bar *bar, BarArg *a) +{ + int i, x = 0; + + for (i = 0; i < LENGTH(launchers); i++) { + x += TEXTW(launchers[i].name); + } + return x; +} + +int +draw_launcher(Bar *bar, BarArg *a) +{ + int i, x = 0, w = 0;; + + for (i = 0; i < LENGTH(launchers); i++) { + w = TEXTW(launchers[i].name); + drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, 0, True); + x += w; + } + + return x; +} + +int +click_launcher(Bar *bar, Arg *arg, BarArg *a) +{ + int i, x = 0; + + for (i = 0; i < LENGTH(launchers); i++) { + x += TEXTW(launchers[i].name); + if (a->x < x) { + spawn(&launchers[i].command); + break; + } + } + return -1; +} +#endif // BAR_STATUS2D_PATCH
\ No newline at end of file |
