当前位置: 首页 > 文档资料 > Fluxbox 中文文档 >

章 5. 按键绑定

优质
小牛编辑
122浏览
2023-12-01

Keygrabber

keygrabber 的工作方式和 bbkeys(也是一个非常棒的工具, 但功能上有其局限性,过去采用了不兼容的许可证)非常相似,但配置文件采用了全新的语法,所具有 的一些新功能甚至让 Fluxbox 变得更加强大。

其中之一就是,新的 keygrabber 支持类似于 emacs 中的 keychains... 也就是说您可以用:Mod1 + M + Mod1 + F 切换至下一个 workspace (不是每个人在实际中都会采用这个按键序列啦)。

如果您已经敲入了某个按键序列的部分按键但是决定不再继续(即退出) 那么只需敲入别的按键序列(必须是已在 keys-file 中配置了的)即可退出(使用: AbortChain)。

除此之外您还可以通过按键序列的绑定在已分组/贴标签的一组窗口中进行切换 (使用:NextTab 和 PrevTab)。

最后,为了让您的便利我们(或者说就是 vlaad 和 tarzeau二人)还提供了两个脚本(它们的作用相同)用于将 bbkeys 配置文件转换成 Fluxbox 的 keys-file。(这两个脚本的用法已在脚本中予以描述)。Download: convertkeys or convertkeys2.

例子 5.1. Fluxbox keysfile

    Mod1 Tab :NextWindow
    Mod1 F1 :Workspace 1
    Mod1 F2 :Workspace 2
    Mod1 F3 :Workspace 3
    Mod1 F4 :Workspace 4
    Control n Mod1 n :NextTab

就像您看到的那样,首先是一个修饰符,然后是一个按键 (如果您想要更长的按键序列就接着跟上修饰符和按键) 最后是一个分号跟上一个动作。

欲知合法的按键动作的详细情况请继续阅读此文档。

以上所讲的对您有什么用处呢?现在您就可以完全控制您的 xmms 了,例如:

例子 5.2. XMMS 按键绑定

    Mod1 P :ExecCommand xmms -p
    Mod1 F :ExecCommand xmms -f

如果您有一些附加的按键(例如多媒体键)的话,就可以通过这种方式来控制 xmms,但前提是 已在 XFree86 中正确配置了这些按键:

例子 5.3. Multimedia keys for XMMS

    None XF86AudioPlay :ExecCommand xmms -u
    None XF86AudioStop :ExecCommand xmms -s

我想说的是详细情况最好参见 xmms --help,但您现在应该完成得非常不错了...

按键名称

您或许在问自己怎样才能找出每个按键的名称。运行 xev,将鼠标移动到新创建的 窗口上,在键盘上随便按一个键,看看 xev 是怎么说的。这里有个例子说明的是按下右箭头键后的情况:

例子 5.4. 按下右箭头键后 xev 的输出

    KeyPress event, serial 18, synthetic NO, window 0x2c00001,
    root 0x60, subw 0x0, time 3745737930, (373,380), root:(504,526),
    state 0x10, keycode 102 (keysym 0xff53, Right), same_screen YES,
    XLookupString gives 0 characters:  ""

我们感兴趣的是按键的名称,也就是在括号中和 keysym 一起列出的 内容。在此例中,位于 (keysym 0xff53, Right)中。所以,对应的按键名称即 Right

特殊按键

这里有些方便您的特殊按键。注意在按下这些键之后 xev 立即就会 显示出它们(而不是作为其它按键的修饰符)。

KeyX11 Name
Control, StrgControl
AltMod1
Super, Meta, Win* KeysMod4

动作

以下是 Fluxbox 所能提供的动作。它们基本上对应了用户大部分所能想到的按键。 要注意的是在按键绑定的配置文件中,位于动作前的最后一个字符应该是 :

动作对于大小写是敏感的。

表格 5.1. Navigation

ActionResult
WorkspaceGo to a particular workspace. Use :Workspace 1, :Workspace 2, etc.
NextTabSwitch to the Next Tab in the current group.
PrevTabSwitch to the Previous Tab in the current group.
NextWindow NGo to Next Window. See Note 1.
PrevWindow NGo to previous window. Again, see Note 1.
NextWorkspaceGo to the Next Workspace.
PrevWorkspaceGo to the Previous Workspace.
NextGroup , PrevGroupGo to the next/prev window group.
LeftWorkspaceSame as PrevWorkspace.
RightWorkspaceSame as NextWorkspace.

1. NextWindow / PrevWindow

NextWindow / PrevWindow 有很多参数,想在上面这张表中全部都解释有点不太现实。这里只是它的基本工作原理。

用于配置行为的整数参数:

Parameter valueBehaviour
0 or unspecifiedDefault/current behavior - no skipping
1Skip lower tabs
2Skip stuck windows
3Skip lower tabs/stuck windows
4Skip shaded windows
5Skip lower tabs/shaded windows
6Skip stuck windows/shaded windows
7Skip lower tabs/stuck windows/shaded windows

表格 5.2. Window Operations

ActionResult
CloseClose the Window.
KillWindowThe equivalent of calling xkill and clicking on the window.
MinimizeAlso known as "iconify". Make the window iconified.
ShadeWindowPut window in the 'shaded' state, or restore from the 'shaded' state.
StickWindowToggle a Window's 'sticky' state.
ToggleDecorToggle whether or not current window has a border, buttons, and titlebar.
RaiseBring the window to the 'Top', it will appear 'Above' windows that it overlaps.
LowerOpposite of Raise.
NextTab , PrevTabActivate next, prev tab.
MoveTabLeft , MoveTabRightMove activate tab by the n tabs left/right.
DetachClientTake client out of tab-group.

表格 5.3. Window Sizing

ActionResult
MaximizeHorizontalMaximize the window horizontally.
MaximizeVerticalMaximize the window vertically.
MaximizeWindowMaximize the Window.
ResizeResize the active window by the specified delta, e.g. resize -8 -8 .
ResizeToResize the active window to the specified geometry. resize -8 -8 .
ResizeHorizontalResize horizontal by the specified delta.
ResizeVerticalResize vertical by the specified delta.
ArrangeWindowsTile Windows magically.
ShowDesktopIconify all windows.

在缩放的时候,"one unit" 对于不同的应用程序可能意义有所不同。 xterm/aterm/Eterm 会增加额外一个字符宽的空间,而不是以像素为单位缩放。

其它的程序应该都是以像素为单位进行缩放。

表格 5.4. 窗口移动

ActionResult
SendToWorkspaceSend current window to a specified workspace. Use :SendToWorkspace 1
Moveby delta-x delta-y.
MoveLeftGuess.
MoveRightGuess.
MoveUpGuess.
MoveDownGuess.

表格 5.5. 杂项

ActionResult
AbortKeychainIn Multi-binding keychains, cancel the keybinding.
ExecCommandExecute a command. Example :ExecCommand xmms -t.
RootMenuSummon the Root Menu.
WorkSpaceMenuSummon the Workspace Menu.
RestartRestart fluxbox.
ReconfigureReconfigure fluxbox, rereads configuration. e.g. if keys was changed, but init and slitlist might be written before read.
SetStyleLoad the specified file.
SetWorkspaceName.
SaveRCSave resource files.
QuitQuit fluxbox.