重新启动后“切换到特定工作区”快捷方式不起作用

BiA*_*AiB 2 shortcut-keys compiz

我定义了一些快捷方式来访问我的每个工作区:

<Super>+1 for the First
<Super>+2 for the Second
etc...
Run Code Online (Sandbox Code Playgroud)

当我分配这些快捷方式时,它们会正常运行,直到我重新启动。我不知道为什么会这样。

出于某种原因,在我工作的桌面上(相同的发行版,10.10),它工作正常。

为了使它们再次起作用,我需要取消所有它们的分配,然后再次重新分配它们。

我有一个脚本可以自动执行这些操作:

gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_1
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_2
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_3
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_4
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_5
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_6
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_7
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_8

gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_1 "<Mod4>ampersand"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_2 "<Mod4>eacute"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_3 "<Mod4>quotedbl"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_4 "<Mod4>apostrophe"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_5 "<Mod4>parenleft"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_6 "<Mod4>minus"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_7 "<Mod4>egrave"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_8 "<Mod4>undersocre"
Run Code Online (Sandbox Code Playgroud)

但是当我将此脚本配置为在启动时运行时,奇怪的是它不起作用。

任何人都有关于如何解决这个问题的线索?

des*_*gua 6

它似乎不适用于 Natty + compiz(如果您使用 metacity - 则可以使用metacity --replace)。您可以通过以下方式解决:

您可以使用wmctrl并为特定命令创建快捷方式。

基本命令:

如果您使用 metacity:
wmctrl -d来显示您的所有工作区。
wmctrl -s <workspace_name>更改为特定工作区。

如果您正在使用 Compiz:
您将不得不做一个技巧,因为 Compiz“工作区”实际上是单个工作区的视口。

技巧说明

检查wmctrl -d例如的输出,我的是:

0 * DG:4098x2304 VP:1366,0 WA:0,23 1366x745 不适用

这意味着实际上我有一个 4098 x 2304 的工作区,而不是我“认为”我拥有的(九个“工作区”,3 x 3)。
我在应该是“工作区”2的地方,但实际上我在视口(VP)1366,0(4098 / 3 = 1366),如上面的输出所示。

这就是它的工作原理:我们将整个工作区划分为我们“认为”拥有的“工作区”数量。就我而言:4098 / 3 = 1366 和 2304 / 3 = 768。

如果我想转到我的“工作区”1,命令是:
wmctrl -o 0,0

然后,如果我想进入我的“工作区”4,命令是:
wmctrl -o 0,768

如果我想去我的“工作区”8,命令是:
wmctrl -o 1366,1536

如果我想去我的“工作区”9,命令是:
wmctrl -o 2732,1536

知道了?;-)

制作快捷方式

1)我们需要Compiz 设置管理器

您可以从Ubuntu 软件中心或单击此处安装这些

2)打开 Compiz ( Alt+F2和 type ccsmand hit Enter)

3)转到命令并添加例如wmctrl -o 0,0一个命令

4)然后转到键绑定并为其创建<Super>+1快捷方式。

5)对其他工作区重复步骤“3”和“4”。