New: ydotool automation support

This commit is contained in:
Akemi Izuko 2023-01-14 21:50:07 -07:00
parent aa796e7523
commit 4add7c2701
No known key found for this signature in database
GPG key ID: 905D444F6A5E4BE4
6 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
sleep .1 # Wait for ydotool's virtual device to start
sudo /usr/bin/ydotool mousemove --absolute 310 450
sudo /usr/bin/ydotool click 0xC0
sudo /usr/bin/ydotool mousemove -- 20 -40
sudo /usr/bin/ydotool click 0xC0
sleep .2 # Takes a bit to pull up window
sudo /usr/bin/ydotool mousemove --absolute 110 150
sudo /usr/bin/ydotool click 0xC0
sudo /usr/bin/ydotool mousemove --absolute 210 120
sudo /usr/bin/ydotool click -r 2 -d 100 0xC0

View file

@ -44,6 +44,7 @@ declare -r \
'viu' 'viu'
'wl-clipboard' 'wl-paste'
'wtype' 'wtype'
'ydotool' 'ydotool'
'zathura-pdf-mupdf' 'zathura'
'zathura' 'zathura'
) \

View file

@ -146,6 +146,7 @@ xremap_checks() {
check_xremap_executable
check_xremap_systemd
check_xremap_sudoer
check_ydotool_sudoer
}
check_xremap_config() {
@ -213,7 +214,19 @@ check_xremap_sudoer() {
if ! sudo -l | grep -Eq 'NOPASSWD:[[:space:]]+/usr/bin/systemctl restart xremap.service'; then
printf "ERR: xremap.service not passwordless for sudoers\n"
printf "\t $ please bash -c 'echo \"%s\" >> /etc/sudoers.d/xremap'\n" '%wheel ALL=NOPASSWD: /usr/bin/systemctl restart xremap.service'
printf '\t $ please bash -c "cp $HOME/.configs_pointer/sudoers.d/xremap /etc/sudoers.d/xremap"\n'
return_code=1
fi
return $return_code
}
check_ydotool_sudoer() {
local return_code=0
if ! sudo -l | grep -Eq 'NOPASSWD:[[:space:]]+/usr/bin/ydotool \*'; then
printf "ERR: ydotool not passwordless for sudoers\n"
printf '\t $ please bash -c "cp $HOME/.configs_pointer/sudoers.d/ydotool /etc/sudoers.d/ydotool"\n'
return_code=1
fi

1
sudoers.d/xremap Normal file
View file

@ -0,0 +1 @@
%wheel ALL=NOPASSWD: /usr/bin/systemctl restart xremap.service

1
sudoers.d/ydotool Normal file
View file

@ -0,0 +1 @@
%wheel ALL=NOPASSWD: /usr/bin/ydotool *

View file

@ -100,6 +100,11 @@ bindsym $mod2+tab exec ~/.config/sway/cycle_windows.py previous
# Important rust jerk
bindsym $mod1+ctrl+r exec wtype "asExpectedOfRust"
# Automatic upload image to discord
bindsym $mod1+ctrl+u exec sudo -u emiliko ~/.configs_pointer/bin/auto_image_upload_discord.sh
# Paste by typing
bindsym Mod4+Ctrl+v exec ~/.configs_pointer/bin/wpastetype.py
# rEsize containers ====
bindsym $mod1+e mode "resize"