mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 03:06:30 +00:00
add toggletag and toggleview
This commit is contained in:
parent
35557ab042
commit
66054700cb
2 changed files with 30 additions and 1 deletions
|
@ -32,7 +32,9 @@ static const struct xkb_rule_names xkb_rules = {
|
|||
#define MODKEY WLR_MODIFIER_ALT
|
||||
#define TAGKEYS(KEY,SKEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
|
||||
|
||||
/* commands */
|
||||
static const char *termcmd[] = { "kitty", "-o", "linux_display_server=wayland", NULL };
|
||||
|
|
27
dwl.c
27
dwl.c
|
@ -154,6 +154,8 @@ static void spawn(const Arg *arg);
|
|||
static void tag(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unmapnotify(struct wl_listener *listener, void *data);
|
||||
static void view(const Arg *arg);
|
||||
static Client *xytoclient(double x, double y,
|
||||
|
@ -1116,6 +1118,31 @@ togglefloating(const Arg *arg)
|
|||
sel->isfloating = !sel->isfloating /* || sel->isfixed */;
|
||||
}
|
||||
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
unsigned int newtags;
|
||||
Client *sel = selclient();
|
||||
if (!sel)
|
||||
return;
|
||||
newtags = sel->tags ^ (arg->ui & TAGMASK);
|
||||
if (newtags) {
|
||||
sel->tags = newtags;
|
||||
focus(NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
|
||||
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focus(NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unmapnotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue