1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | -- Useful reusable functions
local tonumber = tonumber
local awful = awful
local naughty = naughty
local timer = timer
local pairs = pairs
local type = type
local table = table
local io = io
local tostring = tostring
local log = log
module("utility")
function run_once(prg, times)
if not prg then
do return nil end
end
times = times or 1
count_prog =
tonumber(awful.util.pread('ps aux | grep "' .. prg .. '" | grep -v grep | wc -l'))
if times > count_prog then
for l = count_prog, times-1 do
awful.util.spawn_with_shell(prg)
end
end
end
function repeat_every(func, seconds)
func()
local t = timer({ timeout = seconds })
t:connect_signal("timeout", func)
t:start()
end
function pop_spaces(s1,s2,maxsize)
local sps = ""
for i = 1, maxsize-string.len(s1)-string.len(s2) do
sps = sps .. " "
end
return s1 .. sps .. s2
end
function append_table(what, to_what, overwrite)
for k, v in pairs(what) do
if type(k) ~= "number" then
if overwrite or not to_what[k] then
to_what[k] = v
end
else
table.insert(to_what, v)
end
end
end
function slurp(file, mode)
local mode = mode or "*all"
local handler = io.open(file, 'r')
local result = handler:read(mode)
handler:close()
return result
end
-- *** Internal calc function *** ---
function calc(result)
naughty.notify( { title = "Awesome calc",
text = "Result: " .. result,
timeout = 5})
end
-- *** Debug pring function *** ---
function nprint(s)
naughty.notify( { title = "Debug print",
text = tostring(s),
timeout = 5})
end
-- *** Expand table debug pring function *** ---
function dprint(s)
naughty.notify( { title = "ETDP",
text = log.d_return("Debug output", s),
timeout = 0})
end
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | local capi = { screen = screen,
mouse = mouse }
local wibox = require("wibox")
module("minitray")
local instance = {}
local function show()
local geom = capi.screen[capi.mouse.screen].workarea
instance.wibox.height = 20
instance.wibox.width = instance.tray.width or 100
instance.wibox:geometry({ x = geom.width - geom.x - instance.wibox.width,
y = geom.y })
instance.wibox.visible = true
end
local function init()
instance.wibox = wibox({})
instance.wibox.ontop = true
instance.layout = wibox.layout.align.horizontal()
instance.tray = wibox.widget.systray()
instance.layout:set_right(instance.tray)
instance.wibox:set_widget(instance.layout)
end
local function hide()
instance.wibox.visible = false
end
function toggle()
if not instance.wibox then
init()
end
if instance.wibox.visible then
hide()
else
show()
end
end
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | -- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Widget and layout library
require("wibox")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Logging library
require("log")
-- Awesome MPD widget
require("awesompd/awesompd")
-- Vicious widget library
require("vicious")
-- Scratchpad
require("scratch")
-- Blingbling widget library
require("blingbling")
-- Menubar
require("menubar")
-- Hideable minitray
require("minitray")
-- Utility
require("utility")
-- Launchbar
require("launchbar")
-- Map useful functions outside
calc = utility.calc
nprint = utility.nprint
dprint = utility.dprint
notify_at = utility.notify_at
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = err })
in_error = false
end)
end
-- }}}
-- Autorun programs
autorun = true
autorunApps =
{
"setxkbmap -layout 'us,ua,ru' -variant ',winkeys,winkeys' -option grp:alt_shift_toggle -option compose:ralt -option terminate:ctrl_alt_bksp",
"kbdd"
}
runOnceApps = {
"emacs --daemon",
"thunderbird",
"mpd",
"xrdb -merge /home/unlogic/.Xresources"
}
if autorun then
for app = 1, #autorunApps do
awful.util.spawn(autorunApps[app])
end
for app = 1, #runOnceApps do
utility.run_once(runOnceApps[app])
end
end
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init(awful.util.getdir("config") .. "/themes/conscience/theme.lua")
beautiful.onscreen.init()
-- This is used later as the default terminal and editor to run.
terminal = "urxvt"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- 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,
-- 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.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.floating, -- 1
awful.layout.suit.tile, -- 2
awful.layout.suit.tile.bottom, -- 3
awful.layout.suit.max -- 4
}
-- }}}
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = awful.tag({ "α", "β", "δ", "λ", "θ", "Ω"}, s, {layouts[1], layouts[4], layouts[2], layouts[1], layouts[1], layouts[1]})
end
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
local mainmenu = { items = {
{ 'awesome', { { "restart", awesome.restart },
{ "quit", awesome.quit } },
beautiful.awesome_icon , width = 300 },
},
theme = { width = 150 } }
mymainmenu = awful.menu(mainmenu)
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- }}}
-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock("%H:%M ")
-- Awesompd widget
musicwidget = awesompd:create()
musicwidget.font = "Liberation Mono"
musicwidget.scrolling = true
musicwidget.output_size = 30
musicwidget.update_interval = 10
musicwidget.path_to_icons = beautiful.icon_dir
musicwidget.debug_mode = true
musicwidget.jamendo_format = awesompd.FORMAT_MP3
musicwidget.show_album_cover = true
musicwidget.browser = "firefox"
musicwidget.mpd_config = "/home/unlogic/.mpdconf"
musicwidget.album_cover_size = 50
musicwidget.ldecorator = "| "
musicwidget.rdecorator = " |"
musicwidget.servers = {
{ server = "localhost",
port = 6600 }
}
musicwidget:register_buttons({ { "", awesompd.MOUSE_LEFT, musicwidget:command_toggle() },
{ "Control", awesompd.MOUSE_SCROLL_UP, musicwidget:command_prev_track() },
{ "Control", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_next_track() },
{ "", awesompd.MOUSE_SCROLL_UP, musicwidget:command_volume_up() },
{ "", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_volume_down() },
{ "", awesompd.MOUSE_RIGHT, musicwidget:command_show_menu() },
{ "", "XF86AudioLowerVolume", musicwidget:command_volume_down() },
{ "", "XF86AudioRaiseVolume", musicwidget:command_volume_up() },
{ modkey, "Pause", musicwidget:command_playpause() } })
musicwidget:run()
-- CPU widget
cpuwidget = wibox.widget.textbox()
vicious.register(cpuwidget, vicious.widgets.cpu,
function (widget, args)
-- infojets.update_cpu(args[1])
if string.len(args[1]) == 1 then
return "☢ " .. args[1] .. "% "
else
return "☢ " .. args[1] .. "% "
end
end)
cpuwidget:buttons(
awful.util.table.join(awful.button({ }, 1,
function ()
awful.util.spawn(terminal .. " -e htop")
end),
awful.button({ }, 3,
function ()
cpuwidget.width = 1
end)))
-- CPU temperature widget
cputempwidget = wibox.widget.textbox()
vicious.register(cputempwidget, vicious.widgets.thermal,
function (widget, args)
-- infojets.update_temp(args[1])
return args[1] .. "°C"
end, 19, "thermal_zone0" )
-- Memory widget
memwidget = wibox.widget.textbox()
vicious.register(memwidget, vicious.widgets.mem,
function (widget, args)
-- infojets.update_ram(args[2], args[4])
return "♻ " ..args[1].."%"
end, 13)
-- Battery widget
batcharge_label = wibox.widget.textbox()
batcharge_label:set_markup("⚡ ")
battery_charge=blingbling.progress_bar.new()
battery_charge:set_height(19)
battery_charge:set_width(13)
battery_charge:set_v_margin(3)
battery_charge:add_value(0.5)
battery_charge:set_show_text(true)
battery_charge:set_horizontal(false)
battery_charge:set_graph_color(beautiful.motive)
battery_charge:set_text_color(beautiful.bg_focus_color)
battery_charge:set_background_text_color("#00000000")
battery_charge:set_label("")
battery_charge.info_path = "/sys/class/power_supply/BAT0/"
function if_battery_present(w)
if not w.info_path then
return false
end
local fr = awful.util.file_readable
return fr(w.info_path .. "status")
and fr(w.info_path .. "energy_now") and fr(w.info_path .. "energy_full")
end
function update_battery(w, readfunc)
local st = readfunc(w.info_path .. "status", "*line")
local ch = readfunc(w.info_path .. "energy_now", "*line")
local max = readfunc(w.info_path .. "energy_full", "*line")
local battery = ch / max
if st:match("Charging") then
w:set_label("▲")
elseif st:match("Discharging") then
w:set_label("▼")
if battery <= 0.1 then
naughty.notify({ title = "Battery Warning"
, text = "Battery low! " .. battery * 100 .."%" .. " left!"
, timeout = 5
, position = "top_right"
})
end
else
w:set_label("")
end
w:add_value(battery)
end
if if_battery_present(battery_charge) then
utility.repeat_every(function ()
update_battery(battery_charge, utility.slurp)
end, 10)
end
-- Quick launch bar widget
launchbar.icon_dirs = { beautiful.icon_dir }
w_launchbar = launchbar.new(awful.util.getdir("config") .. "/launchbar/")
-- Keyboard widget
kbdwidget = wibox.widget.textbox()
kbdwidget:set_markup(" ✡ US")
dbus.request_name("session", "ru.gentoo.kbdd")
dbus.add_match("session", "interface='ru.gentoo.kbdd',member='layoutChanged'")
dbus.connect_signal("ru.gentoo.kbdd", function(...)
local data = {...}
local layout = data[2]
lts = {[0] = "✡ US", [1] = "★ UA", [2] = "☭ RU"}
kbdwidget:set_markup(" " .. lts[layout])
end
)
-- Volume widget
require('blingbling')
volume_label = wibox.widget.textbox()
volume_label:set_markup('♫ ')
my_volume=blingbling.volume.new()
my_volume:set_height(18)
my_volume:set_v_margin(4)
my_volume:set_width(20)
my_volume:update_master()
my_volume:set_master_control()
my_volume:set_bar(true)
my_volume:set_background_graph_color("#444444")--beautiful.bg_focus)
my_volume:set_graph_color(beautiful.motive)--beautiful.fg_normal)
-- Menubar widget
menubar.cache_entries = true
menubar.app_folders = { "/usr/share/applications/" }
menubar.show_categories = true -- Change to false if you want only programs to appear in the menu
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
instance = nil
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 },
{ callback = function()
instance = nil
end})
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Widgets that are aligned to the left
local separator = wibox.widget.textbox()
separator:set_markup(" | ")
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mylauncher)
left_layout:add(mytaglist[s])
left_layout:add(separator) ---
left_layout:add(w_launchbar)
left_layout:add(separator) ---
-- if s == 1 then left_layout:add(wibox.widget.systray()) end
-- left_layout:add(separator) ---
left_layout:add(mypromptbox[s])
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(musicwidget.widget)
right_layout:add(kbdwidget)
right_layout:add(separator)
right_layout:add(cpuwidget)
right_layout:add(cputempwidget)
right_layout:add(separator) ---
right_layout:add(memwidget)
right_layout:add(separator) ---
right_layout:add(volume_label)
right_layout:add(my_volume.widget)
right_layout:add(separator) ---
right_layout:add(batcharge_label)
right_layout:add(battery_charge.widget)
right_layout:add(separator) ---
right_layout:add(mytextclock)
right_layout:add(mylayoutbox[s])
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_middle(mytasklist[s])
layout:set_right(right_layout)
mywibox[s]:set_widget(layout)
end
-- }}}
-- {{{ Mouse bindings
-- root.buttons(awful.util.table.join(
-- awful.button({ }, 3, function () mymainmenu:toggle() end),
-- awful.button({ }, 4, awful.tag.viewnext),
-- awful.button({ }, 5, awful.tag.viewprev)
-- ))
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "p", function() menubar.show() end ),
awful.key({ modkey, "Control" }, "p", function() minitray.toggle() end ),
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Tab", awful.tag.history.restore),
awful.key({ modkey, }, "Up",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "Down",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, }, "Return", function () scratch.drop("urxvt -pe tabbed", "top", "center", 1, 0.5) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
awful.key({ modkey, "Control" }, "n", awful.client.restore),
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/.cache/scrot/'") end),
awful.key({ "Control" }, "Print", function () awful.util.spawn("scrot -s -e 'mv $f ~/.cache/scrot/'") end),
awful.key({ modkey }, "Print", function () awful.util.spawn("scrot -d 5 -e 'mv $f ~/.cache/scrot/'") end),
awful.key({ modkey }, "b", function ()
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
local clients = client.get()
local curtagclients = {}
local tags = screen[mouse.screen]:tags()
for _, c in ipairs(clients) do
for k, t in ipairs(tags) do
if t.selected then
local ctags = c:tags()
for _, v in ipairs(ctags) do
if v == t then
table.insert(curtagclients, c)
end
end
end
end
end
for _, c in ipairs(curtagclients) do
if c.maximized_vertical then
c.maximized_vertical = false
c.maximized_vertical = true
end
end
end),
-- Prompt
awful.key({ modkey }, "r", function ()
local promptbox = mypromptbox[mouse.screen]
awful.prompt.run({ prompt = promptbox.prompt,
bg_cursor = beautiful.bg_focus_color },
promptbox.widget,
function (...)
local result = awful.util.spawn(...)
if type(result) == "string" then
promptbox.widget:set_text(result)
end
end,
awful.completion.shell,
awful.util.getdir("cache") .. "/history")
end),
awful.key({ modkey }, "x", function ()
awful.prompt.run({ prompt = "Run Lua code: ",
bg_cursor = beautiful.bg_focus_color },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end)
)
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, "Control" }, "Return", function (c) scratch.drop.toggle_droppable(c, "urxvt -pe tabbed", "top", "center", 1, 0.5) end),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end
-- Bind all key numbers to tags.
-- 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.
for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i])
end
end),
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end))
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
-- Set keys
musicwidget:append_global_keys()
root.keys(globalkeys)
-- }}}
-- {{{ Rules
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "gimp" },
properties = { floating = true,
tag = tags[1][6]} },
-- Set Firefox to always map on tags number 2 of screen 1.
{ rule = { class = "Firefox" },
properties = { tag = tags[1][2] } },
{ rule = { class = "Chromium-browser" },
properties = { tag = tags[1][2] } },
{ rule = { class = "Iceweasel" },
properties = { tag = tags[1][2] } },
{ rule = { class = "Thunderbird" },
properties = { tag = tags[1][2] } },
{ rule = { class = "Pidgin" },
properties = { tag = tags[1][5],
floating = true } },
{ rule = { class = "Skype" },
properties = { tag = tags[1][5],
floating = true } }
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup)
-- Enable sloppy focus
c:connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
|
x
Notes
Requirements:
* awesome-git (pre-4.0) version
* blingbling (https://github.com/cedlemo/blingbling)
* vicious
* infojets (https://github.com/alexander-yakushev/infojets)
* menubar (https://github.com/alexander-yakushev/menubar)
* awesompd
Yatter said about 12 years ago
blingbling не работает с awesome-git, как делали? Выправляли blingbling?
Yatter said about 12 years ago
blingbling does not work with awesome-git
unlog1c said about 12 years ago
Да, небольшие изменения. Скоро надеюсь их заапрувят в сам blingbling.
xaocon said about 12 years ago
I get complaints about the require(“log”) and require(“menubar”) sections. What are they from? Is it something built in? I’ve just built from the master branch of the git.
jonno85 said about 12 years ago
Hi man, I get complain as well, from the “log” resource and from launchbar.lua and revalation.lua. What do you suggest? Thanks