You are not logged in.

#1 2019-01-13 02:34:04

cdyrssen
Member
Registered: 2018-12-25
Posts: 8

Opacity oddity with Sublime Text using Compton, tansset-df, and i3

Hello all,

I've been trying to wrap up a rice I have been working on for my i3-gaps arch installation, however, I have come to somewhat of a wall. Currently I have Compton and i3 working exactly how I want it to for all my programs except for pcmanfm and sublime text. What I am trying to accomplish is this:

- All inactive windows should be nearly transparent. I accomplish this with Compton's inactive-opacity feature set to 0.3.
- The active window should be pretty opaque to fully opaque depending on the program. (ex. Firefox should not be transparent at all when active, but my terminal can be slightly transparent) I accomplish this with Compton's opacity-rules by checking for any programs I want to be slightly transparent while they are focused.
- Upon a pressing a key-combination, the program with the mouse over it should toggle its opacity to the most opaque it can get depending on the settings determined in Compton's opacity rules. This should happen whether the program is focused or not.

The third bullet point is where I am having issues. I wrote a small script called toggle_transparency utilizing transset-df which accomplishes just that, but the change does not persist after pcmanfm's or Sublime Text's focus changes. For every other program I can toggle this feature on and off perfectly, but those two specifi programs revert back to being nearly transparent once their focus has changed.

EDIT: I had been editing a lot of dot files and such, so I decided to try a reboot. That seems to have solved the issue for Pcmanfm, but the reboot had no affect on Sublime Text's interaction with this setup.

My motivation behind such a feature is to completely remove boarders on all i3 windows and utilize these varying transparencies as a designator for window focus. However, there are times when I want to easily read something on an unfocused window, so I would like to be able to toggle that windows opacity to its max value so that it becomes easy to read while it is unfocused and I am working in a different window. I hope my explanation of what I'm trying to accomplish is clear enough.


Here is my i3 config file:

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

for_window [class="^.*"] border pixel 0

#smart_gaps on
gaps inner 15
#gaps outer 10

exec_always compton
# Kill console bell/beep
exec_always rmmod pcspkr
exec_always setterm -blength 0
exec_always bell-style none
exec_always xset -b

# Set random wallpaper
exec_always feh --randomize --bg-scale ~/Pictures

#
bindsym $mod+Escape exec --no-startup-id i3lock-fancy

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec st

# kill focused window
bindsym $mod+Shift+q kill

# toggle opacity at window mouse is over
bindsym $mod+plus exec --no-startup-id "/home/toffer/.scripts/toggle_transparency.sh"

# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id rofi -show drun focus
bindsym $mod+Shift+d exec --no-startup-id "rofi -show drun -run-command 'gksudo {cmd}'" focus
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

# split in horizontal orientation
bindsym $mod+minus split v

# split in vertical orientation
bindsym $mod+bar split h

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
#bindsym $mod+w layout tabbed
#bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

workspace $ws1 gaps inner 0
#focus_on_window_activations focuse

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

# Resizing by 1
bindsym $mod+Ctrl+l resize shrink width 1 px or 1 ppt
bindsym $mod+Ctrl+k resize grow height 1 px or 1 ppt
bindsym $mod+Ctrl+j resize shrink height 1 px or 1 ppt
bindsym $mod+Ctrl+h resize grow width 1 px or 1 ppt

# Resizing by 10
bindsym $mod+Ctrl+Shift+l resize shrink width 5 px or 5 ppt
bindsym $mod+Ctrl+Shift+k resize grow height 5 px or 5 ppt
bindsym $mod+Ctrl+Shift+j resize shrink height 5 px or 5 ppt
bindsym $mod+Ctrl+Shift+h resize grow width 5 px or 5 ppt

# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec backlight_control +10 # increase screen brightness
bindsym XF86MonBrightnessDown exec backlight_control -10 # decrease screen brightness

# Touchpad controls
bindsym XF86TouchpadToggle exec ~/.scripts/toggletouchpad.sh # toggle touchpad

# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous


# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
        status_command i3status
}

Here is my compton config file:

# Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
shadow-radius = 7; shadow-offset-x = -7;
shadow-offset-y = -7;
# shadow-opacity = 0.7;
# shadow-red = 0.0;
# shadow-green = 0.0;
# shadow-blue = 0.0;
shadow-exclude = [
	"name = 'Notification'",
	"class_g = 'Conky'",
	"class_g ?= 'Notify-osd'",
	"class_g = 'Cairo-clock'",
	"_GTK_FRAME_EXTENTS@:c"
];
# shadow-exclude = "n:e:Notification";
# shadow-exclude-reg = "x10+0+0";
# xinerama-shadow-crop = true;

# Opacity
menu-opacity = 0.8;
inactive-opacity = 0.3;
#active-opacity = 0.8;
frame-opacity = 0.7;
inactive-opacity-override = false;
alpha-step = 0.06;
# inactive-dim = 0.2;
# inactive-dim-fixed = true;
blur-background = true;
# blur-background-frame = true;
blur-kern = "7x7box"
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
# blur-background-fixed = true;
blur-background-exclude = [
	"window_type = 'dock'",
	"window_type = 'desktop'",
	"_GTK_FRAME_EXTENTS@:c"
];
opacity-rule = [
	"80:class_g = 'st-256color' && focused",
	"90:class_g = 'Sublime_text' && focused",
];

# Fading
fading = true;
# fade-delta = 30;
fade-in-step = 0.03;
fade-out-step = 0.03;
# no-fading-openclose = true;
# no-fading-destroyed-argb = true;
fade-exclude = [ ];

# Other
backend = "glx"
mark-wmwin-focused = true;
mark-ovredir-focused = true;
use-ewmh-active-win = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
vsync = "none";
dbe = false;
# sw-opti = true;
# unredir-if-possible = true;
# unredir-if-possible-delay = 5000;
# unredir-if-possible-exclude = [ ];
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-transient = false;
detect-client-leader = false;
invert-color-include = [ ];
# resize-damage = 1;

# GLX backend
# glx-no-stencil = true;
glx-copy-from-front = false;
# glx-use-copysubbuffermesa = true;
# glx-no-rebind-pixmap = true;
glx-swap-method = "undefined";
# glx-use-gpushader4 = true;
# xrender-sync = true;
# xrender-sync-fence = true;

# Window type settings
wintypes:
{
  tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; };
};

And here is my toggle_transparency.sh script:

WINID=$(xdotool getmouselocation --shell | grep WINDOW | sed -n -e 's/^WINDOW=//p')
transset-df --id $WINID --toggle 0.9999999

Anyone have any clues as to why this setup works for every other programs except for Sublime Text and Pcmanfm?

Last edited by cdyrssen (2019-01-13 03:58:15)

Offline

#2 2019-01-13 21:21:34

prosvetlyonniy
Banned
Registered: 2019-01-06
Posts: 25

Re: Opacity oddity with Sublime Text using Compton, tansset-df, and i3

Just sublime uses its own settings of the graphics engine that are involved in the core of the program.
I think the only solution is to do this:

inactive-opacity = 0.9;

Offline

#3 2019-01-13 23:45:37

cdyrssen
Member
Registered: 2018-12-25
Posts: 8

Re: Opacity oddity with Sublime Text using Compton, tansset-df, and i3

prosvetlyonniy wrote:

Just sublime uses its own settings of the graphics engine that are involved in the core of the program.

That is good to know. I will look into some of sublime's settings and see if I can find anything in there.

prosvetlyonniy wrote:

I think the only solution is to do this:

inactive-opacity = 0.9;

I'm not sure how this is supposed to solve the issue? All that does is make the problem less noticeable.

Offline

Board footer

Powered by FluxBB