Skip to content

Instantly share code, notes, and snippets.

@whoizit
Last active March 24, 2019 04:33
Show Gist options
  • 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