perform some changes, add a few keybinds, typo fix, add windowmap

This commit is contained in:
speedie 2022-11-11 21:00:53 +01:00
parent 5368a541fc
commit d4f42f0f64
6 changed files with 111 additions and 15 deletions

View file

@ -44,7 +44,9 @@ Please let me know if any keybinds are missing as these have been manually added
Keybinds for regular applications
- Super+Shift+Enter - Opens a terminal
- Super+Enter - Opens st with tabbed
- Super+Control+Shift - Opens Alacritty
- Super+Shift+Enter - Opens the defined terminal (default is st)
- Super+Shift+Colon - Opens a dmenu prompt
- Super+Shift+s - Opens 'maim' to take a screenshot and copies it to the clipboard using 'xclip' (requires speedwm-extras)
- Super+Shift+f - Opens the defined file manager
@ -188,6 +190,10 @@ Please let me know if any keybinds are missing as these have been manually added
- Super+, & d - Toggle tag powerline shape
- Super+, & s - Toggle tag and title powerline shapes
- Super+, & r - Reset powerline options
- Super+q & n/p - Switch to the next/previous track
- Super+q & l/h - Seek 3 seconds forward/backwards
- Super+q & u/d - Seek 10 seconds forward/backwards
- Super+q & 0 - Seek to the beginning of the track
- Super+Shift+g & i - Decrease inner gaps by 1
- Super+Shift+g & o - Decrease outer gaps by 1
- Super+Shift+e & a - Open the virtual keyboard
@ -555,7 +561,7 @@ Below is a list of all signums and what they do.
- 82 - Toggle the sticky indicator area in the bar
- 83 - Toggle the icon in the window title
- 84 - Toggle bar position (top/bottom)
- 85 - Toggle layouit position (left/right)
- 85 - Toggle layout position (left/right)
- 86 - Show all bar modules
- 87 - Increase bar height by 1
- 88 - Decrease bar height by 1

View file

@ -82,7 +82,7 @@
- 82 - Toggle the sticky indicator area in the bar
- 83 - Toggle the icon in the window title
- 84 - Toggle bar position (top/bottom)
- 85 - Toggle layouit position (left/right)
- 85 - Toggle layout position (left/right)
- 86 - Show all bar modules
- 87 - Increase bar height by 1
- 88 - Decrease bar height by 1

View file

@ -2,7 +2,9 @@
Keybinds for regular applications
- Super+Shift+Enter - Opens a terminal
- Super+Enter - Opens st with tabbed
- Super+Control+Shift - Opens Alacritty
- Super+Shift+Enter - Opens the defined terminal (default is st)
- Super+Shift+Colon - Opens a dmenu prompt
- Super+Shift+s - Opens 'maim' to take a screenshot and copies it to the clipboard using 'xclip' (requires speedwm-extras)
- Super+Shift+f - Opens the defined file manager
@ -146,6 +148,10 @@
- Super+, & d - Toggle tag powerline shape
- Super+, & s - Toggle tag and title powerline shapes
- Super+, & r - Reset powerline options
- Super+q & n/p - Switch to the next/previous track
- Super+q & l/h - Seek 3 seconds forward/backwards
- Super+q & u/d - Seek 10 seconds forward/backwards
- Super+q & 0 - Seek to the beginning of the track
- Super+Shift+g & i - Decrease inner gaps by 1
- Super+Shift+g & o - Decrease outer gaps by 1
- Super+Shift+e & a - Open the virtual keyboard

View file

@ -49,6 +49,8 @@ static Key keys[] = {
{ MODIFIER1|CONTROL|SHIFT, -1, XK_semicolon, spawn, cmd( "speedwm-applist" ) },
/* Application keybinds */
{ MODIFIER1, -1, XK_Return, spawn, cmd( "tabbed -c -r 2 st -w ''" ) },
{ MODIFIER1|CONTROL, -1, XK_Return, spawn, cmd( "alacritty" ) },
{ MODIFIER1|SHIFT, -1, XK_Return, spawn, cmd( TERMINAL ) },
{ MODIFIER1|SHIFT, -1, XK_s, spawn, cmd( "speedwm-screenshotutil -s" ) },
{ MODIFIER1|SHIFT, -1, XK_f, spawn, cmd( TERMINAL "vifmrun || vifm" ) },
@ -198,6 +200,7 @@ static Key keys[] = {
{ MODIFIER1, XK_t, XK_b, togglebarpos, {0} },
{ MODIFIER1, XK_t, XK_r, resetbar, {0} },
/* Chained powerline toggle keybinds */
{ MODIFIER1, XK_apostrophe,XK_w, toggletitlepowerline, {0} },
{ MODIFIER1, XK_apostrophe,XK_t, toggletagpowerline, {0} },
{ MODIFIER1, XK_apostrophe,XK_a, toggletitleplshape, {0} },
@ -205,10 +208,17 @@ static Key keys[] = {
{ MODIFIER1, XK_apostrophe,XK_s, toggleplshape, {0} },
{ MODIFIER1, XK_apostrophe,XK_r, resetpowerline, {0} },
/* Chained music keybinds */
{ MODIFIER1, XK_q, XK_n, spawn, cmd( "cmus-remote --next" ) },
{ MODIFIER1, XK_q, XK_p, spawn, cmd( "cmus-remote --prev" ) },
{ MODIFIER1, XK_q, XK_l, spawn, cmd( "cmus-remote --seek +3" ) },
{ MODIFIER1, XK_q, XK_h, spawn, cmd( "cmus-remote --seek -3" ) },
{ MODIFIER1, XK_q, XK_u, spawn, cmd( "cmus-remote --seek +10" ) },
{ MODIFIER1, XK_q, XK_d, spawn, cmd( "cmus-remote --seek -10" ) },
{ MODIFIER1, XK_q, XK_0, spawn, cmd( "cmus-remote --seek 0" ) },
{ MODIFIER1, XK_l, XK_p, togglelayoutpos, {0} },
{ MODIFIER1|SHIFT, XK_k, XK_o, killunsel, {0} },
{ MODIFIER1|SHIFT, XK_e, XK_p, spawn, cmd( "speedwm-swal --previous" ) },
{ MODIFIER1|SHIFT, XK_e, XK_r, spawn, cmd( "speedwm-swal --randomize" ) },
{ MODIFIER1|SHIFT, XK_e, XK_a, spawn, cmd( "speedwm-virtualkeyboard" ) },

View file

@ -286,6 +286,12 @@ struct Monitor {
int barposition;
int layoutposition;
/* icon */
#if USEWINICON
int iconsize;
int iconspacing;
#endif
/* coloring */
int colorselectedtitle;
int colorhiddentitle;
@ -683,6 +689,12 @@ static void viewtoright(const Arg *arg);
static void viewtoleft_vacant(const Arg *arg);
static void viewtoright_vacant(const Arg *arg);
#if USEWINMAP
static void window_set_state(Display *dpy, Window win, long state);
static void window_map(Display *dpy, Client *c, int deiconify);
static void window_unmap(Display *dpy, Window win, Window root, int iconify);
#endif
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int wmclasscontains(Window win, const char *class, const char *name);
@ -1728,6 +1740,10 @@ createmon(void)
m->barposition = barposition;
m->layoutposition = layoutposition;
/* icon stuff */
m->iconspacing = iconspacing;
m->iconsize = iconsize;
/* coloring */
m->colorselectedtitle = colorselectedtitle;
m->colorhiddentitle = colorhiddentitle;
@ -2552,7 +2568,7 @@ resizebarwin(m);
drw_text(drw, x + pltitle, 0, tabw, bh, lrpad / 2, c->name, 0);
#if USEWINICON
} else {
drw_text(drw, x + pltitle, 0, tabw, bh, lrpad / 2 + (c->icon ? c->icw + iconspacing : 0), c->name, 0); /* draw, with icon spacing and width added */
drw_text(drw, x + pltitle, 0, tabw, bh, lrpad / 2 + (c->icon ? c->icw + selmon->iconspacing : 0), c->name, 0); /* draw, with icon spacing and width added */
if (c->icon && !selmon->hidetitlepowerline && selmon->colorselectedtitle)
drw_pic(drw, x + pltitle + lrpad / 2, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */
else if (c->icon)
@ -2891,13 +2907,13 @@ geticonprop(Window win, unsigned int *picw, unsigned int *pich)
for (i = p; i < end - 1; i += sz) {
if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; }
if ((sz = w * h) > end - i) break;
if ((m = w > h ? w : h) >= iconsize && (d = m - iconsize) < bstd) { bstd = d; bstp = i; }
if ((m = w > h ? w : h) >= selmon->iconsize && (d = m - selmon->iconsize) < bstd) { bstd = d; bstp = i; }
}
if (!bstp) {
for (i = p; i < end - 1; i += sz) {
if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; }
if ((sz = w * h) > end - i) break;
if ((d = iconsize - (w > h ? w : h)) < bstd) { bstd = d; bstp = i; }
if ((d = selmon->iconsize - (w > h ? w : h)) < bstd) { bstd = d; bstp = i; }
}
}
if (!bstp) { XFree(p); return None; }
@ -2907,11 +2923,11 @@ geticonprop(Window win, unsigned int *picw, unsigned int *pich)
uint32_t icw, ich;
if (w <= h) {
ich = iconsize; icw = w * iconsize / h;
ich = selmon->iconsize; icw = w * selmon->iconsize / h;
if (icw == 0) icw = 1;
}
else {
icw = iconsize; ich = h * iconsize / w;
icw = selmon->iconsize; ich = h * selmon->iconsize / w;
if (ich == 0) ich = 1;
}
*picw = icw; *pich = ich;
@ -3297,7 +3313,9 @@ showhide(Client *c)
return;
if (ISVISIBLE(c)) {
/* show clients top down */
#if !USEWINMAP
XMoveWindow(dpy, c->win, c->x, c->y);
#endif
if (c->needresize && autoresize) {
c->needresize = 0;
@ -3306,13 +3324,22 @@ showhide(Client *c)
XMoveWindow(dpy, c->win, c->x, c->y);
}
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0);
#if USEWINMAP
window_map(dpy, c, 1);
#else
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0);
#endif
showhide(c->snext);
} else {
/* hide clients bottom up */
showhide(c->snext);
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
#if USEWINMAP
window_unmap(dpy, c->win, root, 1);
#else
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
#endif
}
}
@ -3695,7 +3722,6 @@ manage(Window w, XWindowAttributes *wa)
grabbuttons(c, 0);
if (!c->isfloating)
c->isfloating = c->oldstate = t || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
switch(attachdirection){
case 1:
@ -6677,6 +6703,53 @@ updatewmhints(Client *c)
}
}
#if USEWINMAP
void
window_set_state(Display *dpy, Window win, long state)
{
long data[] = { state, None };
XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
PropModeReplace, (unsigned char*)data, 2);
}
void
window_map(Display *dpy, Client *c, int deiconify)
{
Window win = c->win;
if (deiconify)
window_set_state(dpy, win, NormalState);
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
XMapWindow(dpy, win);
}
void
window_unmap(Display *dpy, Window win, Window root, int iconify)
{
static XWindowAttributes ca, ra;
XGrabServer(dpy);
XGetWindowAttributes(dpy, root, &ra);
XGetWindowAttributes(dpy, win, &ca);
/* Prevent UnmapNotify events */
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
XUnmapWindow(dpy, win);
if (iconify)
window_set_state(dpy, win, IconicState);
XSelectInput(dpy, root, ra.your_event_mask);
XSelectInput(dpy, win, ca.your_event_mask);
XUngrabServer(dpy);
}
#endif
void
view(const Arg *arg)
{

View file

@ -24,6 +24,7 @@ Not compatible with BSDs so for those, set this to 0. */
#define USEROUNDCORNERS 1 /* Whether or not to include rounded corners */
#define USEMEDIA 1 /* Whether or not to include media keys */
#define USEMOUSE 1 /* Whether or not to include mouse binds */
#define USEWINMAP 1 /* Whether or not to map and unmap windows */
#define USEXRESOURCES 1 /* Whether or not to include .Xresources support. By disabling this, you're also disabling the speedwmrc config file. It is recommended that you keep this enabled. */
#define USEXFTWORKAROUND 0 /* Whether or not to include the libXft emoji workaround.
This is usually not necessary so only enable it if you find that you need it. */