-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
[Unit] | ||
Description=Asus Touchpad to Numpad Handler for %i | ||
After=display-manager.service | ||
|
||
[Service] | ||
User=%i | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=Asus Touchpad to Numpad Handler for %i | ||
|
||
[Service] | ||
User=%i | ||
Type=idle | ||
ExecStart=/usr/bin/env python3 /usr/share/asus_touchpad_numpad-driver/asus_touchpad.py $LAYOUT $CONFIG_FILE_DIR | ||
StandardInput=tty-force | ||
StandardOutput=append:/var/log/asus_touchpad_numpad-driver/error.log | ||
StandardError=append:/var/log/asus_touchpad_numpad-driver/error.log | ||
TimeoutSec=5 | ||
Restart=on-failure | ||
Environment="DISPLAY=$XDISPLAY" | ||
Environment="XAUTHORITY=$XAUTHORITY" | ||
Environment="DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" | ||
Environment="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,17 +224,42 @@ if [ "$wayland_or_x11" = "x11" ]; then | |
|
||
xauthority=$(/usr/bin/xauth info | grep Authority | awk '{print $3}') | ||
xdisplay=$(echo $DISPLAY) | ||
|
||
echo "DISPLAY: $xdisplay" | ||
echo "AUTHORITY: $xauthority" | ||
cat asus_touchpad.X11.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model XDISPLAY=$xdisplay XAUTHORITY=$xauthority envsubst '$LAYOUT $XAUTHORITY $XDISPLAY $CONFIG_FILE_DIR' > /etc/systemd/system/[email protected] | ||
|
||
if [ "$1" = "--user" ]; then | ||
|
||
uid=$(id -u $RUN_UNDER_USER) | ||
xdg_runtime_dir="/run/user/$uid" | ||
dbus_session_bus_address="unix:path=$xdg_runtime_dir/bus" | ||
|
||
echo "UID: $uid" | ||
echo "XDG_RUNTIME_DIR: $xdg_runtime_dir" | ||
echo "DBUS_SESSION_BUS_ADDRESS: $dbus_session_bus_address" | ||
|
||
cat asus_touchpad.X11.user.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model XDISPLAY=$xdisplay XAUTHORITY=$xauthority XDG_RUNTIME_DIR=$xdg_runtime_dir DBUS_SESSION_BUS_ADDRESS=$dbus_session_bus_address envsubst '$LAYOUT $XAUTHORITY $XDISPLAY $CONFIG_FILE_DIR $XDG_RUNTIME_DIR $DBUS_SESSION_BUS_ADDRESS' > /usr/lib/systemd/[email protected] | ||
cat asus_touchpad.X11.user.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model XDISPLAY=$xdisplay XAUTHORITY=$xauthority XDG_RUNTIME_DIR=$xdg_runtime_dir DBUS_SESSION_BUS_ADDRESS=$dbus_session_bus_address envsubst '$LAYOUT $XAUTHORITY $XDISPLAY $CONFIG_FILE_DIR $XDG_RUNTIME_DIR $DBUS_SESSION_BUS_ADDRESS' > /etc/systemd/system/[email protected] | ||
cat asus_touchpad.X11.user.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model XDISPLAY=$xdisplay XAUTHORITY=$xauthority XDG_RUNTIME_DIR=$xdg_runtime_dir DBUS_SESSION_BUS_ADDRESS=$dbus_session_bus_address envsubst '$LAYOUT $XAUTHORITY $XDISPLAY $CONFIG_FILE_DIR $XDG_RUNTIME_DIR $DBUS_SESSION_BUS_ADDRESS' > /etc/systemd/user/[email protected] | ||
else | ||
cat asus_touchpad.X11.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model XDISPLAY=$xdisplay XAUTHORITY=$xauthority envsubst '$LAYOUT $XAUTHORITY $XDISPLAY $CONFIG_FILE_DIR' > /etc/systemd/system/[email protected] | ||
fi | ||
elif [ "$wayland_or_x11" = "wayland" ]; then | ||
echo "Wayland is detected, unfortunatelly you will not be able use feature: Disabling Touchpad (e.g. Fn+special key) disables NumberPad aswell, at this moment is supported only X11" | ||
|
||
cat asus_touchpad.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model envsubst '$LAYOUT $CONFIG_FILE_DIR' > /etc/systemd/system/[email protected] | ||
if [ "$1" = "--user" ]; then | ||
cat asus_touchpad.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model envsubst '$LAYOUT $CONFIG_FILE_DIR' > /etc/systemd/user/[email protected] | ||
else | ||
cat asus_touchpad.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model envsubst '$LAYOUT $CONFIG_FILE_DIR' > /etc/systemd/system/[email protected] | ||
fi | ||
else | ||
echo "Wayland or X11 is not detected" | ||
|
||
cat asus_touchpad.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model envsubst '$LAYOUT $CONFIG_FILE_DIR' > /etc/systemd/system/[email protected] | ||
if [ "$1" = "--user" ]; then | ||
cat asus_touchpad.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model envsubst '$LAYOUT $CONFIG_FILE_DIR' > /etc/systemd/user/[email protected] | ||
else | ||
cat asus_touchpad.service | CONFIG_FILE_DIR="$CONFIG_FILE_DIR/" LAYOUT=$model envsubst '$LAYOUT $CONFIG_FILE_DIR' > /etc/systemd/system/[email protected] | ||
fi | ||
fi | ||
|
||
|
||
|
@@ -394,7 +419,11 @@ else | |
echo "Automatic installing of toggling script for XF86Calculator key failed. Please create an issue (https://github.com/asus-linux-drivers/asus-numberpad-driver/issues)." | ||
fi | ||
|
||
systemctl daemon-reload | ||
if [ "$1" = "--user" ]; then | ||
systemctl --user daemon-reload | ||
else | ||
systemctl daemon-reload | ||
fi | ||
|
||
if [[ $? != 0 ]]; then | ||
echo "Something went wrong when was called systemctl daemon reload" | ||
|
@@ -405,7 +434,19 @@ fi | |
|
||
read -r -p "Do you want start the driver automatically at boot using systemd service? [y/N] (result might be black screen which will prevent login, systemd service is not designed to be started at boot with using X11, is recommended start driver on every startup by other way)" response | ||
case "$response" in [yY][eE][sS]|[yY]) | ||
systemctl enable asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
|
||
if [ "$1" = "--user" ]; then | ||
# --user search /etc/systemd/user/ | ||
|
||
# systemctl enable --user [email protected] | ||
# Created symlink /home/ldrahnik/.config/systemd/user/default.target.wants/[email protected] → /etc/xdg/systemd/user/[email protected]. | ||
|
||
systemctl enable --user asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
else | ||
# --global search /etc/systemd/system/ | ||
systemctl enable --global asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
fi | ||
|
||
if [[ $? != 0 ]]; then | ||
echo "Something went wrong when enabling the asus_touchpad_numpad.service" | ||
exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,22 +24,44 @@ echo $RUN_UNDER_USER | |
|
||
source remove_previous_implementation_of_service.sh | ||
|
||
systemctl stop asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
if [[ $? != 0 ]] | ||
if [ "$1" = "--user" ] | ||
then | ||
echo "asus_touchpad_numpad.service cannot be stopped correctly..." | ||
fi | ||
|
||
systemctl disable asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
if [[ $? != 0 ]] | ||
then | ||
echo "asus_touchpad_numpad.service cannot be disabled correctly..." | ||
fi | ||
systemctl --user stop asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
if [[ $? != 0 ]] | ||
then | ||
echo "asus_touchpad_numpad.service cannot be stopped correctly..." | ||
fi | ||
|
||
rm -f /etc/systemd/system/[email protected] | ||
if [[ $? != 0 ]] | ||
then | ||
echo "/etc/systemd/system/asus_touchpad_numpad.service cannot be removed correctly..." | ||
systemctl --user disable asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
if [[ $? != 0 ]] | ||
then | ||
echo "asus_touchpad_numpad.service cannot be disabled correctly..." | ||
fi | ||
|
||
rm -f /etc/systemd/user/[email protected] | ||
if [[ $? != 0 ]] | ||
then | ||
echo "/etc/systemd/user/asus_touchpad_numpad.service cannot be removed correctly..." | ||
fi | ||
else | ||
systemctl --global stop asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
if [[ $? != 0 ]] | ||
then | ||
echo "asus_touchpad_numpad.service cannot be stopped correctly..." | ||
fi | ||
|
||
systemctl --global disable asus_touchpad_numpad@$RUN_UNDER_USER.service | ||
if [[ $? != 0 ]] | ||
then | ||
echo "asus_touchpad_numpad.service cannot be disabled correctly..." | ||
fi | ||
|
||
rm -f /etc/systemd/system/[email protected] | ||
if [[ $? != 0 ]] | ||
then | ||
echo "/etc/systemd/system/asus_touchpad_numpad.service cannot be removed correctly..." | ||
fi | ||
fi | ||
|
||
|
||
|
@@ -136,7 +158,11 @@ then | |
echo "/usr/lib/udev/rules.d/90-numberpad-external-keyboard.rules cannot be removed correctly..." | ||
fi | ||
|
||
systemctl daemon-reload | ||
if [ "$1" = "--user" ]; then | ||
systemctl --user daemon-reload | ||
else | ||
systemctl --global daemon-reload | ||
fi | ||
|
||
if [[ $? != 0 ]]; then | ||
echo "Something went wrong when was called systemctl daemon reload" | ||
|