Я пытался контролировать поведение Ubuntu 14.4.1 Launcher. Я хочу, чтобы он автоматически скрывался каждый раз, когда у меня появилось окно браузера, например firefox maxmaized. Я нашел это решение:
#!/bin/bash
## Change value of "hide" to the command which worked for you to hide the panel
hide='gsettings set com.canonical.Unity2d.Launcher hide-mode 1;'
## Change value of "show" to the command which worked for you to show the panel when it was hidden
show='gsettings set com.canonical.Unity2d.Launcher hide-mode 0;'
## Look for the grep value, add a new browser or application name followed by "\|" eg: 'firefox\|google\|chromium'
while [ 1 ]
do z=$(wmctrl -l -p | grep -i 'firefox\|google');
if [ -n "$z" ]; then
eval $hide
else
eval $show
fi;
sleep 2;
done;
, но кажется слишком старым, чтобы работать, тогда я нашел это
. Я попытался объединить два сценария вместе, вот что я сделал:
#!/bin/bash
AUTOHIDE=$(dconf read /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode)
if [[ $AUTOHIDE -eq 1 ]]
then
dconf write /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 0
else
dconf write /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 1
fi
## Look for the grep value, add a new browser or application name followed by "\|" eg: 'firefox\|google\|chromium'
while [ 1 ]
do z=$(wmctrl -l -p | grep -i 'firefox\|google');
if [ -n "$z" ]; then
eval $hide
else
eval $show
fi;
sleep 2;
done;
Но скрипт не работает. может ли кто-нибудь улучшить этот сценарий для меня и заставить его работать?
Здесь вы идете ребята. Протестировано на моем Ubuntu 14.04 с оригинальной средой Unity. Надеюсь, кто-то оценит мою маленькую работу ...
Подходит для одного окна браузера
#!/bin/bash
## Tested with Ubuntu 14.04 Unity
## Auto hide Unity Launcher when web browser is maximized
## wmctrl is required: sudo apt-get install wmctrl
## ~pba
## Change value of "key" to the command which worked for you
key='gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-hide-mode';
while [ 1 ];
do
p=$(wmctrl -lG);
a=($(echo -E "$p" | grep -i "unity-launcher"));
w=($(echo -E "$p" | grep -i "firefox\|google\|chromium\|opera"));
if [ ${w[0]} ]; then
e=$(xwininfo -all -id ${w[0]});
l=( $(echo -E "$e" | grep -ci ' Hidden')
$(echo -E "$e" | grep -ci ' Maximized Vert')
$(echo -E "$e" | grep -ci ' Maximized Horz') );
b=($(echo -E "$p" | grep -i "unity-panel"));
if [ ${l[0]} -ne "1" -a ${l[1]} -eq "1" -a ${l[2]} -eq "1" -a ${w[2]} -eq ${a[4]} -a ${w[3]} -eq ${b[5]} ]; then
eval "$key 1";
elif [ ${l[0]} -ne "1" -a ${l[1]} -ne "1" -a ${l[2]} -ne "1" -a ${a[3]} -lt "0" ]; then
eval "$key 0";
elif [ ${l[0]} -eq "1" -a ${a[3]} -lt "0" -a ${w[2]} -ne "1" ]; then
eval "$key 0";
elif [ ${l[0]} -ne "1" -a ${l[1]} -eq "1" -a ${l[2]} -eq "1" -a ${a[3]} -lt "0" -a ${w[2]} -ne "0" ]; then
eval "$key 0";
elif [ ${l[0]} -ne "1" -a ${l[1]} -eq "1" -a ${l[2]} -eq "1" -a ${a[3]} -lt "0" -a ${w[3]} -ne ${b[5]} -a ${w[3]} -ne "0" ]; then
eval "$key 0";
fi;
elif [ ${a[3]} -lt "0" ]; then eval "$key 0";
fi;
sleep 2;
done;
Старые сценарии