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