feat(ags): implement tablet service in bar
This commit is contained in:
parent
97239557f7
commit
fcdd6fc414
5 changed files with 8 additions and 99 deletions
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
tablet() {
|
||||
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
|
||||
|
||||
brightnessctl -d tpacpi::kbd_backlight s 0
|
||||
|
||||
"$HYPR_PATH"/autorotate.sh &
|
||||
|
||||
evtest --grab "/dev/input/by-path/platform-i8042-serio-0-event-kbd" &
|
||||
evtest --grab "/dev/input/by-path/platform-i8042-serio-1-event-mouse" &
|
||||
evtest --grab "/dev/input/by-path/platform-AMDI0010:02-event-mouse" &
|
||||
evtest --grab "/dev/input/by-path/platform-thinkpad_acpi-event" &
|
||||
evtest --grab "/dev/video-bus" &
|
||||
evtest --grab "/dev/touchpad" &
|
||||
}
|
||||
|
||||
laptop() {
|
||||
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false
|
||||
|
||||
brightnessctl -d tpacpi::kbd_backlight s 2
|
||||
|
||||
killall -r autorotate.sh
|
||||
killall -r evtest
|
||||
}
|
||||
|
||||
toggle () {
|
||||
if [[ "$(gsettings get org.gnome.desktop.a11y.applications screen-keyboard-enabled)" == "false" ]]; then
|
||||
echo "Tablet"
|
||||
tablet > /dev/null
|
||||
else
|
||||
echo "Laptop"
|
||||
laptop > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
[[ $1 == "toggle" ]] && toggle
|
||||
[[ $1 == "laptop" ]] && laptop
|
||||
[[ $1 == "tablet" ]] && tablet
|
|
@ -1,17 +1,16 @@
|
|||
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import { subprocess } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
|
||||
import EventBox from '../misc/cursorbox.js';
|
||||
|
||||
|
||||
export default () => EventBox({
|
||||
className: 'toggle-off',
|
||||
onPrimaryClickRelease: self => {
|
||||
subprocess(
|
||||
['bash', '-c', '$AGS_PATH/tablet-toggle.sh toggle'],
|
||||
output => self.toggleClassName('toggle-on', output == 'Tablet'),
|
||||
);
|
||||
},
|
||||
onPrimaryClickRelease: () => Tablet.toggleMode(),
|
||||
|
||||
connections: [[Tablet, self => {
|
||||
self.toggleClassName('toggle-on', Tablet.tabletMode);
|
||||
}, 'mode-toggled']],
|
||||
|
||||
child: Box({
|
||||
className: 'tablet-toggle',
|
||||
vertical: false,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
$AGS_PATH/tablet-toggle.sh laptop &
|
||||
ags -r 'Tablet.setLaptopMode()'
|
||||
$LOCK_PATH/blur.sh
|
||||
gtklock
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script was forked from https://gitlab.com/snippets/1793649 by Fishonadish
|
||||
|
||||
|
||||
SCREEN="eDP-1"
|
||||
WAYLANDINPUT=("wacom-hid-52eb-finger"
|
||||
"wacom-hid-52eb-pen")
|
||||
|
||||
|
||||
|
||||
function rotate_ms {
|
||||
if [[ $(hyprctl activewindow | grep Waydroid) == "" ]]; then
|
||||
case $1 in
|
||||
"normal")
|
||||
rotate 0
|
||||
;;
|
||||
"right-up")
|
||||
rotate 3
|
||||
;;
|
||||
"bottom-up")
|
||||
rotate 2
|
||||
;;
|
||||
"left-up")
|
||||
rotate 1
|
||||
;;
|
||||
esac
|
||||
elif [[ $(hyprctl monitors | grep "transform: 0") == "" ]]; then
|
||||
rotate 0
|
||||
fi
|
||||
}
|
||||
|
||||
function rotate {
|
||||
TARGET_ORIENTATION=$1
|
||||
|
||||
echo "Rotating to" $TARGET_ORIENTATION
|
||||
|
||||
hyprctl keyword monitor $SCREEN,transform,$TARGET_ORIENTATION
|
||||
|
||||
for i in "${WAYLANDINPUT[@]}"
|
||||
do
|
||||
hyprctl keyword device:"$i":transform $TARGET_ORIENTATION
|
||||
done
|
||||
|
||||
$HYPR_PATH/lisgd.sh &
|
||||
}
|
||||
|
||||
while IFS='$\n' read -r line; do
|
||||
rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")"
|
||||
[[ ! -z $rotation ]] && rotate_ms $rotation
|
||||
done < <(stdbuf -oL monitor-sensor)
|
Loading…
Reference in a new issue