add new keybind

This commit is contained in:
speediegq 2022-10-14 15:56:42 +02:00
parent 7ef4374126
commit 087ea0a3fb
3 changed files with 68 additions and 12 deletions

View file

@ -24,7 +24,7 @@
These keybinds are for navigating speedwm
- Super+t | Reorganize tags and move clients
- Super+t | Reorganize tags and move windows
- Super+f | Full-screen the selected window
- Super+b | Show/hide the speedwm bar
- Super+s | Show/hide the systray
@ -38,11 +38,11 @@
- Super+Control+Shift+o | Show all hidden windows
- Super+Control+Shift+p | Hide all windows
- Super+Control+a/d | Move to the next/previous tag
- Super+Control+Shift+z/c | Move to the next/previous tag skipping any without windows open
- Super+Minus | Show the scratchpad
- Super+Equal | Remove the scratchpad
- Super+Enter | Switch order of windows
- Super+Shift+q | Close the current window
- Super+Space | Set layout
- Super+Colon | Open a list of desktop entries in dmenu
- Super+0 | Reset mfact
- Super+r | Reset number of masters
@ -84,9 +84,7 @@
- Super+Control+q | Mutes your audio
- Super+Control+w | Increases your volume
- Super+Control+e | Decreases your volume
- Super+Control+r | Switch to layout 0 (Tile)
- Super+Control+t | Switch to layout 18 (Dynamic Grid)
- Super+Control+0 | View all windows at once.
- Super+Control+0 | Tag all tags at once.
- Super+Control+Arrow | Moves a window to any corner of your screen (Arrow key)
- Super+Control+Tab | Open a dmenu prompt asking the user what layout to switch to
- Super+Control+h | Open a list of all keybinds in your terminal using less

View file

@ -83,13 +83,6 @@ static const Key keys[] = {
/* Layout keybinds */
{ MODIFIER1|CONTROL|SHIFT, -1, XK_a, cyclelayout, {.i = -1 } },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_d, cyclelayout, {.i = +1 } },
#if LAYOUT_TILE
{ MODIFIER1|CONTROL, -1, XK_r, setlayout, {.v = &layouts[1]} },
#endif
#if LAYOUT_DGRID
{ MODIFIER1|CONTROL, -1, XK_t, setlayout, {.v = &layouts[18]} },
#endif
{ MODIFIER1, -1, XK_space, setlayout, {0} },
/* Scratchpad keybinds */
{ MODIFIER1, -1, XK_minus, scratchpad_show, {0} },
@ -160,6 +153,8 @@ static const Key keys[] = {
{ MODIFIER1, -1, XK_t, reorganizetags, {0} },
{ MODIFIER1|CONTROL, -1, XK_a, viewtoleft, {0} },
{ MODIFIER1|CONTROL, -1, XK_d, viewtoright, {0} },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_z, viewtoleft_vacant, {0} },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_c, viewtoright_vacant, {0} },
/* Hide/Show keybinds */
{ MODIFIER1, -1, XK_o, hide, {0} },

View file

@ -442,7 +442,9 @@ static void moveorplace(const Arg *arg);
static Client *nexttagged(Client *c);
static Client *nexttiled(Client *c);
static unsigned int nexttag(void);
static unsigned int nexttag_skip_vacant(void);
static unsigned int prevtag(void);
static unsigned int prevtag_skip_vacant(void);
#if USEMOUSE
static void placemouse(const Arg *arg);
#endif
@ -571,6 +573,8 @@ static void tag(const Arg *arg);
static void view(const Arg *arg);
static void viewtoleft(const Arg *arg);
static void viewtoright(const Arg *arg);
static void viewtoleft_vacant(const Arg *arg);
static void viewtoright_vacant(const Arg *arg);
static void warp(const Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
@ -3709,6 +3713,30 @@ nexttag(void)
return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1;
}
unsigned int
nexttag_skip_vacant(void)
{
unsigned int seltag = selmon->tagset[selmon->seltags];
unsigned int usedtags = 0;
Client *c = selmon->clients;
if (!c)
return seltag;
/* skip vacant tags */
do {
usedtags |= c->tags;
c = c->next;
} while (c);
do {
seltag = seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1;
} while (!(seltag & usedtags));
return seltag;
}
unsigned int
prevtag(void)
{
@ -3716,6 +3744,29 @@ prevtag(void)
return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1;
}
unsigned int
prevtag_skip_vacant(void)
{
unsigned int seltag = selmon->tagset[selmon->seltags];
unsigned int usedtags = 0;
Client *c = selmon->clients;
if (!c)
return seltag;
/* skip vacant tags */
do {
usedtags |= c->tags;
c = c->next;
} while (c);
do {
seltag = seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1;
} while (!(seltag & usedtags));
return seltag;
}
#if USEFADE
void
@ -5006,6 +5057,18 @@ viewtoleft(const Arg *arg)
view(&(const Arg){.ui = prevtag()});
}
void
viewtoright_vacant(const Arg *arg)
{
view(&(const Arg){.ui = nexttag_skip_vacant()});
}
void
viewtoleft_vacant(const Arg *arg)
{
view(&(const Arg){.ui = prevtag_skip_vacant()});
}
void
togglebar(const Arg *arg)
{