Opacified / Translucent / Transparent Windows in Cinnamon.

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Mintymandy34

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Mintymandy34 »

smurphos wrote: Fri Mar 15, 2019 3:34 pm I've just edited the first post with version 0.2 of the script. After experimenting with a few ways to match up related windows (dialogs to parents etc) I settled on a fairly simple but I think quite pleasing method of grouping windows by PID (Process ID's) so they can have a different opacity from unrelated unfocused windows.

As provided the focused window will be 95% opaque, other windows in it's group 90% and other unfocused windows 70%.
Sorry for the delay.
And thanks for the second version of the script.
I love the technique of grouping windows by PID.
I have set GROUP_OPACITY=100 so that when one opens a Preferences Window or anything similar the application is treated as Maximised focused window providing better visibility.
Thanks for this.
It's really great.
I'll post a comparison between this effect and the original ones, but I think your script has achieved everything it was originally created for.
Thanks. :D
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos »

No worries - there will probably be one more iteration in the next few days. I've noticed that the script creates quite a lot of spam in .xsession-errors. The errors are harmless, but I should be able to amend to script to 'mute' them.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos »

First post updated with v0.3 of the script. This is just to eliminate ~/.xsession-errors being spammed by xdotool / xprop error states when there isn't a focused window, when the focused window is a splash, and on focused window closure.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Mintymandy34

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Mintymandy34 »

smurphos wrote: Tue Mar 19, 2019 11:54 pm First post updated with v0.3 of the script. This is just to eliminate ~/.xsession-errors being spammed by xdotool / xprop error states when there isn't a focused window, when the focused window is a splash, and on focused window closure.
Thanks smurphos, will test this. :)
Do you know if this effect can be temporarily disabled like for 30 minutes or 1 hour without rebooting the machine?
I was testing this with several applications and checking custom opacity values that are favourable for my case, if I could disable it temporarily, I could check the for the difference it makes in different applications and choose which ones to ignore and which ones to keep.

Thanks for this script, it's great. :D
I'm thinking of a way to configure custom values when starting this script, the idea came from your way of implementing zenity to choose different profiles for firejail.
I think this has a great potential. :)
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos »

You can kill the script running in the background with a terminal command. Assuming you had saved the script with the suggested filename...

Code: Select all

pkill opacify_windows.sh
That will leave all currently open windows in their last opacity state though.

So perhaps a little secondary script to toggle the main script on and off, including a quick run through all current windows to set the opacity to default if it's toggling off? The second script you could link to a panel or desktop launcher or just use from the terminal

Code: Select all

#!/bin/bash

# Requires wmctrl - apt install wmctrl

# If opacify_windows.sh is not running run it
if ! pgrep opacify_windows.sh; then
  exec opacify_windows.sh
  exit 1
# else kill it and set all windows to 100% opacity.
else
  pkill opacify_windows.sh
# get list of all window IDs in workspace
  WIDS=$(wmctrl -l | awk '{print$1}')
# run through list and update opacity
  for w in $WIDS; do
    xprop -id $w -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0xffffffff
  done
fi 
Mintymandy34 wrote: Fri Mar 22, 2019 3:35 pm Thanks for this script, it's great. :D
I'm thinking of a way to configure custom values when starting this script, the idea came from your way of implementing zenity to choose different profiles for firejail.
I think this has a great potential. :)
:thumbsup: :D
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Mintymandy34

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Mintymandy34 »

smurphos wrote: Sat Mar 23, 2019 2:15 am You can kill the script running in the background with a terminal command. Assuming you had saved the script with the suggested filename...

Code: Select all

pkill opacify_windows.sh
That will leave all currently open windows in their last opacity state though.

So perhaps a little secondary script to toggle the main script on and off, including a quick run through all current windows to set the opacity to default if it's toggling off? The second script you could link to a panel or desktop launcher or just use from the terminal

Code: Select all

#!/bin/bash

# Requires wmctrl - apt install wmctrl

# If opacify_windows.sh is not running run it
if ! pgrep opacify_windows.sh; then
  exec opacify_windows.sh
  exit 1
# else kill it and set all windows to 100% opacity.
else
  pkill opacify_windows.sh
# get list of all window IDs in workspace
  WIDS=$(wmctrl -l | awk '{print$1}')
# run through list and update opacity
  for w in $WIDS; do
    xprop -id $w -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0xffffffff
  done
fi 
Thanks smurphos.
I'm planning to make a full fledged UI for this, one that provides features like buttons to enable and disable this script, resetting to default settings, controlling opacity values, adding exceptions and saving custom presets.
I know this can be done in zenity but I've not seen any complex GUI created in zenity, when I search online, I only find simple and single elements implemented.
Do you know where I could find such complex GUI implementations in Zenity?
I've also tried Glade, but I couldn't find enough tutorials to get it going, I'm really bad at learning from man, I learn better with the help of visuals, if only there was man-gui version. :(
And I'm really on this, I would love to implement a GUI for this. :D
You've really done a great job with the script. I love it.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos »

Mintymandy34 wrote: Sat Mar 23, 2019 3:40 pm I know this can be done in zenity but I've not seen any complex GUI created in zenity, when I search online, I only find simple and single elements implemented.
Do you know where I could find such complex GUI implementations in Zenity?
I've also tried Glade, but I couldn't find enough tutorials to get it going, I'm really bad at learning from man, I learn better with the help of visuals, if only there was man-gui version. :(
And I'm really on this, I would love to implement a GUI for this. :D
You've really done a great job with the script. I love it.
Sorry I'm not aware of any in depth tutorials for zenity. You might want to look into yad (yet another dialog) as-well - it's zenity on steroids so a little more complex, but also more flexible.

apt install yad
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
jlfh0816
Level 1
Level 1
Posts: 47
Joined: Wed May 01, 2019 12:00 pm

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by jlfh0816 »

Hello,
I have tested your script on Xubuntu 18.04 and it works perfectly!
I’m quite taken with the work you’ve done, so much so that I decided to give you some spotlight on the ubuntu.fr forum.
For my part, I have been desperately searching for a script that would make transparent my nemo window background (instead of the whole window).
Aside from nw.js and this script in python, I haven’t found anything that would work on nemo as is. Would you have any lead on that front?

Good job for the amazing script you’ve written,
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos »

jlfh0816 wrote: Wed May 01, 2019 1:23 pm Good job for the amazing script you’ve written,
Thank-you for the feedback, glad you like it and it works well outside of Cinnamon / Muffin. It principle it should be OK in any Xorg based desktop environment, but having not tested outside of Cinnamon/Muffin I wouldn't want to advertise that... :)

I'll have a think about making the pane transparent via a GTK override.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
vaca
Level 3
Level 3
Posts: 194
Joined: Thu Jul 12, 2018 1:58 pm
Location: Barcelona Spain

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by vaca »

Thanks !!!! excelent job Smurphos perfect opacity and workspace background switcher linux , mint forever :D :D :D
Acer 7542G/4gb ram/Mint20 usb 1TB. Hp Elitedesk 800 G3 Mini 35 wt /i5 7500T /16GB RAM DDR4 2400/UEFI MINT 20 1 TB USB3 /240GB SSD sata/!
Voctor

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Voctor »

This is great! I'm using it, :D
User avatar
bn40400
Level 1
Level 1
Posts: 26
Joined: Thu Jan 23, 2020 3:29 am
Location: US - OH

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by bn40400 »

Just what I was looking for....Great job on the script Smurphos! Thank you so much for the time and effort you put into this (never lone sharing it), I'm using it now and it works flawlessly. My desktop environment looks so amazing! :D
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos »

You are welcome - glad you like it. :)
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
pilotbob42
Level 2
Level 2
Posts: 56
Joined: Mon Dec 16, 2019 11:45 am

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by pilotbob42 »

A bit late to the game, but just found this. Exactly what I was looking for! Great job!
Kendoori
Level 5
Level 5
Posts: 749
Joined: Thu Jul 09, 2009 12:51 pm
Location: Sanibel, FL USA

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Kendoori »

In case someone is looking for the variant of this script that can be used for a specific app, this does it: https://10pm.ca/script-to-set-window-op ... -cinnamon/

I use Todoist as my task management system and want to keep their desktop app open, but slightly muted front and center on my desktop. The script variant allows me to easily target that window by name.
Locked

Return to “Cinnamon”