You are not logged in.

#1 2008-09-04 14:24:08

filou.linux
Member
From: Zurich
Registered: 2008-04-17
Posts: 87

[SOLVED] Upgrading from Awesome 2.3 to Awesome 3: Config

Hi.

I wanted to upgrade from awesome 2.3 to the newer version 3. Once again the configuration changed completely. Originally the reason why I chose awesome was that it didn't require you to learn lua to configure it (as Ion3 did). Nevertheless I wanted to do the step and so I began reading into the Awesome-Wiki and looking at other configuration files. It came out that with a bit of effort it wasn't that difficult to get a good result. At this point I really want to thank GGLucas for his almost perfect rc.lua (Dude, you're great!!! Your keybindings rock as well!)!

I really got most of the things done I wanted, and it works great. But there are some details that I didn't figure out how to get them working, probably one of you guys has an idea:

xcompmgr
I really liked the integration of the xcompmgr in awesome to make non focused clients transparent. I didn't found the method in the awful module to set the opacity.

Font Shadow
In the Styles section there was an option to set a shadow for the Fonts in awesome. The manpages state that this option is there, but I don't know how to apply it. I didn't see any examples in other config files, neither in the "theme"-files for beautiful.

That's it so far. I really like awesome 3, and I'll keep on using it... whether I get this to work or not. It just would be nice, and I hope that others can profit as well.
Thanks in advance (and speacial thanks to GGLucas).

Last edited by filou.linux (2008-10-16 14:52:31)

Offline

#2 2008-09-05 16:03:34

filou.linux
Member
From: Zurich
Registered: 2008-04-17
Posts: 87

Re: [SOLVED] Upgrading from Awesome 2.3 to Awesome 3: Config

Okay I figured some things out... but still not everything.

Font Shadow
After reading the manpage again and again I tried some things out. In the markup section of GGLucas rc.lua you need to change the fg method to that:

function beautiful.markup.fg(color, text)
--    return '<span color="'..color..'">'..text..'</span>'
    return '<text shadow="'..beautiful.shadow..'" shadow_offset="'..beautiful.shadow_offset..'">'..text..'</text>'
end

However it doesn't apply shadows to all Texts in awesome. For some widgets it was easy to apply (like the clock). But I couldn't figure out how to apply the shadow to the taglist. Is there no way to apply a shadow generally?

xcompmgr
Still no progress here

Probably someone has an idea. I'd really appreciate. Thanks in advance!

Last edited by filou.linux (2008-09-05 16:03:55)

Offline

#3 2008-09-05 16:32:44

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: [SOLVED] Upgrading from Awesome 2.3 to Awesome 3: Config

I would ask someone in the awesome IRC chat. It seems like an easy enough question that someone there is bound to know.

Offline

#4 2008-09-08 16:05:30

filou.linux
Member
From: Zurich
Registered: 2008-04-17
Posts: 87

Re: [SOLVED] Upgrading from Awesome 2.3 to Awesome 3: Config

Wooohooo, I'm getting closer big_smile

After asking in the IRC Channel (Special thanks to Possum) and reading through the API Doc again I was able to solve the xcompmgr problem.

xcompmgr
In the API Documentation I found a Client Attribute called "opacity". Could it be any more obvious? After I found out about that, the rest was easy. Just add the Lines into the focus and unfocus hooks:

-- {{{ Focus hook
awful.hooks.focus.register(function (c)

    -- Skip over my urxvtcnotify
    if c.name and c.name:lower():find('urxvtcnotify') and awful.client.next(1) ~= c then
        awful.client.focusbyidx(1)
        return
    end

    -- Set border
    c.border_color = beautiful.border_focus
    c.opacity = 1

    -- Raise the client
    c:raise()

    -- Set statusbar color
    if settings.statusbar_highlight_focus and settings.statusbar_highlight_focus[1] then
        if last_screen == nil or last_screen ~= c.screen then
            mainstatusbar[settings.statusbar_highlight_focus[2]][c.screen].bg = beautiful.bg_sbfocus

            if last_screen then
                mainstatusbar[settings.statusbar_highlight_focus[2]][last_screen].bg = beautiful.bg_normal
            end
        end

        last_screen = c.screen
    end

end)
-- }}}

-- {{{ Unfocus hook
awful.hooks.unfocus.register(function (c)
    -- Set border
    c.border_color = beautiful.border_normal
    c.opacity = 0.5
end)
-- }}}

Font Shadow
No progress on that sad

Last edited by filou.linux (2008-09-08 16:08:15)

Offline

#5 2008-10-10 03:53:53

msdark
Member
From: Chile
Registered: 2008-08-17
Posts: 49
Website

Re: [SOLVED] Upgrading from Awesome 2.3 to Awesome 3: Config

can you post your rc.lua?


www.msdarkici.wordpress.com (Spanish) All what i Do in the linux world!!!
Arch User... Feel Free... Feel Speed....

Offline

#6 2008-10-16 13:44:40

filou.linux
Member
From: Zurich
Registered: 2008-04-17
Posts: 87

Re: [SOLVED] Upgrading from Awesome 2.3 to Awesome 3: Config

Sorry for letting you wait. Here you are:

-- Digi's Awesome-3 Lua Config (based on GGLucas'; Thank you!!!!)
-- Version 2.1
------
-- This config is for use with awesome 3.0.
------
-- If you have any suggestions or questions, feel free
-- to pass me a message, find me in #awesome on OFTC, or
-- email me at <lucas[at]glacicle.com>
------
-- I use both wicked and eminent, so to use it,
-- you'll need to get both those helper libraries too.
------
-- Note that I use all-custom keybindings, so you might
-- want to copy the default rc.lua's keybindings 
-- into here if you wish to use those, although you might
-- find you like mine better :P
------

---- {{{ Require lua libraries
-- Shipped with awesome
require("awful")
require("beautiful")

-- External
require("wicked") -- Widgets
require("eminent") -- Dynamic tagging
-- }}}

---- {{{ 'Beautiful' theme settings
-- Font
--beautiful.font = "Terminus 7"
beautiful.font = "DejaVu Sans 7"

-- Background
beautiful.bg_normal = '#333333'
beautiful.bg_focus = '#269900'
beautiful.bg_sbfocus = '#444444'
beautiful.bg_urgent = '#992600'

-- Foreground
beautiful.fg_normal = '#CCCCCC'
beautiful.fg_focus = '#FFFFFF'
beautiful.fg_urgent = '#FFFFFF'
--beautiful.fg_shadow =  '#111111'

-- Border
beautiful.border_width = 0
beautiful.border_normal = '#000000'
beautiful.border_focus = '#00330C'
beautiful.border_marked = '#33000C'

-- }}}

---- {{{ Modkeys
key = {}
key.none = {}
key.alt = {"Mod1"}
key.super = {"Mod4"}
key.shift = {"Shift"}
key.control = {"Control"}

key.super_alt = {key.super[1], key.alt[1]}
key.super_shift = {key.super[1], key.shift[1]}
key.super_control = {key.super[1], key.control[1]}
key.control_alt = {key.control[1], key.alt[1]}
key.shift_alt = {key.shift[1], key.alt[1]}

-- }}}

---- {{{ Settings   
-- Initialise tables
settings = {}
settings.widget = {}
settings.apps = {}
settings.tag = {}
settings.bindings = {}

-- {{{ General  
-- Widget spacer and separator
settings.widget_spacer = " "
settings.widget_separator = " "

-- Warp mouse
settings.warp_mouse = true
settings.sloppy_focus = false

-- New become master
settings.new_become_master = true

-- Tag mwfact
settings.tag.mwfact = 0.618033988769

-- }}}

-- {{{ Applications
settings.apps.terminal = 'urxvtc'

-- Command to lock the screen
settings.apps.lock_screen = 'xscreensaver-command -lock'

-- Browser
settings.apps.browser = 'firefox'

-- Add other default apps

-- }}} 

-- {{{ Floating windows
settings.floating = {
    ["gimp"] = true,
    ["mplayer"] = true
}

-- }}}

-- {{{ Tags
    settings.tags = {
        [1] = '#',
        [2] = 'Web',
        [3] = 'Dev',
        [4] = 'Sys',
        [5] = 'Media',
        [6] = 'Graph',
        [7] = 'Game',
    }
-- }}}

-- {{{ Client/Tag mapping
    settings.client_tag = 
    {
        ["urxvt"] = 1,
        ["firefox"] = 2,
        ["minefield"] = 2,
        ["gran paradiso"] = 2,
        ["gimp"] = 6,
        ["sonata"] = 5,
        ["mplayer"] = 5,
        ["gmplayer"] = 4,
        ["eclipse"] = 3,
        ["monodevelop"] = 3,
        ["xmoto"] = 7,
        ["firestarter"] = 4,
        ["qt-curve"] = 4,
        ["lxappearance"] = 4,
        ["lxrandr"] = 4
    }
-- }}}

-- {{{ Other
-- Check what widget mode to use
    settings.widget_mode = 'laptop'
--    settings.widget_mode = 'desktop'


-- Highlight statusbar of focussed screen on multiple-monitor setups
if screen.count() > 1 then
    settings.statusbar_highlight_focus = {true, 1}
end

-- }}}

-- }}}

---- {{{ Keybindings
-- Initialise table
settings.bindings.wm = {}
settings.bindings.mouse = {}

-- {{{  Run specific commands 
settings.bindings.commands = {
    -- Open Terminal
    [settings.apps.terminal] = {key.super, "#49"},

    -- Lock screen
    [settings.apps.lock_screen] = {key.super, "l"},

}
-- }}}

-- {{{ Client keybindings 
settings.bindings.wm.client = {
    -- Super+: Close window
    [function() client.focus:kill() end] = {key.super, "Escape"},

    -- Mod+q: Focus previous window
    [function() awful.client.focusbyidx(-1) end] = {key.super, "q"},

    -- Mod+w: Focus next window
    [function() awful.client.focusbyidx(1) end] = {key.super, "w"},

    -- Mod+Shift+q: Swap with previous window
    [function() awful.client.swap(-1) end] = {key.super_shift, "q"},

    -- Mod+Shift+w: Swap with previous window
    [function() awful.client.swap(1) end] = {key.super_shift, "w"},

     -- Mod+t: Add Titlebar
    [function() awful.titlebar.add(client.focus) end] = {key.super, "t"},

     -- Mod+t: Remove Titlebar
    [function() awful.titlebar.remove(client.focus) end] = {key.super_shift, "t"},

    -- Mod+c: Toggle floating
    --[awful.client.togglefloating] = {key.super, "c"},

    -- Mod+\: Make window master
    [function() local c = awful.client.master(); if c ~= client.focus then c:swap(client.focus) end end] =
        {key.super, "Return"},
        
    
    -- Mod+Shift+a: Move window to previous tag
    [function () awful.client.movetotag(eminent.tag.getprev(mouse.screen)) end] =
        {key.super_shift, "a"},

    -- Mod+Shift+s: Move window to next tag
    [function () awful.client.movetotag(eminent.tag.getnext(mouse.screen)) end] =
        {key.super_shift, "s"},

    -- Mod+Shift+e: Move window to next screen
    [function () s = client.focus.screen+1; if s > screen.count() then s = 1 end; client.focus.screen = s end] =
        {key.super_shift, "e"},

    -- Mod+Shift+d: Move window to previous screen
    [function () s = client.focus.screen-1; if s < 1 then s = screen.count() end; client.focus.screen = s end] =
        {key.super_shift, "d"},
}
-- }}}

-- {{{ Tag bindings
settings.bindings.wm.tag = {
    -- Mod+a: Switch to previous tag
    [function() eminent.tag.prev(mouse.screen) end] = {key.super, "a"},

    -- Mod+s: Switch to next tag
    [function() eminent.tag.next(mouse.screen) end] = {key.super, "s"},

    -- Alt+\: Switch to float layout
    [function() awful.layout.set('floating') end] = {key.alt, "c"},

    -- Alt+z: Switch to max layout
    [function() awful.layout.set('max') end] = {key.alt, "z"},

    -- Alt+x: Switch to tile layout
    [function() awful.layout.set('tile') end] = {key.alt, "x"},
}
-- }}}

-- {{{ Prompt bindings
settings.bindings.prompt = {
    -- Alt+w: Run prompt
    [{awful.spawn, " Run: "}] = {key.super, "x"},

    -- Mod+Alt+w: Lua eval prompt
    [{awful.eval, " Run Lua: "}] = {key.super_alt, "x"},
}

-- }}}

-- {{{ Miscellaneous bindings
settings.bindings.wm.misc = {
    -- Mod+Alt+r: Restart awesome
    [awesome.restart] = {key.super_alt, "r"},

    -- Mod+e: Switch focus to next screen
    [function() awful.screen.focus(1) end] = {key.super, "e"},

    -- Mod+d: Switch focus to previous screen
    [function() awful.screen.focus(-1) end] = {key.super, "d"},
}
-- }}}

-- {{{ Keyboard digit bindings
settings.bindings.digits = {
    -- Mod+##: View tag
    [awful.tag.viewonly] = key.super,

    -- Mod+Shift+##: Toggle tag view
    [function(t) t.selected = not t.selected end] = key.super_shift,

    -- Mod+Control+##: Move window to tag
    [awful.client.movetotag] = key.super_control,

    -- Mod+Alt+##: Toggle window on tag
    [awful.client.toggletag] = key.super_alt,

}
-- }}}

-- {{{ Mouse bindings
settings.bindings.mouse.desktop = {
    -- Right click on desktop: Open terminal
    [function() awful.spawn(settings.apps.terminal) end] = {key.none, 3},
}

settings.bindings.mouse.client = {

    -- Left: Focus window
    [function(c) client.focus = c end] = {key.none, 1},

    -- Super+Left: Move window
    [function(c) c:mouse_move() end] = {key.super, 1},

    -- Super+Right: Resize window
    [function(c) c:mouse_resize({corner="bottomright"}) end] = {key.super, 3},
}
-- }}}

-- }}}

---- {{{ Markup helper functions
-- Inline markup is a tad ugly, so use these functions
-- to dynamically create markup, we hook them into
-- the beautiful namespace for clarity.
beautiful.markup = {}

function beautiful.markup.bg(color, text)
    return '<bg color="'..color..'" />'..text
end

function beautiful.markup.fg(color, text)
    return '<span color="'..color..'">'..text..'</span>'
end

function beautiful.markup.font(font, text)
    return '<span font_desc="'..font..'">'..text..'</span>'
end

function beautiful.markup.title(t)
    return t
end

function beautiful.markup.title_normal(t)
    return beautiful.title(t)
end

function beautiful.markup.title_focus(t)
    return beautiful.markup.bg(beautiful.bg_focus, beautiful.markup.fg(beautiful.fg_focus, beautiful.markup.title(t)))
end

function beautiful.markup.title_urgent(t)
    return beautiful.markup.bg(beautiful.bg_urgent, beautiful.markup.fg(beautiful.fg_urgent, beautiful.markup.title(t)))
end

function beautiful.markup.bold(text)
    return '<b>'..text..'</b>'
end

function beautiful.markup.heading(text)
    return beautiful.markup.fg(beautiful.fg_focus, beautiful.markup.bold(text))
end

-- }}}

---- {{{ Widgets
settings.statusbars = {}
settings.widgets = {}

settings.statusbars[1] = {{
    position = "top",
    height = 15,
    fg = beautiful.fg_normal,
    bg = beautiful.bg_normal,
    name = "mainstatusbar",
}, "all"}

settings.promptbar = {
    position = "top",
    height = 15,
    fg = beautiful.fg_normal,
    bg = beautiful.bg_normal,
    name = "promptbar",
}

-- {{{ Taglist
maintaglist = widget({ 
    type = 'taglist', 
    name = 'maintaglist' 
})

function maintaglist.label(t)
    return awful.widget.taglist.label.noempty(t)
end

maintaglist:mouse_add(mouse(key.none, 1, function (o, t) awful.tag.viewonly(t) end))

table.insert(settings.widgets, {1, maintaglist})
-- }}}

if settings.widget_mode == 'laptop' or settings.widget_mode == 'all' then
-- {{{ Battery Widget
batterywidget = widget({
    type = 'textbox',
    name = 'batterywidget',
    align = 'right'
})

function read_battery_temp(format)
    local f = io.open('/tmp/battery-temp')

    if f == nil then 
        return {'n/a'}
    end

    local n = f:read()

    if n == nil then
        f:close()
        return {'n/a'}
    end

    return {awful.escape(n)}
end

wicked.register(batterywidget, read_battery_temp,
        settings.widget_spacer..beautiful.markup.heading('BAT')..': $1'..settings.widget_spacer..settings.widget_separator,
30)

-- Start timer to read the temp file
awful.hooks.timer.register(28, function ()
    -- Call battery script to get batt%
    command = "battery"
    os.execute(command..' > /tmp/battery-temp &')
end, true)

table.insert(settings.widgets, {1, batterywidget})

-- }}}
end
if settings.widget_mode ~= 'none' then

-- {{{ CPU Usage Widget
cputextwidget = widget({
    type = 'textbox',
    name = 'cputextwidget',
    align = 'right'
})

wicked.register(cputextwidget, wicked.widgets.cpu, 
    settings.widget_spacer..beautiful.markup.heading('CPU')..': $1%'..settings.widget_spacer..settings.widget_separator,
nil, nil, 2) 

table.insert(settings.widgets, {1, cputextwidget})

-- }}}

-- {{{ CPU Graph Widget["firestarter"] = 4,
cpugraphwidget = widget({
    type = 'graph',
    name = 'cpugraphwidget',
    align = 'right'
})


cpugraphwidget.height = 0.85
cpugraphwidget.width = 30
cpugraphwidget.bg = '#444444'
cpugraphwidget.border_color = '#0a0a0a'
cpugraphwidget.grow = 'left'


cpugraphwidget:plot_properties_set('cpu', {
    fg = '#7F0000',
    fg_center = '#AF0000',
    fg_end = '#FF0000',
    vertical_gradient = true
})

wicked.register(cpugraphwidget, wicked.widgets.cpu, '$1', 1, 'cpu')
table.insert(settings.widgets, {1, cpugraphwidget})

-- }}}

-- {{{ Memory Usage Widget
memtextwidget = widget({
    type = 'textbox',
    name = 'memtextwidget',
    align = 'right'
})

wicked.register(memtextwidget, wicked.widgets.mem,
    settings.widget_spacer..beautiful.markup.heading('MEM')..': '..
    '$1% ($2/$3)'..settings.widget_spacer..settings.widget_separator,
3, nil, {2, 4, 4})

table.insert(settings.widgets, {1, memtextwidget})

-- }}}

-- {{{ Memory Graph Widget
memgraphwidget = widget({
    type = 'graph',
    name = 'memgraphwidget',
    align = 'right'
})

memgraphwidget.height = 0.85
memgraphwidget.width = 30
memgraphwidget.bg = '#444444'
memgraphwidget.border_color = '#0a0a0a'
memgraphwidget.grow = 'left'

memgraphwidget:plot_properties_set('mem', {
    fg = '#7F0000',
    fg_center = '#AF0000',
    fg_end = '#FF0000',
    vertical_gradient = true
})

wicked.register(memgraphwidget, wicked.widgets.mem, '$1', 1, 'mem')
table.insert(settings.widgets, {1, memgraphwidget})

-- }}}

-- {{{ Clock widget
clockwidget = widget({
    type = 'textbox',
    name = 'clockwidget',
    align = 'right'
})

wicked.register(clockwidget, wicked.widgets.date, settings.widget_spacer..settings.widget_separator..settings.widget_spacer..'%a %d. %b %X'..settings.widget_spacer..settings.widget_separator, 1)

table.insert(settings.widgets, {1, clockwidget})

-- }}}
end

-- }}}

-------------------------------------------------------
-- You shouldn't have to edit the code after this, 
-- it takes care of applying the settings above.
-------------------------------------------------------

---- {{{ Initialisations 
-- Register beautiful with awful
awful.beautiful.register(beautiful)

-- Set default colors
awesome.colors_set({ 
    fg = beautiful.fg_normal, 
    bg = beautiful.bg_normal })

-- Set default font
awesome.font_set(beautiful.font)

-- Create new tags
for s=1, screen.count() do

    for nr, name in pairs(settings.tags) do
        eminent.tag.name(nr, s, name)
    end

end

-- Spawn Default terminal


-- }}}

---- {{{ Create statusbars
local mainstatusbar = {}

for i, b in pairs(settings.statusbars) do
    mainstatusbar[i] = {}

    for s=1,screen.count() do
        this_screen = false

        if b[2] ~= "all" then
            for sc in pairs(b[2]) do
                if sc == s then
                    this_screen = true
                    break
                end
            end
        end

        if b[2] == "all" or this_screen then
            mainstatusbar[i][s] = statusbar(b[1])
            local widgets = {}

            for ii, w in pairs(settings.widgets) do
                if w[1] == i then
                    table.insert(widgets, w[2])
                end
            end

            mainstatusbar[i][s]:widgets(widgets)
            mainstatusbar[i][s].screen = s
        end
    end
end

-- }}}

---- {{{ Create prompt statusbar
local mainpromptbar = statusbar(settings.promptbar)
local mainpromptbox = widget({type = "textbox", align = "left", name = "mainpromptbox"})

mainpromptbar:widgets({mainpromptbox})
mainpromptbar.screen = nil

-- }}}

---- {{{ Useful functions
-- {{{ Mouse warp function 
function mouse_warp(c, force)
    -- Allow skipping a warp
    if warp_skip then
        warp_skip = false
        return
    end

    -- Get vars
    local sel = c or client.focus
    if sel == nil then return end

    local coords = sel:coords()
    local m = mouse.coords()

    -- Settings
    mouse_padd = 6
    border_area = 5
    
    -- Check if mouse is not already inside the window
    if  (( m.x < coords.x-border_area or
           m.y < coords.y-border_area or
           m.x > coords.x+coords.width+border_area or
           m.y > coords.y+coords.height+border_area
        ) and (
           table.maxn(m.buttons) == 0
        )) or force
    then
        mouse.coords({ x=coords.x+mouse_padd, y=coords.y+mouse_padd})
    end
end
-- }}}

-- {{{ Prompt with statusbar
function prompt_statusbar(s, callback, prompt)
    if not callback then callback = awful.spawn end
    if not prompt then prompt = " Run: " end

    for i, b in pairs(mainstatusbar) do
        for ii, bb in pairs(b) do
            if bb.screen == s then
                bb.screen = nil
            end
        end 
    end

    mainpromptbar.screen = s

    awful.prompt.run({prompt = prompt}, mainpromptbox, callback, 
        awful.completion.bash, os.getenv("HOME") .. "/.cache/awesome_history", 50, function ()
            mainpromptbar.screen = nil

            for i, b in pairs(mainstatusbar) do
                for ii, bb in pairs(b) do
                    if ii == s then
                        bb.screen = ii
                    end
                end 
            end
        end)
end

-- }}}

-- }}}

---- {{{ Create bindings
--- This reads the binding tables and turns them into actual keybindings

-- WM Bindings
for i,table in pairs(settings.bindings.wm) do
    for f, keys in pairs(table) do
        keybinding(keys[1], keys[2], f):add()
    end
end

-- Keyboard digit bindings
for i=1,9 do
    for f, mod in pairs(settings.bindings.digits) do
        keybinding(mod, i, function()
            t = eminent.tag.getn(i, nil, true)
            if not t then return end
            f(t)
        end):add()
    end
end

-- Prompt Bindings
for prompt, keys in pairs(settings.bindings.prompt) do
    keybinding(keys[1], keys[2], function() prompt_statusbar(mouse.screen, unpack(prompt)) end):add()
end

-- Custom command bindings
for command, keys in pairs(settings.bindings.commands) do
    keybinding(keys[1], keys[2], function() awful.spawn(command) end):add()
end

-- Desktop mouse bindings
for f, keys in pairs(settings.bindings.mouse.desktop) do
    awesome.mouse_add(mouse(keys[1], keys[2], f))
end

-- }}}

---- {{{ Set hooks

-- {{{ Focus hook
awful.hooks.focus.register(function (c)

    -- Set border
    c.border_color = beautiful.border_focus

    -- Raise the client
    c:raise()

    -- Set statusbar color
    if settings.statusbar_highlight_focus and settings.statusbar_highlight_focus[1] then
        if last_screen == nil or last_screen ~= c.screen then
            mainstatusbar[settings.statusbar_highlight_focus[2]][c.screen].bg = beautiful.bg_sbfocus

            if last_screen then
                mainstatusbar[settings.statusbar_highlight_focus[2]][last_screen].bg = beautiful.bg_normal
            end
        end

        last_screen = c.screen
    end

end)
-- }}}

-- {{{ Unfocus hook
awful.hooks.unfocus.register(function (c)
    -- Set border
    c.border_color = beautiful.border_normal
end)
-- }}}

-- {{{ Mouseover hook
awful.hooks.mouseover.register(function (c)
    -- Set focus for sloppy focus
    if settings.sloppy_focus then
        client.focus = c
    end
end)
-- }}}

-- {{{ Manage hook
awful.hooks.manage.register(function (c)
    local class = ""
    local name = ""

    if c.class then
        class = c.class:lower()
    end

    if c.name then
        name = c.name:lower()
    end

    -- Create border
    c.border_width = beautiful.border_width
    c.border_color = beautiful.border_normal

    -- Add mouse bindings
    for f, keys in pairs(settings.bindings.mouse.client) do
        c:mouse_add(mouse(keys[1], keys[2], f))
    end

    -- Check if floating
    for app, i in pairs(settings.floating) do
        if class:find(app) or name:find(app) then
            c.floating = i
            break
        end
    end

    -- Move Client to tags
    for app, tag in pairs(settings.client_tag) do
        if class:find(app) or name:find(app) then
            t = eminent.tag.getn( tag, mouse.screen,  true )
            awful.client.movetotag( t, c)
            awful.tag.viewonly(t)
            break
        end
    end

    -- Focus new clients
    client.focus = c

    -- Prevent new windows from becoming master
    if not settings.new_become_master then
        awful.client.swap(1, c)
    end

    -- Don't honor size hints
    c.honorsizehints = false
end)
-- }}}

-- {{{ Arrange hook
awful.hooks.arrange.register(function(s)
    -- Warp the mouse
    if settings.warp_mouse then
        mouse_warp()
    end

    -- Check focus
    if not client.focus then
        local c = awful.client.focus.history.get(s, 0)
        if c then client.focus = c end
    end
end)
-- }}}

-- }}}

-- vim: set filetype=lua fdm=marker tabstop=4 shiftwidth=4 expandtab smarttab autoindent smartindent nu:

If you have any improvments, don't hesitate to post the here.

Offline

Board footer

Powered by FluxBB