diff --git a/README.md b/README.md index 6999676..bf5d35c 100644 --- a/README.md +++ b/README.md @@ -312,8 +312,7 @@ You can add, change and remove keybinds by editing `keybinds.h` and `mouse.h` an - st - Default terminal - Chromium - Default web browser - htop - Status monitor -- sfeed - RSS reader -- rssread - RSS frontend +- newsboat - RSS reader - cmus - Music player - Default status bar also has support for moc/mocp (Music On Console) - neovim - Text editor @@ -542,6 +541,7 @@ Below is a list of all .Xresources values you can define. - speedwm.stack.i3mcount: 0 - speedwm.stack.mastercount: 1 - speedwm.stack.snap: 20 +- speedwm.status.separator: ; - speedwm.status.defaultstatus: - speedwm.switcher.maxheight: 200 - speedwm.switcher.maxwidth: 600 @@ -783,8 +783,11 @@ Below is a list of all modules bundled with speedwm. The source code for these m - tags_pwl: Tags with powerlines. - systray: Basic X11 system tray. - status_basic: Basic status bar. +- status_basic_es: Basic status bar. - status: Clickable status bar with color support through status2d. +- status_es: Clickable status bar with color support through status2d (Extra status). - status_pwl: Non-clickable status bar with powerlines. It supports colors by cycling through colorschemes. +- status_pwl_es: Non-clickable status bar with powerlines. It supports colors by cycling through colorschemes (Extra status). - title: Title, shows all windows, including hidden windows. - title_basic: Basic title, shows focused window. diff --git a/bar.h b/bar.h index 4c574dd..565e02b 100644 --- a/bar.h +++ b/bar.h @@ -3,43 +3,43 @@ * This header is for configuring the bar along with its modules. Below are some usage notes. * * Monitor: - * -1: Show the module on all monitors. - * 0": Show on the main monitor (monitor 0). - * 'A': Show on the focused monitor. + * -1: Show the module on all monitors. + * 0": Show on the main monitor (monitor 0). + * 'A': Show on the focused monitor. * * Bar: - * 0: Main bar. - * 1: Extra bar. + * 0: Main bar. + * 1: Extra bar. * * Alignment: - * bar_align_left: Force the module to be placed on the left side of the bar if possible. - * bar_align_right: Force the module to be placed on the right side of the bar if possible. - * bar_align_center: Force the module to be placed in the center of the bar if possible. - * bar_align_left_left: Force the module to be placed on the left side of the bar next to the center split. - * bar_align_left_right: Force the module to be placed on the right side of the bar next to the center split. - * bar_align_left_center: Force the module to be placed on the center in the middle of the remaining space left of the center split on the left.. - * bar_align_right_left: Force the module to be placed on the left side of the bar next to the center split. - * bar_align_right_right: Force the module to be placed on the right side of the bar next to the center split. - * bar_align_right_center: Force the module to be placed on the center in the middle of the remaining space left of the center split on the right. - * bar_align_none: No specific alignment. This will give the module the remaining space. + * bar_align_left: Force the module to be placed on the left side of the bar if possible. + * bar_align_right: Force the module to be placed on the right side of the bar if possible. + * bar_align_center: Force the module to be placed in the center of the bar if possible. + * bar_align_left_left: Force the module to be placed on the left side of the bar next to the center split. + * bar_align_left_right: Force the module to be placed on the right side of the bar next to the center split. + * bar_align_left_center: Force the module to be placed on the center in the middle of the remaining space left of the center split on the left.. + * bar_align_right_left: Force the module to be placed on the left side of the bar next to the center split. + * bar_align_right_right: Force the module to be placed on the right side of the bar next to the center split. + * bar_align_right_center: Force the module to be placed on the center in the middle of the remaining space left of the center split on the right. + * bar_align_none: No specific alignment. This will give the module the remaining space. * * Width: * Function to run when getting the width of the module. * - * Syntax: width_ - * Example: width_tags_pwl + * Syntax: width_ + * Example: width_tags_pwl * * Draw * Function to run when drawing the module. * - * Syntax: draw_ - * Example: draw_tags_pwl + * Syntax: draw_ + * Example: draw_tags_pwl * * Click * Function to run when getting a click. * - * Syntax: click_ - * Example: click_tags_pwl + * Syntax: click_ + * Example: click_tags_pwl * * Module name * Does nothing special, just helpful for debugging among other things. @@ -48,22 +48,25 @@ * * List of modules that can be used. * - * ltsymbol: Standard, basic layout icon. - * tags: Basic tags, without powerlines. - * tags_pwl: Tags with powerlines. - * systray: System tray. - * status_basic: Basic status bar. - * status: Clickable status bar with color support. - * status_pwl: Status with powerlines. NOTE: It is not clickable. - * title: Title, shows all windows, including hidden windows. - * title_basic: Basic title, shows focused window. + * ltsymbol: Standard, basic layout icon. + * tags: Basic tags, without powerlines. + * tags_pwl: Tags with powerlines. + * systray: System tray. + * status_basic: Basic status bar. + * status_basic_es: Basic status bar (Extra status). + * status: Clickable status bar with color support. + * status_es: Clickable status bar with color support (Extra status). + * status_pwl: Status with powerlines. NOTE: It is not clickable. + * status_pwl_es: Status with powerlines. NOTE: It is not clickable (Extra status). + * title: Title, shows all windows, including hidden windows. + * title_basic: Basic title, shows focused window. * */ static const BarRule barrules[] = { - /* Monitor Bar Alignment Width Draw Click Module name */ - { -1, 0, bar_align_left, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" }, - { -1, 0, bar_align_left, width_tags_pwl, draw_tags_pwl, click_tags_pwl, "powerline tags" }, - { 'A', 0, bar_align_right, width_systray, draw_systray, click_systray, "systray" }, - { -1, 0, bar_align_right, width_status_pwl, draw_status_pwl, click_status_pwl, "powerline status" }, - { -1, 0, bar_align_none, width_title, draw_title, click_title, "title" }, + /* Monitor Bar Alignment Width Draw Click Module name */ + { -1, 0, bar_align_left, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" }, + { -1, 0, bar_align_left, width_tags_pwl, draw_tags_pwl, click_tags_pwl, "powerline tags" }, + { 'A', 0, bar_align_right, width_systray, draw_systray, click_systray, "systray" }, + { -1, 0, bar_align_right, width_status_pwl, draw_status_pwl, click_status_pwl, "powerline status" }, + { -1, 0, bar_align_none, width_title, draw_title, click_title, "title" }, }; diff --git a/bar/items.c b/bar/items.c index 9e7e4ea..71a6fc7 100644 --- a/bar/items.c +++ b/bar/items.c @@ -4,8 +4,11 @@ #include "tags.c" /* Include tags */ #include "layoutindicator.c" /* Include layout indicator */ #include "statusbar.c" /* Include status bar with status2d and clickstatus */ +#include "statusbar-es.c" /* Include status bar with status2d and clickstatus */ #include "statusbar-basic.c" /* Include basic status bar */ +#include "statusbar-basic-es.c" /* Include basic status bar */ #include "statusbar-powerline.c" /* Include powerline status bar */ +#include "statusbar-powerline-es.c" /* Include powerline status bar */ #include "title-basic.c" /* Include basic title */ #include "title.c" /* Include title */ #include "systray.c" /* Include systray */ diff --git a/bar/items.h b/bar/items.h index 03a62aa..db1a8c7 100644 --- a/bar/items.h +++ b/bar/items.h @@ -3,8 +3,11 @@ #include "tags.h" #include "layoutindicator.h" #include "statusbar.h" +#include "statusbar-es.h" #include "statusbar-basic.h" +#include "statusbar-basic-es.h" #include "statusbar-powerline.h" +#include "statusbar-powerline-es.h" #include "title-basic.h" #include "title.h" #include "systray.h" diff --git a/bar/statusbar-basic-es.c b/bar/statusbar-basic-es.c new file mode 100644 index 0000000..4531c12 --- /dev/null +++ b/bar/statusbar-basic-es.c @@ -0,0 +1,31 @@ +int +width_status_basic_es(Bar *bar, BarWidthArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return TEXTW(estext); + } +} + + +int +draw_status_basic_es(Bar *bar, BarDrawArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, estext, 0, True); + } +} + + +int +click_status_basic_es(Bar *bar, Arg *arg, BarClickArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return clickstatusbar; + } +} diff --git a/bar/statusbar-basic-es.h b/bar/statusbar-basic-es.h new file mode 100644 index 0000000..a376a79 --- /dev/null +++ b/bar/statusbar-basic-es.h @@ -0,0 +1,3 @@ +static int width_status_basic_es(Bar *bar, BarWidthArg *a); +static int draw_status_basic_es(Bar *bar, BarDrawArg *a); +static int click_status_basic_es(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/bar/statusbar-es.c b/bar/statusbar-es.c new file mode 100644 index 0000000..9c41d68 --- /dev/null +++ b/bar/statusbar-es.c @@ -0,0 +1,29 @@ +int +width_status_es(Bar *bar, BarWidthArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return textlength(rawestext) + lrpad; + } +} + +int +draw_status_es(Bar *bar, BarDrawArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return drawstatustext(a->x, rawestext); + } +} + +int +click_status_es(Bar *bar, Arg *arg, BarClickArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return click_status_text(arg, a->rel_x, rawestext); + } +} diff --git a/bar/statusbar-es.h b/bar/statusbar-es.h new file mode 100644 index 0000000..6dece2d --- /dev/null +++ b/bar/statusbar-es.h @@ -0,0 +1,3 @@ +static int width_status_es(Bar *bar, BarWidthArg *a); +static int draw_status_es(Bar *bar, BarDrawArg *a); +static int click_status_es(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/bar/statusbar-powerline-es.c b/bar/statusbar-powerline-es.c new file mode 100644 index 0000000..302b34d --- /dev/null +++ b/bar/statusbar-powerline-es.c @@ -0,0 +1,29 @@ +int +click_status_pwl_es(Bar *bar, Arg *arg, BarClickArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return clickstatusbar; + } +} + +int +width_status_pwl_es(Bar *bar, BarWidthArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return widthpowerlinestatus(rawestext); + } +} + +int +draw_status_pwl_es(Bar *bar, BarDrawArg *a) +{ + if (selmon->hidestatus) { + return 0; + } else { + return drawpowerlinestatus(a->x + a->w, rawestext); + } +} diff --git a/bar/statusbar-powerline-es.h b/bar/statusbar-powerline-es.h new file mode 100644 index 0000000..a15438b --- /dev/null +++ b/bar/statusbar-powerline-es.h @@ -0,0 +1,3 @@ +static int width_status_pwl_es(Bar *bar, BarWidthArg *a); +static int draw_status_pwl_es(Bar *bar, BarDrawArg *a); +static int click_status_pwl_es(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/docs/doc-10.md b/docs/doc-10.md index efc365a..901fd18 100644 --- a/docs/doc-10.md +++ b/docs/doc-10.md @@ -45,8 +45,11 @@ Below is a list of all modules bundled with speedwm. The source code for these m - tags_pwl: Tags with powerlines. - systray: Basic X11 system tray. - status_basic: Basic status bar. +- status_basic_es: Basic status bar. - status: Clickable status bar with color support through status2d. +- status_es: Clickable status bar with color support through status2d (Extra status). - status_pwl: Non-clickable status bar with powerlines. It supports colors by cycling through colorschemes. +- status_pwl_es: Non-clickable status bar with powerlines. It supports colors by cycling through colorschemes (Extra status). - title: Title, shows all windows, including hidden windows. - title_basic: Basic title, shows focused window. diff --git a/docs/example.Xresources b/docs/example.Xresources index 18d59c1..4062665 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -243,6 +243,7 @@ speedwm.stack.mastercount: 1 ! Number of master clients in the maste speedwm.stack.snap: 20 ! Snap pixel () !! Text to print when no status bar is running. Empty means nothing. +speedwm.status.separator: ; speedwm.status.defaultstatus: !! Switcher options diff --git a/options.h b/options.h index 0ca580e..35bb8df 100644 --- a/options.h +++ b/options.h @@ -61,6 +61,7 @@ static int autoresize = 1; /* Allow resizing clients aut static char font[] = "Noto Sans Regular 9"; /* Font to draw the bar with */ /* Status options */ +static char statussep = ';'; /* Separator used to switch from the main status bar to the next */ static char defaultstatus[] = ""; /* What to print when a status bar is not running */ /* Task switcher options diff --git a/speedwm.1 b/speedwm.1 index af14563..34d9706 100644 --- a/speedwm.1 +++ b/speedwm.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.0 +.\" Automatically generated by Pandoc 3.0.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. @@ -602,9 +602,7 @@ Chromium - Default web browser .IP \[bu] 2 htop - Status monitor .IP \[bu] 2 -sfeed - RSS reader -.IP \[bu] 2 -rssread - RSS frontend +newsboat - RSS reader .IP \[bu] 2 cmus - Music player .RS 2 @@ -1061,6 +1059,8 @@ speedwm.stack.mastercount: 1 .IP \[bu] 2 speedwm.stack.snap: 20 .IP \[bu] 2 +speedwm.status.separator: ; +.IP \[bu] 2 speedwm.status.defaultstatus: .IP \[bu] 2 speedwm.switcher.maxheight: 200 @@ -1509,11 +1509,19 @@ systray: Basic X11 system tray. .IP \[bu] 2 status_basic: Basic status bar. .IP \[bu] 2 +status_basic_es: Basic status bar. +.IP \[bu] 2 status: Clickable status bar with color support through status2d. .IP \[bu] 2 +status_es: Clickable status bar with color support through status2d +(Extra status). +.IP \[bu] 2 status_pwl: Non-clickable status bar with powerlines. It supports colors by cycling through colorschemes. .IP \[bu] 2 +status_pwl_es: Non-clickable status bar with powerlines. +It supports colors by cycling through colorschemes (Extra status). +.IP \[bu] 2 title: Title, shows all windows, including hidden windows. .IP \[bu] 2 title_basic: Basic title, shows focused window. diff --git a/speedwm.c b/speedwm.c index cdeba7e..ebf265c 100644 --- a/speedwm.c +++ b/speedwm.c @@ -816,12 +816,15 @@ static Client *swallowingclient(Window w); static Client *termforwin(const Client *c); static pid_t winpid(Window w); +/* status text */ +static char stext[1024]; +static char rawstext[1024]; +static char estext[1024]; +static char rawestext[1024]; + /* variables */ static const char notitle[] = ""; /* Title when none can be grabbed. */ static Client *lastfocused = NULL; -static char stext[1024]; /* max character count */ -static char rawstext[1024]; /* max character count */ - static int screen; static int tw, sh; /* X display screen geometry width, height */ static int bh; /* bar geometry */ @@ -6029,10 +6032,21 @@ updatestatus(void) Monitor* m; if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext)) && !selmon->hidestatus) { strcpy(stext, defaultstatus); + estext[0] = '\0'; } else { if (!selmon->hidestatus) { - copyvalidchars(stext, rawstext); - } + char *e = strchr(rawstext, statussep); + + if (e) { + *e = '\0'; e++; + strncpy(rawestext, e, sizeof(estext) - 1); + copyvalidchars(estext, rawestext); + } else { + estext[0] = '\0'; + } + + copyvalidchars(stext, rawstext); + } } for (m = mons; m; m = m->next) diff --git a/xresources.h b/xresources.h index 5d8e9ec..e4e2919 100644 --- a/xresources.h +++ b/xresources.h @@ -97,6 +97,7 @@ ResourcePref resources[] = { { "text.layout14", STRING, &text_layout14 }, { "text.layout15", STRING, &text_layout15 }, { "run.shell", STRING, &shell }, + { "status.separator", STRING, &statussep }, { "status.defaultstatus", STRING, &defaultstatus }, { "fullscreen.lockfullscreen", INTEGER, &lockfullscreen }, { "fullscreen.movefullscreenmon", INTEGER, &movefullscreenmon },