Compare commits
2 commits
bc6d6815b7
...
2aedbced66
Author | SHA1 | Date | |
---|---|---|---|
2aedbced66 | |||
7af9381e6e |
5 changed files with 51 additions and 1 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
pkg/
|
||||
src/
|
||||
sway-dynamic-*/
|
||||
sway-dynamic-*.pkg.tar.zst
|
17
PKGBUILD
Normal file
17
PKGBUILD
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Maintainer redxef <redxef@redxef.at>
|
||||
pkgname=sway-dynamic
|
||||
pkgver=1.0.1
|
||||
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"
|
||||
}
|
|
@ -1,3 +1,9 @@
|
|||
# sway-dynamic
|
||||
|
||||
Dynamically switch between sway and sway-nvidia based on active gpu.
|
||||
|
||||
## Usage
|
||||
|
||||
Blacklist the module which should not be loaded on boot, the script
|
||||
detects if the `nvidia` or `nouveau` driver is loaded and either calls
|
||||
`sway-nvidia` or `sway`.
|
||||
|
|
18
sway-dynamic
Executable file
18
sway-dynamic
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
active_module() {
|
||||
if [ -n "$(lsmod | grep "nvidia")" ]; then
|
||||
echo "nvidia"
|
||||
elif [ -n "$(lsmod | grep "nouveau")" ]; then
|
||||
echo nouveau
|
||||
else
|
||||
# no nvidia modules loaded
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$(active_module)" = 'nvidia' ]; then
|
||||
exec sway-nvidia
|
||||
else
|
||||
exec sway
|
||||
fi
|
5
sway-dynamic.desktop
Normal file
5
sway-dynamic.desktop
Normal 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
|
Loading…
Reference in a new issue