From bb59bfd71ec1731587467f64625c7c6818c973dc Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 2 Jan 2021 23:27:41 -0800 Subject: *: replace the "shelf" with "contexts" This is unfortunately a bit of a large commit, but it's at least pretty much all on-topic for the generalized "contexts" feature. Rather than waste time trying to split this further into smaller commits, I'm just landing it as-is, now that I've lived with the interaction model long enough to not completely hate it. I fully expect to revisit this in the future. One TODO item in particular I'd like to note is "sending" windows to contexts always creates a new virtual desktop for the sent window in the destination context. What should really happen is the destination context should be checked for an empty desktop, and a new desktop created only when there isn't an empty one to be reused for receiving the sent window. Note this only affects non-migrate sends, as migrates (modified by Shift) explicitly use the existing focused desktop at the destination context. See the README for more information on how contexts work and what's different about the interaction model. It's fairly minimal, most of what you already know how to do should keep working as-is. The only oddity would be Mos1-s no longer "shelves" windows, it's now a modifier to turn "migrates" into "sends", and by itself is a noop now. Colors used for contexts haven't been refined and are enumerated in src/context_colors.def. --- src/vwm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/vwm.c') diff --git a/src/vwm.c b/src/vwm.c index 0e47fb0..9bc60de 100644 --- a/src/vwm.c +++ b/src/vwm.c @@ -70,6 +70,8 @@ static vwm_t * vwm_startup(void) goto _err; } + INIT_LIST_HEAD(&vwm->contexts); + INIT_LIST_HEAD(&vwm->contexts_mru); INIT_LIST_HEAD(&vwm->desktops); INIT_LIST_HEAD(&vwm->desktops_mru); INIT_LIST_HEAD(&vwm->windows_mru); @@ -123,6 +125,11 @@ static vwm_t * vwm_startup(void) #define color(_sym, _str) \ XAllocNamedColor(VWM_XDISPLAY(vwm), VWM_XCMAP(vwm), _str, &vwm->colors._sym ## _color, &vwm->colors._sym ## _color); #include "colors.def" +#undef color + +#define color(_num, _str) \ + XAllocNamedColor(VWM_XDISPLAY(vwm), VWM_XCMAP(vwm), _str, &vwm->context_colors[_num], &vwm->context_colors[_num]); +#include "context_colors.def" #undef color XSelectInput(VWM_XDISPLAY(vwm), VWM_XROOT(vwm), @@ -133,8 +140,9 @@ static vwm_t * vwm_startup(void) XSetInputFocus(VWM_XDISPLAY(vwm), VWM_XROOT(vwm), RevertToPointerRoot, CurrentTime); - /* create initial virtual desktop */ - vwm_desktop_focus(vwm, vwm_desktop_create(vwm)); + /* create initial contexts and desktop */ + vwm_desktop_create(vwm, NULL); /* shelf */ + vwm_desktop_focus(vwm, vwm_desktop_create(vwm, NULL)); /* general */ vwm_desktop_mru(vwm, vwm->focused_desktop); /* manage all preexisting windows */ -- cgit v1.2.3