Hi,
I have an own config, which derived from the original rc.lua but is different
by now.
So use_titlebar does not make sense in my config and is not defined.
I notice another "strange" thing:
- Dialog boxes often do not have a titlebar!
So the awful.client.floating.get is probably not correct for dialogs?
Just for the sake of it, I added my config as attachment.
Greetings,
Nathan
On Wed, Jan 21, 2009 at 03:45:34PM -0500, Evan LeCompte wrote:
> Hmm thats a very clever idea nathan, I HATE dialogue windows that don't
> have their own close button, so having the titlebar on those would be
> quite useful indeed.
>
> do you have use_titlebar = false in your config?
>
> Otherwise I don't know why this doesn't work with those apps, but I will
> try this and test it.
>
> On Wed, Jan 21, 2009 at 3:40 PM, Nathan Huesken
> <[1][email protected]> wrote:
>
> Hi,
>
> In my config, I have this function to enable titlebar for floating
> clients and disable it for non-floating clients:
>
> function set_floating_props(c)
> if awful.client.floating.get(c) then
> awful.titlebar.add(c, {modkey = "Mod1"} )
> else
> awful.titlebar.remove(c)
> end
> end
>
> Then I have a key which changes the floating state via:
>
> function client_floating_toggle(c)
> awful.client.floating.toggle(c)
> set_floating_props(c)
> end
>
> And the set_floating props is also called when a new client appears (in
> the manage_hook).
> This works most of the time, except for 2 applications, these are
> firefox and soffice (openoffice).
>
> - These application have a titlebar when they start.
> - They can not be moved or rezised.
> - The client_floating_toggle function has no effect on them
> - They are always "fullscreen", and not integrated in the tile-layout
>
> Is this a bug? What could be wrong?
> Thanks!
> Nathan
> --
> To unsubscribe, send mail to [2][email protected].
>
-- Standard awesome library
require("awful")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
require("revelation")
require("wicked")
require("lfs")
globalkeys = {}
clientkeys = {}
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
-- The default is a dark theme
theme_path = "/home/ls/.config/awesome/default"
-- Uncommment this for a lighter theme
-- theme_path = "/usr/share/awesome/themes/sky/theme"
-- Actually load theme
beautiful.init(theme_path)
-- 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
function execute_command(command)
local fh = io.popen(command)
local str = ""
for i in fh:lines() do
str = str .. i
end
io.close(fh)
return str
end
-- 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.tile,
-- awful.layout.suit.tile.left,
-- awful.layout.suit.tile.bottom,
-- awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.max,
-- awful.layout.suit.max.fullscreen,
-- awful.layout.suit.magnifier,
-- awful.layout.suit.floating
}
-- Table of clients that should be set floating. The index may be either
-- the application class or instance. The instance is useful when running
-- a console app in a terminal like (Music on Console)
-- xterm -name mocp -e mocp
floatapps =
{
-- by class
["MPlayer"] = true,
["gimp"] = true,
-- by instance
["mocp"] = true
}
-- Applications to be moved to a pre-defined tag by class or instance.
-- Use the screen and tags indices.
apptags =
{
-- ["Firefox"] = { screen = 1, tag = 2 },
-- ["mocp"] = { screen = 2, tag = 4 },
}
-- Define if we want to use titlebar on all applications.
use_titlebar = true
-- }}}
-- {{{ Tags
-- Define tags table.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = {}
-- Create 9 tags per screen.
for tagnumber = 1, 9 do
tags[s][tagnumber] = tag(tagnumber)
-- Add tags to screen one by one
tags[s][tagnumber].screen = s
--Add keys for tag
table.insert(globalkeys,
key({ "Mod1" }, "F"..tagnumber,
function ()
local screen =
mouse.screen
if
tags[screen][tagnumber] then
awful.tag.viewonly(tags[screen][tagnumber])
end
end))
table.insert(globalkeys,
key({ "Mod1", "Control" },
"F"..tagnumber,
function ()
local screen =
mouse.screen
if
tags[screen][tagnumber] then
tags[screen][tagnumber].selected = not tags[screen][tagnumber].selected
end
end))
table.insert(globalkeys,
key({ "Mod1", "Shift" },
"F"..tagnumber,
function ()
if client.focus and
tags[client.focus.screen][tagnumber] then
awful.client.movetotag(tags[client.focus.screen][tagnumber])
end
end))
table.insert(globalkeys,
key({ "Mod1", "Control", "Shift" },
"F"..tagnumber,
function ()
if client.focus and
tags[client.focus.screen][tagnumber] then
awful.client.toggletag(tags[client.focus.screen][tagnumber])
end
end))
end
-- I'm sure you want to see at least one tag.
tags[s][1].selected = true
end
-- }}}
-- {{{ Wibox
-- Create a textbox widget
mytextbox = widget({ type = "textbox", align = "right" })
-- Create a keychaintextbox widget
keychaintextbox = widget({ type = "textbox", align = "right" })
keychaintextbox.text="-----"
-- Set the default text in textbox
mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>"
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") ..
"/rc.lua" },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
}
mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu,
beautiful.awesome_icon },
{ "open
terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu
= mymainmenu })
-- Create a systray
mysystray = widget({ type = "systray", align = "right" })
--------------------------- WIDGETS ------------------------------
function setFg(fg,s)
return "<span color=\"" .. fg .. "\">" .. s .."</span>"
end
-- eMail widget
mailtextbox = widget({ type = "textbox", align = "right"})
num_mails= "0"
function update_mailcount()
num_mails=execute_command("find /home/ls/Maildir/ -type d -name \"new\"
-exec ls '{}' \\; | wc -l")
end
function update_mailwidget()
if num_mails == "0" then
mailtextbox.text = setFg("white","Mails: ") .. "0"
else
if os.time() % 2 == 0 then
mailtextbox.text = setFg("white","Mails: ") ..
setFg("green",num_mails)
else
mailtextbox.text = setFg("white","Mails: ") ..
setFg("white",num_mails)
end
end
end
awful.hooks.timer.register(10,update_mailcount)
awful.hooks.timer.register(1,update_mailwidget)
update_mailcount()
update_mailwidget()
email_notify=nil
email_notify_time=nil
function show_new_mails()
update_mailcount()
update_mailwidget()
if email_notify and email_notify_time then
if os.time() < email_notify_time + 20 then
naughty.destroy(email_notify)
email_notify_time=nil
return
end
end
if num_mails=="0" then
return
end
--
-- return
-- end
local text=""
local first_file
first_file=true
--Search other directories
for mailbox in lfs.dir("/home/ls/Maildir") do
first_file=true
if mailbox ~= "." and mailbox ~= ".." then
for email in lfs.dir("/home/ls/Maildir/" .. mailbox .. "/new")
do
if email ~= "." and email ~= ".." then
if first_file==true then
text=text .. "\n" .. setFg("yellow",mailbox)
..":\n------------\n"
first_file=false
end
text=text .. setFg("blue","From:") ..
setFg("white",awful.util.escape(execute_command("cat /home/ls/Maildir/" ..
mailbox .. "/new/" .. email .. "| /usr/bin/822field from"))) ..'\n'
text=text .. setFg("red","Sub:") ..
setFg("white",awful.util.escape(execute_command("cat /home/ls/Maildir/" ..
mailbox .. "/new/" .. email .. "| /usr/bin/822field subject"))) ..'\n'
end
end
end
end
text=text ..'\n'
email_notify=naughty.notify({text=text,timeout=20,width=600})
email_notify_time=os.time()
end
mailtextbox:buttons({
button({}, 1, show_new_mails)
})
-- Volume widget
cardid = 0
channel = "Master"
function volume (mode, widget)
if mode == "update" then
local fd = io.popen("amixer -c " .. cardid .. " -- sget " .. channel)
local status = fd:read("*all")
fd:close()
local volume = string.match(status, "(%d?%d?%d)%%")
volume = string.format("% 3d", volume)
status = string.match(status, "%[(o[^%]]*)%]")
if string.find(status, "on", 1, true) then
volume = setFg("white","Vol: ") .. setFg("green",volume) .. "%"
else
volume = setFg("white","Vol: ") .. setFg("red",volume) .. "%"
end
widget.text = volume
elseif mode == "up" then
execute_command("amixer -q -c " .. cardid .. " sset " .. channel .. "
5%+")
volume("update",widget)
elseif mode == "down" then
execute_command("amixer -q -c " .. cardid .. " sset " .. channel .. "
5%-")
volume("update",widget)
else
execute_command("amixer -q -c " .. cardid .. " sset " .. channel .. "
toggle")
volume("update",widget)
end
end
tb_volume = widget({ type = "textbox", name = "tb_volume", align = "right"} )
tb_volume:buttons({
button({}, 4, function() volume("up",
tb_volume) end),
button({}, 5, function()
volume("down", tb_volume) end),
button({}, 1, function()
volume("mute", tb_volume) end)
})
awful.hooks.timer.register(10, function () volume("update", tb_volume) end)
volume("update",tb_volume)
-- Battery widget
batterywidget = widget({type = "textbox", name = "batterywidget", align =
"right" })
function batteryInfo()
local fcur = io.open("/sys/class/power_supply/BAT0/energy_now")
local fcap = io.open("/sys/class/power_supply/BAT0/energy_full")
local fsta = io.open("/sys/class/power_supply/AC/online")
local cur = fcur:read()
local cap = fcap:read()
local sta = fsta:read()
local battery = math.floor(cur * 100 / cap)
local text;
if battery <= 10 then
text = setFg("red",battery) .. "%"
elseif battery <=50 then
text = setFg("yellow",battery) .. "%"
else
text = setFg("green",battery) .. "%"
end
if sta=="1" then
text = setFg("white","A/C: ") .. text .. "("..setFg("blue","↑")..")"
else
text = setFg("white","BAT: ") .. text .. "("..setFg("orange","↓")..")"
end
batterywidget.text=text
fcur:close()
fcap:close()
fsta:close()
end
awful.hooks.timer.register(5, function()
batteryInfo()
end)
batteryInfo()
--- WLAN
function exists(n)
local f=io.open(n)
if f==nil then
return false
else
io.close(f)
return true
end
end
wlanwidget = widget({ type = "textbox", name = "wlanwidget", align = "right"} )
function wlanInfo()
local fqual = io.open("/sys/class/net/wlan0/wireless/link")
local qual = fqual:read()
fqual:close()
qual=qual*1
local essid=execute_command("echo `/usr/sbin/iwconfig wlan0 | sed -n -e
's/.*ESSID:\"\\([^\"]*\\)\"/ \\1/p'`")
text=setFg("#ff00ff",essid) ..": "
if exists("/tmp/wlan-working")==true then
text=setFg("white","WLAN ") .. setFg("yellow","working...")
else
if qual==0 then
text=setFg("#ff8888","No wlan")
else
if qual>70 then
text=text .. setFg("green",qual)
elseif qual>30 then
text = text .. setFg("yellow",qual)
else
text = text .. setFg("red",qual)
end
end
end
text=text .."%"
wlanwidget.text=text
end
awful.hooks.timer.register(1, function()
wlanInfo()
end)
wlanInfo()
-- Keyboard layout widget
keyboard_layout = widget({type="textbox", name = "keyboard_layout", align
="right"})
current_layout=nil
function set_keyboard_layout(layout)
if layout== "toggle" then
if current_layout=="us+" then
set_keyboard_layout("de")
else
set_keyboard_layout("us+")
end
end
if layout=="de" then
keyboard_layout.text=setFg("red","D") .. setFg("yellow","E")
awful.util.spawn("/usr/bin/setxkbmap de nodeadkeys")
current_layout="de"
end
if layout=="us+" then
keyboard_layout.text=setFg("blue","U") .. setFg("white","S") ..
setFg("red","+")
awful.util.spawn("/usr/bin/setxkbmap us && /usr/bin/xmodmap
/home/ls/.Xmodmap")
current_layout="us+"
end
end
set_keyboard_layout("us+")
keyboard_layout:buttons({
button({}, 1, function()
set_keyboard_layout("toggle") end)
})
spacer = widget({ type = "textbox", name = "spacer", align = "right"} )
spacer.text=" ][ "
------------------------------------------------------------------
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = { button({ }, 1, awful.tag.viewonly),
button({ modkey }, 1, awful.client.movetotag),
button({ }, 3, function (tag) tag.selected = not tag.selected end),
button({ modkey }, 3, awful.client.toggletag),
button({ }, 4, awful.tag.viewnext),
button({ }, 5, awful.tag.viewprev) }
mytasklist = {}
mytasklist.buttons = { button({ }, 1, function (c) client.focus = c; c:raise()
end),
button({ }, 3, function () awful.menu.clients({ width=250 }) end),
button({ }, 4, function () awful.client.focus.byidx(1) end),
button({ }, 5, function () awful.client.focus.byidx(-1) end) }
draw_urgent_background=true
function label_func(t, args)
if not args then args = {} end
local theme = beautiful.get()
local fg_focus = args.fg_focus or theme.taglist_fg_focus or theme.fg_focus
local bg_focus = args.bg_focus or theme.taglist_bg_focus or theme.bg_focus
local fg_normal = args.fg_normal or theme.taglist_fg_normal or
theme.fg_normal
local bg_normal = args.bg_normal or theme.taglist_bg_normal or
theme.bg_normal
local fg_empty = args.fg_empty or theme.taglist_fg_empty
local bg_empty = args.bg_empty or theme.taglist_bg_empty
local fg_urgent = args.fg_urgent or theme.taglist_fg_urgent or
theme.fg_urgent
local bg_urgent = args.bg_urgent or theme.taglist_bg_urgent or
theme.bg_urgent
local font = args.font or theme.taglist_font or theme.font or ""
local text = "<span font_desc='"..font.."'> "
local sel = client.focus
local bg_color = bg_empty
local fg_color = fg_empty
local bg_image
-- local bg_resize = false
if t.selected then
bg_image = image("/home/ls/.config/awesome/focus_back.png")
end
for k,c in pairs(t:clients()) do
fg_color=fg_normal
bg_color=bg_normal
if c.urgent then
if draw_urgent_background==true then
if bg_urgent then bg_color = bg_urgent end
if fg_urgent then fg_color = fg_urgent end
end
break
end
end
if fg_color then
text = text .. "<span
color='"..awful.util.color_strip_alpha(fg_color).."'>"..awful.util.escape(t.name)
.. "</span>"
else
text = text .. awful.util.escape(t.name)
end
text = text .. " </span>"
return text, bg_color, bg_image, t.icon
end
awful.hooks.timer.register(0.5,
function()
c=awful.client.urgent.get()
if c then
awful.hooks.user.call('property', client.focus, 'urgent')
draw_urgent_background = not draw_urgent_background
else
draw_urgent_background=true
end
end)
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = widget({ type = "textbox", align = "left" })
-- Create an imagebox widget which will contains an icon indicating which
layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = widget({ type = "imagebox", align = "right" })
mylayoutbox[s]:buttons({ button({ }, 1, function ()
awful.layout.inc(layouts, 1) end),
button({ }, 3, function ()
awful.layout.inc(layouts, -1) end),
button({ }, 4, function ()
awful.layout.inc(layouts, 1) end),
button({ }, 5, function ()
awful.layout.inc(layouts, -1) end) })
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist.new(s, label_func, mytaglist.buttons)
-- mytaglist[s] = awful.widget.taglist.new(s,
awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist.new(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons)
-- Create the wibox
mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg =
beautiful.bg_normal })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = { mylauncher,
mytaglist[s],
mytasklist[s],
mypromptbox[s],
wlanwidget,
spacer,
batterywidget,
spacer,
tb_volume,
spacer,
mailtextbox,
spacer,
keychaintextbox,
spacer,
keyboard_layout,
spacer,
mytextbox,
s == 1 and mysystray or nil,
mylayoutbox[s]}
mywibox[s].screen = s
end
-- }}}
-- {{{ Key bindings
table.insert(globalkeys,
key({ "Mod1" }, "Escape", awful.tag.history.restore))
table.insert(globalkeys,
key({ "Mod1" }, "Tab", function()
awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end))
-- Standard program
table.insert(globalkeys,key({ "Mod1" }, "Return", function ()
awful.util.spawn(terminal) end))
-- Set titlebar and similar for floating client
function set_floating_props(c)
if awful.client.floating.get(c) then
awful.titlebar.add(c, {modkey = "Mod1"} )
-- awful.placement.no_offscreen(c)
else
awful.titlebar.remove(c)
end
end
-- toggle floating of a client
function client_floating_toggle(c)
awful.client.floating.toggle(c)
set_floating_props(c)
end
-- some keychains, which can be reseted
ctrl_x_pos=nil
function reset_keychain(c)
-- remove the text
keychaintextbox.text="-----"
if not (ctrl_x_pos) then
table.insert(globalkeys,key({ "Control" }, "x", keychain_ctrl_x_add))
ctrl_x_pos=#globalkeys
end
-- no client, then we are done
if not c then
root.keys(globalkeys)
return
end
-- if we are emacs, remove it agin
if (string.lower(c.class)== "emacs" or string.lower(c.class)== "urxvt") then
keychaintextbox.text="OFF"
table.remove(globalkeys,ctrl_x_pos)
ctrl_x_pos=nil
root.keys(globalkeys)
return
end
root.keys(globalkeys)
end
--Universal Ctrl-x Ctrl-c close window
function ctrl_x_function(modifier,key,r)
if r == "press" then
if key == "c" then
if modifier.Control then
client.focus:kill()
end
end
reset_keychain(client.focus)
return false
end
return true
end
-- Alt-] as starting key combination
key_notification=nil
function alt_paranthese_function(modifier, key,r)
if r == "press" then
-- reset box
reset_keychain(client.focus)
naughty.destroy(key_notification)
-- No cobinations with modifier
if #modifier > 0 then
return false
end
-- test our key
if key=="r" then
mypromptbox[mouse.screen].text =
awful.util.escape(awful.util.restart())
end
if key=="q" then
awesome.quit()
end
if key == "f" then
client_floating_toggle(client.focus)
end
if key == "e" then
show_new_mails()
end
if key == "a" then
volume("mute",tb_volume)
end
if key == "1" then
end
if key == "d" then
set_keyboard_layout("de")
end
if key == "u" then
set_keyboard_layout("us+")
end
if key=="t" then
awful.util.spawn("emacs -Q --load
/home/ls/common/configs/emacs/.emacs-basic /home/ls/common/todo")
end
if key=="m" then
awful.util.spawn("urxvt -e mutt")
end
if key=="1" then
awful.layout.set(awful.layout.suit.max)
end
if key=="2" then
awful.layout.set(awful.layout.suit.tile)
end
if key=="3" then
awful.layout.set(awful.layout.suit.fair.horizontal)
end
if key=="4" then
awful.layout.set(awful.layout.suit.fair)
end
return false
end
return true
end
function keychain_alt_parantese_add()
local text
local title=setFg("red","Keys") .. ":\n-----------"
local color="white"
local title_color="yellow"
text=setFg(title_color,"General:")
text=text .. "\n" .. setFg(color,"e") .. ":\tShow new eMails"
text=text .. "\n" .. setFg(color,"a") .. ":\tToggle audio mute"
text=text .. "\n" .. setFg(color,"f") .. ":\tToggle floating of focused
window"
text=text .. "\n" .. setFg(color,"r") .. ":\tRestart awesome"
text=text .. "\n" .. setFg(color,"q") .. ":\tQuit awesome"
text=text .. "\n"
text=text .. setFg(title_color,"Keymap:")
text=text .. "\n" .. setFg(color,"u") .. ":\tus keymap with Nathans
extras"
text=text .. "\n" .. setFg(color,"d") .. ":\tgerman keymap"
text=text .. "\n"
text=text .. setFg(title_color,"Actions:")
text=text .. "\n" .. setFg(color,"t") .. ":\tedit todo file"
text=text .. "\n" .. setFg(color,"m") .. ":\trun mutt"
text=text .. "\n"
text=text .. setFg(title_color,"Layout:")
text=text .. "\n" .. setFg(color,"1") .. ":\tmaximized"
text=text .. "\n" .. setFg(color,"2") .. ":\ttiled"
text=text .. "\n" .. setFg(color,"3") .. ":\tfair horizontal"
text=text .. "\n" .. setFg(color,"4") .. ":\tfair vertical"
text=text .. "\n"
key_notification=naughty.notify({title=title,text=text,timeout=0})
keychaintextbox.text="<span bgcolor=\"red\" color=\"green\">Alt-] </span> "
keygrabber.run(alt_paranthese_function)
end
table.insert(globalkeys,key({ "Mod1" }, "bracketright",
keychain_alt_parantese_add))
function keychain_ctrl_x_add()
keychaintextbox.text="<span bgcolor=\"red\" color=\"green\">Ctrl-x</span> "
keygrabber.run(ctrl_x_function)
end
-- Prompt
table.insert(globalkeys,
key({ "Mod1" }, "p", function ()
awful.prompt.run({ prompt = "<span color=\"yellow\">Run: </span>" },
mypromptbox[mouse.screen],
awful.util.spawn, awful.completion.bash,
awful.util.getdir("cache") .. "/history")
end))
table.insert(globalkeys,
key({ modkey, "Ctrl" }, "i", function ()
local s = mouse.screen
if mypromptbox[s].text then
mypromptbox[s].text = nil
elseif client.focus then
mypromptbox[s].text = nil
if client.focus.class then
mypromptbox[s].text = "Class: " .. client.focus.class .. " "
end
if client.focus.instance then
mypromptbox[s].text = mypromptbox[s].text .. "Instance: "..
client.focus.instance .. " "
end
if client.focus.role then
mypromptbox[s].text = mypromptbox[s].text .. "Role: "..
client.focus.role
end
end
end))
-- }}}
-- {{{ Hooks
-- Hook function to execute when focusing a client.
awful.hooks.focus.register(function (c)
reset_keychain(c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_focus
end
end)
-- Hook function to execute when unfocusing a client.
awful.hooks.unfocus.register(function (c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_normal
end
end)
-- Hook function to execute when marking a client
awful.hooks.marked.register(function (c)
c.border_color = beautiful.border_marked
end)
-- Hook function to execute when unmarking a client.
awful.hooks.unmarked.register(function (c)
c.border_color = beautiful.border_focus
end)
-- Hook function to execute when the mouse enters a client.
awful.hooks.mouse_enter.register(function (c)
end)
-- Hook function to execute when a new client appears.
awful.hooks.manage.register(function (c)
-- Add mouse bindings
c:buttons({
button({ }, 1, function (c) client.focus = c; c:raise() end),
button({ "Mod1" }, 1, awful.mouse.client.move),
button({ "Mod1" }, 3, awful.mouse.client.resize)
})
-- New client may not receive focus
-- if they're not focusable, so set border anyway.
c.border_width = beautiful.border_width
c.border_color = beautiful.border_normal
-- Check if the application should be floating.
local cls = c.class
local inst = c.instance
if floatapps[cls] then
awful.client.floating.set(cls, floatapps[cls])
awful.titlebar.add(c, { modkey = "Mod1" })
elseif floatapps[inst] then
awful.client.floating.set(cls, floatapps[inst])
awful.titlebar.add(c, { modkey = "Mod1" })
end
set_floating_props(c)
-- Check application->screen/tag mappings.
local target
if apptags[cls] then
target = apptags[cls]
elseif apptags[inst] then
target = apptags[inst]
end
if target then
c.screen = target.screen
awful.client.movetotag(tags[target.screen][target.tag], c)
end
-- Do this after tag mapping, so you don't see it on the wrong tag for a
split second.
client.focus = c
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Honor size hints: if you want to drop the gaps between windows, set this
to false.
-- c.size_hints_honor = false
end)
-- Hook function to execute when arranging the screen.
-- (tag switch, new client, etc)
awful.hooks.arrange.register(function (screen)
local layout = awful.layout.getname(awful.layout.get(screen))
if layout and beautiful["layout_" ..layout] then
mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
else
mylayoutbox[screen].image = nil
end
-- Give focus to the latest client in history if no window has focus
-- or if the current window is a desktop or a dock one.
if not client.focus then
local c = awful.client.focus.history.get(screen, 0)
if c then
client.focus = c
else
c=awful.client.visible(mouse.screen)[1]
if c then
client.focus = c
end
end
end
end)
-- Hook called every second
awful.hooks.timer.register(1, function ()
-- For unix time_t lovers
mytextbox.text = "<span color=\"white\">" .. os.date("%H:%M") .. "</span>"
.. " <span color=\"yellow\">" .. os.date("(%d/%m)") .. "</span>"
-- Otherwise use:
-- mytextbox.text = " " .. os.date() .. " "
-- Let the taglist blink
-- c=awful.client.urgent.get()
-- c=client.focus
-- client.focus=c
-- c:raise()
-- awful.hooks.user.call('mark',client.focus)
end)
-- }}}
-- Set keys
root.keys(globalkeys)