Skip to content

Instantly share code, notes, and snippets.

@jparrill
Created June 28, 2018 10:23
Show Gist options
  • Select an option

  • Save jparrill/e8e76c8620dcd60be8b5a47a5c3b5ee3 to your computer and use it in GitHub Desktop.

Select an option

Save jparrill/e8e76c8620dcd60be8b5a47a5c3b5ee3 to your computer and use it in GitHub Desktop.
Rename i3wm shell tile
#!/usr/bin/env bash
# Depends on: xdotool, wmctrl
FOCUSED=$(wmctrl -lp | grep $(xprop -root | grep _NET_ACTIVE_WINDOW | head -1 | awk '{print $5}' | sed 's/,//' | sed 's/^0x/0x0/'))
if [[ -z $FOCUSED ]]; then
FOCUSED=$(wmctrl -lp | grep $(xprop -root | grep _NET_ACTIVE_WINDOW | head -1 | awk '{print $5}' | sed 's/,//' | sed 's/^0x/0x00/'))
fi
FPID=$(echo $FOCUSED | awk '{print $3}')
FNME=$(echo $FOCUSED | cut -f -4 -d ' ' --complement)
xdotool search -all --pid $FPID --name "$FNME" set_window -name "$*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment