How to use 128x128 icon for alt-tab in Linux? - linux

I have a problem to show high quality icon in Alt-Tab in Linux. My development is using GTK2, and using gtk_window_set_icon() for a 128x128 png icon. And the environment is GNOME3.
However, when I alt-tab, the icon is blurred and pixelated.
I am not sure it is caused by GNOME3 freedesktop.org specification, or caused by GTK2. Please help.

You can install multiple versions of the icon, at different resolutions, and Gnome should pick the best one depending on the context. So for example on Fedora 15 the firefox package installs several icons:
/usr/share/icons/hicolor/16x16/apps/firefox.png
/usr/share/icons/hicolor/22x22/apps/firefox.png
/usr/share/icons/hicolor/24x24/apps/firefox.png
/usr/share/icons/hicolor/32x32/apps/firefox.png
/usr/share/icons/hicolor/48x48/apps/firefox.png
/usr/share/icons/hicolor/256x256/apps/firefox.png
You can even install a scalable icon, so if it wanted to (it currently doesn't), the firefox package could install:
/usr/share/icons/hicolor/scalable/apps/firefox.svg
Then in the desktop file for the application just give the name of the icon, for example:
Icon=firefox
and Gnome should work it all out and choose the best icon for each context where it is using it.

Related

Displaying a Classification Banner at the top of each computer monitor in Gnome Desktop

I work in an environment where we have to have a security classification banner displayed at the top of each monitor on our Gnome Desktops. Currently, I am using a Perl/Tk window to display the classification of the system. However, that window cannot be moved because of the way it is built (no decorations) and occasionally overlays open windows making it difficult for users to manage those windows.
I would like to be able to do something different, but I'm not sure where to start. Three ideas I have are this:
An icon or something in the Top Bar showing the classification
A banner, like the Top Bar, that sits above the Top Bar
A window, like I already have, but relocatable
I figure the first option would be easiest, but since the Top Bar isn't shown on every monitor, that may not be the best option. I don't even know if the second option is even possible. The third option would require me to use something other than Perl/Tk but that's the only language I'm fluent in at the moment.
So I'm looking for suggestions or examples or Gnome extensions I can use to solve this problem.
Thanks.
There is a classification-banner python utility at https://github.com/fcaviggia/classification-banner. It's no longer maintained, but we've been using it without change for a few years now. It's OK. One problem is that it doesn't "shrink" the desktop screen, so application windows can overlap it; it's set to Always On Top, but it would be nicer if it actually couldn't be overlaid at all.
A simple solution, of sorts, would be to change the desktop background image. This can have issues if you're displaying on multiple resolutions (I don't know if Gnome supports SVG for such purposes) and of course it can be obscured by windows covering it.
Older versions of Gnome let you create multiple bars that worked perfectly, but that disappeared - along with many other customizations - in Gnome 3.

Can ZeroBrane windows have a dark theme without using OS's high-contrast theme?

Just to clarify, I'm not talking about making the background of the editing frame or window dark via:
local G = ...
styles = G.loadfile('cfg/tomorrow.lua')('Zenburn') -- theme
I'm talking about making the background of the Project frame/window, Output window, the menu bar, etc., all dark too.
Is this possible to do without using Windows's high-contrast theme for everything?
Thank you.
I don't think this is possible, as it relies on wxwidgets to draw those windows and wxwidgets uses system-provided colors to draw them (without much if any user control).
I opened a wxwidgets ticket that would implement re-configuring system colors, but there hasn't been much movement on it.

How can I change icon theme in Inkscape?

I'm using Inkscape (0.92, installed via pacman) on Linux (Manjaro Gnome) with a dark theme.
It is very hard to see the icons in Inkscape (gray on gray) and therefore I'd like to change the icon theme. I think I should be able to do that by replacing the icons.svg, but unfortunately I don't see any change if I replace the file in /usr/share/inkscape/icons/.
In Inkscape under Preferences -> System there is a setting "Icon theme". But it is just a text box with locations, that cannot be changed.
The text box content looks like this:
/home/username/.icons
/home/username/.local/share/icons
/home/username/.local/share/flatpak/exports/share/icons
/var/lib/flatpak/exports/share/icons
/usr/local/share/icons
/usr/share/icons
/home/username/.local/share/flatpak/exports/share/pixmaps
/var/lib/flatpak/exports/share/pixmaps
/usr/local/share/pixmaps
/usr/share/pixmaps
/home/username/.local/share/inkscape/icons
/home/username/.local/share/flatpak/exports/share/inkscape/icons
/var/lib/flatpak/exports/share/inkscape/icons
/usr/local/share/inkscape/icons
/usr/share/inkscape/icons
/home/username/.config/inkscape/icons
/usr/share/inkscape/icons
/usr/share/icons
I checked all the locations for icon files and tried to add the icons.svg file to some of the locations, with no change after restarting Inkscape.
Is there another way to change the icons? Or how can I find out where my Inkscape installation is getting the icons form?
The issue seems to be similar to this post regarding Ubuntu.
With Inkscape 1.0 (May 1, 2020) you can go to Edit > Preferences, and then to Interface > Theme to change the icons:
Thanks #Moini!
It seems that the Gnome Icon theme overwrites the icons theme in the Inkscape .config/inkscape/icons folder.
By using the Gnome tweak tools, you can change the icon theme and some of the themes affect also the icons in Inkscape.
In my case the Gnome icons that affect Inkscape are in /usr/share/icons/<theme-name>/22x22/actions. Unlike the default icons each icon has it's own svg file, and they are not all bundled in a icons.svg file.
if you install it by flatpak you can fix it just by putting icons.svg in
/home/username/.var/app/org.inkscape.Inkscape/config/inkscape/icons
and then go to gnome-tweaks and change icons to default icons then open inkscape and close it then go to gnome-tweaks and change your icons back then congratulations !
The latest version of Inkscape (v1.1) ships with a dark theme. This theme can setup at startup or from Themeing option in Interface (screenshot below)
Change Theme of Inkscape
For Linux distros, install using their app image or Snap. From the normal Ubuntu repositories (20.04 LTS), I could install only a version <1.0. Versions <1.0 do not contain the Theme tab in the Interface option in Preferences.

set window icon tkinter macosx

This line works fine for my Windows program.
When i run this same file on the Mac OS X, I get a blank page instead of my icon.
Here is the windows line:
self.iconbitmap("Boss.ico")
I have searched relentlusly for an answer I want this icon to work on both platforms. self is the root Tk window if your wondering if it's root or not.
Note: I have tried using icns, .xbm , .gif by loading a photo image and setting thru window attributes all produce the same blank page on the mac.
After 5 days of searching, and this post having been viewed at least 15 times I went directly to the tk/tcl documentation. If I understand this correctly, apparently there is no way to properly set the icon for mac OS X without using special library or other sort of hacks. It would be nice if there were a mac specific documentation for the tkinter library but alas there isn't that I have found. here is the part of the documentation I found:
wm iconphoto window ?-default? image1 ?image2 ...? Sets the titlebar
icon for window based on the named photo images. If -default is
specified, this is applied to all future created toplevels as well.
The data in the images is taken as a snapshot at the time of
invocation. If the images are later changed, this is not reflected to
the titlebar icons. Multiple images are accepted to allow different
images sizes (e.g., 16x16 and 32x32) to be provided. The window
manager may scale provided icons to an appropriate size. On Windows,
the images are packed into a Windows icon structure. This will
override an ico specified to wm iconbitmap, and vice versa.
On X, the images are arranged into the _NET_WM_ICON X property, which
most modern window managers support. A wm iconbitmap may exist
simultaneously. It is recommended to use not more than 2 icons,
placing the larger icon first.
On Macintosh, this currently does nothing.
if anyone has a working solution please post this. I want to accomplish this so that any system can open a freshly installed python and run my application without installing any additional library.
#GarryHurst This is not a solution but I sort of get the idea now:
On Mac, TK decided that the icon will never appear on the window title bar.
Instead, it shows up as the app's Dock icon.
It's most probably a by-design or won't fix issue on their side.
It is showing the icon of the file you are putting in the directory so setting the file to be an app will set the window icon to be the icon of that app.
for example:
root.iconbitmap("/Users/homedir./Desktop/Test apps/Clicker.app")
tk window with icon
I have a coup. Why not change mind, like this.
The emoji library is enough to choose a good-looking icon.
We can do that.:-D
Code
Effect

How to have subpixel rendering of font for LCD (cleartype on windows) on linux?

I am working on embedded system, with own windowing system and rendering library. Before someday when I installed Ubuntu, to my surprise it has LCD subpixel rendering. It really looks cool to have it on my device. Because it is very readable.
Currently I ask for particular glyph in freetype, freetype gives me one memory buffer with values of alpha, with that it is not possible to have subpixel rendering. What I have is normal antialiazed font. As in subpixel - rendering left most pixel of font is anti-aliazed with Red and Rightmost with Blue ( Assuming Screen is RGB ).
Is there any methods with which freetype can give me information that whether current pixel is left or right or centerone?
Thanks, Sunny.
freetype can do it
As you point out, the desktop environment you're using (GNOME, KDE, whatever) may implement this. The setting for it varies by environment.
As to how to do it in your own code, you can use the same routines the window manager does (Gtk+ on GNOME, Qt on KDE, etc.), or you can use a separate library like FreeType or SDL_ttf. Antialiasing -- the generic term for this, as ClearType is a patented algorithm specific to Microsoft -- is usually optional in these libraries, disabled by default for speed.
I think that libcairo is at the bottom of most GTK applications in Ubuntu that do antialiasing. I think that whether subpixel rendering is done specifically for an LCD screen is something the user chooses, not the application author. The user controls it through the "Fonts" tab of "Appearance Preferences" in System -> Preferences -> Appearance (which can be run manually as the binary "gnome-appearance-properties") and clicking on the "Subpixel smoothing (LCDs)" option.
Maybe there's a way that an application can override this setting for themselves? Not sure why they'd want to, though, since an app doesn't control what kind of display the user is using.

Resources