Created
May 2, 2024 22:51
-
-
Save belkarx/bb46a0827b363823ea4b7c0e093f25c5 to your computer and use it in GitHub Desktop.
open note on beanote
This file contains hidden or 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
#!/bin/bash | |
### | |
# add an .xbindkeys entry like so: | |
# "sleep .1 && xdotool click 3 && sh /home/script_name.sh" | |
# alt+f | |
### | |
# Function to handle the key combination | |
function handle_key_combo { | |
# Simulate a right-click event | |
#xdotool click 3 | |
#xdotool click 3 | |
# Add a delay to wait for the menu to appear | |
sleep 0.1 | |
# Get the current mouse coordinates | |
coordinates=$(xdotool getmouselocation) | |
y=$(echo "$coordinates" | awk -F '[: ]' '{print $4}') | |
# Check the y-coordinate and move the mouse accordingly | |
if [ "$y" -lt 600 ]; then | |
# Move the mouse up by 400 pixels | |
xdotool mousemove_relative -- 0 370 | |
else | |
# Move the mouse down by 200 pixels | |
xdotool mousemove_relative -- 0 -200 | |
fi | |
# Add a small delay to allow the mouse movement to complete | |
sleep 0.1 | |
# Perform a mouse click | |
xdotool click 1 | |
# Add a small delay to allow the click to register | |
sleep 0.1 | |
} | |
# Run the key combination handler | |
handle_key_combo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment