Skip to content

Instantly share code, notes, and snippets.

@whoizit
Last active March 24, 2019 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whoizit/ee6fe17673bae63f17cbdca5c611e9c0 to your computer and use it in GitHub Desktop.
Save whoizit/ee6fe17673bae63f17cbdca5c611e9c0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# https://github.com/mpv-player/mpv/issues/351
# set this option in config:
# title=mpv351: ${filename}
# requirements:
# https://github.com/baskerville/xtitle
# https://github.com/ierton/xkb-switch
prev_title=0
while read -r x; do
case "$x" in
*mpv351*)
prev_title=mpv
saved_layout=$(xkb-switch)
xkb-switch -s us
;;
*)
[ "$prev_title" == "mpv" ] && xkb-switch -s $saved_layout
prev_title="$x"
;;
esac
done < <(xtitle -s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment