commit e8b268f40411939560adc84cb93fd6f14f1e08f6
Author: seninha <lucas_AT_seninha.org>
Date: Sat Oct 1 13:36:18 2022 -0300
[surf][patch] add icon patch
I tried to simply set the _NET_WM_ICON property directly, but gtk does
not like simple approaches.
diff --git a/surf.suckless.org/patches/icon/index.md b/surf.suckless.org/patches/icon/index.md
new file mode 100644
index 00000000..836e7e60
--- /dev/null
+++ b/surf.suckless.org/patches/icon/index.md
_AT_@ -0,0 +1,26 @@
+Icon
+====
+
+Description
+-----------
+
+This patch sets the `_NET_WM_ICON` ewmh property for gtk-created windows.
+
+This property is used by some window managers to display an icon for the window on the title bar.
+It is also used by some programs (like pagers and taskbars) to show a miniature for the window.
+
+This patch sets icons of size 16x16, 32x32 and 48x48.
+The icons are found on the new file `surf.xpm`, which is included directly in the source code.
+The icons look like `surf.png` except that they have a white border (to make them distinguishable on dark taskbars/titlebars), and the proportion is slightly modified to make the image fit on small icons.
+
+If you use dwm, you can get window icons on the status bar with the [winicon](
https://dwm.suckless.org/patches/winicon/) patch.
+
+Download
+--------
+
+* [surf-icon-2.1.diff](surf-icon-2.1.diff) (5876) (20221001)
+
+Authors
+-------
+
+* Lucas de Sena <lucas at seninha dot org>
diff --git a/surf.suckless.org/patches/icon/surf-icon-2.1.diff b/surf.suckless.org/patches/icon/surf-icon-2.1.diff
new file mode 100644
index 00000000..26d56529
--- /dev/null
+++ b/surf.suckless.org/patches/icon/surf-icon-2.1.diff
_AT_@ -0,0 +1,172 @@
+diff -Nup surf-2.1/surf.c surf-icon/surf.c
+--- surf-2.1/surf.c Sun May 9 19:34:33 2021
++++ surf-icon/surf.c Sat Oct 1 12:30:40 2022
+_AT_@ -39,6 +39,8 @@
+
+ enum { AtomFind, AtomGo, AtomUri, AtomLast };
+
++enum { Icon16x16, Icon32x32, Icon48x48, IconLast };
++
+ enum {
+ OnDoc = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
+ OnLink = WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK,
+_AT_@ -300,6 +302,7 @@ static ParamName loadfinished[] = {
+
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
++#include "surf.xpm"
+
+ void
+ die(const char *errstr, ...)
+_AT_@ -325,6 +328,8 @@ setup(void)
+ {
+ GIOChannel *gchanin;
+ GdkDisplay *gdpy;
++ GdkPixbuf *gpix;
++ GList *icons = NULL;
+ int i, j;
+
+ /* clean up any zombies immediately */
+_AT_@ -413,6 +418,17 @@ setup(void)
+ if (defconfig[j].prio >= uriparams[i].config[j].prio)
+ uriparams[i].config[j] = defconfig[j];
+ }
++ }
++
++ /* set icons */
++ for (i = 0; i < IconLast; i++) {
++ gpix = gdk_pixbuf_new_from_xpm_data(surf_xpm[i]);
++ icons = g_list_prepend(icons, gpix);
++ }
++ gtk_window_set_default_icon_list(icons);
++ for (i = 0; icons != NULL && i < IconLast; i++) {
++ g_object_unref(icons->data);
++ icons = g_list_remove_link(icons, icons);
+ }
+ }
+
+diff -Nup surf-2.1/surf.xpm surf-icon/surf.xpm
+--- surf-2.1/surf.xpm Wed Dec 31 21:00:00 1969
++++ surf-icon/surf.xpm Sat Oct 1 11:44:16 2022
+_AT_@ -0,0 +1,121 @@
++/* XPM */
++
++static char * surf_16_xpm[] = {
++"16 16 3 1",
++" c None",
++". c #FFFFFF",
++"+ c #0A0A0A",
++" ",
++" ",
++" ",
++" ....",
++" .+++",
++" .+++",
++".............++.",
++".+++++.+++++++++",
++".+++++.+++++++++",
++".++.++.++.++.++.",
++"+++.+++++.++.++.",
++"+++.+++++.++.++.",
++"................",
++" ",
++" ",
++" "};
++
++static char * surf_32_xpm[] = {
++"32 32 3 1",
++" c None",
++". c #FFFFFF",
++"+ c #000000",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" .........",
++" .........",
++" ..+++++++",
++" ..+++++++",
++" ..+++++++",
++" ..+++....",
++" ........................+++....",
++" ........................+++....",
++" ..++++++++...++++++++++++++++..",
++" ..++++++++...++++++++++++++++..",
++" ..++++++++...++++++++++++++++..",
++" ..+++..+++...+++..+++...+++....",
++"...+++..+++...+++..+++...+++....",
++"...+++..+++...+++..+++...+++.. ",
++"++++++..+++++++++..+++...+++.. ",
++"++++++..+++++++++..+++...+++.. ",
++"++++++..+++++++++..+++...+++.. ",
++".............................. ",
++".............................. ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" "};
++
++static char * surf_48_xpm[] = {
++"48 48 3 1",
++" c None",
++". c #FFFFFF",
++"+ c #000000",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ..............",
++" ..............",
++" ..............",
++" ..............",
++" ....++++++++..",
++" ....++++++++..",
++" ....++++++++..",
++" ....++++++++..",
++" ....................................++++......",
++" ....................................++++......",
++" ....................................++++......",
++" ....................................++++......",
++" ....++++++++++++....+++++++++++++++++++++++...",
++" ....++++++++++++....+++++++++++++++++++++++...",
++" ....++++++++++++....+++++++++++++++++++++++...",
++" ....++++++++++++....+++++++++++++++++++++++...",
++"......++++....++++....++++....++++....++++......",
++"......++++....++++....++++....++++....++++......",
++"......++++....++++....++++....++++....++++......",
++"......++++....++++....++++....++++....++++......",
++"..++++++++....++++++++++++....++++....++++.... ",
++"..++++++++....++++++++++++....++++....++++.... ",
++"..++++++++....++++++++++++....++++....++++.... ",
++"..++++++++....++++++++++++....++++....++++.... ",
++".............................................. ",
++".............................................. ",
++".............................................. ",
++".............................................. ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" ",
++" "};
++
++static char **surf_xpm[IconLast] = {
++ [Icon16x16] = surf_16_xpm,
++ [Icon32x32] = surf_32_xpm,
++ [Icon48x48] = surf_48_xpm,
++};
Received on Sat Oct 01 2022 - 18:40:22 CEST