contrib: recommend using a venv for layout.py
This avoids needing to run pwayland's scanner with root privileges and install the river-layout bindings to system directories.
This commit is contained in:
parent
30da9e7221
commit
3b24e7fcd5
@ -18,10 +18,14 @@ from pywayland.protocol.wayland import WlOutput
|
|||||||
try:
|
try:
|
||||||
from pywayland.protocol.river_layout_v3 import RiverLayoutManagerV3
|
from pywayland.protocol.river_layout_v3 import RiverLayoutManagerV3
|
||||||
except:
|
except:
|
||||||
print("Your pywayland package does not have bindings for river-layout-v3.")
|
river_layout_help = """
|
||||||
print("You can add the bindings with the following command:")
|
Your pywayland package does not have bindings for river-layout-v3.
|
||||||
print(" python3 -m pywayland.scanner -i /usr/share/wayland/wayland.xml river-layout-v3.xml")
|
You can generate the bindings with the following command:
|
||||||
print("Note that you may need root privileges if you have pywayland installed system-wide.")
|
python3 -m pywayland.scanner -i /usr/share/wayland/wayland.xml river-layout-v3.xml
|
||||||
|
It is recommended to use a virtual environment to avoid modifying your
|
||||||
|
system-wide python installation, See: https://docs.python.org/3/library/venv.html
|
||||||
|
"""
|
||||||
|
print(river_layout_help)
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
layout_manager = None
|
layout_manager = None
|
||||||
@ -58,7 +62,7 @@ def layout_handle_layout_demand(layout, view_count, usable_w, usable_h, tags, se
|
|||||||
# the server can forward to status bars. You can use it to tell the user
|
# the server can forward to status bars. You can use it to tell the user
|
||||||
# which layout is currently in use. You could also add some status
|
# which layout is currently in use. You could also add some status
|
||||||
# information status information about your layout, which is what we do here.
|
# information status information about your layout, which is what we do here.
|
||||||
layout.commit(f"{view_count} windows layed out by python", serial)
|
layout.commit(f"{view_count} windows laid out by python", serial)
|
||||||
|
|
||||||
def layout_handle_namespace_in_use(layout):
|
def layout_handle_namespace_in_use(layout):
|
||||||
# Oh no, the namespace we choose is already used by another client! All we
|
# Oh no, the namespace we choose is already used by another client! All we
|
||||||
@ -67,7 +71,7 @@ def layout_handle_namespace_in_use(layout):
|
|||||||
# client could instead destroy only the one single affected layout object
|
# client could instead destroy only the one single affected layout object
|
||||||
# and recover from this mishap. Writing such a client is left as an exercise
|
# and recover from this mishap. Writing such a client is left as an exercise
|
||||||
# for the reader.
|
# for the reader.
|
||||||
print(f"Namespace already in use!")
|
print("Namespace already in use!")
|
||||||
global loop
|
global loop
|
||||||
loop = False
|
loop = False
|
||||||
|
|
||||||
@ -136,4 +140,3 @@ for output in outputs:
|
|||||||
outputs.remove(output)
|
outputs.remove(output)
|
||||||
|
|
||||||
display.disconnect()
|
display.disconnect()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user