Programming approaches to Alternative Appmenu icon effects, Setting default workspace per qube, Additional label colors

Alright. I have finished qubes-label-tweak-tool. Lets test it and post results here. First we copy it to dom0/GUIVM bin directory and make it executable (do not do this at home unless you know what you are doing):

qvm-run --pass-io sys-firewall curl https://raw.githubusercontent.com/alimirjamali/personal-qubesos/main/bin/qubes-label-tweak-tool > ~/bin/qubes-label-tweak-tool
chmod +x ~/bin/qubes-label-tweak-tool

Testing the list function with qubes-label-tweak-tool list --ANSI

So far, nothing new. xfce4-terminal could show only 256 colors. But not bad as a rough representation of colors. We create our 1st label according to UI/UX team suggestions with --verbose option to see if nothing goes wrong.

qubes-label-tweak-tool create custom-Maroon 0x800000 --ANSI --verbose

Icon directory was successfully created, svg templates copied and colors tinted. Good. But I removed

custom-Maroon label is too long. So lets delete it:

qubes-label-tweak-tool remove custom-Maroon

Remove function works without any issues. Lets add all suggested colors:

qubes-label-tweak-tool create ux-Maroon 0x800000 -y
qubes-label-tweak-tool create ux-Red 0xe6194b -y
qubes-label-tweak-tool create ux-Pink 0xfabed4 -y
qubes-label-tweak-tool -y --ANSI create ux-Orange 0xf58231
qubes-label-tweak-tool -y --ANSI create ux-Apricot 0xffd8b1
qubes-label-tweak-tool -y --ANSI create ux-Olive 0x808000
qubes-label-tweak-tool -y --ANSI create ux-Lime 0xbfef45
qubes-label-tweak-tool -y --ANSI create ux-Mint 0xaaffc3
qubes-label-tweak-tool -y --ANSI create ux-Cyan 0x42d4f4
qubes-label-tweak-tool -y --ANSI create ux-Navy 0x000075
qubes-label-tweak-tool -y --ANSI create ux-Lavender 0xdcbeff
qubes-label-tweak-tool -y --ANSI create ux-Magenta 0xf032e6


So far, so good. Let’s see how they look like in action label picker:

Not bad. But Lavender label is still long. So I delete it (as well as Apricot).
It appears that we are experiencing the 1st bug. And it is not my fault (or maybe Qubes fault). System is mixing red with ux-Red. I have to analyze it later. Just deleting ux-Red for now. I did not logout/login or reboot to see if it would persist.

Now lets have some fun with custom labels. I have created few distro icons for myself but did not push them to Github for now as I am not a lawyer and I do not want to get sued because of copyright violation. Let’s create Debian label with 0xd70a53 color and custom label for TemplateVMs. Then Fedora, Archlinux, Gentoo. And finally a special Whonix Label. with individual icons. Whonix icon for templatevm, Tor onion logo for servicevm, tbb logo for appvm. Finally a tinted Tor onion for dispvm. A small bug is fixed.

qubes-label-tweak-tool --ANSI --verbose create dist-Debian 0xd70a53 --icon templatevm=qube-debian.svg
qubes-label-tweak-tool --ANSI --verbose -y create dist-Fedora 0x51a2da --icon templatevm=qube-fedora.svg
qubes-label-tweak-tool --ANSI -y create dist-Arch 0x1793d1 --icon templatevm=qube-archlinux.svg
qubes-label-tweak-tool --ANSI -y create dist-Gentoo 0x9f99c7 --icon templatevm=qube-gentoo.svg
qubes-label-tweak-tool --ANSI -y create dist-Whonix 0x931ace --icon templatevm=qube-whonix.svg --icon appvm=qube-tb.svg --icon servicevm=qube-tor.svg --tint on --icon dispvm=qube-tor.svg

Final results:



We are done for the time. But the hard work remains. And that would be getting people with good knowledge of bash scripting to do a peer review of the code. Hopefully in future.

p.s.: I forgot to update gentoo-minimal and fedora-39-xfce labels to new values. It is working. Here is the screenshot:

2 Likes

So the bugs we are experiencing after reboot are as follow:

  1. Qubes Application Menu (qubes-app-menu) works without any issues.
  2. Qubes OS Update (qubes-update-gui) render is bizarre. Icons are OK but text is missing. I am not sure if it is because of - in label names, using user ~/.local for icon storage to avoid running script as root or something else. Running it with --log DEBUG provides no clue (see next point).
  3. Qube Manager (qubes-qube-manager) crashes. But provides very useful information. The bug turnes out to be - in the label name. See screenshot. Either official qubesmanager library should be fixed to allow two - in icon filenames, or admin.api.Create should reject - in label name. I have to file the issue on github and provide a patch. Please avoid - in your labels for the time. I will update qubes-update-tweak-tool help to reflect this bug.
  4. No issue with Qubes Devices and Clipboard widgets


4 Likes

Thank you for this enormous work. For my part, everything works perfectly without “-” in the label.
I try your color and some of mine, everything’s ok. Really a great job, no bugs for me :slight_smile:

The custom icons are really great in the menu, maybe you could quickly explain how to make the icons ourselves? (that way, no problem with copyright ;)) But maybe it’s a little complicated ?

2 Likes

I am really glad that it is working for you. Just please note that I am still working on it and adding features and solving bugs. For example I added ANSI coloring to tinting progress output in verbose mode just few hours ago. Would you please inform me if you are using Qubes 4.1 or 4.2? And do you use it inside a GUIVM or dom0?

The icons are made via Inkscape. I used one of Qubes official artwork icons, centered the background and added Distro logos on top of it with some minor changes. Basic Inkscape knowledge or experience with other vector graphic software (Adobe Illustrator, CorelDraw,…) would help a lot. I should read Artwork Guidelines for each Distro and ensure that I won’t violate their guides or copyright. Then upload the icons to Github repo in icon directory. Some logos would definitely not happen (i.e. Microsoft Windows). Some Distro provide clear and easy to understand guidelines and policies which makes it really easy.

And there are some complications with SVG tinting. Qubes qute icons were made via Adobe Illustrator. XML structure of Inkscape svgs differs with that. How I used Regex to detect colors differs with Willy-JL’s work. But have advantage and disadvantages. I have to improve it.

2 Likes

I’m on 4.2 and try it in Dom0 :wink:

1 Like

Speaking of that, this reminds me of the greatest limitation of this scripts. And it is the exact question I had in my 1st post in the forum. qubes-label-tweak-tool depends on the qubesd-query which is only available on dom0 afaik. And it is the only way I know to query admin.api in bash without writing a Python bridge. When I started writing this tool, my aim was to provide it for both dom0 and GUIVMs. Unfortunately it is a little bit complicated for the time.

1 Like

Great project!

2 Likes

Progress

I decided to relax from the project for a little bit and have some fun designing some icons for my qube labels. Here is sneak peek for those interested:

I am waiting for my Henri Matisse rose to bloom. So I can take a photo of it and vectorize it for my personal qube.

Dash (-) character in label name bug

Some notes on the bug of labels with “-” character in label name which crashes qubes-qube-manager:

If you inspect this line in Qubes Manager source, you will find out problematic usage of Python string.split function. It should be"

vmtype, vmcolor = vm.icon.split("-", 1)

For people who are new to Python:

But I am not going to file a new issue on Qubes Github for now. I would rather fix all the bugs and come up with a complete solution.

qvm-run-tweak-tool

I had mentioned a single sed command to modify .desktop files of a qube to launch its App in user specified Workspace. But the solution is ugly and I do not like it. Instead of adding multiple commands to .desktop file Exec= key, I would rather write a new tool to perform multiple operations. Like switching to a Workspace by name or number, Sending the Window to specified Workspace without switching to it, chain-loading custom Freedesktop CSS themes, etc. And automate Appmenu generation via my qvm-appmenus-tweak-tool.

qubes-label-tweak-tool

There were some issues with the tool. png icon generation was broken which is now fixed. And I have to add icon removal to remove command. Those are relatively easy to fix. The major issue is the tint function for custom icons. Different tools (Inkscape, Illustrator, Corel, …) add their own tags to XML structure of svg files. And I am not in the mood to write an svg validator or parser in bash. But I hope I could come up with an acceptable compromise.

1 Like

Progress update

I have been distracted by sketching some qube icons in Inkscape. Some of them are my original design and I will upload them to Github repository. Some designs are based of other CC-BY-SA licensed designs, perfectly safe to publish. Here is a sneak peek (Warning! Some of them are optical illusions).

Generally talking, dealing with licensing rights of designs is a headache, but they could be usually categorized as follow:

  1. Original designs which are perfectly fine to publish with CC-BY-SA license. Or designs based on public domain concepts (e.g Dice, Qube Isometric, Tesseract).
  2. Designs based on (or using) other CC-BY-SA licensed works, perfectly fine to share with proper attribution (e.g. Qube Webcolors, Qube CAM where I used a drill bit design by someone)
  3. Not CC-BY-SA but usually easy to obtain permission or very similar to CC-BY-SA. One example would be MS-DOS logo.
  4. Designs based on expired patents. Special permission might be necessary. For example the Rubik’s qubes might be risky. Even though the patent expired in 2000; and the European Union highest court ruled in 2016 that the puzzle’s shape was not sufficient to grant it trademark protection. BTW, Rubik’s Cube could be an excellent official game for Qube OS (similar to this).
  5. Highly impossible qubes. Like WALL.E or LEGO brick.

But I am not a lawyer or a patent expert; nor a UI/UX person. Neither good at public relations to approach design rights holders to obtain permission (not even a native English speaker). And definitely not representing Qubes OS project by any means. But I guess I made my point that proper Icon designs are a nice way to signify different Qubes. If anyone from core team demands the icons I have sketched so far, I will be more than glad to donate them.

Many of the icons I have designed are for my personal work or hobbies. I am interested in more ideas if anyone wants to share. Some of my other ideas are as follow:

PCB qube for EDA tools, Ice qube (the melting one, not the musician), Wooden qubes of different species, Cardboard qube, Prism qube, A machinist end mill cutting a qube, cubicle, Infinity qube, Ice cube (the musician), 3D puzzle cube, Cubane molecule for chemists, Qube speaker. Maybe Bauhaus qubes, Peter Keler D1

2 Likes

Status update (tl;dr: qubes-label-tweak-tool is usable).

After many distractions during past few days, I managed to finish qubes-label-tweak-tool and it is fully operational. 1st the screenshots of how it turned out:

Favourites tab of Appmenu

Apps tab of Appmenu

CAD VM with isometric qube icon and icons with thick border effect (via app-menus-tweak-tool)

CAM VM with drilled qube icon and icons overlayed on gray background.

personal VM with untouched icons

untrusted VM with inverted paranoid icons

Webdev & work VMs with thin bordered icons


Templates tab of Appmenu

Service tab of Appmenu

Qubes Manager and Qubes Domains systray widget

Qubes Devices

XFCE 4 Orthodox traditional Appmenu

Label Picker

Bugs & Issues

Qubes Updater GUI VM name render

The weird render of Qubes OS Updater GUI turns out to be CSS hard coding of labels in qubes-update-gui. Fortunately it is extremely simple to fix. It even works perfectly with dark themes at the moment. And if you select the VM with bright themes, you could still read the Qube Name in Updater.

Mentioned CSS files could be found in this repository and directory. Almost all of the GUI tools are in qubes-desktop-linux-manager repo. And they are written in GTK (neither PyQt nor Tkinter). I finally decided to bite the bullet and install gtk3-devel tools to have access to GTK inspector during development. Maybe while I am at it, I could find the fix to the unrelated bug of white background of tray icons in dark theme as well.

GraphicMagick bizarre bug

GraphicMagick is installed by default in dom0. And I wanted to use it to avoid asking users to install ImageMagick as a prerequisite. It turns out that the GraphicMagick version of Fedora 37 is ancient buggy. See these icons converted by GraphicMagick:

And compare with ImageMagick conversion:

So qubes-label-tweak-tool will search for ImageMagick and only reverts back to GraphicMagick if IM is not present. As Gary Bernhardt wisely said in his presentation during pycon 2014

“imagemagick is a cockroach, it’ll never die”

So How to Use?

Just copy the qubes-label-tweak-tool to dom0 at your ~/bin directory and make it executable. Run it with --help and follow the instructions. You could use the default Qute Sushi icons in different colors, or provide your icon(s). If icon rendering via GraphicMagick is wrong, install imagemagick from official repos via qubes-dom0-update.

The tool stores icons at ~/.local/share/icons directory. You could back it up if you like. But it doesn’t usually pre-exist at all. And this tool does not require sudo.

You could read the source if you are worried about its function, or ask someone who is proficient with bash to do it for you. Also please note that qubes-label-tweak-tool only creates labels with icons. Alternative effects to tint is done via qvm-appmenus-tweak-tool. I am still working on that to add more functions.

If you find any bug or want other functions which I did not consider, please feel free to reply to this thread.

3 Likes

Did you exchange on your work with Marta and @ninavizz from the Qubes team ? If not, I think it would be a very good idea for maybe an official or commnunity version of your great menu tool…
CC: @adw

2 Likes

I have not contacted them so far. I have been monitoring core team member tasks on Github and I assumed that they might be very busy at the moment. I also wanted to test the tools properly and fix all bugs that might occur before showing up with an incomplete solution.

2 Likes

The best way would be to follow the procedure here:

3 Likes

Further progress

qvm-run-tweak-tool

It is time to work on this tool. Basis of my work will be qvm_run.py. I want to add more functions to it. One would be --workspace=<workspace_no|workspace_name> which will switch to the specified workspace before executing the actual command in the vm. If --workspace is not specified, it should check for specific feature tag of the template (e.g. workspace) and use it if it is available. And it will be ignored if --all is used. I have to decide if I should choose workspace feature tag for this or something like ttworkspace; just to avoid conflicts with official tags which might occur in the future. The other option to add would be --theme=themefile to allow individual Freedesktop CSS themes per label. Once this tool is finished, I could use it in my qvm-appmenus-tweak-tool instead of qvm-run for Exec= entries of .desktop files. The default ANSI color 31 (red) is used on qvm_run.py for both stdout and stderr. I do not like that. I have to properly study the current stream handling in qvm-run. Then I should consider my own preferred colors (i.e. 37 for for stdout and 91 for stderr). Or maybe a config file at ~/.confg/qubestt.conf to allow persistent user configs.

QubesOS Update GUI bug with custom labels

Updater bug with light theme is a minor issue. Just add this line to /usr/lib/python3.11/site-packages/qui/styles/qubes-colors-light.css

label {color: #000000;}

This is a minor cosmetic makeup and not a major plastic surgery. I could file a new issue on Github or send a pool request to fix it in the upstream; but I would not do it for now because of reasons mentioned earlier in this thread.

A GUI for custom labels?

I had an idea about creating a GUI alternative to qubes-label-tweak-tool. Something like this:

+---------+----------+----------+----------+----------+----------+------------+
|         |   App    |   Disp   |  Service |  Stand   | Template |            |
|  Label  |          |          |          |          |          |  Delete ?  |
|         |   VM     |    VM    |    VM    |  Alone   |    VM    |            |
+---------+----------+----------+----------+----------+----------+------------+
|  Name   |          |          |          |          |          |            |
|   in    |   Icon   |   Icon   |   Icon   |   Icon   |   Icon   |     x      |
|  Color  |          |          |          |          |          |            |
+---------+----------+----------+----------+----------+----------+------------+
.                                                                             .
.                                                                             .
.                                                                             .
+---------+----------+----------+----------+----------+----------+------------+
|                                                                             |
|  Add Custom Label          Add from Community labels              Exit      |
|                                                                             |
+-----------------------------------------------------------------------------+

Or maybe the label name, label color and label hexadecimal value could be individual columns. It is ages since I worked on a GUI. It is not rocket science and luckily PyQt is installed by default in dom0. But I have doubts if enough users need such a tool? Most of the Qubes OS users are more focused on opsec and qubes-label-tweak-tool is more than sufficient for them.

Educational video on creating custom labels?

Users could visit websites that provide public domain or other forms of free vector designs and convert them to icons. One example would be OpenClipArt. I wonder if an education guide or video is needed.

1 Like

Progress Update.

  • 25 qube icons are uploaded to the repository.
  • Back to GraphicsMagick and resolving the rendering bug
  • Window Buttons (Running Apps) Icon Effects. icon-receiver daemon
  • Trying to learn from History.

Qube Icons (Help Needed)

25 qube icons suitable to be used with qubes-label-tweak-tool are now uploaded to the repository. You could see them all together on Github page if you scroll down the page. Please be advised that some icons include optical illusions which might trigger CNS disorders in some people. Original Qubes OS Vector Perfect Qute Sushi icons are linked directly from Qubes Artwork repository for reference.

Some of those icons are my own sketches. Some include design elements from other designers. Proper attribution to original designers (like @ninvavizz) is added to README.md file as well as SVG metadata. I really appreciate your feedback specially if you find any trademarks policy violation. Receiving a Github take-down notice is the last thing I want at this stage.

While reading Trademarks policies of various Distros, I realized that most of them are very restrictive and prohibitive and disallow performing any kind of modifications on their logos. Some explicitly advise against overlaying their logo on any non-square shaped background. The only relax ones are Debian and Gentoo. So I ditched the whole idea of overlaying Distro logos on qubes icons. An independent table of Distro logos which are linked directly from their websites is included in the README.md file. This table includes official color codes as well as links to the Distro artwork policy pages (if available). I appreciate if anyone has spare time to read Distros’ artwork trademarks policies and inform me if it would be OK to include their unmodified icons directly in the repository.

For people who want to design their own qube icons, Rubik’s qube and Webcolors qube SVGs include Inkscape guides which will facilitate your design. Just do not forget to update the Metadata of svg in file properties and add your own name/license/…

Proper Makefile with label creation targets is included. You could use it after installing qubes-label-tweak-tool to automatically create all or just one category of default TT labels. Run make in the icons directory for more information.

Switching back to GraphicsMagick

After educating myself on GM internals, it became obvious that Vector to Raster conversion is performed in multiple stages. Not only special modifiers is required but also the order of command line options is important. So we are back to GM because of multiple reasons. GraphicsMagick is significantly faster than ImageMagick for png icon generation. 5,303 milliseconds for GM vs 42,907 milliseconds for IM to convert 25 SVG icons to 512x512 PNGs. Not even close. Render output is a little bit different between the two. See screenshot (pay attention to dice, sticky notes and qube-square3 icons):

Even ignoring the performance difference, IM is known to switch between several different licenses in the past and ended up on Apache license. More info on GM FAQ. So if you have installed ImageMagick to use with qubes-label-tweak-tool, please remove it. Just run dnf history and find ImageMagick and all its related weak dependencies and purge them.

If you create your own icons, it is advisable to check them with both GM and IM conversions:

gm convert -background transparent -density 512x512 -size 512x512 svgfile -size 512x512 pngoutput
convert +antialias -background transparent -density 512x512 -size 512x512 svgfile -size 512x512 pngoutput

And do not forget to cleanse up your SVG icons in Inkscape using cleanup option in the file menu.

Icon Receiver daemon.

Qubes OS VM icons are transferred to dom0/GUIVM in 3 different ways.

  1. Via TemplateVM package manager post-install hooks and permanently stored in GUIVM. I have already finished writing alternate effects for these icons via qvm-appmenus-tweak-tool.
  2. Icons of running apps in Windows Buttons area next to Qubes Application Menu. These icons could be dynamically generated by the source app. They persist in RAM. Qubes uses icon-receiver daemon of window-icon-updater which is a part of qubes-gui-daemon repository. Fortunately it is not necessary to touch the original daemon and perform invasive plastic surgery on it. It loads via an XDG autostart .desktop file. It could be suppressed via a .desktop file at ~/.config/autostart with Hidden=true tag. And the Tweak Tool version will be loaded via a separate .desktop file at the same location. So everything runs in user space without requiring root privileges or sudo. The original icon-updater will be used as a Python library and alternate effects will be overloaded on it. I have tested it and it works fine. I have to refactor and cleanse it to because worthy of peer review. BTW, there might be a minor bug in the icon-receiver daemon. If you logoff and logon without shutting down a VM, icon-receiver daemon does not re-register it. Maybe I could spend some time on it and fix it.
  3. The Systray Icons (WiFi/Network Icon, sys-whonix systray icon, …) effects use a totally different code base. It is again a part of qubes-gui-daemon repository under gui-daemon sup-directory and is written in C code. That is why Systray icons have independent style config in Qubes Global Config settings. I will discuss it further in next session.

Learning from History

I have to carefully study the history of split path of Systray and Windows Buttons icon effects. As was once said wisely:

Ideally Icon receiver should merely sanitize them against malicious code injection and the (tint or other) effects should be performed on the front-end via Freedesktops CSS or similar technics. Currently all icons are sanitized and rasterized, then tint effect is performed in the backend via CPU. The current Vector to Raster conversion approach might hinder adoption of users with HiDPI screens. Sanitizing SVGs against script code injection requires XML interpreters and will be an enormous task to accomplish. But it might become a necessity in the future. CSS effects might be much faster due to GPU acceleration. If Freedesktop CSS theme per label could be implemented, UIUX people could do their magic touch instead of limited hard coded effects in the back-end.

1 Like

Current status of Window Buttons icon effects. Firefox icons from left to right: Thin border, Thick border, Overlay on Gray, Overlay on Green, Tint (the only currently available standard effect) with blue, paranoid invert, untouched.

Thin & Thick borders, Overlay and Tint could be used with any colors. I am not very satisfied with thin border. 1 pixel is too little and 2 pixel is what is currently being used for thick border. I have to write a proper anti-alias algorithm for 1.5 pixel border. I can write it quick if I was targeting only 32x32 pixel icons. But I have long term goals.

BTW, does anyone read these posts? Sometimes I feel that I am just talking to myself here.

4 Likes

I do. :wink:

1 Like

You’ve done great work. It is indeed noticed and appreciated.

3 Likes

Agreed!!!

1 Like

P.S.:

I might rename the executables and libraries from *tweaks or *tweak-tool to *tt as it will be much easier to type.

Think & Thick border Anti-aliasing

Just finished the border Anti-aliasing code. Turned out good. Even bright color thin borders are now distinguishable.


1 Like