Update: Add new option, fix preview scaling bug caused by one line not

being changed accordingly.
This commit is contained in:
speediegq 2022-08-23 17:50:48 +02:00
parent 54b0b9938a
commit 7b9f6ad9bf
4 changed files with 13 additions and 5 deletions

View file

@ -75,11 +75,12 @@
- speedwm.warpcursor: 1 - speedwm.warpcursor: 1
- speedwm.pertag: 1 - speedwm.pertag: 1
- speedwm.i3nmaster: 0 - speedwm.i3nmaster: 0
- speedwm.scalepreview: 4
- speedwm.tagpreview: 1 - speedwm.tagpreview: 1
- speedwm.tagpreviewpaddingv: 0 - speedwm.tagpreviewpaddingv: 0
- speedwm.tagpreviewpaddingh: 0 - speedwm.tagpreviewpaddingh: 0
- speedwm.mousepreview: 1 - speedwm.mousepreview: 1
- speedwm.barpreview: 0
- speedwm.scalepreview: 4
- speedwm.monocleclientcount: 0 - speedwm.monocleclientcount: 0
- speedwm.monoclecount: 0 - speedwm.monoclecount: 0
- speedwm.monocleformat: [%d/%d] - speedwm.monocleformat: [%d/%d]

View file

@ -92,7 +92,7 @@
/* Misc */ /* Misc */
#define SHCMD(cmd) { .v = (const char*[]){ shell, "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ shell, "-c", cmd, NULL } }
#define TAGKEYS(CHAIN,KEY,TAG) { MODKEY, CHAIN, KEY, view, {.ui = 1 << TAG} }, \ #define TAGKEYS(CHAIN,KEY,TAG) { MODKEY, CHAIN, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, CHAIN, KEY, previewtag, {.ui = TAG} }, { MODKEY|ShiftMask, CHAIN, KEY, previewtag, {.ui = TAG} }, \
/* Options /* Options
* *
* If xrdb is installed, you can simply edit ~/.config/speedwm-de/speedwmrc instead of recompiling. * If xrdb is installed, you can simply edit ~/.config/speedwm-de/speedwmrc instead of recompiling.
@ -138,6 +138,7 @@ static int tagpreview = 1; /* Enable tag previews */
static int tagpreviewpaddingv = 0; /* Vertical tag padding */ static int tagpreviewpaddingv = 0; /* Vertical tag padding */
static int tagpreviewpaddingh = 0; /* Horizontal tag padding */ static int tagpreviewpaddingh = 0; /* Horizontal tag padding */
static int mousepreview = 1; /* Display tag previews if hovering over a tag */ static int mousepreview = 1; /* Display tag previews if hovering over a tag */
static int barpreview = 0; /* Display the bar in the preview */
static int scalepreview = 4; /* Size of tag preview */ static int scalepreview = 4; /* Size of tag preview */
/* Window spawning options */ /* Window spawning options */

View file

@ -3925,10 +3925,15 @@ getpreview(void)
imlib_context_set_blend(0); imlib_context_set_blend(0);
imlib_context_set_visual(visual); imlib_context_set_visual(visual);
imlib_context_set_drawable(root); imlib_context_set_drawable(root);
imlib_copy_drawable_to_image(0, selmon->wx, selmon->wy, selmon->ww ,selmon->wh, 0, 0, 1);
selmon->tagmap[i] = XCreatePixmap(dpy, selmon->tagwin, selmon->mw / scalepreview, selmon->mh / scalepreview, depth); if (!barpreview)
imlib_copy_drawable_to_image(0, selmon->wx, selmon->wy, selmon->ww ,selmon->wh, 0, 0, 1);
else
imlib_copy_drawable_to_image(0, selmon->mx, selmon->my, selmon->mw ,selmon->mh, 0, 0, 1);
selmon->tagmap[i] = XCreatePixmap(dpy, selmon->tagwin, selmon->mw + tagpreviewpaddingh / scalepreview, selmon->mh + 1 * sp + tagpreviewpaddingv / scalepreview, depth);
imlib_context_set_drawable(selmon->tagmap[i]); imlib_context_set_drawable(selmon->tagmap[i]);
imlib_render_image_part_on_drawable_at_size(0, 0 + tagpreviewpaddingh, selmon->mw, selmon->mh, 0, 0 + 1 * sp + tagpreviewpaddingv, selmon->mw / scalepreview, selmon->mh / scalepreview); imlib_render_image_part_on_drawable_at_size(0, 0, selmon->mw + tagpreviewpaddingh, selmon->mh, 0, 0 + 1 * sp + tagpreviewpaddingv, selmon->mw / scalepreview, selmon->mh / scalepreview);
imlib_free_image(); imlib_free_image();
} }
} }

View file

@ -134,6 +134,7 @@ ResourcePref resources[] = {
{ "tagpreview", INTEGER, &tagpreview }, { "tagpreview", INTEGER, &tagpreview },
{ "tagpreviewpaddingv", INTEGER, &tagpreviewpaddingv }, { "tagpreviewpaddingv", INTEGER, &tagpreviewpaddingv },
{ "tagpreviewpaddingh", INTEGER, &tagpreviewpaddingh }, { "tagpreviewpaddingh", INTEGER, &tagpreviewpaddingh },
{ "barpreview", INTEGER, &barpreview },
{ "mousepreview", INTEGER, &mousepreview }, { "mousepreview", INTEGER, &mousepreview },
{ "leftlayout", INTEGER, &leftlayout }, { "leftlayout", INTEGER, &leftlayout },
{ "hidelayout", INTEGER, &hidelayout }, { "hidelayout", INTEGER, &hidelayout },