gm

(orphaned) group manager using libcxb
git clone git://z3bra.org/gm
Log | Files | Refs | README | LICENSE

commit 4267f2d236525eb9e1d925075e5c4b7be9520a5e
parent fc301645ad33d31c0b2c09f292797209a40d8532
Author: z3bra <willy@mailoo.org>
Date:   Mon Nov 17 19:35:56 2014

Change default group for new windows

Diffstat:
 README   | 15 +++++++++++----
 config.h | 47 +++++++++++++++++++++++++++--------------------
 gm.c     |  4 ++--
 3 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/README b/README @@ -1,17 +1,24 @@ - ┏━╸┏┳┓ ┃╺┓┃┃┃ ┗━┛╹ ╹ -- by z3bra =============== -gm stands for 'G'roup 'M'anager. it's a tiny daemon that helps you to manage -your X windows in groups. You can then add windows to groups, and show/hide -groups on your desktop with a hotkey. +gm stands for 'G'roup 'M'anager. It's a tiny daemon that helps you manage your +X windows visibility in groups. + +behavior +-------- + +By default, all windows get added to the group number 0. it is a special +group, as you cannot hide it. All other groups are hidden by default, which +means that if you send a window to group 1, it will get hidden until you +toggle group 1 state. default keybinds ---------------- + ALT + F[1-5] - only show group [1-5] SUPER + F[1-5] - toggle visibility of group [1-5] SUPER + SHIFT + F[1-5] - add focused window to group [1-5] diff --git a/config.h b/config.h @@ -1,26 +1,33 @@ -#define GROUPNUM 5 +#define GROUPNUM 5 /* number of available groups (other than 0) */ +#define GROUPDEF 1 /* add new windows to this group */ -#define MOD XCB_MOD_MASK_4 -#define ALT XCB_MOD_MASK_1 -#define CTRL XCB_MOD_MASK_CONTROL -#define SHIFT XCB_MOD_MASK_SHIFT +#define SUPER XCB_SUPER_MASK_4 +#define ALT XCB_SUPER_MASK_1 +#define CTRL XCB_SUPER_MASK_CONTROL +#define SHIFT XCB_SUPER_MASK_SHIFT static struct hotkey keys[] = { - { MOD, XK_F1, togglegroup, 1}, - { MOD, XK_F2, togglegroup, 2}, - { MOD, XK_F3, togglegroup, 3}, - { MOD, XK_F4, togglegroup, 4}, - { MOD, XK_F5, togglegroup, 5}, - { ALT, XK_F1, solelygroup, 1}, - { ALT, XK_F2, solelygroup, 2}, - { ALT, XK_F3, solelygroup, 3}, - { ALT, XK_F4, solelygroup, 4}, - { ALT, XK_F5, solelygroup, 5}, + /* toggle visibility of groups */ + { SUPER, XK_F1, togglegroup, 1}, + { SUPER, XK_F2, togglegroup, 2}, + { SUPER, XK_F3, togglegroup, 3}, + { SUPER, XK_F4, togglegroup, 4}, + { SUPER, XK_F5, togglegroup, 5}, - { MOD|SHIFT, XK_F1, changegroup, 1}, - { MOD|SHIFT, XK_F2, changegroup, 2}, - { MOD|SHIFT, XK_F3, changegroup, 3}, - { MOD|SHIFT, XK_F4, changegroup, 4}, - { MOD|SHIFT, XK_F5, changegroup, 5}, + /* set only one group as visible */ + { ALT, XK_F1, solelygroup, 1}, + { ALT, XK_F2, solelygroup, 2}, + { ALT, XK_F3, solelygroup, 3}, + { ALT, XK_F4, solelygroup, 4}, + { ALT, XK_F5, solelygroup, 5}, + + /* add current window to a group */ + { SUPER|SHIFT, XK_F1, changegroup, 1}, + { SUPER|SHIFT, XK_F2, changegroup, 2}, + { SUPER|SHIFT, XK_F3, changegroup, 3}, + { SUPER|SHIFT, XK_F4, changegroup, 4}, + { SUPER|SHIFT, XK_F5, changegroup, 5}, + + { SUPER|SHIFT, XK_F9, changegroup, 0}, }; diff --git a/gm.c b/gm.c @@ -340,7 +340,7 @@ void evnt_create (xcb_generic_event_t *e) np = newnod(ev->window); if (np) { - addgroup(np, 0); + addgroup(np, GROUPDEF); } return; @@ -548,7 +548,7 @@ void discover() for (i = 0; i < r->children_len; i++) { if (w[i] != scn->root) { np = newnod(w[i]); - addgroup(np, 0); + addgroup(np, GROUPDEF); xcb_map_window(con, np->id); } }