porcupine
porcupine copied to clipboard
popping tabs plugin multiple screens
Currently I don't have multiple monitors on any computer. Don't know how poppingtabs plugin would work in that case. The code seems to assume one screen only.
In general, someone with multiple monitors should try different features of Porcupine, not just dragging tabs out of the Porcupine window, and see what works and what doesn't work.
Today I tested a couple things with multiple monitors (using my monitor on a laptop feels super weird, lol).
Dragging tabs from the secondary monitor to the primary monitor works, but not vice versa. In that case the location is correct, but it's displayed on the primary monitor.
Geometry (location) remembering doesn't work.
Btw, this was Window$
Maybe winfo_screen()
and the screenName
argument of Tk
would work for this. This computer only has one monitor, but I don't get errors:
>>> root = tkinter.Tk()
>>> root.winfo_screen()
':0.0'
>>> root.destroy()
>>> root2 = tkinter.Tk(screenName=':0.0')
>>>
The setup()
function of each plugin runs after the root window is created, but I can't find any way to say "move to this screen" to an existing window. But there's also a setup_argument_parser()
method that runs before creating the root window. This method should be renamed, because it doesn't always have anything to do with parsing arguments :)
We can't let a plugin create the root window, because then multiple plugins could do it and conflict with each other. We can still let plugins choose the screenName
that ends up being used. They could set a value into Porcupine's global state, for example, and if two plugins do that, then the loading order determines which value is used.
Apparently screenName
refers to the X screen to use, so it's useful if I use Tkinter via ssh, for example
me@desktop:~$ ssh me@laptop -Y
me@laptop:~$ cat test_screenname.py
import tkinter
a = tkinter.Tk()
print(a.winfo_screen())
a.destroy()
b = tkinter.Tk(screenName=":0.0")
print(b.winfo_screen())
me@laptop:~$ python3 test_screenname.py
localhost:10.0
:0.0
.geometry()
can be used to move the window to another monitor.
To get the monitor sizes we can use .maxsize()
(which gives the size of the two monitors combined) together with .winfo_screenwidth()
and .winfo_screenheight()
(which give the size of the primary monitor), though they don't work in every cases. Maybe it's better to use the screeninfo
module for that.