mirror of
https://github.com/wassname/thinkpad-x380-yoga-scripts.git
synced 2026-09-12 13:00:29 +08:00
Add the Arch package
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Maintainer: oggy <ognjen.maric@gmail.com>
|
||||
|
||||
pkgname=thinkpad-yoga-rotate
|
||||
pkgver=0.1
|
||||
pkgrel=1
|
||||
pkgdesc="A small Thinkpad Yoga utility to automatically rotate the screen in tablet mode"
|
||||
url="https://github.com/oggy-/thinkpad-yoga-rotate"
|
||||
license=('GPL-3')
|
||||
arch=('any')
|
||||
depends=('xorg-xrandr' 'acpid')
|
||||
source=('rotate-screen.sh' 'tablet-mode')
|
||||
sha1sums=('81eebe35cbfc61f17ecaef51506cadefc9412155'
|
||||
'adf3aa47174d32f23f4f52186bdc8de07a802ddc')
|
||||
|
||||
package() {
|
||||
# "Register" the tablet-mode event and set the handler
|
||||
mkdir -p "$pkgdir/etc/acpi/events"
|
||||
install -m 644 tablet-mode "$pkgdir/etc/acpi/events"
|
||||
|
||||
# Install the handler
|
||||
mkdir -p "$pkgdir/etc/acpi/actions"
|
||||
install -m 644 rotate-screen.sh "$pkgdir/etc/acpi/actions"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Note: xrandr needs to execute in the context of the X server
|
||||
|
||||
# Find the user running the X server
|
||||
user="$(who -u | grep -F '(:0)' | head -n 1 | awk '{print $1}')"
|
||||
|
||||
# A convenience function to run a command in the X server context
|
||||
with_display() { DISPLAY=:0.0 su -c "$(printf "%q " "$@")" "$user"; }
|
||||
|
||||
# As the same ACPI event is currently emitted for both going in and out
|
||||
# of the tablet mode, we need to toggle the orientation
|
||||
|
||||
# Figure out the current rotation:
|
||||
current=`with_display xrandr -q --verbose | grep eDP1 | cut -d " " -f5`
|
||||
|
||||
# Set the next orientation
|
||||
case $current in
|
||||
normal) next=left;;
|
||||
left) next=normal;;
|
||||
esac
|
||||
|
||||
with_display xrandr -o $next
|
||||
@@ -0,0 +1,2 @@
|
||||
event=ibm/hotkey LEN0068:00 00000080 000060c0
|
||||
action=/etc/acpi/actions/rotate-screen.sh
|
||||
Reference in New Issue
Block a user