Commit 50fbe5701688fe6d94ce16371053099c4c168342

Authored by Ian Foster
1 parent d9a3c0e698
Exists in master

hotkey arandr

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

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