Opacified / Translucent / Transparent Windows in Cinnamon.

Please post suggestions for improvement of Cinnamon here
https://github.com/linuxmint/Cinnamon
Mintymandy34
Level 4
Level 4
Posts: 377
Joined: Mon Feb 11, 2019 10:57 pm

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Mintymandy34 » Mon Mar 18, 2019 10:53 am

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 12
Level 12
Posts: 4055
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos » Tue Mar 19, 2019 3:48 am

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 12
Level 12
Posts: 4055
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos » 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.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

Mintymandy34
Level 4
Level 4
Posts: 377
Joined: Mon Feb 11, 2019 10:57 pm

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Mintymandy34 » Fri Mar 22, 2019 3:35 pm

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 12
Level 12
Posts: 4055
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos » 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 
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
Level 4
Level 4
Posts: 377
Joined: Mon Feb 11, 2019 10:57 pm

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by Mintymandy34 » Sat Mar 23, 2019 3:40 pm

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 12
Level 12
Posts: 4055
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos » Thu Mar 28, 2019 3:18 am

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: 1
Joined: Wed May 01, 2019 12:00 pm

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by jlfh0816 » Wed May 01, 2019 1:23 pm

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 12
Level 12
Posts: 4055
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by smurphos » Thu May 02, 2019 1:42 am

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.

vaca
Level 2
Level 2
Posts: 56
Joined: Thu Jul 12, 2018 1:58 pm
Location: Barcelona Spain

Re: Opacified / Translucent / Transparent Windows in Cinnamon.

Post by vaca » Tue Sep 10, 2019 4:18 am

Thanks !!!! excelent job Smurphos perfect opacity and workspace background switcher linux , mint forever :D :D :D

Post Reply

Return to “Cinnamon”