Tuesday, May 29, 2012

OpenBox Key Bindings

I've been using Arch Linux on my test box for the last few months and I really like it. I still feel like a linux noob, and they say that Arch isn't for noobs, but I felt that the set up was pretty straight forward. Arch installs as bare boned as possible, with no gui. So I installed and configured X and then installed OpenBox as a windows manager. And that's it. No login manager, no task bar, no conky, no file manager, nada.

OpenBox comes with a configurable start menu that you can reach by right-clicking on the desktop. You can also configure keybindings by editing your ~/.config/openbox/rc.xml file. I was really missing the window positioning keyboard short cuts that come with windows that allow you to maximize a window or split the screen with a window.  So I added them to my rc.xml file, and then I added a few more that I wished windows would have come with.  My screen resolution on that machine is 1200x1600, so the window heights and widths are based on that.  Here's a snippet of my config file:


<!-- Keybindings for moving windows --> 
<!-- In the key attribute, the W refers to the 
     windows/super key, C refers to the ctrl key and KP_# refers
     to a number on the numpad. -->
<!-- Move and resize the window to fill the top left quarter of the screen --> <keybind key="W-C-KP_7">
  <action name="UnmaximizeFull" />
  <action name="MoveResizeTo">
    <height>600</height>
    <width>800</widht>
    <x>0</x>
    <y>0</y>
  </action>
</keybind>

<!-- Move and resize the window to fill the top right quarter of the screen --> <keybind key="W-C-KP_9">
  <action name="UnmaximizeFull" />
  <action name="MoveResizeTo">
    <height>600</height>
    <width>800</widht>
    <x>800</x>
    <y>0</y>
  </action>
</keybind>

<!-- Move and resize the window to fill the bottom left quarter of the screen --> 
<keybind key="W-C-KP_1">
  <action name="UnmaximizeFull" />
  <action name="MoveResizeTo">
    <height>600</height>
    <width>800</widht>
    <x>0</x>
    <y>600</y>
  </action>
</keybind>

<!-- Move and resize the window to fill the bottom right quarter of the screen --> 
<keybind key="W-C-KP_3">
  <action name="UnmaximizeFull" />
  <action name="MoveResizeTo">
    <height>600</height>
    <width>800</widht>
    <x>800</x>
    <y>600</y>
  </action>
</keybind>

<!-- Move and resize the window to fill the top half of the screen --> 
<keybind key="W-C-KP_8">
  <action name="UnmaximizeFull" />
  <action name="MaximizeHorz" />
  <action name="MoveResizeTo">
    <height>600</height>
    <x>0</x>
    <y>0</y>
  </action>
</keybind>

<!-- Move and resize the window to fill the right half of the screen --> 
<keybind key="W-C-KP_6">
  <action name="UnmaximizeFull" />
  <action name="MaximizeVert" />
  <action name="MoveResizeTo">
    <width>800</width>
    <x>800</x>
    <y>0</y>
  </action>
</keybind>
<!-- Move and resize the window to fill the bottom half of the screen --> 
<keybind key="W-C-KP_2">
  <action name="UnmaximizeFull" />
  <action name="MaximizeHorz" />
  <action name="MoveResizeTo">
    <height>600</height>
    <x>0</x>
    <y>600</y>
  </action>
</keybind>

<!-- Move and resize the window to fill the right half of the screen --> 
<keybind key="W-C-KP_4">
  <action name="UnmaximizeFull" />
  <action name="MaximizeVert" />
  <action name="MoveResizeTo">
    <width>800</width>
    <x>0</x>
    <y>0</y>
  </action>
</keybind>
<!-- Resize and center the window --> 
<keybind key="W-C-KP_5">
  <action name="UnmaximizeFull" />
  <action name="MoveResizeTo">
    <height>600</height>
    <width>800</widht>
    <x>400</x>
    <y>300</y>
  </action>
</keybind>







Wednesday, May 02, 2012

CSS vertical-align Property

I had an issue where I needed to vertically align a label to the top of a textarea. Here's the sample html:

<p>
    <label for="txtDesc">Description</label>
    <textarea id="txtDesc"></textarea>
</p>

Here's what it looked like:

My first inclination was to put a "vertical-align: top" css rule on the label to raise it up to the "top" of the text area. However, that didn't work.

The trick was to use the rule on the text area instead. Here's that same code with "vertical-align: top;" applied to the textarea: