mirror of
https://github.com/wassname/thinkpad-x380-yoga-scripts.git
synced 2026-09-11 12:51:55 +08:00
Renaming files and reshuffling
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
# Maintainer: oggy <ognjen.maric@gmail.com>
|
||||
|
||||
pkgname=thinkpad-yoga-rotate
|
||||
pkgver=0.3
|
||||
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')
|
||||
install=$pkgname.install
|
||||
|
||||
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 755 rotate-screen.sh "$pkgdir/etc/acpi/actions"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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 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 | grep -o -E 'left|normal' | head -1`
|
||||
|
||||
|
||||
# Set the next orientation
|
||||
case $current in
|
||||
normal) next=left;;
|
||||
left) next=normal;;
|
||||
esac
|
||||
|
||||
with_display xrandr -o $next
|
||||
@@ -1,2 +0,0 @@
|
||||
event=ibm/hotkey LEN0068:00 00000080 000060c0
|
||||
action=/etc/acpi/actions/rotate-screen.sh
|
||||
@@ -1,11 +0,0 @@
|
||||
_note_restart_acpi(){
|
||||
echo "You need to restart acpid now"
|
||||
}
|
||||
|
||||
post_install(){
|
||||
_note_restart_acpi
|
||||
}
|
||||
|
||||
post_upgrade(){
|
||||
_note_restart_acpi
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
# Maintainer: oggy <ognjen.maric@gmail.com>
|
||||
|
||||
pkgname=thinkpad-yoga-rotate
|
||||
pkgver=0.3
|
||||
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')
|
||||
install=$pkgname.install
|
||||
|
||||
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 755 rotate-screen.sh "$pkgdir/etc/acpi/actions"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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 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 | grep -o -E 'left|normal' | head -1`
|
||||
|
||||
|
||||
# Set the next orientation
|
||||
case $current in
|
||||
normal) next=left;;
|
||||
left) next=normal;;
|
||||
esac
|
||||
|
||||
with_display xrandr -o $next
|
||||
@@ -1,11 +0,0 @@
|
||||
_note_restart_acpi(){
|
||||
echo "You need to restart acpid now"
|
||||
}
|
||||
|
||||
post_install(){
|
||||
_note_restart_acpi
|
||||
}
|
||||
|
||||
post_upgrade(){
|
||||
_note_restart_acpi
|
||||
}
|
||||
Reference in New Issue
Block a user