aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2021-10-06 12:10:59 +0200
committerIsaac Freund <mail@isaacfreund.com>2021-10-06 12:16:36 +0200
commit3b24e7fcd5abae2fbea8dfcfaf1da955f7a3b95c (patch)
tree8f234ceb8fb4a26b76928ee8ece6bf2edddd7c3b
parent30da9e722136f334dc1fb87b3a8677fbaced63f6 (diff)
downloadriver-3b24e7fcd5abae2fbea8dfcfaf1da955f7a3b95c.tar.gz
river-3b24e7fcd5abae2fbea8dfcfaf1da955f7a3b95c.tar.xz
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.
-rwxr-xr-xcontrib/layout.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/contrib/layout.py b/contrib/layout.py
index 7940988..76d8dbb 100755
--- a/contrib/layout.py
+++ b/contrib/layout.py
@@ -18,10 +18,14 @@ from pywayland.protocol.wayland import WlOutput
try:
from pywayland.protocol.river_layout_v3 import RiverLayoutManagerV3
except:
- print("Your pywayland package does not have bindings for river-layout-v3.")
- print("You can add the bindings with the following command:")
- print(" python3 -m pywayland.scanner -i /usr/share/wayland/wayland.xml river-layout-v3.xml")
- print("Note that you may need root privileges if you have pywayland installed system-wide.")
+ river_layout_help = """
+ Your pywayland package does not have bindings for river-layout-v3.
+ You can generate the bindings with the following command:
+ 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()
layout_manager = None
@@ -53,12 +57,12 @@ def layout_handle_layout_demand(layout, view_count, usable_w, usable_h, tags, se
# Committing the layout means telling the server that your code is done
# laying out windows. Make sure you have pushed exactly the right amount of
# view dimensions, a mismatch is a fatal protocol error.
- #
+ #
# You also have to provide a layout name. This is a user facing string that
# 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
# 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):
# 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
# and recover from this mishap. Writing such a client is left as an exercise
# for the reader.
- print(f"Namespace already in use!")
+ print("Namespace already in use!")
global loop
loop = False
@@ -136,4 +140,3 @@ for output in outputs:
outputs.remove(output)
display.disconnect()
-