diff options
| author | Shivesh Mandalia <mail@shivesh.org> | 2021-09-23 15:09:20 +0100 |
|---|---|---|
| committer | Shivesh Mandalia <mail@shivesh.org> | 2021-09-23 15:09:20 +0100 |
| commit | cae7d561524ec143baa849237b5a7bbb7051502e (patch) | |
| tree | 2167cd5f5c3d6c571f7e8602e93ee84d931eb572 | |
| parent | dae3ae1dba800f80f36d79075a2330b2035c1bf3 (diff) | |
| download | tabbed-cae7d561524ec143baa849237b5a7bbb7051502e.tar.gz tabbed-cae7d561524ec143baa849237b5a7bbb7051502e.zip | |
Implement hiding of the window frame
- Config option to set whether the frame is hidden on start
- Keyboard shortcut to toggle whether the frame is hidden or not
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | tabbed.1 | 2 | ||||
| -rw-r--r-- | tabbed.c | 58 |
4 files changed, 44 insertions, 20 deletions
diff --git a/config.def.h b/config.def.h index defa426..ccbba84 100644 --- a/config.def.h +++ b/config.def.h @@ -14,6 +14,7 @@ static const char titletrim[] = "..."; static const int tabwidth = 200; static const Bool foreground = True; static Bool urgentswitch = False; +static Bool hideframe = True; /* * Where to place a new tab when it is opened. When npisrelative is True, @@ -62,5 +63,6 @@ static Key keys[] = { { MODKEY, XK_u, focusurgent, { 0 } }, { MODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } }, + { 0, XK_F10, toggleframe, { 0 } }, { 0, XK_F11, fullscreen, { 0 } }, }; @@ -14,6 +14,7 @@ static const char titletrim[] = "..."; static const int tabwidth = 200; static const Bool foreground = True; static Bool urgentswitch = False; +static Bool hideframe = True; /* * Where to place a new tab when it is opened. When npisrelative is True, @@ -63,5 +64,6 @@ static Key keys[] = { // { CTRLMODKEY, XK_u, focusurgent, { 0 } }, // { CTRLMODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } }, + { 0, XK_F10, toggleframe, { 0 } }, { 0, XK_F11, fullscreen, { 0 } }, }; @@ -126,6 +126,8 @@ an already existing tab. .B Alt\-[0..9] jumps to nth tab .TP +.B F10 +Toggle window frame. .B F11 Toggle fullscreen mode. .SH EXAMPLES @@ -49,7 +49,7 @@ enum { ColFG, ColBG, ColLast }; /* color */ enum { WMProtocols, WMDelete, WMName, WMState, WMFullscreen, - XEmbed, WMSelectTab, WMLast }; /* default atoms */ + XEmbed, WMSelectTab, WMMotifHints, WMLast }; /* default atoms */ typedef union { int i; @@ -103,7 +103,7 @@ static void expose(const XEvent *e); static void focus(int c); static void focusin(const XEvent *e); static void focusonce(const Arg *arg); -static void focusurgent(const Arg *arg); +/* static void focusurgent(const Arg *arg); */ static void fullscreen(const Arg *arg); static char *getatom(int a); static int getclient(Window w); @@ -128,7 +128,8 @@ static void setup(void); static void sigchld(int unused); static void spawn(const Arg *arg); static int textnw(const char *text, unsigned int len); -static void toggle(const Arg *arg); +/* static void toggle(const Arg *arg); */ +static void toggleframe(const Arg *arg); static void unmanage(int c); static void unmapnotify(const XEvent *e); static void updatenumlockmask(void); @@ -374,6 +375,7 @@ drawbar(void) dc.x += dc.w; clients[c]->tabx = dc.x; } + XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0); XSync(dpy, False); } @@ -509,21 +511,22 @@ focusonce(const Arg *arg) nextfocus = True; } -void -focusurgent(const Arg *arg) -{ - int c; - - if (sel < 0) - return; - - for (c = (sel + 1) % nclients; c != sel; c = (c + 1) % nclients) { - if (clients[c]->urgent) { - focus(c); - return; - } - } -} +/* void + * focusurgent(const Arg *arg) + * { + * int c; + * + * if (sel < 0) + * return; + * + * for (c = (sel + 1) % nclients; c != sel; c = (c + 1) % nclients) { + * if (clients[c]->urgent) { + * focus(c); + * return; + * } + * } + * } + */ void fullscreen(const Arg *arg) @@ -998,6 +1001,7 @@ setup(void) wmatom[WMSelectTab] = XInternAtom(dpy, "_TABBED_SELECT_TAB", False); wmatom[WMState] = XInternAtom(dpy, "_NET_WM_STATE", False); wmatom[XEmbed] = XInternAtom(dpy, "_XEMBED", False); + wmatom[WMMotifHints] = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); /* init appearance */ wx = 0; @@ -1074,6 +1078,10 @@ setup(void) XSetWMProtocols(dpy, win, &wmatom[WMDelete], 1); + long hints[5] = {hideframe ? 2 : 0, 0, 0, 0, 0}; + XChangeProperty(dpy, win, wmatom[WMMotifHints], XA_ATOM, + 32, PropModeReplace, (unsigned char *)&hints, 5); + snprintf(winid, sizeof(winid), "%lu", win); setenv("XEMBED", winid, 1); @@ -1120,10 +1128,20 @@ textnw(const char *text, unsigned int len) return ext.xOff; } +/* void + * toggle(const Arg *arg) + * { + * *(Bool*) arg->v = !*(Bool*) arg->v; + * } + */ + void -toggle(const Arg *arg) +toggleframe(const Arg *arg) { - *(Bool*) arg->v = !*(Bool*) arg->v; + hideframe = !hideframe; + long hints[5] = {hideframe ? 2 : 0, 0, 0, 0, 0}; + XChangeProperty(dpy, win, wmatom[WMMotifHints], XA_ATOM, + 32, PropModeReplace, (unsigned char *)&hints, 5); } void |
