Notes of Rasmus Johanson

i3 transparent placeholder

20 Aug, 2020

i3 does have i3 open command to open blank/empty container but at least for me it draws weird container borders on desktop and in general is undocumented and unreliable.

To get over it I use Python's tkinter to make a simple 'gui' and use main windows alpha attribute to make it completely transparent.

Screenshot

You can drop a python program in your config folder, something like that:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3

import sys
try:
    from tkinter import Tk
    tkinterExist = True
except ModuleNotFoundError:
    tkinterExist = False
    print('Install tkinter module (possibly apt install python3-tk)')

if tkinterExist:
    try:
        args = sys.argv[1]
    except:
        args = 0
    print('Alpha level: {0}'.format(args))

    root = Tk()
    root.wait_visibility(root)
    root.wm_attributes('-alpha', args)
    root.mainloop()

And bind it to some key, mod+o in my case:

bindsym $mod+o exec bash -c 'python3 ~/.config/i3/placeholder.py'

Works like charm, even takes a parameter for the opacity level, defaulting to 0. placeholder.py 0.5 for semi transparency.