Initial implementation.

This commit is contained in:
redxef 2024-04-15 17:31:37 +02:00
parent bc6d6815b7
commit 7af9381e6e
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921
4 changed files with 41 additions and 1 deletions

17
PKGBUILD Normal file
View file

@ -0,0 +1,17 @@
# Maintainer redxef <redxef@redxef.at>
pkgname=sway-dynamic
pkgver=1.0.0
pkgrel=1
pkgdesc="Helper files to dynamically launch sway for NVIDIA comaptibility or not"
arch=('any')
url="https://gitea.redxef.at/redxef/sway-dynamic"
license=('MIT')
depends=('sway' 'sway-nvidia')
source=("$pkgname-$pkgver::git+$url.git#tag=v$pkgver")
sha256sums=('SKIP')
package() {
cd "$pkgname-$pkgver"
install -Dm755 sway-dynamic "$pkgdir/usr/bin/sway-dynamic"
install -Dm644 sway-dynamic.desktop "$pkgdir/usr/share/wayland-sessions/sway-dynamic.desktop"
}

View file

@ -1,3 +1,14 @@
# sway-dynamic
Dynamically switch between sway and sway-nvidia based on active gpu.
## Usage
When booting a GPU set the environment variable `GPUMODE=<driver>` with something
like `systemd.setenv=GPUMODE=<driver>`. The script will decide how to
launch sway depending on this variable. Possible values:
- `nvidia`
- `nouveau`

7
sway-dynamic Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
if [ "$GPUMODE" = 'nvidia' ]; then
exec sway-nvidia
else
exec sway
fi

5
sway-dynamic.desktop Normal file
View file

@ -0,0 +1,5 @@
[Desktop Entry]
Name=Sway (Dynamic)
Comment=An i3-compatible Wayland compositor (NVIDIA Fixes or Standard)
Exec=sway-dynamic
Type=Application