-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap-input.sh
More file actions
executable file
·25 lines (20 loc) · 1.14 KB
/
map-input.sh
File metadata and controls
executable file
·25 lines (20 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
function execute() {
#Detect the name of the display in use
local display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
#Detect the user using such display
local user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
#Detect the id of the user
local uid=$(id -u $user)
# sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
sudo -u kallefornia DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus "$@"
}
time="6"
popup_duration="$2"
#execute notify-send -t $popup_duration EVENT "map-input.sh started\nwaiting $time seconds..."
sleep $time
#execute notify-send -t $popup_duration USER-outside "running as $(whoami)"
#sudo -u kallefornia env -i DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /bin/bash -c "notify-send -t $popup_duration USER-inside \"running as \$(whoami)\""
sudo -u kallefornia env -i DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /bin/bash -c "xinput --map-to-output 10 LVDS-1"
execute notify-send -t $popup_duration Touch-Input "Touch input mapped to LVDS-1"
exit 0