Skip to content

Instantly share code, notes, and snippets.

@benkaiser
Created January 5, 2015 12:41
Show Gist options
  • Select an option

  • Save benkaiser/0da0a966b3d40cea5d09 to your computer and use it in GitHub Desktop.

Select an option

Save benkaiser/0da0a966b3d40cea5d09 to your computer and use it in GitHub Desktop.
shift a window to the side when focused. Good for keeping floating chat windows to the side of the screen in i3 (tiling window manager)
#!/bin/bash
name="Emily Brinsmead"
windowname=$(xdotool getactivewindow getwindowname)
width=$(xdotool search --name "Emily Brinsmead" getwindowgeometry --shell | grep "WIDTH=" | tr -cd "[:digit:]")-40;
#echo $windowname;
if [ "$windowname" == "$name" ]
then
echo "focus"
xdotool search --name "$name" windowmove --relative -- $((36-$width)) 'y'
else
echo "unfocus"
xdotool search --name "$name" windowmove --relative +$width 'y'
fi
@benkaiser

Copy link
Copy Markdown
Author

I use it with this command:

xdotool search "Emily" behave %@ focus exec "./windowmove.sh"

The window I am targeting has the text "Emily Brinsmead", change yours accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment