From 135c4f9263c232456191a67d2e376c76813947c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Wed, 15 Jan 2014 22:40:34 +0100 Subject: [PATCH] Added window icons; fixes issue #125 --- icon/128x128.png | Bin 0 -> 1150 bytes icon/16x16.png | Bin 0 -> 397 bytes icon/32x32.png | Bin 0 -> 504 bytes icon/48x48.png | Bin 0 -> 661 bytes icon/64x64.png | Bin 0 -> 747 bytes icon/Makefile | 12 +++ icon/dat2h.awk | 35 +++++++ icon/data.h | 247 +++++++++++++++++++++++++++++++++++++++++++++++ sxiv.desktop | 1 + window.c | 25 +++++ 10 files changed, 320 insertions(+) create mode 100644 icon/128x128.png create mode 100644 icon/16x16.png create mode 100644 icon/32x32.png create mode 100644 icon/48x48.png create mode 100644 icon/64x64.png create mode 100644 icon/Makefile create mode 100644 icon/dat2h.awk create mode 100644 icon/data.h diff --git a/icon/128x128.png b/icon/128x128.png new file mode 100644 index 0000000000000000000000000000000000000000..a38c1abd55900b84197fcdd96453ac64b787599e GIT binary patch literal 1150 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSY)RhkE)4%caKYZ?lYt_f1s;*b z3=DinK$vl=HlH+5kiEpy*OmPqBR`Kk_oc!E*+3!L%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6_|fr0svr;B4q#jUq<_hySYO0?hSX}S?{^q5n!3yY)btcWE7 z8^rp@3;rcZb*{uhqP#pMCq5oK}|h ztya!M@ZF?>@72$~zq_7$Oig{+f6ghNe!f0+;yAzD49{O*C6%u6GAS^i!;FNUVn!1T zVUV&fvt;-Eceq;mbz4a6^!)1B`d9Y;%nVHE(1E?ZNl~tBzNP$phHb|;{jTGezutJ6 zfu$dWUNxudH+&Fe5MW@e;1&QwnJi;qunO*Yhp|;{X#TF#p$Iz_{)D z{i7V=tlGTu1RZ{GEU>L%36Qg6(%_e8oYH*Df+lI&=2!_H9s)mlLjG7fNZFlDLAQ zR#dU=!)X-`)k7YPzf_!j9!}>JaB7Kqf9mN;?Uwt2Ka`X{cV`>z-y!DDoHFOv*8mq6 zu{x=y?;>^AdoOr2>|xp1C6N5W?BQ>*g&P@MIg6vuLAGEL|6TVF zb}j{44IL-uCW}A$-u*l-?!&yVr>~2iB&aYRh?=Y1`>5&hM_`&TD ze;s}Ane%2HznP0mRObWNhQ;m6p1fN3H~Ri|QN@rCnp_vdn6w#Zc?5*F+;H;uY%>$8 z5Or|b<{6Ok{0qP5+!-k+R90v=nKN$j6qw9Y$+^nqMN0gui}&-DhP{3cU}!JNnK>RFx_Ui-5xRdKp`=G$GC zFs6`PhPIr>D=rnkKb8n^hSZuFh;r@{IoJ~MS20RKm2=Zwi)g`B+nBGII%Em$5IVS% zK`*TSgqVkK(>A3mmHS@(W?rJ!*zabb7+(KE%p>vOCWT zu#q(3ny%h;OW^m(rIX#`+HP}v3H&P{Cmj4kaXV{}JnKD{gs0kh47WebK2vYTad=BZ z;?v6vafkAE|8mY}&&Xyxd}=x4oc8&T-dw-M)HcmdKI;Vst0PD2D`Tzg` literal 0 HcmV?d00001 diff --git a/icon/16x16.png b/icon/16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..6559e955af7f94c28579cf8749a2cadf376597ab GIT binary patch literal 397 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=DinK$vl=HlH+5kiEpy*OmPqBR{u-@~+Sj4WN*0W=KSdbAE1aYF-JD%fR4Vl$uzQ znxasiS(2gP?&%wlqL<1J6#wYy;uvCaIyofB;OBV<#snp|i+6u7FFa)!bd|OI{rtA% zl-Y$Bd4NFYg_@T3tV5y)Z~S1m!)*{eRn+(4tiqqNHxo7;YB+z8f4g|cRgX!GH%t!k zas+ZEM-=Ca`t>eX&rM87xWObo`+Hx95LP5$sBd7s!0hk7>l2k;!6J*9r0;6Z`e z+vEBkK03<|avD!q;cEqu4#w~epME?QCeU7!q+fIV8y7=XnR#g75z_*+3xGHF(k&Lqi?| zi2`o-pmVr+h6bn8J2{SVv7UL#x(gbgDo#u4Qi}5aJnwc z=oF3f?%m2~_+quTK#9#RW?ye9*lPZ)~l+a*|R)8MGri}?9h z5oio%8v5Rxpqy|2Km#ga)j;FUnci-@CZol6;Xesr=P zv0!>O0jMN_SFq_PN4Um>#~cxVl&xDjW9|oUHFDY>6Ml6p0RoW literal 0 HcmV?d00001 diff --git a/icon/48x48.png b/icon/48x48.png new file mode 100644 index 0000000000000000000000000000000000000000..f473fe856f6fdd2f73ce7a6a8759f1ac7dde8f8b GIT binary patch literal 661 zcmV;G0&4wV03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00H?)L_t(&-tCyNO2beT zhX00wxH#3tp|%z&2wK$Ep+k{AfT)XG2cJQ@xH|O(+&VZ}kru=U5C<3SP=`VWwRIK| z9ZIJ4pgIGrUJrYpqbm?aE$r^a6JXl7?_P*C`$gw>5aqHZ zrtw&0z|XvX59r?m0<99sF&f19OaUm2&nyF!=9L3bn^y`DhIwTfFrN(ox6JF!pCtgm z`RSJU7_CA2uy|5-J-@wn4*)3SGl8qhf^Y@kg^t?WPO4%P- z5DSJ!>R^vnSlh%f+e6(}IA(0YL+dD|yQ zC1eBM?N{v4%Yu+#LiQ2sJYUaa?uo3{b5;MHPersLd;_ vK$zxbtI+LNT(e-vn71}|k*h%5%mctLZkWrZ(2HPu00000NkvXXu0mjf^wSP? literal 0 HcmV?d00001 diff --git a/icon/64x64.png b/icon/64x64.png new file mode 100644 index 0000000000000000000000000000000000000000..fd32f04909deff8ec4ffe4a41f11bb9ac32a9c0e GIT binary patch literal 747 zcmVWFU8GbZ8()Nlj2>E@cM*00K`*L_t(|+U=OXOT$1E z$6pUYTpXk>4qBBW2vw@BgM)~(h`P85y16(>7e{sJKj7BE$%-h5e}Fi+ScN(W8PwKU zM06-!)Il1OG|gRdKXNheJEbI$en0Q~?%pLalFI#nMtXX=wf!C)&P#nCftU*cAOHjq zZzXiw1uy{!00AHX1fWn|yt6t@&RL!|>&w262|xe{00AHXo?U>p%F}iY*Oi)8p4|CRvg|{PaIh3fw@5)ZOD8RE?Ug*J&vT z^*AgGLTkbE0>K1;R(;+S$cEqs!VOC3-vgSJr1WjnD-DFF`XW*wBMH_N_-+Be=A$m+ z$9yK8jm)CRngSBn%G&_2n3q}oFjGL{T6tfCkc#SS3qZAb)onoHTKUk=0@?!zv-&FA d022^*0KWh?@rv8*s>}cY002ovPDHLkV1j_xF3$h} literal 0 HcmV?d00001 diff --git a/icon/Makefile b/icon/Makefile new file mode 100644 index 0000000..bbb4786 --- /dev/null +++ b/icon/Makefile @@ -0,0 +1,12 @@ +PREFIX = /usr/local +ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png + +all: + +install: + for f in $(ICONS); do \ + dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \ + mkdir -p "$$dir"; \ + cp "$$f" "$$dir/sxiv.png"; \ + chmod 644 "$$dir/sxiv.png"; \ + done diff --git a/icon/dat2h.awk b/icon/dat2h.awk new file mode 100644 index 0000000..cd6f362 --- /dev/null +++ b/icon/dat2h.awk @@ -0,0 +1,35 @@ +#!/usr/bin/awk -f + +function printchars() { + while (n > 0) { + x = n / 16 >= 1 ? 16 : n; + printf("0x%x%x,%s", x - 1, ref[c] - 1, ++i % 12 == 0 ? "\n" : " "); + n -= x; + } +} + +/^$/ { + printchars(); + printf("\n\n"); + c = ""; + i = 0; +} + +/./ { + if (!ref[$0]) { + col[cnt++] = $0; + ref[$0] = cnt; + } + if ($0 != c) { + if (c != "") + printchars(); + c = $0; + n = 0; + } + n++; +} + +END { + for (i = 0; i < cnt; i++) + printf("%s,%s", col[i], ++j % 4 == 0 || i + 1 == cnt ? "\n" : " "); +} diff --git a/icon/data.h b/icon/data.h new file mode 100644 index 0000000..adb44e6 --- /dev/null +++ b/icon/data.h @@ -0,0 +1,247 @@ +#ifndef ICON_DATA_H +#define ICON_DATA_H + +typedef struct { + unsigned int size; + unsigned int cnt; + const unsigned char *data; +} icon_data_t; + +static const unsigned int icon_colors[] = { + 0xff222034, 0xffffffff, 0xff306082, 0xff76428a, + 0xfffbf236, 0xff99e550, 0xffd95763, 0xff37946e, + 0xff6abe30, 0xffac3232 +}; + +static const unsigned char icon_data_16[] = { + 0xf0, 0x80, 0x01, 0xf0, 0x80, 0x21, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x40, 0x01, 0x10, 0x01, 0x10, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x30, 0x11, 0x00, 0x01, 0x00, 0x51, 0xf0, 0x22, 0xa0, 0x42, 0x80, 0x62, + 0x03, 0x50, 0x02, 0x34, 0x05, 0x22, 0x13, 0x06, 0x10, 0x37, 0x08, 0x35, + 0x12, 0x13, 0x09, 0x06, 0x22, 0x47, 0x25, 0x02, 0x13, 0x09, 0x06, 0x32, + 0x47, 0x08, 0x05, 0x08, 0x03, 0x19, 0x16, 0x32, 0x47, 0x18, 0x29, 0x16, + 0x42, 0x37, 0x18, 0x19, 0x26, 0x42, 0x47, 0x08 +}; + +static const unsigned char icon_data_32[] = { + 0xf0, 0x10, 0x11, 0xf0, 0xd0, 0x11, 0xf0, 0xd0, 0x11, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0x10, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, + 0x10, 0x11, 0x90, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, + 0x90, 0x51, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x10, 0x11, 0x90, 0x11, + 0x30, 0x11, 0x30, 0x11, 0x10, 0x11, 0x10, 0x11, 0x00, 0x22, 0x50, 0x11, + 0x30, 0x11, 0x30, 0x11, 0x10, 0x11, 0x10, 0x11, 0x32, 0x50, 0x11, 0x30, + 0x11, 0x30, 0x11, 0x10, 0x11, 0x10, 0x11, 0x32, 0x30, 0x31, 0x10, 0x11, + 0x10, 0xb1, 0x52, 0x30, 0x31, 0x10, 0x11, 0x10, 0xb1, 0x52, 0x30, 0x31, + 0x10, 0x11, 0x10, 0xb1, 0x52, 0xf0, 0x10, 0xd2, 0xf0, 0x00, 0xe2, 0xf0, + 0x54, 0x92, 0x13, 0xc0, 0x84, 0x05, 0x62, 0x33, 0x80, 0x74, 0x55, 0x42, + 0x33, 0x09, 0x02, 0x30, 0x77, 0x08, 0x85, 0x32, 0x33, 0x19, 0x12, 0xc7, + 0x08, 0x65, 0x08, 0x12, 0x33, 0x19, 0x06, 0x52, 0x97, 0x08, 0x45, 0x18, + 0x02, 0x33, 0x19, 0x16, 0x62, 0x97, 0x08, 0x35, 0x18, 0x23, 0x29, 0x16, + 0x72, 0x97, 0x18, 0x15, 0x18, 0x23, 0x29, 0x26, 0x72, 0x97, 0x48, 0x13, + 0x39, 0x26, 0x72, 0x97, 0x48, 0x03, 0x39, 0x36, 0x82, 0x97, 0x38, 0x49, + 0x36, 0x82, 0x97, 0x38, 0x39, 0x46, 0x82, 0x97, 0x38, 0x29, 0x56, 0x92, + 0x97, 0x28, 0x29, 0x56, 0x92, 0x97, 0x28 +}; + +static const unsigned char icon_data_48[] = { + 0xf0, 0xa0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xc0, 0x21, 0xf0, + 0xf0, 0xc0, 0x21, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xa0, 0x81, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, + 0x20, 0x21, 0xe0, 0x81, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, + 0xe0, 0x81, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0xe0, 0x81, + 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0x20, 0x21, 0xe0, 0x21, 0x50, 0x21, + 0x50, 0x21, 0x20, 0x21, 0x20, 0x21, 0xe0, 0x21, 0x50, 0x21, 0x50, 0x21, + 0x20, 0x21, 0x20, 0x21, 0xe0, 0x21, 0x50, 0x21, 0x50, 0x21, 0x20, 0x21, + 0x20, 0x21, 0x10, 0x32, 0x80, 0x21, 0x50, 0x21, 0x50, 0x21, 0x20, 0x21, + 0x20, 0x21, 0x52, 0x50, 0x51, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x00, 0x72, + 0x50, 0x51, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x82, 0x50, 0x51, 0x20, 0x21, + 0x20, 0xf1, 0x11, 0x82, 0x50, 0x51, 0x20, 0x21, 0x20, 0xf1, 0x11, 0x82, + 0xf0, 0xf0, 0x00, 0xe2, 0xf0, 0xe0, 0xf2, 0x02, 0xf0, 0xc0, 0xf2, 0x22, + 0xf0, 0xb0, 0xf2, 0x32, 0xf0, 0xa0, 0xf2, 0x42, 0xf0, 0x90, 0xf2, 0x52, + 0xf0, 0x80, 0x74, 0x15, 0xc2, 0x03, 0xf0, 0x50, 0xc4, 0x15, 0x92, 0x23, + 0xf0, 0x10, 0xe4, 0x35, 0x72, 0x33, 0x19, 0xc0, 0xc4, 0x85, 0x62, 0x43, + 0x19, 0x12, 0x70, 0x57, 0x18, 0xf5, 0x05, 0x52, 0x53, 0x19, 0x12, 0x40, + 0xb7, 0x18, 0xe5, 0x32, 0x53, 0x29, 0x22, 0xf7, 0x37, 0xb5, 0x08, 0x22, + 0x53, 0x29, 0x06, 0x72, 0xf7, 0xa5, 0x08, 0x12, 0x53, 0x29, 0x16, 0x92, + 0xe7, 0x85, 0x18, 0x02, 0x43, 0x39, 0x26, 0x92, 0xe7, 0x08, 0x65, 0x28, + 0x43, 0x39, 0x26, 0xa2, 0xe7, 0x18, 0x45, 0x28, 0x43, 0x39, 0x36, 0xa2, + 0xe7, 0x28, 0x25, 0x28, 0x33, 0x49, 0x36, 0xb2, 0xe7, 0x78, 0x33, 0x49, + 0x46, 0xb2, 0xe7, 0x68, 0x23, 0x59, 0x46, 0xb2, 0xe7, 0x68, 0x13, 0x59, + 0x56, 0xc2, 0xe7, 0x58, 0x79, 0x56, 0xc2, 0xe7, 0x58, 0x69, 0x66, 0xd2, + 0xd7, 0x58, 0x59, 0x76, 0xd2, 0xd7, 0x58, 0x49, 0x86, 0xe2, 0xe7, 0x38, + 0x39, 0x86, 0xf2, 0xe7, 0x38, 0x29, 0x86, 0xf2, 0x02, 0xe7, 0x38 +}; + +static const unsigned char icon_data_64[] = { + 0xf0, 0xf0, 0x30, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, + 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xb0, 0x31, + 0xf0, 0xf0, 0xf0, 0xb0, 0x31, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, + 0x31, 0x30, 0x31, 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, + 0x30, 0x31, 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, + 0x31, 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, + 0x30, 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, + 0x31, 0xf0, 0x30, 0xb1, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, + 0xf0, 0x30, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x20, + 0x42, 0xb0, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x00, + 0x62, 0xb0, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, + 0xb0, 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, 0xb0, + 0x31, 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, 0xb0, 0x31, + 0x70, 0x31, 0x70, 0x31, 0x30, 0x31, 0x30, 0x31, 0x72, 0x70, 0x71, 0x30, + 0x31, 0x30, 0xf1, 0x71, 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, + 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, 0xb2, 0x70, 0x71, 0x30, + 0x31, 0x30, 0xf1, 0x71, 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, + 0xb2, 0x70, 0x71, 0x30, 0x31, 0x30, 0xf1, 0x71, 0xb2, 0xf0, 0xf0, 0x50, + 0xf2, 0x92, 0xf0, 0xf0, 0x30, 0xf2, 0xb2, 0xf0, 0xf0, 0x20, 0xf2, 0xc2, + 0xf0, 0xf0, 0x10, 0xf2, 0xd2, 0xf0, 0xf0, 0x00, 0x94, 0xf2, 0x42, 0xf0, + 0xe0, 0xe4, 0xf2, 0x12, 0x23, 0xf0, 0xa0, 0xf4, 0x14, 0x05, 0xe2, 0x43, + 0xf0, 0x70, 0xf4, 0x14, 0x35, 0xc2, 0x43, 0x19, 0xf0, 0x30, 0xf4, 0x95, + 0xa2, 0x53, 0x29, 0xe0, 0xf4, 0x04, 0xd5, 0x82, 0x63, 0x29, 0x02, 0x90, + 0xc7, 0xf5, 0x65, 0x62, 0x73, 0x29, 0x12, 0x50, 0xf7, 0x27, 0xf5, 0x35, + 0x52, 0x73, 0x29, 0x06, 0x32, 0xf7, 0x87, 0xf5, 0x05, 0x08, 0x42, 0x73, + 0x39, 0x06, 0x32, 0xf7, 0xa7, 0xd5, 0x28, 0x22, 0x73, 0x39, 0x16, 0xa2, + 0xf7, 0x47, 0xb5, 0x38, 0x12, 0x73, 0x39, 0x26, 0xb2, 0xf7, 0x47, 0xa5, + 0x38, 0x02, 0x73, 0x39, 0x26, 0xd2, 0xf7, 0x47, 0x08, 0x75, 0x48, 0x63, + 0x49, 0x36, 0xd2, 0xf7, 0x47, 0x18, 0x65, 0x38, 0x63, 0x49, 0x36, 0xe2, + 0xf7, 0x47, 0x28, 0x45, 0x38, 0x53, 0x59, 0x46, 0xe2, 0xf7, 0x47, 0x38, + 0x15, 0x48, 0x53, 0x59, 0x46, 0xf2, 0xf7, 0x37, 0xa8, 0x43, 0x69, 0x56, + 0xf2, 0xf7, 0x37, 0x98, 0x33, 0x79, 0x56, 0xf2, 0xf7, 0x37, 0x98, 0x23, + 0x79, 0x66, 0xf2, 0x02, 0xf7, 0x37, 0x88, 0x13, 0x89, 0x66, 0xf2, 0x02, + 0xf7, 0x37, 0x88, 0x03, 0x89, 0x76, 0xf2, 0x12, 0xf7, 0x37, 0x78, 0x99, + 0x76, 0xf2, 0x12, 0xf7, 0x37, 0x78, 0x89, 0x86, 0xf2, 0x12, 0xf7, 0x37, + 0x78, 0x79, 0x96, 0xf2, 0x22, 0xf7, 0x37, 0x68, 0x69, 0xa6, 0xf2, 0x22, + 0xf7, 0x37, 0x68, 0x69, 0xa6, 0xf2, 0x22, 0xf7, 0x37, 0x68, 0x59, 0xb6, + 0xf2, 0x32, 0xf7, 0x37, 0x58, 0x59, 0xb6, 0xf2, 0x32, 0xf7, 0x37, 0x58, + 0x59, 0xb6, 0xf2, 0x32, 0xf7, 0x37, 0x58 +}; + +static const unsigned char icon_data_128[] = { + 0xf0, 0xf0, 0xf0, 0xf0, 0x70, 0x71, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0x70, 0x71, 0xf0, 0xf0, 0xf0, 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, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, + 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, + 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, + 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, + 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, 0x70, + 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, 0x71, + 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, 0xf1, + 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, 0x70, + 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xf0, 0xf0, + 0x70, 0xf1, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0x70, 0x71, 0xa0, + 0x42, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x70, 0x71, + 0x60, 0x82, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, 0x70, + 0x71, 0x40, 0xa2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, 0x71, + 0x70, 0x71, 0x20, 0xc2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, 0x70, + 0x71, 0x70, 0x71, 0x00, 0xe2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0x70, 0x71, 0xf0, 0x71, 0xf0, 0x71, + 0x70, 0x71, 0x70, 0x71, 0xf2, 0xf0, 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, + 0xf1, 0xf2, 0x72, 0xf0, 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, + 0x72, 0xf0, 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0xf0, + 0xf1, 0x70, 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0xf0, 0xf1, 0x70, + 0x71, 0x70, 0xf1, 0xf1, 0xf1, 0xf2, 0x72, 0xf0, 0xf1, 0x70, 0x71, 0x70, + 0xf1, 0xf1, 0xf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xf7, 0x77, 0xd8, 0xd9, 0xf6, 0x76, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, + 0xc8, 0xc9, 0xf6, 0x86, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xc9, + 0xf6, 0x86, 0xf2, 0xf2, 0x42, 0xf7, 0xf7, 0x77, 0xc8, 0xb9, 0xf6, 0x96, + 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, + 0x52, 0xf7, 0xf7, 0x77, 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, 0x52, 0xf7, + 0xf7, 0x77, 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, + 0xb8, 0xb9, 0xf6, 0x96, 0xf2, 0xf2, 0x52, 0xf7, 0xf7, 0x77, 0xb8 +}; + +#define ICON_(s) { s, ARRLEN(icon_data_##s), icon_data_##s } + +static const icon_data_t icons[] = { + ICON_(16), + ICON_(32), + ICON_(48), + ICON_(64), + ICON_(128) +}; + +#endif /* ICON_DATA_H */ + diff --git a/sxiv.desktop b/sxiv.desktop index a981171..f644e6e 100644 --- a/sxiv.desktop +++ b/sxiv.desktop @@ -5,3 +5,4 @@ GenericName=Image Viewer Exec=sxiv %F MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp; NoDisplay=true +Icon=sxiv.png diff --git a/window.c b/window.c index e0b7273..48a2419 100644 --- a/window.c +++ b/window.c @@ -19,14 +19,17 @@ #define _POSIX_C_SOURCE 200112L #define _WINDOW_CONFIG +#include #include #include #include +#include #include "options.h" #include "util.h" #include "window.h" #include "config.h" +#include "icon/data.h" enum { H_TEXT_PAD = 5, @@ -163,10 +166,12 @@ void win_update_sizehints(win_t *win) void win_open(win_t *win) { + int c, i, j, n; win_env_t *e; XClassHint classhint; XSetWindowAttributes attr; unsigned long attr_mask; + unsigned long *icon_data; XColor col; char none_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; Pixmap none; @@ -240,6 +245,26 @@ void win_open(win_t *win) gc = XCreateGC(e->dpy, win->xwin, 0, None); + n = icons[ARRLEN(icons)-1].size; + icon_data = s_malloc((n * n + 2) * sizeof(*icon_data)); + + for (i = 0; i < ARRLEN(icons); i++) { + n = 0; + icon_data[n++] = icons[i].size; + icon_data[n++] = icons[i].size; + + for (j = 0; j < icons[i].cnt; j++) { + for (c = icons[i].data[j] >> 4; c >= 0; c--) + icon_data[n++] = icon_colors[icons[i].data[j] & 0x0F]; + } + XChangeProperty(e->dpy, win->xwin, + XInternAtom(e->dpy, "_NET_WM_ICON", False), + XA_CARDINAL, 32, + i == 0 ? PropModeReplace : PropModeAppend, + (unsigned char *) icon_data, n); + } + free(icon_data); + win_set_title(win, "sxiv"); classhint.res_class = "Sxiv";