diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/refreshbrowser | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/refreshbrowser')
| -rwxr-xr-x | debian/.local/bin/refreshbrowser | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/debian/.local/bin/refreshbrowser b/debian/.local/bin/refreshbrowser new file mode 100755 index 0000000..4b1812d --- /dev/null +++ b/debian/.local/bin/refreshbrowser @@ -0,0 +1,42 @@ +#!/bin/sh + +###################################################################### +# @author : Gavin Jaeger-Freeborn (gavinfreeborn@gmail.com) +# @file : test.sh +# @created : Wed 25 Mar 2020 05:49:29 PM +# +# @description : simple xdotool script used to reload browsers +###################################################################### + +browserclass="${BROWSER:-firefox}" + +#=== FUNCTION ====================================================== +# NAME: moveto +# DESCRIPTION: move to the center of the specified window id +#===================================================================== +moveto() { + geom=$(xdotool getwindowgeometry "${1}") + local=$(echo "${geom}" | awk NR==2 | cut -d: -f 2 | cut -d\( -f 1) + dimentions=$(echo "${geom}" | awk NR==3 | cut -d: -f 2 | cut -d\( -f 1 | cut -d, -f1) + x=$(echo "${local}" | cut -d, -f1) + y=$(echo "${local}" | cut -d, -f2) + w=$(echo "${dimentions}" | cut -dx -f1) + h=$(echo "${dimentions}" | cut -dx -f2) + + xdotool mousemove $((x + w / 2)) $((y + h / 2)) +} + +# Save the current window +cwid=$(xdotool getwindowfocus) +# Find the browser window +twid=$(xdotool search --onlyvisible --class "${browserclass}") +[ -z "${twid}" ] && notify-send 'failed to determine browser window' && exit +[ -z "${cwid}" ] && notify-send 'failed to determine current window' && exit + +moveto "${twid}" + +xdotool key F5 + +moveto "${cwid}" + +# vim: set tw=78 ts=2 et sw=2 sr: |
