我可以仅在浏览器运行时隐藏启动器吗?

我只想在谷歌浏览器运行时隐藏启动器。 我怎样才能做到这一点?

首先,知道哪个命令可以隐藏/显示面板是非常重要的,因为Ubuntu版本之间的命令不同。 逐个执行这些命令并记下隐藏面板的命令:

我正在使用带有Unity 2D的Ubuntu 12.04,这些对我有用

# hide gsettings set com.canonical.Unity2d.Launcher hide-mode 1 # show gsettings set com.canonical.Unity2d.Launcher hide-mode 0 

对于Ubuntu 12.10 (也请查看此问题 ):

 # hide gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-hide-mode 1 # show gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-hide-mode 0 

` 如果上面不起作用,可能还有其他人 (也请查看这个问题 )

 # hide gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 1 # show gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 0 

现在按照以下简单步骤:

  1. 安装wmctrl包:

     sudo apt-get install wmctrl 
  2. 制作一个脚本文件。 将以下内容粘贴到文件中并为文件指定任何名称,例如autohide

     #!/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; 
  3. 使文件可执行:

     chmod +x autohide 
  4. 执行文件:

     ./autohide 

而已。 现在,无论何时打开firefox或chrome,都会隐藏面板,当您关闭时,面板将会显示。

您还可以在每次启动系统时执行此脚本。

  • 看到这个问题: 如何在登录时自动启动应用程序?

有可能的:

虽然这可能不是一个完美的方式,但它应该工作:

这是可以更改团结启动器设置的命令:

gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 2

最后2个来自这里:

模式编号:

  • 0 – 从不
  • 1 – 自动隐藏
  • 2 – 道奇Windows
  • 3 – 道奇活动窗口

所以现在转到/usr/bin

您需要编辑google-chrome可执行文件:

sudo emacs /usr/bin/google-chrome

在开始时添加以下行:

gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 1

因此,无论何时启动google-chrome,都会执行此行并且您的启动器将进入自动隐藏模式

我不知道当google-chrom退出时是否执行了任何脚本..因此您可能需要使用以下行手动重置更改:

gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 0

希望这可以帮助!