Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make tkinter Window floating in i3 windowmanager

Tags:

python

tkinter

I'm just playing around with tkinter in python a little, but have some "troubles" with my i3 (tiling) windowmanager.

I want to create a floating window for entering a value (similar to a "Open File" Dialog). This has to be possible, since Gimp for example works with floating windows in i3, too. Of course I'm not sure if it's possible with tkinter.

Does someone happen to know the problem and found the solution? I guess there's got to be some sort of flag to set on the tkinter.Tk() widget.

like image 751
J. Doe Avatar asked Mar 06 '16 18:03

J. Doe


2 Answers

You can tell i3wm that this is a dialog by setting your root element's type attribute to dialog

from Tkinter import Tk
root = Tk()
root.attributes('-type', 'dialog')
root.mainloop()

i3 will open the window automatically in floating mode instead of tiling.

like image 196
Dane Johnson Avatar answered Sep 29 '22 00:09

Dane Johnson


If you know the title of the window, or any pattern of the title, you can add the following line in your i3 config file to make it float on start:

for_window [title="title of your window"] floating enable

For example, I use this config to make my gnome-keyring floating every time it asks me for password:

for_window [title="Unlock private key"] floating enable

EDIT:

According to this https://faq.i3wm.org/question/61/forcing-windows-as-always-floating.1.html:

"i3 sets dialog, utility, toolbar and splash windows to floating."

like image 33
Mingwei Zhang Avatar answered Sep 29 '22 01:09

Mingwei Zhang