Showing posts with label x. Show all posts
Showing posts with label x. Show all posts

Monday, September 21, 2009

xmonad

Xmonad is a sweet window manager. So sweet, in fact, that I've decided to use it. Here's a quick reference, basically the manpage rearranged (mod = alt by default) ... (also, remember to change the session login to "Run Xclient script" so that other things, like xmodmap, can be run in .xsession):

=== Launch ===
mod-shift-q -- Quit xmonad
mod-q -- Restart xmonad (and reload config file)
mod-shift-return -- Launch terminal
mod-shift-c -- Close the focused window
mod-p -- Launch dmenu

=== Layout ===
mod-space -- Rotate through the available layout algorithms
mod-shift-space -- Reset the layouts on the current workspace to default

=== Focus ===
mod-tab -- Move focus to the next window
mod-shift-tab -- Move focus to the previous window
mod-j -- Move focus to the next window
mod-k -- Move focus to the previous window
mod-m -- Move focus to the master window

=== Swap ===
mod-return -- Swap the focused window and the master window
mod-shift-j -- Swap the focused window with the next window
mod-shift-k -- Swap the focused window with the previous window

=== Resize ===
mod-h -- Shrink the master area
mod-l -- Expand the master area

=== Master Area (the area on the left) ===
mod-comma -- Increment the number of windows in the master area
mod-period -- Deincrement the number of windows in the master area

=== Workspace ===
mod-[1..9] -- Switch to workspace N
mod-shift-[1..9] -- Move client to workspace N

=== Multiple Screens ===
mod-{w,e,r} -- Switch to physical/Xinerama screens 1, 2, or 3
mod-shift-{w,e,r} -- Move client to screen 1, 2, or 3

=== Mouse ===
mod-button1 -- Set the window to floating mode and move by dragging
mod-button2 -- Raise the window to the top of the stack
mod-button3 -- Set the window to floating mode and resize by dragging
mod-t -- Push window back into tiling

=== Setup ===
sudo apt-get install xmonad dwm xlockmore xclock htop

=== ? ===
mod-shift-p -- Launch gmrun
mod-n -- Resize viewed windows to the correct size
mod-b -- Toggle the status bar gap

Here are some other useful utilities to replace functionality that is present in, say, GNOME on the command line:
How to install Xmobar

First, install the necessary packages:
sudo apt-get install libghc6-http-dev libghc6-zlib-dev libx11-dev libxft-dev

I hadn't installed any packages with cabal before, so I needed to set up that as well. I found it necessary to do the standard download, untar, runhaskell Setup configure && runhaskell Setup build && sudo runhaskell Setup install for the following packages:
  • http://hackage.haskell.org/packages/archive/HTTP/4000.0.8/HTTP-4000.0.8.tar.gz
  • http://haskell.org/cabal/release/cabal-1.6.0.2/Cabal-1.6.0.2.tar.gz
  • http://haskell.org/cabal/release/cabal-install-0.6.2/cabal-install-0.6.2.tar.gz
A cabal update initializes the package database and a cabal install xmobar grabs the package.

Put this in your xmonad.hs (changing the paths appropriately, of course):

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import System.IO

main = do
xmproc <- spawnPipe "/home/dannyc/.cabal/bin/xmobar /home/dannyc/.xmonad/xmobarrc"
xmonad $ defaultConfig {
layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
}
And put this in your xmobarrc:
Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 90
, commands = [ Run Weather "EGPF" ["-t"," <tempF>F","-L","64","-H","77",
"--normal","green","--high","red","--low","lightblue"] 36000
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio> 10
, Run Swap [] 10
, Run Date "%a %b %_d %l:%M" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %memory% * %swap% <fc=#ee9a00>date%<fc> | %EGPF%"
}

There, you now have a bare-bones xmobar install. I figured this out by loosely following the instructions here. I don't know any haskell (yet) and this is my first time messing with the xmonad config, so I don't guarantee at all that I am doing things the Right Way. If your xmonad keeps locking up because of this configuration, see the big bold comment in the link above which points to here.

TODO
  • customize xmobar
  • some kind of screen-like titleing for workspaces
  • better fonts?
  • picture background on startup (/transparent windows?)

Friday, October 10, 2008

wmctrl and friends

wmctrl seems like an awesome utility. I first read about it in Kyle Rankin's Linux Journal column here. The wmctrl project page also has links to a bunch of other desktop-automation and related utilities. This is all going in the "to learn when I have some spare time" file along with screen.

Monday, August 11, 2008

HOWTO vertical display (X, Nvidia)

Here is how to get your monitor looking something like this (not my monitor, btw):




























Put this line as an option in the "Device" section of /etc/X11/xorg.conf: Option "Rotate" "CCW" Then, restart X with Ctrl+Alt+Backspace. Afterwards, start up sudo nvidia-settings and shuffle the screens around in X Server Display Configuration so that they are properly aligned. Be sure to press the Save to X Configuration File button.

Found via this forum thread and a tip from Arash.

Update:
Following is an xorg.conf file to get 2 Dell 2407 monitors in a T formation (with one on the left vertical and one on the right horizontal aka Rajiv-style). This setup has a few problems, though...
1) The screens are flush at the top, which makes a window across both monitors look disjointed... not a huge problem, and could probably be solved by tweaking the config
2) Can't seem to get compiz-fusion to work
3) Using Xinerama instead of Twinview is waaaaay slower, especially when an object is on both screens
4) Just feels too unnatural... I'm going back to both screens horizontal
It's also a bit hard finding helpful forum posts on these things anyways because everyone seems to misuse the terminlogy (Xinerama, Twinview, etc.) and problems are very individual (Depending on video drivers, screens, etc.). Anyways, here's the xorg.conf:

Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" RightOf "Screen1"
Screen 1 "Screen1" 0 0
EndSection

Section "Module"
Load "glx"
EndSection

Section "ServerFlags"
Option "Xinerama" "1"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "DELL 2407WFP"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 76.0
EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Unknown"
ModelName "DELL 2407WFP"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 76.0
EndSection

Section "Device"
Identifier "Videocard0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 7900 GS"
Option "Rotate" "CCW"
Option "NoLogo" "True"
BusID "PCI:1:0:0"
Screen 0
EndSection

Section "Device"
Identifier "Videocard1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 7900 GS"
BusID "PCI:1:0:0"
Screen 1
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard1"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "DFP-0: nvidia-auto-select +0+0"
EndSection

Section "Screen"
Identifier "Screen1"
Device "Videocard0"
Monitor "Monitor1"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "DFP-1: nvidia-auto-select +0+0"
EndSection

Tuesday, June 17, 2008

HOWTO Swap caps lock and escape keys in Linux

Caps lock takes up way too much space on a keyboard for how little (never) one presses it. Esc is a very useful key that gets pressed a lot (especially for vi users) but is rather far away and takes more effort to press in the corner of the keyboard. Here is how to switch the functionality of the two keys (solution adapted from the xmodmap manpage) in Linux.

Create a file called .Xmodmap in your home directory. Put the following text in the file:

!
! Swap Caps_Lock and Escape
!
remove Lock = Caps_Lock
remove Control = Escape
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
add Control = Escape

Next time you log in, these settings should stick. If you want to switch the keys manually instead of on startup, run xmodmap .Xmodmap to do so. Loading the file again after you have loaded it once will switch the keys back to their original functionalities.

Btw, an informative discussion of all of this X customization stuff is found in chapter 6 of Unix Power Tools.