Commit dfb109ed3e62488a87406695727c6a0fd8bcdb55

Authored by Ian Foster
1 parent 15beeca370
Exists in master

braille counting for awesome workspaces

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

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