# 
#  Author:: Jonathan Dahan <jedahan@gmail.com>
# Version:: 0.1
# License:: GNU GPL
#

OPTIONS = {
  :border  => 2,                                   
  :step    => 5,
  :snap    => 10,
  :gravity => :center,
  :urgent  => true,
  :resize  => false,
  :padding => [ 0, 0, 0, 0 ],
  :font    => "-*-fixed-*-*-*-*-18-*-*-*-*-*-*-*"
#  :font    => "-*-lucidatypewriter-medium-r-normal-*-12-*-*-*-*-*-*-*"
#  :font     =>"-*-inconsolata-*-*-*-*-20-*-*-*-*-*-*-*"
}

PANEL = {
  :top       => [ :views, :title, :spacer, :tray, :sublets ],
  :bottom    => [ ],
  :stipple   => false,
  :separator => "  "
}

COLORS = { 
  :fg_panel      => "#5881ed",
  :fg_views      => "#5881ed",
  :fg_sublets    => "#ffffff",
  :fg_focus      => "#ffffff",
  :fg_urgent     => "#572923",

  :bg_panel      => "#5d5d5d",
  :bg_views      => "#5d5d5d",
  :bg_sublets    => "#5881ed",
  :bg_focus      => "#5881ed",
  :bg_urgent     => "#883421",

  :border_focus  => "#5881ed",
  :border_normal => "#5d5d5d",
  
  :background    => "#ffffff",
}

GRAVITIES = {
  :top_left       => [   0,   0,  50,  50 ], 
  :top_left66     => [   0,   0,  50,  66 ],
  :top_left33     => [   0,   0,  50,  33 ],
  :top            => [   0,   0, 100,  50 ],
  :top66          => [   0,   0, 100,  66 ],
  :top33          => [   0,   0, 100,  33 ],
  :top_right      => [ 100,   0,  50,  50 ],
  :top_right66    => [ 100,   0,  50,  66 ],
  :top_right33    => [ 100,   0,  50,  33 ],
  :left           => [   0,   0,  50, 100 ],
  :left66         => [   0,  50,  50,  33 ],
  :left33         => [   0,  50,  25,  33 ],
  :center         => [   0,   0, 100, 100 ],
  :center66       => [   0,  50, 100,  33 ],
  :center33       => [  50,  50,  50,  33 ],
  :right          => [ 100,   0,  50, 100 ],
  :right66        => [ 100,  50,  50,  33 ],
  :right33        => [ 100,  50,  25,  33 ],
  :bottom_left    => [   0, 100,  50,  50 ],
  :bottom_left66  => [   0, 100,  50,  66 ],
  :bottom_left33  => [   0, 100,  50,  33 ],
  :bottom         => [   0, 100, 100,  50 ],
  :bottom66       => [   0, 100, 100,  66 ],
  :bottom33       => [   0, 100, 100,  33 ],
  :bottom_right   => [ 100, 100,  50,  50 ],
  :bottom_right66 => [ 100, 100,  50,  66 ],
  :bottom_right33 => [ 100, 100,  50,  33 ]
}  

@dmenu = "dmenu_run -fn '%s' -nb '%s' -nf '%s' -sb '%s' -sf '%s' -p 'Select:'" % [
  OPTIONS[:font],
  COLORS[:bg_panel], COLORS[:fg_panel], 
  COLORS[:bg_focus], COLORS[:fg_focus]
]

# An action is something that happens when a grab is activated, this can be one of the following:
#
# [*symbol*] Run a subtle action
# [*string*] Start a certain program
# [*array*]  Cycle through gravities
# [*lambda*] Run a Ruby proc
#
GRABS = {
  # Switch to view1, view2, ...
  "W-1"      => :ViewJump1,
  "W-2"      => :ViewJump2,
  "W-3"      => :ViewJump3,
  "W-4"      => :ViewJump4,

  # Move mouse to screen1, screen2, ...
  "W-A-1"    => :ScreenJump1,
  "W-A-2"    => :ScreenJump2,
  "W-A-3"    => :ScreenJump3,
  "W-A-4"    => :ScreenJump4,

  # Move window to screen1, screen2, ...
  "A-S-1"    => :WindowScreen1,
  "A-S-2"    => :WindowScreen2,
  "A-S-3"    => :WindowScreen3,
  "A-S-4"    => :WindowScreen4,

  # Force reload of config
  "W-C-r"    => :SubtleReload,

  # Quit subtle
  "W-C-q"    => :SubtleQuit,

  # Move current window
  "W-B1"     => :WindowMove,

  # Resize current window
  "W-B3"     => :WindowResize,

  # Toggle floating mode of window
  "W-f"      => :WindowFloat,

  # Toggle fullscreen mode of window
  "W-space"  => :WindowFull,

  # Toggle sticky mode of window (will be visible on all views)
  "W-s"      => :WindowStick,

  # Raise window
  "W-r"      => :WindowRaise,
  
  # Lower window
  "W-l"      => :WindowLower,

  # Fake alt-tab
  "A-Tab"    => :WindowLower,

  # Select next windows
  "W-Left"   => :WindowLeft,
  "W-Down"   => :WindowDown,
  "W-Up"     => :WindowUp,
  "W-Right"  => :WindowRight,

  # Kill current window
  "W-S-k"    => :WindowKill,

  # Cycle between given gravities
  "W-S-7"    => [ :top_left,     :top_left66,     :top_left33     ],
  "W-S-Up"    => [ :top,          :top66,          :top33          ],
  "W-S-9"    => [ :top_right,    :top_right66,    :top_right33    ],
  "W-S-Left"    => [ :left,         :left66,         :left33         ],
  "W-S-I"    => [ :center,       :center66,       :center33       ],
  "W-S-Right"    => [ :right,        :right66,        :right33        ],
  "W-S-J"    => [ :bottom_left,  :bottom_left66,  :bottom_left33  ],
  "W-S-Down"    => [ :bottom,       :bottom66,       :bottom33       ],
  "W-S-L"    => [ :bottom_right, :bottom_right66, :bottom_right33 ],

  # Exec some programs
  "W-Return" => "urxvt",
  "W-d"      => @dmenu,
  "W-c"     => "chromium",
  "W-x"     => "xchat"

}

TAGS = {
  "terminal"   => "xterm|[u]?rxvt",
  "browser" => "uzbl|opera|firefox|navigator",
  "torrent" => "transmission",
  "irc"     => "xchat",
  "pdf"     => "epdfview",
  "editor"  => { :regex => "[g]?vim", :resize => true },
  "stick"   => { :regex => "mplayer|imagemagick|wpa_gui", :float => true, :stick => true },
  "float"   => { :regex => "gimp|qjackctl|Qjackctl", :float => true },
  "fixed"   => { :geometry => [ 10, 10, 100, 100 ], :stick => true },
  "resize"  => { :regex => "sakura|gvim", :resize => true },
  "gravity" => { :gravity => :center }
}  

VIEWS = {
  "0"     => "default",
  "dev"   => "editor|terminal",
  "read"  => "pdf|browser",
  "chat"  => "irc",
  "down"  => "torrent"
}

HOOKS = {
    :HookClientCreate => lambda { |c| puts c.views} 
}

PANEL = {
    :top    => [ :views, :title, :spacer, :tray ],
    :bottom => [ :ddate, :spacer, :clock ]
}

