git: 248938f607f8 - main - x11/xseticon: new port had been added (+)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Dec 2024 19:40:07 UTC
The branch main has been updated by danfe:
URL: https://cgit.FreeBSD.org/ports/commit/?id=248938f607f8961ea821f43dc360eb2cc8cacf4f
commit 248938f607f8961ea821f43dc360eb2cc8cacf4f
Author: Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2024-12-13 19:38:34 +0000
Commit: Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2024-12-13 19:38:34 +0000
x11/xseticon: new port had been added (+)
Some X11 programs do not set their window icons which window
managers typically use to represent that program window in
switcher lists, taskbars, and so on; this little program can
be handy in this case.
The patch to enable window selection based on WM_CLASS hints
is courtesy of Victor Kareh.
WWW: http://www.leonerd.org.uk/code/xseticon/
---
x11/Makefile | 1 +
x11/xseticon/Makefile | 27 +++++++++++++++++
x11/xseticon/distinfo | 3 ++
x11/xseticon/files/patch-xseticon.c | 58 +++++++++++++++++++++++++++++++++++++
x11/xseticon/pkg-descr | 4 +++
5 files changed, 93 insertions(+)
diff --git a/x11/Makefile b/x11/Makefile
index aa6405480270..22c89f0c3801 100644
--- a/x11/Makefile
+++ b/x11/Makefile
@@ -640,6 +640,7 @@
SUBDIR += xscreensaver.app
SUBDIR += xsel-conrad
SUBDIR += xset
+ SUBDIR += xseticon
SUBDIR += xsetroot
SUBDIR += xsettingsd
SUBDIR += xskyroot
diff --git a/x11/xseticon/Makefile b/x11/xseticon/Makefile
new file mode 100644
index 000000000000..459b2d5fdf2e
--- /dev/null
+++ b/x11/xseticon/Makefile
@@ -0,0 +1,27 @@
+PORTNAME= xseticon
+PORTVERSION= 0.1
+DISTVERSIONSUFFIX= +bzr14
+CATEGORIES= x11
+MASTER_SITES= ${WWW}
+
+MAINTAINER= danfe@FreeBSD.org
+COMMENT= Set window icon for any given X11 window
+WWW= http://www.leonerd.org.uk/code/xseticon/
+
+LICENSE= GPLv2+
+
+LIB_DEPENDS= libgd.so:graphics/gd
+
+USES= gmake gnome pkgconfig xorg
+USE_GNOME= glib20
+USE_XORG= x11 xmu
+
+PLIST_FILES= bin/${PORTNAME}
+
+post-patch:
+ @${REINPLACE_CMD} -e 's,gcc,$${CC} $${CFLAGS},' ${WRKSRC}/Makefile
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/x11/xseticon/distinfo b/x11/xseticon/distinfo
new file mode 100644
index 000000000000..cf1bd256701b
--- /dev/null
+++ b/x11/xseticon/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1516047601
+SHA256 (xseticon-0.1+bzr14.tar.gz) = 048a8339b47030ebbff9cce4b58cb071a5c5f5a2cd7ff1ecc8434f95b2f8e4c5
+SIZE (xseticon-0.1+bzr14.tar.gz) = 10192
diff --git a/x11/xseticon/files/patch-xseticon.c b/x11/xseticon/files/patch-xseticon.c
new file mode 100644
index 000000000000..6ab257f54a1b
--- /dev/null
+++ b/x11/xseticon/files/patch-xseticon.c
@@ -0,0 +1,58 @@
+--- xseticon.c.orig 2018-01-15 20:20:01 UTC
++++ xseticon.c
+@@ -46,6 +46,7 @@ void usage(int exitcode)
+ printf("options:\n");
+ printf(" -name <text> : apply icon to the window of the name supplied\n");
+ printf(" -id <windowid> : apply icon to the window id supplied\n");
++ printf(" -class <text> : apply icon to the window matching the class supplied\n");
+ printf("\n");
+ printf("Sets the window icon to the specified .png image. The image is loaded from\n");
+ printf("the file at runtime and sent to the X server; thereafter the file does not\n");
+@@ -98,6 +99,30 @@ Window Window_With_Name(Display* dpy, Window top, char
+ return(w);
+ }
+
++Window Window_With_Class(Display* dpy, Window top, char* class)
++{
++ Window *children, dummy;
++ unsigned int nchildren;
++ int i;
++ Window w = 0;
++ XClassHint *hint = XAllocClassHint();
++
++ if (XGetClassHint(dpy, top, hint)
++ && (!strcmp(hint->res_class, class) || !strcmp(hint->res_name, class)))
++ return(top);
++
++ if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
++ return(0);
++
++ for (i=0; i<nchildren; i++) {
++ w = Window_With_Class(dpy, children[i], class);
++ if (w)
++ break;
++ }
++ if (children) XFree ((char *)children);
++ return(w);
++}
++
+ Window Select_Window_Args(Display* dpy, int screen, int* rargc, char* argv[])
+ {
+ int nargc = 1;
+@@ -127,6 +152,16 @@ Window Select_Window_Args(Display* dpy, int screen, in
+ OPTION);
+ if (!w)
+ Fatal_Error("No window with name %s exists!",OPTION);
++ continue;
++ }
++ if (!strcmp(OPTION, "-class")) {
++ NXTOPT;
++ if (verbose)
++ printf("Selecting window by class %s\n", OPTION);
++ w = Window_With_Class(dpy, RootWindow(dpy, screen),
++ OPTION);
++ if (!w)
++ Fatal_Error("No window with class %s exists!",OPTION);
+ continue;
+ }
+ if (!strcmp(OPTION, "-id")) {
diff --git a/x11/xseticon/pkg-descr b/x11/xseticon/pkg-descr
new file mode 100644
index 000000000000..4a2bae8e5c77
--- /dev/null
+++ b/x11/xseticon/pkg-descr
@@ -0,0 +1,4 @@
+Xterm, and likely many other X11 programs, do not set themselves window
+icons, which window managers typically use to represent that program
+window in switcher lists, taskbars, and so on. This program can set the
+X11 window icon for any given window, to that of a given image file.