diff options
author | Triss Healy | 2022-08-22 15:19:42 +1000 |
---|---|---|
committer | Triss Healy | 2022-08-22 15:19:42 +1000 |
commit | 6e1ed103c33b6c20b17132c00daf245defdf3f90 (patch) | |
tree | fbbf8cc2b4f658845c34525ebb55df1f46ffb125 | |
download | aur-6e1ed103c33b6c20b17132c00daf245defdf3f90.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | 45-display-switch.rules | 2 | ||||
-rwxr-xr-x | PKGBUILD | 66 | ||||
-rw-r--r-- | display-switch.ini | 41 | ||||
-rw-r--r-- | display-switch.service | 26 | ||||
-rw-r--r-- | display-switch.sysusers | 1 |
6 files changed, 148 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..ee5e6f62ecfd --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,12 @@ +pkgbase = display_switch + pkgdesc = Turn a 0 USB switch into a full-featured multi-monitor KVM switch + pkgver = 1.2.0 + pkgrel = 1 + url = https://github.com/haimgel/display-switch + arch = x86_64 + license = MIT + makedepends = cargo + source = display-switch-1.2.0.tar.gz::https://codeload.github.com/haimgel/display-switch/tar.gz/refs/tags/1.2.0 + sha256sums = 28e3d9791d39f655c337de19063ea8b19f5c3a0784fa84a222abdf63a33823af + +pkgname = display_switch diff --git a/45-display-switch.rules b/45-display-switch.rules new file mode 100644 index 000000000000..fd66f425ec94 --- /dev/null +++ b/45-display-switch.rules @@ -0,0 +1,2 @@ +# Assigns the i2c devices to group i2c, and gives that group RW access: +KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660" diff --git a/PKGBUILD b/PKGBUILD new file mode 100755 index 000000000000..41f8abf3804b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,66 @@ +# Maintainer: Triss Healy <th+aur@trissyle.gs> +pkgname=display-switch +_cratename=${pkgname/_/-} +pkgver=1.2.0 +pkgrel=1 +pkgdesc="Turn a $30 USB switch into a full-featured multi-monitor KVM switch" +arch=(x86_64) +url="https://github.com/haimgel/display-switch" +license=('MIT') +groups=() +depends=(libusb) +makedepends=(cargo) +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +source=("$pkgname-$pkgver.tar.gz::https://codeload.github.com/haimgel/display-switch/tar.gz/refs/tags/$pkgver" + "$pkgname.sysusers" + "45-$pkgname.rules" + "$pkgname.service" + "display-switch.ini") + + +noextract=() +sha256sums=('28e3d9791d39f655c337de19063ea8b19f5c3a0784fa84a222abdf63a33823af' + 'bf5ee4f9876505628c5ce84e84e918c70d66be70b766d62bb138e294608ffbae' + 'af9dbdc771023cd04f5b0c638c30356e6a824b32f0c04ea61fe929c71122bccd' + '9ba8def93e8fff1aff7f463809633bfbac27e351f2768503fcbbb09fdfaa6167' + '1ff20643b8b6b1590bcfda26cb2f5323b791040cb164f5b44c944ed9e9b613bc') + +prepare() { + cd "$pkgname-$pkgver" + # This file sets the expected toolchain. When compiling with + # rustup this will download that specific version. When + # building a arch package we really want to use the user + # installed rust version though. + rm rust-toolchain + cargo fetch --locked --target "$CARCH-unknown-linux-gnu" +} + +build() { + cd "$pkgname-$pkgver" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --frozen --release --all-features +} + +check() { + cd "$pkgname-$pkgver" + export RUSTUP_TOOLCHAIN=stable + cargo test --frozen --all-features +} + +package() { + cd "$pkgname-$pkgver" + install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/display_switch" + install -Dm644 "$srcdir/display-switch.ini" "$pkgdir/etc/display-switch/display-switch.ini" + install -Dm644 "$srcdir/$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" + install -Dm644 "$srcdir/45-$pkgname.rules" "$pkgdir/usr/lib/udev/rules.d/45-$pkgname.rules" + install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service" +} diff --git a/display-switch.ini b/display-switch.ini new file mode 100644 index 000000000000..c8d79f505d98 --- /dev/null +++ b/display-switch.ini @@ -0,0 +1,41 @@ +## Example config you'll need to fill these in for display_switch to work. + +## USB device to watch for to trigger screen change +## Run lsusb to get a list of devices currently connected including their vendor:device id's. +## +# usb_device = "xxxx:xxxx" + +## Specify which input to switch for _all_ DDC monitors. +## Valid values are: +## - DisplayPort1 +## - DisplayPort2 +## - Hdmi1 +## - Hdmi2 +## - Dvi1 +## - Dvi2 +## - Vga1 +# on_usb_connect = "Hdmi1" +# on_usb_disconnect = "Hdmi2" + +## Commands to run when display connects/disconnects +# on_usb_connect_execute = "echo connected" +# on_usb_disconnect_execute = "echo disconnected" + +## Specify display specific configution. +## +## monitor_id is a case-insensitive string to search for within the monitor ID. +## +## Finding the monitor id is a bit of chore (as it depends on what +## graphics driver you are using). When display_switch starts it'll +## log all the monitors it can use including the full name of the +## display that monitor_id is matched against. +## +## eg: 03:37:04 [INFO] Display 'AUS ROG XG27UQ L3LMQS072264' is currently set to DisplayPort1(0xf) +## +## hwinfo (avaliable in community/hwinfo) will show the monitor Vendor and Name. + +# [monitor1] +# monitor_id = "aus" # 'AUS' is ASUS's vendor string. +# on_usb_connect = "DisplayPort1" +# on_usb_disconnect = "DisplayPort2" + diff --git a/display-switch.service b/display-switch.service new file mode 100644 index 000000000000..1ac642dfbf16 --- /dev/null +++ b/display-switch.service @@ -0,0 +1,26 @@ +[Unit] +Description=display-switch automatic DDC display switcher +After=graphical.target + +[Service] +Type=simple +StandardOutput=journal +Restart=always + +DynamicUser=yes +SupplementaryGroups=i2c + +LogsDirectory=display-switch +StateDirectory=display-switch + +# There's a lot of finagling to get display_switch to put the files in a normal place. +Environment=HOME=/var/lib/display-switch + +ExecStartPre=mkdir -p /var/lib/display-switch/.config/display-switch +ExecStartPre=ln -sf /etc/display-switch/display-switch.ini /var/lib/display-switch/.config/display-switch +ExecStartPre=mkdir -p /var/lib/display-switch/.local/share/ +ExecStartPre=ln -sf /var/log/display-switch /var/lib/display-switch/.local/share/display-switch +ExecStart=/usr/bin/display_switch + +[Install] +WantedBy=multi-user.target diff --git a/display-switch.sysusers b/display-switch.sysusers new file mode 100644 index 000000000000..ddd5718088b3 --- /dev/null +++ b/display-switch.sysusers @@ -0,0 +1 @@ +g i2c - - |