Monday, March 2, 2009

Code Test with ScribeFire

Not really specific to Linux, but one of the first things a noobie to displaying code in blogs has to contend with.

Because blogs treat the posts as HTML code anytime you want to display code you need to contend with special characters used by HTML.  Example: <, >.

Using the editor that comes with Blogger you need to replace all these type of characters with something like &lt; or &gt.

ScribeFire takes care of this automatically so instead of having to type:

&lt;test&gt;

you only need to type.

<test>

Reference:

Scribefire - http://www.scribefire.com/blog_editor


Sunday, March 1, 2009

OpenBox - Setup Laptop Volume Keys

First you need to verify that your keys are mapped properly.

Run xev and press each of the volume keys:

Example:
   $ xev
Volume Down Results
   KeyRelease event, serial 32, synthetic NO, window 0xc00001,
      root 0x7d, subw 0x0, time 100213680, (-194,56), root:(229,367),
      state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume),
Volume Up Results
   KeyRelease event, serial 35, synthetic NO, window 0xc00001,
      root 0x7d, subw 0x0, time 100214182, (-194,56), root:(229,367),
      state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume),
Volume Mute Results
   KeyRelease event, serial 35, synthetic NO, window 0xc00001,
      root 0x7d, subw 0x0, time 100214715, (-194,56), root:(229,367),
      state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute),
The keycodes are required if you are planning to use programs such as xbindkeys and raw keycodes. For OpenBox in CrunchBangLinux I did not need to install another package. I simply had to configure the OpenBox rc.xml file using the following key names:

XF86AudioLowerVolume, XF86AudioRaiseVolume and XF86AudioMute

Here's how:

Open file ~/.config/openbox/rc.xml with your favourite editor.
   $ nano ~/.config/openbox/rc.xml
Find </keyboard>

Example:
   ... 
    <keybind key="A-C-q">
      <action name="ShowMenu">
        <menu>root-menu</menu>
      </action>
    </keybind>
  </keyboard>
Paste in the following lines between </keybind> and </keyboard>.
   <keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
      <execute>amixer set Master 1+</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioLowerVolume">
    <action name="Execute">
      <execute>amixer set Master 1-</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioMute">
    <action name="Execute">
      <execute>amixer set Master toggle</execute>
    </action>
  </keybind>
Save and reload the configuration from Menu -> Preference -> Openbox Config -> Restart