rozniak / xfce-winxp-tc

Windows XP stuff for XFCE
Other
1.11k stars 37 forks source link

wintc-taskband support for other themes (Royale + Royale Noir, Zune, etc) #352

Open enderman0125 opened 2 months ago

enderman0125 commented 2 months ago

Any possibility of updating wintc-taskband to support other themes in the pack such as Royale Noir and Zune? It looks a bit out of place when I have Royale Noir applied but the taskbar is the regular blue Luna theme. Is this planned in the future?

rozniak commented 2 months ago

See the additional-theme label: https://github.com/rozniak/xfce-winxp-tc/labels/additional-theme

At the moment only the XFWM4 decorations are present for those other themes, the GTK stuff isn't done yet.

enderman0125 commented 2 months ago

Ah, alright.

acdavit commented 3 weeks ago

I'm wondering if it's possible to make an automated script that would take preexisting XP themes and convert them to something that both XFCE4 and winxp-tc could use, There are like thousands of unofficial Windows XP themes floating around on the internet that I would love to use on my XP-fied Linux installation

To what extent are the bitmaps from the original Windows XP themes altered? Would it even be possible to do something similar to this or would there be too much voodoo involved?

rozniak commented 3 weeks ago

@acdavit I have thought about that for quite some time, I think the last time I commented on the idea was in #222 . I did recently start toying around with it in a branch ft-uxtheme, essentially all that's there at the moment is the beginnings of a Python tool for extracting the theme resources as a test. Trouble I came across instantly was that PIL/Pillow does not correctly support 32bpp bitmaps (used by some theme parts like the radio button). I didn't really feel like faffing with parsing the BITMAPV3 headers or whatever manually right now so it's left where it is - if you know some Python and feel like chipping in there it would be useful.

For the time being though I figured it would be best to get the themes done the same way as I have done Luna (Blue) and Professional, just so that there's at least something rather than nothing.

I should probably write my thoughts on what might be needed in a separate issue. Just in general a good start would be getting the resources extracted correctly without losing the alpha channel from the 32bpp bitmaps.

acdavit commented 4 days ago

@rozniak

Do you mind if I post a question about it on stack overflow?

rozniak commented 4 days ago

@acdavit About parsing those 32bpp bitmaps? It's a bit odd, I had a poke in the PIL/Pillow source and it suggests that these headers are supported: https://github.com/python-pillow/Pillow/blob/main/src/PIL/BmpImagePlugin.py#L102

Not really sure why the alpha channel is lost though.

acdavit commented 3 days ago

@rozniak

Exactly. Would you be okay if I posted the code on stack overflow or Reddit? Maybe someone could shed some light on this mystery.

rozniak commented 3 days ago

@acdavit Yeah by all means go ahead, do whatever you would like if you think it would be beneficial. :+1:

acdavit commented 3 days ago

@rozniak

Thanks for the response.

I did submit a question to stack overflow, but I also noticed something bizarre while toying around with the resources.

Resource Hacker on Windows does seem to show thumbnails of the alpha channel correctly, but the extracted bitmap lacks it, just like how it does on our Python script.

Screen-Recording(1).webm

Could this, yet again, be the fault of Resource Hacker incorrectly parsing 32bpp bitmaps, or could there be something fishy about how transparency is handled in msstyles?

I'm curious to hear your thoughts on this matter.

rozniak commented 3 days ago

@acdavit Yeah that's why I don't use Resource Hacker for the theme work. :stuck_out_tongue:

acdavit commented 14 hours ago

@rozniak

In the fashion of Stack Overflow, my post was removed for being "a duplicate" and referred me to this post.

I did try incorporating this code into yours, but no matter what I tried, it always errors out with "Syntax Error: Not a BMP file".

BenBE commented 13 hours ago

Have you tried reading the resource section from the binary in question directly? From there parsing out the actual Bitmap resource is kinda straight forward.

rozniak commented 13 hours ago

I have dumped out the resources raw before and was a bit bamboozled by the fact that they don't appear to have BMP header (have a look in a hex editor, the signature for a bitmap file isn't there).

Out of curiousity I had a play with Pillow a bit more, noted that it actually is reading using the DIB format, and not BMP.

I'm going to see if it's viable to prepend a bitmap header onto the data, and then see if Pillow is happy to read it as a 32bpp bitmap.

rozniak commented 12 hours ago

I'm fairly certain this is a bug with Pillow tbh. Basically the resources here are DIBs with the 40 byte header (BITMAPINFOHEADER), and BI_RGB as the compression (aka uncompressed). I did alter the script to reconstruct the missing BMP file header, just in case it wasn't being read properly by Pillow - I still get the same results though of no alpha channel.

EDIT: Probably suggest fixing this upstream... have a look at this check here which is interesting - could perhaps be a bodge that needs to be amended for this to work? https://github.com/python-pillow/Pillow/blob/main/src/PIL/BmpImagePlugin.py#L245