Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles/sway.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-09 08:08:53 +0000
committerGitHub <noreply@github.com>2021-04-09 08:08:53 +0000
commit3d659dead8cf06e71ad9c36db1abec3f22335414 (patch)
tree6e6c277bd976ee2e1bb5b06db98aa75b6bf22dd6 /profiles/sway.py
parentf8bf2b313ab8c06571d44c571143c28864599223 (diff)
parentb85514ae5e4cdedf00795f165fbcd17abd2cb4fd (diff)
Merge pull request #251 from advaithm/torxed-v2.2.0
Split drivers from xorg and create a seprate profile for wayland. Remove the use of sddm from sway and raise issues with the nvidia drivers
Diffstat (limited to 'profiles/sway.py')
-rw-r--r--profiles/sway.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/profiles/sway.py b/profiles/sway.py
new file mode 100644
index 00000000..edc3b744
--- /dev/null
+++ b/profiles/sway.py
@@ -0,0 +1,47 @@
+import archinstall, os
+
+# TODO: Remove hard dependency of bash (due to .bash_profile)
+
+def _prep_function(*args, **kwargs):
+ """
+ Magic function called by the importing installer
+ before continuing any further. It also avoids executing any
+ other code in this stage. So it's a safe way to ask the user
+ for more input before any other installer steps start.
+ """
+
+ # KDE requires a functioning Xorg installation.
+ profile = archinstall.Profile(None, 'wayland')
+ with profile.load_instructions(namespace='wayland.py') as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ print('Deprecated (??): wayland profile has no _prep_function() anymore')
+
+def _post_install(*args, **kwargs):
+ choice = input("Would you like to autostart sway on login [Y/n]: ")
+ if choice.lower == "y":
+ with open(f"{installation.mountpoint}/etc/profile", "a") as f:
+ x = """
+ if [ -z $DISPLAY ] && [ "$(tty)" == "/dev/tty1" ]; then
+ exec sway
+ fi
+ """
+ f.write(x)
+ f.close()
+ else:
+ installation.log("to start sway run the command sway")
+ installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and modify it")
+# Ensures that this code only gets executed if executed
+# through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py")
+# or through conventional import kde
+if __name__ == 'sway':
+ # Install dependency profiles
+ if _gfx_driver_packages == 'nvidia':
+ raise archinstall.lib.exceptions.HardwareIncompatibilityError("sway does not the prorpitery nvidia driver try using nouveau")
+ else:
+ installation.install_profile('wayland')
+
+ # Install the application kde from the template under /applications/
+ sway = archinstall.Application(installation, 'sway')
+ sway.install()