Commit 6cf8d839485ecc560796a5e20353375cfd6147ba

Authored by Ian Foster
1 parent e0036e2022
Exists in master

enabled new layouts

Showing 1 changed file with 13 additions and 10 deletions Inline Diff

awesome/awesome/rc.lua View file @ 6cf8d83
-------------------------------------- 1 1 --------------------------------------
---- Includes ---- 2 2 ---- Includes ----
-------------------------------------- 3 3 --------------------------------------
-- Standard awesome library 4 4 -- Standard awesome library
require("awful") 5 5 require("awful")
require("awful.autofocus") 6 6 require("awful.autofocus")
require("awful.rules") 7 7 require("awful.rules")
8 8
-- Theme handling library 9 9 -- Theme handling library
require("beautiful") 10 10 require("beautiful")
11 11
-- Notification library 12 12 -- Notification library
require("naughty") 13 13 require("naughty")
14 14
--Expose like plugin 15 15 --Expose like plugin
require("modules/revelation") 16 16 require("modules/revelation")
17 17
--calendaar popup 18 18 --calendaar popup
require('calendar2') 19 19 require('calendar2')
20 20
--freedesktop menus 21 21 --freedesktop menus
require('modules/awesome-freedesktop/freedesktop.utils') 22 22 require('modules/awesome-freedesktop/freedesktop.utils')
require('modules/awesome-freedesktop/freedesktop.menu') 23 23 require('modules/awesome-freedesktop/freedesktop.menu')
24 24
--for widgets 25 25 --for widgets
require("vicious") 26 26 require("vicious")
27 27
require("xrandr") 28 28 require("xrandr")
29 29
30 30
31 require("layouts/browse")
32 require("layouts/termfair")
33 --require("layouts/uselessfair")
34 --require("layouts/uselesstile")
35
--local keydoc = require("keydoc") 31 36 --local keydoc = require("keydoc")
32 37
--make pretty things 33
--this will crash if oocairo is not installed 34
--bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681279 35
--require("blingbling") 36
37
38
-------------------------------------- 39 38 --------------------------------------
---- Variables ---- 40 39 ---- Variables ----
-------------------------------------- 41 40 --------------------------------------
42 41
-- {{{ Variable definitions 43 42 -- {{{ Variable definitions
-- This is used later as the default terminal and editor to run. 44 43 -- This is used later as the default terminal and editor to run.
terminal = "terminator" 45 44 terminal = "terminator"
editor = os.getenv("EDITOR") or "vim" 46 45 editor = os.getenv("EDITOR") or "vim"
editor_cmd = terminal .. " -e " .. editor 47 46 editor_cmd = terminal .. " -e " .. editor
web_browser = "google-chrome" 48 47 web_browser = "google-chrome"
file_manager = "thunar" 49 48 file_manager = "thunar"
lock_command = "xscreensaver-command -lock" 50 49 lock_command = "xscreensaver-command -lock"
exit_command = "cb-exit" 51 50 exit_command = "cb-exit"
52 51
-- Default modkey. 53 52 -- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt. 54 53 -- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key, 55 54 -- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools. 56 55 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others. 57 56 -- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4" 58 57 modkey = "Mod4"
59 58
60 59
-------------------------------------- 61 60 --------------------------------------
---- Plugin Settings ---- 62 61 ---- Plugin Settings ----
-------------------------------------- 63 62 --------------------------------------
64 63
--set default naughty timeout 65 64 --set default naughty timeout
naughty.config.default_preset.timeout = 2 66 65 naughty.config.default_preset.timeout = 2
67 66
68 67
-- Themes define colours, icons, and wallpapers 69 68 -- Themes define colours, icons, and wallpapers
beautiful.init( awful.util.getdir("config") .. "/darkburn/theme.lua") 70 69 beautiful.init( awful.util.getdir("config") .. "/darkburn/theme.lua")
71 70
72 71
-------------------------------------- 73 72 --------------------------------------
---- Error Handleing ---- 74 73 ---- Error Handleing ----
-------------------------------------- 75 74 --------------------------------------
76 75
-- {{{ Error handling 77 76 -- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to 78 77 -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) 79 78 -- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then 80 79 if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, 81 80 naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!", 82 81 title = "Oops, there were errors during startup!",
text = awesome.startup_errors }) 83 82 text = awesome.startup_errors })
end 84 83 end
85 84
-- Handle runtime errors after startup 86 85 -- Handle runtime errors after startup
do 87 86 do
local in_error = false 88 87 local in_error = false
awesome.add_signal("debug::error", function (err) 89 88 awesome.add_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop 90 89 -- Make sure we don't go into an endless error loop
if in_error then return end 91 90 if in_error then return end
in_error = true 92 91 in_error = true
93 92
naughty.notify({ preset = naughty.config.presets.critical, 94 93 naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!", 95 94 title = "Oops, an error happened!",
text = err }) 96 95 text = err })
in_error = false 97 96 in_error = false
end) 98 97 end)
end 99 98 end
-- }}} 100 99 -- }}}
101 100
102 101
-------------------------------------- 103 102 --------------------------------------
---- Tags and Layout ---- 104 103 ---- Tags and Layout ----
-------------------------------------- 105 104 --------------------------------------
106 105
-- Table of layouts to cover with awful.layout.inc, order matters. 107 106 -- Table of layouts to cover with awful.layout.inc, order matters.
layouts = 108 107 layouts =
{ 109 108 {
awful.layout.suit.tile, 110 109 awful.layout.suit.tile,
--awful.layout.suit.tile.left, 111
awful.layout.suit.tile.bottom, 112 110 awful.layout.suit.tile.bottom,
111 awful.layout.suit.max,
112 awful.layout.suit.floating,
113 vain.layout.browse,
114 vain.layout.termfair,
115 --vain.layout.uselessfair,
116 --vain.layout.uselesstile,
117 --awful.layout.suit.magnifier,
118 --awful.layout.suit.tile.left,
--awful.layout.suit.tile.top, 113 119 --awful.layout.suit.tile.top,
--awful.layout.suit.fair, 114 120 --awful.layout.suit.fair,
--awful.layout.suit.fair.horizontal, 115 121 --awful.layout.suit.fair.horizontal,
--awful.layout.suit.spiral, 116 122 --awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle, 117 123 --awful.layout.suit.spiral.dwindle,
awful.layout.suit.max, 118
--awful.layout.suit.max.fullscreen, 119 124 --awful.layout.suit.max.fullscreen,
--awful.layout.suit.magnifier, 120
awful.layout.suit.floating, 121
} 122 125 }
-- }}} 123 126 -- }}}
124 127
-- {{{ Tags 125 128 -- {{{ Tags
-- Define a tag table which hold all screen tags. 126 129 -- Define a tag table which hold all screen tags.
tags = { 127 130 tags = {
names = { '⠒', '⠓', '⠣', '⠧', '⠗', '⠝', '⠵', '⠹', '⠳' }, 128 131 names = { '⠒', '⠓', '⠣', '⠧', '⠗', '⠝', '⠵', '⠹', '⠳' },
layout = { layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1],}, 129 132 layout = { layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1],},
} 130 133 }
for s = 1, screen.count() do 131 134 for s = 1, screen.count() do
-- Each screen has its own tag table. 132 135 -- Each screen has its own tag table.
tags[s] = awful.tag(tags.names, s, tags.layout) 133 136 tags[s] = awful.tag(tags.names, s, tags.layout)
end 134 137 end
-- }}} 135 138 -- }}}
136 139
137 140
-------------------------------------- 138 141 --------------------------------------
---- Menu ---- 139 142 ---- Menu ----
-------------------------------------- 140 143 --------------------------------------
141 144
-- {{{ Menu 142 145 -- {{{ Menu
-- Create a laucher widget and a main menu 143 146 -- Create a laucher widget and a main menu
myawesomemenu = { 144 147 myawesomemenu = {
{ "manual", terminal .. " -e man awesome" }, 145 148 { "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile }, 146 149 { "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart }, 147 150 { "restart", awesome.restart },
{ "quit", awesome.quit } 148 151 { "quit", awesome.quit }
} 149 152 }
150 153
menu_items = freedesktop.menu.new() 151 154 menu_items = freedesktop.menu.new()
table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon }) 152 155 table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon })
table.insert(menu_items, { "Exit", exit_command }) 153 156 table.insert(menu_items, { "Exit", exit_command })
154 157
mymainmenu = awful.menu.new({ items = menu_items, width = beautiful.menu_width }) 155 158 mymainmenu = awful.menu.new({ items = menu_items, width = beautiful.menu_width })
156 159
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), 157 160 mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu }) 158 161 menu = mymainmenu })
-- }}} 159 162 -- }}}
160 163
161 164
-------------------------------------- 162 165 --------------------------------------
---- WiBox ---- 163 166 ---- WiBox ----
-------------------------------------- 164 167 --------------------------------------
165 168
-- {{{ Wibox 166 169 -- {{{ Wibox
-- Create a textclock widget 167 170 -- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" }) 168 171 mytextclock = awful.widget.textclock({ align = "right" })
169 172
--calendar plugin 170 173 --calendar plugin
calendar2.addCalendarToWidget(mytextclock) 171 174 calendar2.addCalendarToWidget(mytextclock)
172 175
--separator widget 173 176 --separator widget
separator = widget({ type = "textbox" }) 174 177 separator = widget({ type = "textbox" })
separator.text = "|" 175 178 separator.text = "|"
176 179
--space widget 177 180 --space widget
space = widget({ type = "textbox" }) 178 181 space = widget({ type = "textbox" })
space.text = " " 179 182 space.text = " "
180 183
181 184
-- RAM usage widget 182 185 -- RAM usage widget
memwidget = awful.widget.progressbar() 183 186 memwidget = awful.widget.progressbar()
memwidget:set_width(8) 184 187 memwidget:set_width(8)
memwidget:set_height(beautiful.menu_height) 185 188 memwidget:set_height(beautiful.menu_height)
memwidget:set_vertical(true) 186 189 memwidget:set_vertical(true)
memwidget:set_background_color(beautiful.bg_widget) 187 190 memwidget:set_background_color(beautiful.bg_widget)
memwidget:set_color(beautiful.fg_widget) 188 191 memwidget:set_color(beautiful.fg_widget)
memwidget:set_gradient_colors({ beautiful.fg_widget, beautiful.fg_center_widget, beautiful.fg_end_widget }) 189 192 memwidget:set_gradient_colors({ beautiful.fg_widget, beautiful.fg_center_widget, beautiful.fg_end_widget })
-- RAM usage tooltip 190 193 -- RAM usage tooltip
memwidget_t = awful.tooltip({ objects = { memwidget.widget },}) 191 194 memwidget_t = awful.tooltip({ objects = { memwidget.widget },})
vicious.cache(vicious.widgets.mem) 192 195 vicious.cache(vicious.widgets.mem)
vicious.register(memwidget, vicious.widgets.mem, 193 196 vicious.register(memwidget, vicious.widgets.mem,
function (widget, args) 194 197 function (widget, args)
memwidget_t:set_text(" RAM: " .. args[1] .. "% " .. args[2] .. "MB / " .. args[3] .. "MB ") 195 198 memwidget_t:set_text(" RAM: " .. args[1] .. "% " .. args[2] .. "MB / " .. args[3] .. "MB ")
return args[1] 196 199 return args[1]
end, 5) 197 200 end, 5)
--update every 5 seconds 198 201 --update every 5 seconds
199 202
-- CPU usage widget 200 203 -- CPU usage widget
cpuwidget = awful.widget.graph() 201 204 cpuwidget = awful.widget.graph()
cpuwidget:set_width(30) 202 205 cpuwidget:set_width(30)
cpuwidget:set_height(beautiful.menu_height) 203 206 cpuwidget:set_height(beautiful.menu_height)
cpuwidget:set_background_color(beautiful.bg_widget) 204 207 cpuwidget:set_background_color(beautiful.bg_widget)
cpuwidget:set_color(beautiful.fg_widget) 205 208 cpuwidget:set_color(beautiful.fg_widget)
cpuwidget:set_gradient_angle(180) 206 209 cpuwidget:set_gradient_angle(180)
cpuwidget:set_gradient_colors({ beautiful.fg_widget, fg_center_widget, beautiful.fg_end_widget }) 207 210 cpuwidget:set_gradient_colors({ beautiful.fg_widget, fg_center_widget, beautiful.fg_end_widget })
cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },}) 208 211 cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },})
-- Register CPU widget 209 212 -- Register CPU widget
vicious.register(cpuwidget, vicious.widgets.cpu, 210 213 vicious.register(cpuwidget, vicious.widgets.cpu,
function (widget, args) 211 214 function (widget, args)
cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%") 212 215 cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%")
return args[1] 213 216 return args[1]
end, 2) 214 217 end, 2)
215 218
-- Create a systray 216 219 -- Create a systray
mysystray = widget({ type = "systray" }) 217 220 mysystray = widget({ type = "systray" })
218 221
-- Create a wibox for each screen and add it 219 222 -- Create a wibox for each screen and add it
mywibox = {} 220 223 mywibox = {}
mypromptbox = {} 221 224 mypromptbox = {}
mylayoutbox = {} 222 225 mylayoutbox = {}
mytaglist = {} 223 226 mytaglist = {}
mytaglist.buttons = awful.util.table.join( 224 227 mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly), 225 228 awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag), 226 229 awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle), 227 230 awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag), 228 231 awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext), 229 232 awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 230 233 awful.button({ }, 5, awful.tag.viewprev)
) 231 234 )
mytasklist = {} 232 235 mytasklist = {}
mytasklist.buttons = awful.util.table.join( 233 236 mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c) 234 237 awful.button({ }, 1, function (c)
if c == client.focus then 235 238 if c == client.focus then
c.minimized = true 236 239 c.minimized = true
else 237 240 else
if not c:isvisible() then 238 241 if not c:isvisible() then
awful.tag.viewonly(c:tags()[1]) 239 242 awful.tag.viewonly(c:tags()[1])
end 240 243 end
-- This will also un-minimize 241 244 -- This will also un-minimize
-- the client, if needed 242 245 -- the client, if needed
client.focus = c 243 246 client.focus = c
c:raise() 244 247 c:raise()
end 245 248 end
end), 246 249 end),
awful.button({ }, 3, function () 247 250 awful.button({ }, 3, function ()
if instance then 248 251 if instance then
instance:hide() 249 252 instance:hide()
instance = nil 250 253 instance = nil
else 251 254 else
instance = awful.menu.clients({ width=250 }) 252 255 instance = awful.menu.clients({ width=250 })
end 253 256 end
end), 254 257 end),
awful.button({ }, 4, function () 255 258 awful.button({ }, 4, function ()
awful.client.focus.byidx(1) 256 259 awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end 257 260 if client.focus then client.focus:raise() end
end), 258 261 end),
awful.button({ }, 5, function () 259 262 awful.button({ }, 5, function ()
awful.client.focus.byidx(-1) 260 263 awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end 261 264 if client.focus then client.focus:raise() end
end)) 262 265 end))
263 266
for s = 1, screen.count() do 264 267 for s = 1, screen.count() do
-- Create a promptbox for each screen 265 268 -- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright }) 266 269 mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using. 267 270 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen. 268 271 -- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s) 269 272 mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join( 270 273 mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), 271 274 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), 272 275 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), 273 276 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) 274 277 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget 275 278 -- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons) 276 279 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
277 280
-- Create a tasklist widget 278 281 -- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c) 279 282 mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s) 280 283 return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons) 281 284 end, mytasklist.buttons)
282 285
-- Create the wibox 283 286 -- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s, height = beautiful.menu_height }) 284 287 mywibox[s] = awful.wibox({ position = "top", screen = s, height = beautiful.menu_height })
-- Add widgets to the wibox - order matters 285 288 -- Add widgets to the wibox - order matters
mywibox[s].widgets = { 286 289 mywibox[s].widgets = {
{ 287 290 {
mylauncher, 288 291 mylauncher,
mytaglist[s], 289 292 mytaglist[s],
mypromptbox[s], 290 293 mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright 291 294 layout = awful.widget.layout.horizontal.leftright
}, 292 295 },
mylayoutbox[s], 293 296 mylayoutbox[s],
mytextclock, 294 297 mytextclock,
separator, 295 298 separator,
space, 296 299 space,
memwidget.widget, 297 300 memwidget.widget,
space, 298 301 space,
separator, 299 302 separator,
space, 300 303 space,
cpuwidget.widget, 301 304 cpuwidget.widget,
space, 302 305 space,
separator, 303 306 separator,
s == 1 and mysystray or nil, --only place the systray on the primary screen 304 307 s == 1 and mysystray or nil, --only place the systray on the primary screen
mytasklist[s], 305 308 mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft 306 309 layout = awful.widget.layout.horizontal.rightleft
} 307 310 }
end 308 311 end
-- }}} 309 312 -- }}}
310 313
311 314
-------------------------------------- 312 315 --------------------------------------
---- Key bindings ---- 313 316 ---- Key bindings ----
-------------------------------------- 314 317 --------------------------------------
315 318
-- {{{ Change workspace on scroll 316 319 -- {{{ Change workspace on scroll
root.buttons(awful.util.table.join( 317 320 root.buttons(awful.util.table.join(
--awful.button({ }, 3, function () mymainmenu:toggle() end), --I dont want a menu when I click on the desktop 318 321 --awful.button({ }, 3, function () mymainmenu:toggle() end), --I dont want a menu when I click on the desktop
awful.button({ }, 4, awful.tag.viewnext), 319 322 awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 320 323 awful.button({ }, 5, awful.tag.viewprev)
)) 321 324 ))
-- }}} 322 325 -- }}}
323 326
324 327
-- {{{ Key bindings 325 328 -- {{{ Key bindings
globalkeys = awful.util.table.join( 326 329 globalkeys = awful.util.table.join(
327 330
--keydoc.group("Layout manipulation"), 328 331 --keydoc.group("Layout manipulation"),
329 332
330 333
--plugins 331 334 --plugins
awful.key({ modkey, }, "e", revelation), 332 335 awful.key({ modkey, }, "e", revelation),
--awful.key({ modkey, }, "F1", keydoc.display), --TODO finish this, needs arg string as last param 333 336 --awful.key({ modkey, }, "F1", keydoc.display), --TODO finish this, needs arg string as last param
334 337
--TODO make work 335 338 --TODO make work
awful.key({}, "XF86Display", xrandr), 336 339 awful.key({}, "XF86Display", xrandr),
337 340
--Conky toggle 338 341 --Conky toggle
awful.key({ }, "Pause", raise_conky, lower_conky), 339 342 awful.key({ }, "Pause", raise_conky, lower_conky),
--awful.key({}, "Pause", toggle_conky) 340 343 --awful.key({}, "Pause", toggle_conky)
341 344
--Move Client to Workspace Left/Right 342 345 --Move Client to Workspace Left/Right
--only works with 3.5, For 3.4 visit link 343 346 --only works with 3.5, For 3.4 visit link
--http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right 344 347 --http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right
awful.key({ modkey, "Shift" }, "Left", 345 348 awful.key({ modkey, "Shift" }, "Left",
function (c) 346 349 function (c)
local curidx = awful.tag.getidx() 347 350 local curidx = awful.tag.getidx()
if curidx == 1 then 348 351 if curidx == 1 then
awful.client.movetotag(tags[client.focus.screen][9]) 349 352 awful.client.movetotag(tags[client.focus.screen][9])
else 350 353 else
awful.client.movetotag(tags[client.focus.screen][curidx - 1]) 351 354 awful.client.movetotag(tags[client.focus.screen][curidx - 1])
end 352 355 end
--awful.tag.viewprev 353 356 --awful.tag.viewprev
end), 354 357 end),
awful.key({ modkey, "Shift" }, "Right", 355 358 awful.key({ modkey, "Shift" }, "Right",
function (c) 356 359 function (c)
local curidx = awful.tag.getidx() 357 360 local curidx = awful.tag.getidx()
if curidx == 9 then 358 361 if curidx == 9 then
awful.client.movetotag(tags[client.focus.screen][1]) 359 362 awful.client.movetotag(tags[client.focus.screen][1])
else 360 363 else
awful.client.movetotag(tags[client.focus.screen][curidx + 1]) 361 364 awful.client.movetotag(tags[client.focus.screen][curidx + 1])
end 362 365 end
--awful.tag.viewnext 363 366 --awful.tag.viewnext
end), 364 367 end),
awful.key({ modkey, }, "Left", awful.tag.viewprev ), 365 368 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ), 366 369 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore), 367 370 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
368 371
awful.key({ modkey, }, "j", 369 372 awful.key({ modkey, }, "j",
function () 370 373 function ()
awful.client.focus.byidx( 1) 371 374 awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end 372 375 if client.focus then client.focus:raise() end
end), 373 376 end),
awful.key({ modkey, }, "k", 374 377 awful.key({ modkey, }, "k",
function () 375 378 function ()
awful.client.focus.byidx(-1) 376 379 awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end 377 380 if client.focus then client.focus:raise() end
end), 378 381 end),
--awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), --we dont like the menu 379 382 --awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), --we dont like the menu
380 383
-- Layout manipulation 381 384 -- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), 382 385 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), 383 386 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), 384 387 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), 385 388 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto), 386 389 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab", 387 390 awful.key({ modkey, }, "Tab",
function () 388 391 function ()
awful.client.focus.history.previous() 389 392 awful.client.focus.history.previous()
if client.focus then 390 393 if client.focus then
client.focus:raise() 391 394 client.focus:raise()
end 392 395 end
end), 393 396 end),
394 397
-- Standard program 395 398 -- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), 396 399 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, }, "w", function () awful.util.spawn(web_browser) end), --hotkey to start web-browser 397 400 awful.key({ modkey, }, "w", function () awful.util.spawn(web_browser) end), --hotkey to start web-browser
awful.key({ modkey, }, "f", function () awful.util.spawn(file_manager) end), --hotkey to start my file manager 398 401 awful.key({ modkey, }, "f", function () awful.util.spawn(file_manager) end), --hotkey to start my file manager
awful.key({ modkey, "Control" }, "l", function () awful.util.spawn(lock_command) end), --lock screen 399 402 awful.key({ modkey, "Control" }, "l", function () awful.util.spawn(lock_command) end), --lock screen
awful.key({ modkey, "Control" }, "r", awesome.restart), 400 403 awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit), 401 404 awful.key({ modkey, "Shift" }, "q", awesome.quit),
402 405
-- Standard program 403 406 -- Standard program
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), 404 407 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), 405 408 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), 406 409 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), 407 410 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), 408 411 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), 409 412 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), 410 413 awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), 411 414 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
412 415
awful.key({ modkey, "Control" }, "n", awful.client.restore), 413 416 awful.key({ modkey, "Control" }, "n", awful.client.restore),
414 417
-- Prompt 415 418 -- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), 416 419 awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
417 420
awful.key({ modkey }, "x", 418 421 awful.key({ modkey }, "x",
function () 419 422 function ()
awful.prompt.run({ prompt = "Run Lua code: " }, 420 423 awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget, 421 424 mypromptbox[mouse.screen].widget,
awful.util.eval, nil, 422 425 awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval") 423 426 awful.util.getdir("cache") .. "/history_eval")
end) 424 427 end)
) 425 428 )
426 429
427 430
-- Compute the maximum number of digit we need, limited to 9 428 431 -- Compute the maximum number of digit we need, limited to 9
keynumber = 0 429 432 keynumber = 0
for s = 1, screen.count() do 430 433 for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber)); 431 434 keynumber = math.min(9, math.max(#tags[s], keynumber));
end 432 435 end
433 436
-- Bind all key numbers to tags. 434 437 -- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout. 435 438 -- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9. 436 439 -- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do 437 440 for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys, 438 441 globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9, 439 442 awful.key({ modkey }, "#" .. i + 9,
function () 440 443 function ()
local screen = mouse.screen 441 444 local screen = mouse.screen
if tags[screen][i] then 442 445 if tags[screen][i] then
awful.tag.viewonly(tags[screen][i]) 443 446 awful.tag.viewonly(tags[screen][i])
end 444 447 end
end), 445 448 end),
awful.key({ modkey, "Control" }, "#" .. i + 9, 446 449 awful.key({ modkey, "Control" }, "#" .. i + 9,
function () 447 450 function ()
local screen = mouse.screen 448 451 local screen = mouse.screen
if tags[screen][i] then 449 452 if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i]) 450 453 awful.tag.viewtoggle(tags[screen][i])
end 451 454 end
end), 452 455 end),
awful.key({ modkey, "Shift" }, "#" .. i + 9, 453 456 awful.key({ modkey, "Shift" }, "#" .. i + 9,
function () 454 457 function ()
if client.focus and tags[client.focus.screen][i] then 455 458 if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i]) 456 459 awful.client.movetotag(tags[client.focus.screen][i])
end 457 460 end
end), 458 461 end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, 459 462 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function () 460 463 function ()
if client.focus and tags[client.focus.screen][i] then 461 464 if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i]) 462 465 awful.client.toggletag(tags[client.focus.screen][i])
end 463 466 end
end)) 464 467 end))
end 465 468 end
466 469
clientbuttons = awful.util.table.join( 467 470 clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end), 468 471 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move), 469 472 awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize)) 470 473 awful.button({ modkey }, 3, awful.mouse.client.resize))
471 474
-- Set keys 472 475 -- Set keys
root.keys(globalkeys) 473 476 root.keys(globalkeys)
-- }}} 474 477 -- }}}
475 478
476 479
-------------------------------------- 477 480 --------------------------------------
--- Rules ---- 478 481 --- Rules ----
-------------------------------------- 479 482 --------------------------------------
480 483
clientkeys = awful.util.table.join( 481 484 clientkeys = awful.util.table.join(
awful.key({ modkey, }, "F11", function (c) c.fullscreen = not c.fullscreen end), 482 485 awful.key({ modkey, }, "F11", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), 483 486 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), 484 487 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), 485 488 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
--awful.key({ modkey, }, "o", awful.client.movetoscreen ), 486 489 --awful.key({ modkey, }, "o", awful.client.movetoscreen ),
--Move Client to Monitor Left/Right 487 490 --Move Client to Monitor Left/Right
awful.key({ modkey, }, "o", function(c) awful.client.movetoscreen(c,c.screen-1) end ), 488 491 awful.key({ modkey, }, "o", function(c) awful.client.movetoscreen(c,c.screen-1) end ),
awful.key({ modkey, }, "p", function(c) awful.client.movetoscreen(c,c.screen+1) end ), 489 492 awful.key({ modkey, }, "p", function(c) awful.client.movetoscreen(c,c.screen+1) end ),
490 493
--awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end), 491 494 --awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), 492 495 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n", 493 496 awful.key({ modkey, }, "n",
function (c) 494 497 function (c)
-- The client currently has the input focus, so it cannot be 495 498 -- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus. 496 499 -- minimized, since minimized clients can't have the focus.
c.minimized = true 497 500 c.minimized = true
end), 498 501 end),
awful.key({ modkey, }, "m", 499 502 awful.key({ modkey, }, "m",
function (c) 500 503 function (c)
c.maximized_horizontal = not c.maximized_horizontal 501 504 c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical 502 505 c.maximized_vertical = not c.maximized_vertical
end) 503 506 end)
) 504 507 )
505 508
-- {{{ Rules 506 509 -- {{{ Rules
awful.rules.rules = { 507 510 awful.rules.rules = {
-- All clients will match this rule. 508 511 -- All clients will match this rule.
{ rule = { }, 509 512 { rule = { },
properties = { border_width = beautiful.border_width, 510 513 properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal, 511 514 border_color = beautiful.border_normal,
focus = true, 512 515 focus = true,
keys = clientkeys, 513 516 keys = clientkeys,
buttons = clientbuttons } }, 514 517 buttons = clientbuttons } },
{ rule = { class = "MPlayer" }, 515 518 { rule = { class = "MPlayer" },
properties = { floating = true } }, 516 519 properties = { floating = true } },
{ rule = { class = "pinentry" }, 517 520 { rule = { class = "pinentry" },
properties = { floating = true } }, 518 521 properties = { floating = true } },
{ rule = { class = "gimp" }, 519 522 { rule = { class = "gimp" },
properties = { floating = true } }, 520 523 properties = { floating = true } },
{ rule = { class = "Conky" }, 521 524 { rule = { class = "Conky" },
properties = { 522 525 properties = {
floating = true, 523 526 floating = true,
sticky = true, 524 527 sticky = true,
ontop = false, 525 528 ontop = false,
focusable = false, 526 529 focusable = false,
size_hints = {"program_position", "program_size"} 527 530 size_hints = {"program_position", "program_size"}
} 528 531 }
} 529 532 }
-- Set Firefox to always map on tags number 2 of screen 1. 530 533 -- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" }, 531 534 -- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } }, 532 535 -- properties = { tag = tags[1][2] } },
} 533 536 }
-- }}} 534 537 -- }}}
535 538