aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--calmwm.h8
-rw-r--r--client.c19
-rw-r--r--conf.c5
-rw-r--r--cwm.16
-rw-r--r--cwmrc.56
-rw-r--r--group.c4
-rw-r--r--kbfunc.c8
-rw-r--r--xutil.c10
8 files changed, 55 insertions, 11 deletions
diff --git a/calmwm.h b/calmwm.h
index aa23bca..bf4e98a 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.263 2014/08/24 15:37:45 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.264 2014/08/25 12:49:19 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -180,6 +180,7 @@ struct client_ctx {
#define CLIENT_WM_TAKE_FOCUS 0x0200
#define CLIENT_URGENCY 0x0400
#define CLIENT_FULLSCREEN 0x0800
+#define CLIENT_STICKY 0x1000
#define CLIENT_HIGHLIGHT (CLIENT_GROUP | CLIENT_UNGROUP)
#define CLIENT_MAXFLAGS (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)
@@ -349,7 +350,8 @@ enum {
_NET_WM_DESKTOP,
_NET_CLOSE_WINDOW,
_NET_WM_STATE,
-#define _NET_WM_STATES_NITEMS 4
+#define _NET_WM_STATES_NITEMS 5
+ _NET_WM_STATE_STICKY,
_NET_WM_STATE_MAXIMIZED_VERT,
_NET_WM_STATE_MAXIMIZED_HORZ,
_NET_WM_STATE_FULLSCREEN,
@@ -396,6 +398,7 @@ void client_set_wm_state(struct client_ctx *, long);
void client_setactive(struct client_ctx *);
void client_setname(struct client_ctx *);
int client_snapcalc(int, int, int, int, int);
+void client_sticky(struct client_ctx *);
void client_transient(struct client_ctx *);
void client_unhide(struct client_ctx *);
void client_urgency(struct client_ctx *);
@@ -464,6 +467,7 @@ void kbfunc_client_nogroup(struct client_ctx *,
void kbfunc_client_raise(struct client_ctx *, union arg *);
void kbfunc_client_rcycle(struct client_ctx *, union arg *);
void kbfunc_client_search(struct client_ctx *, union arg *);
+void kbfunc_client_sticky(struct client_ctx *, union arg *);
void kbfunc_client_vmaximize(struct client_ctx *,
union arg *);
void kbfunc_cmdexec(struct client_ctx *, union arg *);
diff --git a/client.c b/client.c
index d613375..5e2d2c4 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.173 2014/08/20 15:15:29 okan Exp $
+ * $OpenBSD: client.c,v 1.174 2014/08/25 12:49:19 okan Exp $
*/
#include <sys/param.h>
@@ -239,6 +239,17 @@ client_freeze(struct client_ctx *cc)
}
void
+client_sticky(struct client_ctx *cc)
+{
+ if (cc->flags & CLIENT_STICKY)
+ cc->flags &= ~CLIENT_STICKY;
+ else
+ cc->flags |= CLIENT_STICKY;
+
+ xu_ewmh_set_net_wm_state(cc);
+}
+
+void
client_fullscreen(struct client_ctx *cc)
{
struct screen_ctx *sc = cc->sc;
@@ -468,6 +479,9 @@ client_ptrsave(struct client_ctx *cc)
void
client_hide(struct client_ctx *cc)
{
+ if (cc->flags & CLIENT_STICKY)
+ return;
+
XUnmapWindow(X_Dpy, cc->win);
cc->active = 0;
@@ -481,6 +495,9 @@ client_hide(struct client_ctx *cc)
void
client_unhide(struct client_ctx *cc)
{
+ if (cc->flags & CLIENT_STICKY)
+ return;
+
XMapRaised(X_Dpy, cc->win);
cc->flags &= ~CLIENT_HIDDEN;
diff --git a/conf.c b/conf.c
index 194c58b..dccaf8b 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: conf.c,v 1.176 2014/08/24 15:49:58 okan Exp $
+ * $OpenBSD: conf.c,v 1.177 2014/08/25 12:49:19 okan Exp $
*/
#include <sys/param.h>
@@ -204,6 +204,7 @@ static const struct {
{ "CM-g", "grouptoggle" },
{ "CM-f", "fullscreen" },
{ "CM-m", "maximize" },
+ { "CM-s", "sticky" },
{ "CM-equal", "vmaximize" },
{ "CMS-equal", "hmaximize" },
{ "CMS-f", "freeze" },
@@ -389,6 +390,7 @@ static const struct {
{ "rcycleingroup", kbfunc_client_cycle, CWM_WIN,
{.i = CWM_RCYCLE|CWM_INGROUP} },
{ "grouptoggle", kbfunc_client_grouptoggle, CWM_WIN, {0}},
+ { "sticky", kbfunc_client_sticky, CWM_WIN, {0} },
{ "fullscreen", kbfunc_client_fullscreen, CWM_WIN, {0} },
{ "maximize", kbfunc_client_maximize, CWM_WIN, {0} },
{ "vmaximize", kbfunc_client_vmaximize, CWM_WIN, {0} },
@@ -678,6 +680,7 @@ static char *ewmhints[] = {
"_NET_WM_DESKTOP",
"_NET_CLOSE_WINDOW",
"_NET_WM_STATE",
+ "_NET_WM_STATE_STICKY",
"_NET_WM_STATE_MAXIMIZED_VERT",
"_NET_WM_STATE_MAXIMIZED_HORZ",
"_NET_WM_STATE_FULLSCREEN",
diff --git a/cwm.1 b/cwm.1
index 9174304..f75eda1 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.50 2014/02/01 00:25:04 okan Exp $
+.\" $OpenBSD: cwm.1,v 1.51 2014/08/25 12:49:19 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 1 2014 $
+.Dd $Mdocdate: August 25 2014 $
.Dt CWM 1
.Os
.Sh NAME
@@ -90,6 +90,8 @@ Cycle through active groups.
Reverse cycle through active groups.
.It Ic CMS-f
Toggle freezing geometry of current window.
+.It Ic CM-s
+Toggle stickiness of current window.
.It Ic CM-f
Toggle full-screen mode of current window.
.It Ic CM-m
diff --git a/cwmrc.5 b/cwmrc.5
index 86cc090..1847978 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwmrc.5,v 1.58 2014/01/29 21:17:33 okan Exp $
+.\" $OpenBSD: cwmrc.5,v 1.59 2014/08/25 12:49:19 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 29 2014 $
+.Dd $Mdocdate: August 25 2014 $
.Dt CWMRC 5
.Os
.Sh NAME
@@ -341,6 +341,8 @@ Raise current window.
Label current window.
.It freeze
Freeze current window geometry.
+.It sticky
+Stick current window to all groups (same as assigning to nogroup).
.It fullscreen
Full-screen current window (gap + border removed).
.It maximize
diff --git a/group.c b/group.c
index e341c8c..473aff8 100644
--- a/group.c
+++ b/group.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: group.c,v 1.94 2014/08/24 15:37:45 okan Exp $
+ * $OpenBSD: group.c,v 1.95 2014/08/25 12:49:19 okan Exp $
*/
#include <sys/param.h>
@@ -207,6 +207,8 @@ group_hidden_state(struct group_ctx *gc)
int hidden = 0, same = 0;
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
+ if (cc->flags & CLIENT_STICKY)
+ continue;
if (hidden == ((cc->flags & CLIENT_HIDDEN) ? 1 : 0))
same++;
}
diff --git a/kbfunc.c b/kbfunc.c
index c7b48be..46d43cf 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: kbfunc.c,v 1.95 2014/01/30 15:41:11 okan Exp $
+ * $OpenBSD: kbfunc.c,v 1.96 2014/08/25 12:49:19 okan Exp $
*/
#include <sys/param.h>
@@ -433,6 +433,12 @@ kbfunc_client_movetogroup(struct client_ctx *cc, union arg *arg)
}
void
+kbfunc_client_sticky(struct client_ctx *cc, union arg *arg)
+{
+ client_sticky(cc);
+}
+
+void
kbfunc_client_fullscreen(struct client_ctx *cc, union arg *arg)
{
client_fullscreen(cc);
diff --git a/xutil.c b/xutil.c
index 368dc40..a5c1302 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xutil.c,v 1.87 2014/08/22 19:04:00 okan Exp $
+ * $OpenBSD: xutil.c,v 1.88 2014/08/25 12:49:19 okan Exp $
*/
#include <sys/param.h>
@@ -326,6 +326,9 @@ xu_ewmh_handle_net_wm_state_msg(struct client_ctx *cc, int action,
int property;
void (*toggle)(struct client_ctx *);
} handlers[] = {
+ { _NET_WM_STATE_STICKY,
+ CLIENT_STICKY,
+ client_sticky },
{ _NET_WM_STATE_MAXIMIZED_VERT,
CLIENT_VMAXIMIZED,
client_vmaximize },
@@ -367,6 +370,8 @@ xu_ewmh_restore_net_wm_state(struct client_ctx *cc)
atoms = xu_ewmh_get_net_wm_state(cc, &n);
for (i = 0; i < n; i++) {
+ if (atoms[i] == ewmh[_NET_WM_STATE_STICKY])
+ client_sticky(cc);
if (atoms[i] == ewmh[_NET_WM_STATE_MAXIMIZED_HORZ])
client_hmaximize(cc);
if (atoms[i] == ewmh[_NET_WM_STATE_MAXIMIZED_VERT])
@@ -391,10 +396,13 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc)
if (oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ] &&
oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_VERT] &&
oatoms[i] != ewmh[_NET_WM_STATE_FULLSCREEN] &&
+ oatoms[i] != ewmh[_NET_WM_STATE_STICKY] &&
oatoms[i] != ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
atoms[j++] = oatoms[i];
}
free(oatoms);
+ if (cc->flags & CLIENT_STICKY)
+ atoms[j++] = ewmh[_NET_WM_STATE_STICKY];
if (cc->flags & CLIENT_FULLSCREEN)
atoms[j++] = ewmh[_NET_WM_STATE_FULLSCREEN];
else {