add support for extra status. most of the code for it is already here,
so i think its stupid not to.
This commit is contained in:
parent
249e4fe21f
commit
ed8d310fc3
|
@ -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.
|
||||
|
||||
|
|
3
bar.h
3
bar.h
|
@ -53,8 +53,11 @@
|
|||
* 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.
|
||||
*
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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"
|
||||
|
|
31
bar/statusbar-basic-es.c
Normal file
31
bar/statusbar-basic-es.c
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
3
bar/statusbar-basic-es.h
Normal file
3
bar/statusbar-basic-es.h
Normal file
|
@ -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);
|
29
bar/statusbar-es.c
Normal file
29
bar/statusbar-es.c
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
3
bar/statusbar-es.h
Normal file
3
bar/statusbar-es.h
Normal file
|
@ -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);
|
29
bar/statusbar-powerline-es.c
Normal file
29
bar/statusbar-powerline-es.c
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
3
bar/statusbar-powerline-es.h
Normal file
3
bar/statusbar-powerline-es.h
Normal file
|
@ -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);
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -243,6 +243,7 @@ speedwm.stack.mastercount: 1 ! Number of master clients in the maste
|
|||
speedwm.stack.snap: 20 ! Snap pixel (<char>)
|
||||
|
||||
!! Text to print when no status bar is running. Empty means nothing.
|
||||
speedwm.status.separator: ;
|
||||
speedwm.status.defaultstatus:
|
||||
|
||||
!! Switcher options
|
||||
|
|
|
@ -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
|
||||
|
|
16
speedwm.1
16
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.
|
||||
|
|
20
speedwm.c
20
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,8 +6032,19 @@ 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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 },
|
||||
|
|
Loading…
Reference in a new issue