Hotcorners for the poor
Posted: 09 Feb 2025, 20:02
A minimal script to launch actions depending on the mouse position (corners). Works for me in XFCE4 (4.20)
Code: Select all
#!/bin/bash
# nohup hotcorners >/dev/null 2>&1 &
# xdotool based script to fire up different actions
# M. Eerie @ forum.porteus.org
# 8-Feb-2025
read screen_width screen_height < <(xrandr --current | awk '/\*/ {split($1, res, "x"); print res[1], res[2]}') # Get screen dimensions
threshold=10 # Define corners threshold in pixels. Adjust as necessary
while true; do
eval $(xdotool getmouselocation --shell) # Get mouse position
# Check corners / Do actions
if [ $X -le $threshold ] && [ $Y -le $threshold ]; then
xdotool key super+space && sleep 1 # Combo to show hud ### TOP LEFT CORNER
elif [ $X -ge $((screen_width - threshold)) ] && [ $Y -le $threshold ]; then ### TOP RIGHT CORNER
xdotool exec xfce4-terminal --drop-down && sleep 1 # "Guake" terminal
elif [ $X -le $threshold ] && [ $Y -ge $((screen_height - threshold)) ]; then ### BOTTOM LEFT CORNER
xdotool key super+l && sleep 1 # Lock Screen
elif [ $X -ge $((screen_width - threshold)) ] && [ $Y -ge $((screen_height - threshold)) ]; then ### BOTTOM RIGHT CORNER
xdotool key super+d && sleep 1 # Show Desktop
fi
sleep 0.2 # Wait for it
done