Commit b35fe0334806c4cb20247ad69e930f05d9c33a4d

Authored by Ian Foster
1 parent 7d8558c903
Exists in master

added awesome screenshot

Showing 1 changed file with 2 additions and 0 deletions Inline Diff

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