diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-06-16 09:12:14 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-06-16 09:12:14 -0300 |
commit | 3060d840da45d91ce717b5e6dcce070e08f42983 (patch) | |
tree | e81e7505b341a1b4e67855f89437a788568aa3a0 | |
parent | 64e83b8c52efff9969a6b3182203bd48bc7cb979 (diff) | |
download | wrappers-3060d840da45d91ce717b5e6dcce070e08f42983.tar.gz wrappers-3060d840da45d91ce717b5e6dcce070e08f42983.tar.bz2 |
Restore window name as mc forgets to do it
-rwxr-xr-x | mc | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -9,9 +9,26 @@ MC="/usr/bin/mc" INI="$HOME/.config/mc/ini" CONF="`readlink $INI || echo $INI`" +# Get the current window name +# Thanks http://www.shelldorado.com/scripts/cmds/xtitle +function mc_window_name { + if [ ! -z "$WINDOWID" ]; then + xprop -id $WINDOWID | grep ^WM_NAME | sed 's/.*=[ "]*\([^"]*\)["]*$/\1/' + fi +} + # Dispatch if [ ! -z "$DISPLAY" ]; then + WINDOWNAME="`mc_window_name`" TERM=xterm-256color $MC $* + NEWWINDOWNAME="`mc_window_name`" + + # Restore window name as mc forgets to do it + if [ "$WINDOWNAME" != "$NEWWINDOWNAME" ]; then + if echo $NEWWINDOWNAME | grep -q '^mc \['; then + xtitle $WINDOWNAME + fi + fi else $MC $* fi |