Closed siduck closed 3 years ago
so far I was able to preview an image with rofi and align it properly.
#!/bin/sh
preview_dir="$HOME/.dwm/tag_previews/"
current_tag=$(wmctrl -d | grep '*' | cut -d ' ' -f1)
save_Screenshot() {
file="${preview_dir}${current_tag}.png"
maim -u "${file}"
}
$(save_Screenshot)
The above script should be excuted by dwm before the user switches to another workspace. (this is for saving the screenshots )
maim will overwrite the screenshots itself too.
screenshot=".dwm/tag_previews/1.png"
sed -i "s:/home/sid/.*.png:/home/sid/$screenshot:" ~/.config/rofi/tag.rasi
And
- run [tag_preview script](https://paste.sh/HX3tOdA_#Pv67BPdzQ_IgoVzsMM5w_rH-)
I shouldnt worry about the alignment , I'll manage it in the tag_preview script.
works kinda ( but switching tags adds 100ms ~ delay ) :(
after using jpeg for image format , it feels faster than before!
using feh instead of rofi is much faster!
look
Issue 2 :
If there's an inactive tag , do not show its tag preview.
behaviour :
Solution :
just delete its image from the ~/.dwm/tag_previews dir soo in our case 3 was the inactive tag , so remove 3.jpeg :)
if we hover an empty tag
finally my friend made a patch for this! so no external scripts xD
https://github.com/siduck76/chadwm/commit/0372264f1de4aa3487a0c1643051dd5746e0e581
stuff needs to be fixed : tag preview doesnt update the current workspace screenshot
solution : whenever we hover current tag icon , take screenshot + do tag preview
dwm ram usage keeps increasing if I switch to a different tag
dwm ram usage keeps increasing if I switch to a different tag
simplescreenrecorder-2021-08-03_21.49.19.mp4
temp fix https://pastebin.com/raw/rThCDTZ6
dwm ram usage keeps increasing if I switch to a different tag
simplescreenrecorder-2021-08-03_21.49.19.mp4
fixed here https://github.com/siduck76/chadwm/commit/a10d00f9e0329e787b490e54182f15394e41b583
dwm will know take around 11mb to 32~ mb , since its storing the images in ram rather than disk . I'll test it the other way around ( saving images on disk).
FINALLY DONE https://github.com/siduck76/chadwm/commit/f397a51a8e9b093994bc663be4d98cc7150bdb81
thanks a lot to /u/eProTaLT83 for helping with this feature!!
Hi, made a patch for this, which of course I can maintain.
Let me suggest to put it on the patches section since I know some are too comfy on their builds to switch.
Hi, made a patch for this, which of course I can maintain.
Let me suggest to put it on the patches section since I know some are too comfy on their builds to switch.
Thanks for this! if you don't mind then you could add the tabbed with colored buttons patch too.
Thanks for this! if you don't mind then you could add the tabbed with colored buttons patch too.
You mean this ?
Thanks for this! if you don't mind then you could add the tabbed with colored buttons patch too.
You mean this ?
yes
Sorry for the late response but the patch finally got pushed. Also by
Let me suggest to put it on the patches section since I know some are too comfy on their builds to switch.
I meant to the readme of your repo lol. Anyway it's now pushed on the link above.
As for
if you don't mind then you could add the tabbed with colored buttons patch too.
I could but I wouln't be able to keep it up to date.
Maybe the author of the patch is interested on it? see
@explosion-mental The author of the patch is /u/eProTaLT83 on reddit . I came up with this idea and he made a patch for it!
At least in my build of DWM, with the patch of explosion-mental, I have some problem with scaling variable. If I set it to 2 (static const int scalepreview= 2), the window size does not increase, but it still zooms the image. It would be better if the window size increases together. Probably an error in the calculation of XCopyArea.
At least in my build of DWM, with the patch of explosion-mental, I have some problem with scaling variable. If I set it to 2 (static const int scalepreview= 4), the window size does not increase, but it still zooms the image. It would be better if the window size still increases. Probably an error in the calculation of XCopyArea.
you can modify this function
+void
+updatepreview(void)
+{
+ Monitor *m;
+
+ XSetWindowAttributes wa = {
+ .override_redirect = True,
+ .background_pixmap = ParentRelative,
+ .event_mask = ButtonPressMask|ExposureMask
+ };
+ for (m = mons; m; m = m->next) {
+ m->tagwin = XCreateWindow(dpy, root, m->wx, m->by + bh, m->mw / 4, m->mh / 4, 0,
+ DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
+ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor);
+ XMapRaised(dpy, m->tagwin);
+ XUnmapWindow(dpy, m->tagwin);
+ }
+}
+
modify this to
+void
+updatepreview(void)
+{
+ Monitor *m;
+
+ XSetWindowAttributes wa = {
+ .override_redirect = True,
+ .background_pixmap = ParentRelative,
+ .event_mask = ButtonPressMask|ExposureMask
+ };
+ for (m = mons; m; m = m->next) {
+ m->tagwin = XCreateWindow(dpy, root, m->wx, m->by + bh, m->mw / scalepreview, m->mh / scalepreview, 0,
+ DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
+ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor);
+ XMapRaised(dpy, m->tagwin);
+ XUnmapWindow(dpy, m->tagwin);
+ }
+}
+
This solution maybe will handle your problem.
At least in my build of DWM, with the patch of explosion-mental, I have some problem with scaling variable. If I set it to 2 (static const int scalepreview= 4), the window size does not increase, but it still zooms the image. It would be better if the window size still increases. Probably an error in the calculation of XCopyArea.
you can modify this function
+void +updatepreview(void) +{ + Monitor *m; + + XSetWindowAttributes wa = { + .override_redirect = True, + .background_pixmap = ParentRelative, + .event_mask = ButtonPressMask|ExposureMask + }; + for (m = mons; m; m = m->next) { + m->tagwin = XCreateWindow(dpy, root, m->wx, m->by + bh, m->mw / 4, m->mh / 4, 0, + DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), + CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); + XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor); + XMapRaised(dpy, m->tagwin); + XUnmapWindow(dpy, m->tagwin); + } +} +
modify this to
+void +updatepreview(void) +{ + Monitor *m; + + XSetWindowAttributes wa = { + .override_redirect = True, + .background_pixmap = ParentRelative, + .event_mask = ButtonPressMask|ExposureMask + }; + for (m = mons; m; m = m->next) { + m->tagwin = XCreateWindow(dpy, root, m->wx, m->by + bh, m->mw / scalepreview, m->mh / scalepreview, 0, + DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), + CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); + XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor); + XMapRaised(dpy, m->tagwin); + XUnmapWindow(dpy, m->tagwin); + } +} +
This solution maybe will handle your problem.
I don't believe that it was only it! Just exchange a four by the variable. I think this bug fix should be on dwm suckless site as well.
@renanwp2 This patch is not mine, I just found this little bug during debugging. The creator of this patch is explosion-mental.
show a floating picture like thingy for tags when their icons on dwmbar is hovered, something like this
https://cdn.discordapp.com/attachments/635625917623828520/829478089469329438/gif_2021-04-07032620.gif (awesomewm)