Temp update of awesome.

master
Ambrevar 2012-12-31 11:21:18 +01:00
parent 08408cc3d8
commit cb8301f2f4
1 changed files with 85 additions and 43 deletions

View File

@ -8,16 +8,17 @@ local f = io.popen("uname")
local ostype = f:read("*l")
f:close()
-- Standard awesome library
require("awful")
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
require("awful.rules")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
require("beautiful")
local beautiful = require("beautiful")
-- Notification library
require("naughty")
local naughty = require("naughty")
-- local menubar = require("menubar")
-- Widget library
--naughty.notify({ preset = naughty.config.presets.critical,
@ -42,7 +43,7 @@ end
-- Handle runtime errors after startup
do
local in_error = false
awesome.add_signal("debug::error",
awesome.connect_signal("debug::error",
function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
@ -62,6 +63,14 @@ end
-- beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua")
beautiful.init(awful.util.getdir("config") .. "/themes/custom/theme.lua")
-- {{{ Wallpaper
-- if beautiful.wallpaper then
-- for s = 1, screen.count() do
-- gears.wallpaper.maximized(beautiful.wallpaper, s, true)
-- end
-- end
-- }}}
--------------------------------------------------------------------------------
-- Misc
--------------------------------------------------------------------------------
@ -98,19 +107,19 @@ end
-- Separator
separator = " | "
separator_date = widget({ type = "textbox" })
separator_date.text = " |"
separator_date = wibox.widget.textbox()
separator_date:set_text(" |")
-- Systray
systraywidget = widget({ type = "systray" })
systraywidget = wibox.widget.systray()
-- Clock
clockwidget = awful.widget.textclock({ align = "right" })
clockwidget = wibox.widget.textclock({ align = "right" })
cpuwidget = widget({ type = "textbox" })
netwidget = widget({ type = "textbox" })
volmwidget = widget({ type = "textbox" })
batwidget = widget({ type = "textbox" })
cpuwidget = wibox.widget.textbox()
netwidget = wibox.widget.textbox()
volmwidget = wibox.widget.textbox()
batwidget = wibox.widget.textbox()
if ostype == "Linux" then
@ -138,7 +147,7 @@ if ostype == "Linux" then
local volpl = volpf:read("*a")
volpf:close()
if volpl ~= "" then
volpwidget = widget({ type = "textbox" })
volpwidget = wibox.widget.textbox()
vicious.register(volpwidget, vicious.widgets.volume, "PCM $1%", 1, "PCM")
end
@ -238,9 +247,7 @@ for s = 1, screen.count() do
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons)
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
@ -588,30 +595,65 @@ awful.rules.rules = {
--------------------------------------------------------------------------------
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
-- Add a titlebar
-- awful.titlebar.add(c, { modkey = modkey })
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)
-- Enable sloppy focus
c:add_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)
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
-- 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)
local titlebars_enabled = false
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(awful.titlebar.widget.iconwidget(c))
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(awful.titlebar.widget.floatingbutton(c))
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
right_layout:add(awful.titlebar.widget.stickybutton(c))
right_layout:add(awful.titlebar.widget.ontopbutton(c))
right_layout:add(awful.titlebar.widget.closebutton(c))
-- The title goes in the middle
local title = awful.titlebar.widget.titlewidget(c)
title:buttons(awful.util.table.join(
awful.button({ }, 1, function()
client.focus = c
c:raise()
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
client.focus = c
c:raise()
awful.mouse.client.resize(c)
end)
))
-- Now bring it all together
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_right(right_layout)
layout:set_middle(title)
awful.titlebar(c):set_widget(layout)
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)