How to get native windows decorations on GTK3 on Windows 7+ and MSYS2 - gtk

I am trying to port my application from linux to windows and I have a problem with theming. In linux this works out of a box, just compile it and application is using good theme and looks native.
I have installed gtkmm3 and gtk3 in MSYS2 and I am building it with CMake. This is OK, I had to copy all dlls to directory with binary to be able to execute it. I did not copy anything else. I am trying to create "unzip and execute" package.
My problem is, that application looks out of place. It does not look native at all. There are shadows around the window, which is fine in Windows10, but in Windows 7 it looks not native. Also several icons are missing.
Even gitk3-demo looks non-native in the same way (but it has at least the minimize/maximize/close icons correct).
So the question is: How can I achieve native look of GTK3 application on Windows? Or at least native window decorations?
Thanks

Thera are two sub-problems: missing icons and setting right theme.
Missing icons
For missing icons it was enough to copy these icons
window-close-symbolic.symbolic.png
window-maximize-symbolic.symbolic.png
window-minimize-symbolic.symbolic.png
from: C:\msys64\mingw32\share\icons\Adwaita\22x22\actions
to: "your executable folder"\share\icons\Adwaita\22x22\actions
Theme
Using win32 native theme
There is actually a built-in native-like theme in GTK3. For using native-like theme just create file "your executable folder"\etc\gtk-3.0\settings.ini with this in it
[Settings]
gtk-theme-name=win32
win32 theme is built in into GTK3 and only three icons from previous step seems to be needed.
On windows 7 this looks as following:
The problem is, that the decorations looks the same even on Windows 10 (including window decorations).
From comment from #andlabs : GTK+ 3 uses the uxtheme.dll APIs to get its Windows look and feel, and unfortunately Microsoft has kept those Windows 7-like for window borders. (more in comments)
You can see Windows 10 Gtk3 application with win32 theme here:
Using non default theme
And if you are not happy with default or win32 theme, you can use custom themes (like this Flat-Pat) from the internet. :) In order to do it you need to create config file:
"your executable folder"\etc\gtk-3.0\settings.ini with this in it
[Settings]
gtk-theme-name=Flat-Plat
and you need to copy the theme files to directory in path of your executable
"your executable folder"\share\themes\Flat-Plat
in that folder, the index.theme file and gtk-x.x folders should be present. Obviously gtk-theme-name and folder name should match.
After you run the executable you should be able to get different theme.
EDIT: So there is a win32 theme built-in, thank you #andlabs
EDIT2: Added screenshots
EDIT3: Added Windows 10 screenshot and corrected facts.

You can set GTK_CSD=0 environment variable to disable client-side window decorations and enable Windows native decorations, which gets rid of the ugly win7-like titlebar, as well as Adwaita-like one.

Actually, Gtk+3 been compatible with Windows 10 and you can use the native windows theme by making this your default theme.
gtk-theme-name = MS-Windows

For people like me who use (activestate) perl, the /share and /etc need to be placed one directory above the perl.exe (say in C:\Perl64 if perl.exe is in C:\Perl64\bin).

While GTK_CSD=0 is doing a fine job for windows frame icons, it seams that default Drag-And-Drop (DND) icons are missing too.
Dragging GtkEntry or GtkTreeView contents shows a drag-icon.
I've prepared a button as drag source under Gtk+-3.24.4. When dragging the button, the mouse cursor disappears and no drag icon is shown.
When using gtk_drag_source_set_icon_pixbuf(bt, pixbuf), the pixbuf appears as drag icon. But doing it this way is only half the job done, because move/copy indicators are missing on the icon.

Related

How to remove Window 11 Start Menus bloatwares via Powershell?

In the new Windows 11 Start Menus, there are apps like "TikTok" and "Prime Videos" that are not actually installed on the system, they would start installing when you clicked on the icon. This means that usual way of uninstalling via Powershell (ie: Remove-AppxPackages) does not work. In Window 10, I would get a round this by just replacing the orginal Start Menus layout config file with a blank one (effectively remove all pinned apps), then manually repin all the apps I wanted; but, this does not works on Win11 either.
So... does anyone know how to remove all of this visual bloats on the Start Menus via PowerShell (or any other command-line tools/languages, for that matter)?

GTK3 on Msys2, deprecated icons removed?

The Problem
Hello,
At my job we are developing a GTK3 application using PyGObject. As we (unfortunately) have to use Windows on our workstations, we are using Msys2+MinGW64 to have access to usual Linux libraries and shells.
Recently, after an Msys update that upgraded package mingw-w64-x86_64-adwaita-icon-theme from version 40.0-1 to 42.0-1, some icons we are using have disappeared, and warnings such as the following popped up all over the place:
(app.py:28152): Gtk-WARNING **: 14:15:37.369: Error loading theme icon 'view-refresh' for stock: Icon 'view-refresh' not present in theme Adwaita
What I have tried
I searched for the missing icons (e.g. view-refresh.png in the Adwaita icon directory, and sure enough, they were removed between the old and the new version.
The pieces of code that ran into this problem are all using the Gtk.STOCK_**** symbolic names which have been depreacted since Gtk 3.10, with the GTK documentation suggesting to use literal icon names instead. So, for example, I replaced the following code:
button = Gtk.Button()
button.set_image(Gtk.image_new_from_stock(Gtk.STOCK_REFRESH, Gtk.IconSize.SMALL_TOOLBAR))
With:
button = Gtk.Button()
button.set_image(Gtk.Image.new_from_icon_name("view-refresh", Gtk.IconSize.SMALL_TOOLBAR))
... but it kind of feels like a step backwards. Is there any cleaner way to implement this?

Netbeans 8.2 wont apply themes

For some reason, Netbeans IDE 8.2 won't apply any different themes than the original one. Has anyone else had an issue with this? I have applied the new theme and restarted the application many times without success. Thank you.
It's very hard to identify what is wrong since everything in your screenshot looks perfect, and Sublime-Theme works for me using NetBeans 8.2 on Windows 10. See the file with the tab NewServlet.java in the screen shot below.
Note that using Sublime-Theme does not impact everything. For example, the Projects and Navigator panels don't change. Since your screen shot only showed the Options window, and the Start Page doesn't change in the editor either, are you absolutely certain that none of your files in the editor are using Sublime-Theme?
Also, you say that "Netbeans IDE 8.2 won't apply any different themes than the original one", but NetBeans comes bundled with several themes, such as NetBeans and NetBeans 5.5 as shown in the screen shot below. How many options are shown in the profile drop list for you? If you select a different theme from the Profile list and click Apply the rendering of your files in the editor should change immediately. Is that happening?
If so, the problem is probably confined to the installation of Sublime-Theme. Try deleting Sublime-Theme (the button is in the top right corner of your screen shot), and then import the zip file again to see if that fixes the problem. Also, verify that the Sublime-Theme zip file you downloaded can be manually unzipped since it might be a corrupt file.
Another thing to try is using some alternative plugins. Select Tools -> Plugins -> Available Plugins and then install Dark Look and Feel Themes and Darcula LAF for NetBeans. If those don't work either then there is something fundamentally wrong with the installation of NetBeans.
Finally, this article titled The complete guide to tuning the appearance of NetBeans may be helpful.

Mac os X Eclipse Package Explorer view , project folders in smaller size

I recently brought Mac Book Pro and I installed Eclipse Luna. I am facing a problem in viewing the Java projects in "Package Explorer" folders are very small. Is there a way to increase instead of changing the screen resolution?
It should be possible, have a look at this link: http://blog.vogella.com/2013/02/19/css-styling-individual-part-of-the-eclipse-ide/
(Copy of the essential part, in case the above link stops working:
#org-eclipse-jdt-ui-PackageExplorer {
font-size:20;
background:black;
}
)
Remains the question, where to put those lines. Best would be to create your own style, but I never figured out how to do it. So I usually just modify one of the built-in styles. To do this, go to /Applications/eclipse4.4/plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css and open the css-file of the style you currently use (probably e4_default_mac.css). Then add the above lines at the end of that css file and restart Eclipse. Note: when updating Eclipse, you might have to repeat those steps.
EDIT: Just realized it was already asked and answered on SO: I cannot change the font size of package explorer in Eclipse Don't look at the accepted answer, but at the next one below.
No, there is no way to change the size of folders or other visual properties of package explorer.
The views, fonts, etc... of general views are set by the system/OS properties. Only the editor view allows customization of sizing, such as, font.

Eclipse's Package explorer background color follows windows theme. I want to change the color without changing windows' theme. Possible?

Maybe a way to alter the colors locally (as in application dependant)?
A background color of eclipse is white, the same white of windows' active window background color. If I change the color on the theme, eclipse changes to the color.
I want to change this software's color without changing the whole theme (because then every program gets weird colors). Is this possible? I thought that maybe there was a way to apply different windows themes to different programs, or something.
I'm using windows XP, classic windows theme.
Install the "Eclipse 4 Chrome Theme" from
http://marketplace.eclipse.org/content/eclipse-4-chrome-theme
Then you can customize a lot of the Eclipse UI widgets.
But not what you want, at least not out of the box.
For that you should go to the CSS tab (in Eclipse 4 Chrome Theme) and paste this:
Tree, List, Table {
background-color: #202020;
color: #d0d0d0;
}
You can change almost anything, the problem is finding out what, and the fact that some things are bitmaps that you can't change (so if the bitmap is dark and you set a dark background you will "loose" the bitmap)
This list of widgets might help, http://download.eclipse.org/rt/rap/doc/1.5/help/html/reference/theming/index.html but they give you generic info on the widget names, not the Eclipse info (with IDs and all), so be careful :-)
== Very late addition ==
Everything you need in one place, including links to a custom dark theme: http://mihai-nita.net/2013/09/19/dark-eclipse/
Mac Screen Shot Example as of Sept 2013 (please be sure to restart Eclipse after changing file):
Just search "Theme" in the Eclipse Market Place. Install Moonrise. (Should be first option). Then go to the General, appearance, Click on appearance, change theme to moonrise, Then there you go.
Knowing the way the workbench is built, I'm sure your request is not possible on the Eclipse side. You can do this for the editors, because they are StyledText widgets, and you are exposed some preferences to customize these.
The other views are various widgets, some are Trees, some are Text, some are composed from various other widgets. All of them are created with the default constructor which just uses the Windows theme.
I don't know of a way to change every Eclipse window to your color scheme, but I can get you at least as far as changing some of the editing windows...
Open up "Window -> Preferences", then under "General | Editors | Text Editors" you will find a section that will allow you to set the "Appearance color options", Background color is one of those options.
PS: I'm using Eclipse 3.6 (Helios)
Sadly, this is not possible (which is crazy).
However, Aptana Studio (which is an Eclipse derivative) lets you theme the entire IDE.
I did some research and found that actualy it is posible to change all colors, but abit harder.
there are two methods that I found so far.
first since eclipse is using OS themes, you can change your OS background settings, like folder background etc., or just change the whole theme if your using windows, but the downside is that all windowses will be same color, in linux and mac os it is also posible, but in different way, I did read it somewhere, but can't remember where :)
second creating a specific theme for eclipse, for example http://rogerdudler.github.io/eclipse-ui-themes/ or any other theme like google chrome etc.
Install the theme from here as per the instruction in the github:
https:// github.com/guari/eclipse-ui-theme
If you don't like the editor color theme, there are bunch of 'em here
http://eclipsecolorthemes.org/
Combination of both just works like charm for me!