Difference between revisions of "User:Chazza"

From ArchWiki
Jump to: navigation, search
(Brightness control: cull section. this is just another 'Execute' example)
(Modifiers: remove superfluous xml snippet. correct repeated occurrences of 'modifier' being misspelled.)
Line 31: Line 31:
 
==== Modifiers ====
 
==== Modifiers ====
  
{{ic|Modifer}} keys play an important role in keybindings (e.g. holding down the {{ic|shift}} or {{ic|CTRL / control}} key in combination with another key to undertake an action). Using modifers helps to prevent conflicting keybinds, whereby two or more actions are linked to the same key or combination of keys. The syntax to use a modifer with another key is:
+
{{ic|Modifier}} keys play an important role in keybindings (e.g. holding down the {{ic|shift}} or {{ic|CTRL / control}} key in combination with another key to undertake an action). Using modifiers helps to prevent conflicting keybinds, whereby two or more actions are linked to the same key or combination of keys. The syntax to use a modifier with another key is:
  
 
  "<modifier>-<key>"
 
  "<modifier>-<key>"
Line 42: Line 42:
 
* {{ic|W}}: Super / Windows
 
* {{ic|W}}: Super / Windows
 
* {{ic|M}}: Meta
 
* {{ic|M}}: Meta
* {{ic|H}}: Hyper (If it is bound to something)  
+
* {{ic|H}}: Hyper (If it is bound to something)
 
 
For example, the code below would use {{ic|super}} and {{ic|t}} to launch {{Pkg|lxterminal}}
 
 
 
<keybind key="W-t">
 
    <action name="Execute">
 
        <command>lxterminal</command>
 
    </action>
 
</keybind>
 
  
 
==== Multimedia keys ====
 
==== Multimedia keys ====

Revision as of 14:00, 30 December 2016

ArchWiki Maintainer

Hello all. I'm from the UK and I've been using Arch since mid 2013. See also, my AUR packages.

(Openbox) Keybinds

All keybinds must be added to the ~/.config/openbox/rc.xml file, and below the <!-- Keybindings for running aplications --> heading. Although a brief overview has been provided here, a more in-depth explanation of keybindings can be found at openbox.org.

Keybinds can be added to the configuration file using the following syntax:

<keybind key="my-key-combination">
  <action name="my-action">
    ...
  </action>
</keybind>

The action name for running an external command is Execute. Use the following syntax to define an external command to execute:

<action name="Execute">
  <command>my-command</command>
</action>

See the Openbox wiki for a list of all available actions.

Note: The obkeyAUR utility provides a graphical interface for configuring key bindings. Before using obkey, you should use obconf to create ~/.config/openbox/rc.xml.

Special keys

While the use of standard alpha-numeric keys for keybindings is self-explanatory, special names are assigned to other types of keys, such as modifers, multimedia keys and navigation keys.

Modifiers

Modifier keys play an important role in keybindings (e.g. holding down the shift or CTRL / control key in combination with another key to undertake an action). Using modifiers helps to prevent conflicting keybinds, whereby two or more actions are linked to the same key or combination of keys. The syntax to use a modifier with another key is:

"<modifier>-<key>"

The modifer codes are as follows:

  • S: Shift
  • C: Control / CTRL
  • A: Alt
  • W: Super / Windows
  • M: Meta
  • H: Hyper (If it is bound to something)

Multimedia keys

Where available, it is possible to set the appropriate multimedia keys to perform their intended functions, such as to control the volume and/or the screen brightness. These will usually be integrated into the function keys, and are identified by their appropriate symbols. See Extra keyboard keys for details.

The volume and brightness multimedia codes are as follows (note that commands will still have to be assigned to them to actually function):

  • XF86AudioRaiseVolume: Increase volume
  • XF86AudioLowerVolume: Decrease volume
  • XF86AudioMute: Mute / unmute volume
  • XF86MonBrightnessUp: Increase screen brightness
  • XF86MonBrightnessDown: Decrease screen brightness

Examples of how these may be used in ~/.config/openbox/rc.xml have been provided in the #Volume control section.

Navigation keys

These are the directional / arrow keys, usually used to move the cursor up, down, left, or right. The (self-explanatory) navigation codes are as follows:

  • Up: Up
  • Down: Down
  • Left: Left
  • Right: Right

Volume control

What commands should be used for controlling the volume will depend on whether ALSA, PulseAudio, or OSS is used for sound.

Window snapping

Many desktop environments and window managers support window snapping (e.g. Windows 7 Aero snap), whereby they will automatically snap into place when moved to the edge of the screen. This effect can also be simulated in Openbox through the use of keybinds on focused windows.

As illustrated in the example below, percentages must be used to determine window sizes (see openbox.org for further information). In this instance, The super key is used in conjunction with the navigation keys:

<keybind key="W-Left">
    <action name="UnmaximizeFull"/>
    <action name="MaximizeVert"/>
    <action name="MoveResizeTo">
        <width>50%</width>
    </action>
    <action name="MoveToEdge"><direction>west</direction></action>
</keybind>
<keybind key="W-Right">
    <action name="UnmaximizeFull"/>
    <action name="MaximizeVert"/>
    <action name="MoveResizeTo">
        <width>50%</width>
    </action>
    <action name="MoveToEdge"><direction>east</direction></action>
</keybind>

However, it should be noted that once a window has been 'snapped' to an edge, it will remain vertically maximised unless subsequently maximised and then restored. The solution is to implement additional keybinds - in this instance using the down and up keys - to do so. This will also make pulling 'snapped' windows from screen edges faster as well:

<keybind key="W-Down">
   <action name="Unmaximize"/>
</keybind>
<keybind key="W-Up">
   <action name="Maximize"/>
</keybind>

This Ubuntu forum thread provides more information. Applications such as opensnap-gitAUR are also available to automatically simulate window snapping behaviour without the use of keybinds.