You are not logged in.

#1 2009-03-28 13:06:15

Wishes
Member
Registered: 2006-08-06
Posts: 36

[SOLVED] dual-screen problem with awesome3.2 and firefox/gedit

Hi,
my problem is that firefox/gedit (+maybe other apps, i don't know yet) are starting in awesome like they are fullscreen apps. Firefox covers the wibox at the top of the screen, and even overlaps a bit to the seconds screen. So the keyboard-shortcuts doenst work well, because awesome then changes the tags in bots screens when on one tag firefox is opened.
I dont know why this happens, here is my rc.lua:

-- Load libraries
require("awful")
require("beautiful")
require("wicked")


-- {{{ Variable definitions
-- 
-- User styles for windows, statusbars, titlebars and widgets
theme_path = os.getenv("HOME") .. "/.config/awesome/themes/zenburn"
beautiful.init(theme_path)
-- 
-- Modifier keys
modkey = "Mod4" -- Super_L
-- 
-- Window titlebars
use_titlebar = true
-- 
-- Window management layouts
layouts = {
    awful.layout.suit.tile,            -- 1
    awful.layout.suit.tile.left,       -- 2
    awful.layout.suit.tile.bottom,     -- 3
    awful.layout.suit.tile.top,        -- 4
    awful.layout.suit.fair,            -- 5
    awful.layout.suit.fair.horizontal, -- 6
    awful.layout.suit.max,             -- 7
--  awful.layout.suit.max.fullscreen,  -- /
    awful.layout.suit.magnifier,       -- 8
    awful.layout.suit.floating         -- 9
}
-- 
-- Application specific behaviour
apprules = {
    -- Class       Instance       Name                Screen          Tag   Floating
    { "Firefox",   nil,           nil,                nil,       2,  false },
    { "Firefox",   "Download",    nil,                nil,            nil,  true  },
    { "Firefox",   "Places",      nil,                nil,            nil,  true  },
    { "Firefox",   "Extension",   nil,                nil,            nil,  true  },
    { "MPlayer",   nil,           nil,                nil,            nil,  true  },
    {  nil,        nil,           "VLC media player", nil,            nil,  true  },
    { "Gimp",      nil,           nil,                nil,            nil,  true  },
    { "Xmessage",  "xmessage",    nil,                nil,            nil,  true  },
    { "Skype",    nil,        nil,        nil,        1,    true },
    { "Pidgin",    nil,        nil,        nil,        1,    true },                 
}
-- }}}


-- {{{ Tags
-- 
-- Define tags table
tags = {}
tags.settings = {
    { name = "im",  layout = layouts[9] },
    { name = "www", layout = layouts[1] },
    { name = "terms",   layout = layouts[3]  },
    { name = "dev",  layout = layouts[3]  },
    { name = "other",    layout = layouts[5]  },
}
-- Initialize tags
for s = 1, screen.count() do
    tags[s] = {}
    for i, v in ipairs(tags.settings) do
        tags[s][i] = tag(v.name)
        tags[s][i].screen = s
        awful.tag.setproperty(tags[s][i], "layout",   v.layout)
        awful.tag.setproperty(tags[s][i], "setslave", v.setslave)
    end
    tags[s][1].selected = true
end
-- }}}


-- {{{ Wibox
-- 
-- Widgets configuration
-- 
-- Reusable separators
myspace          = widget({ type = "textbox", name = "myspace", align = "right" })
myseparator      = widget({ type = "textbox", name = "myseparator", align = "right" })
myspace.text     = "  "
myseparator.text = "|"
-- 
-- Date, time and...
mydateicon       = widget({ type = "imagebox", name = "mydateicon", align = "right" })
mydateicon.image = image(beautiful.widget_date)
mydatewidget     = widget({ type = "textbox", name = "mydatewidget", align = "right" })
wicked.register(mydatewidget, wicked.widgets.date, "%b %e, %R", 60)
-- a Calendar
function calendar_select(offset)
    local datespec = os.date("*t")
    datespec = datespec.year * 12 + datespec.month - 1 + offset
    awful.util.spawn("cal -m " .. (datespec % 12 + 1) .. " " .. math.floor(datespec / 12) .. " | xmessage -geometry +1135+17 -file -")
end
mydatewidget:buttons({
    button({ }, 1, function () calendar_select(0) end),
    button({ }, 4, function () calendar_select(1) end),
    button({ }, 5, function () calendar_select(-1) end)
})
-- 
-- System tray
mysystray = widget({ type = "systray", align = "right" })
-- 
-- 
-- Create a wibox and...
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) }
-- ...add it to each screen
for s = 1, screen.count() do
    -- Create a promptbox
    mypromptbox[s] = widget({ type = "textbox", align = "left" })
    -- Create an imagebox widget with icons indicating active layout
    mylayoutbox[s] = widget({ type = "imagebox", align = "left" })
    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 the taglist
    mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons)
    -- Create the wibox
    mywibox[s] = wibox({ position = "top", height = "14", fg = beautiful.fg_normal, bg = beautiful.bg_normal })
    -- Add widgets to the wibox (order matters)
    mywibox[s].widgets = { mylayoutbox[s],
                           mytaglist[s],
                           mypromptbox[s],
                           myspace,
                           mydateicon, mydatewidget,
                           myspace,
                           s == screen.count() and mysystray or nil
    }
    mywibox[s].screen = s
end
-- }}}


-- {{{ Mouse bindings
root.buttons({
    button({ }, 4, awful.tag.viewnext),
    button({ }, 5, awful.tag.viewprev)
})
-- }}}


-- {{{ Key bindings
globalkeys = {
    -- Applications
    key({ modkey }, "Return",function () awful.util.spawn("uxterm") end),
    -- 
    -- Prompt menus
    key({ modkey }, "F2", function () awful.prompt.run({ prompt = "Run: " }, mypromptbox[mouse.screen],
                              awful.util.spawn, awful.completion.shell, awful.util.getdir("cache") .. "/history")
                          end),
    -- 
    -- Awesome controls
    key({ modkey, "Shift" }, "q", awesome.quit),
    key({ modkey, "Shift" }, "r", function () mypromptbox[mouse.screen].text = awful.util.escape(awful.util.restart()) end),
    -- 
    -- Layout manipulation
    key({ modkey, "Shift" }, "Plus", function () awful.client.incwfact(-0.05) end),
    key({ modkey, "Shift" }, "Minus", function () awful.client.incwfact(0.05) end),
    key({ modkey }, "space",          function () awful.layout.inc(layouts, 1) end),
    key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    -- 
    -- Focus controls
    key({ modkey }, "Tab", function () awful.client.focus.history.previous(); if client.focus then client.focus:raise() end end),
    key({ modkey }, "Down", function () awful.client.focus.bydirection("down"); if client.focus then client.focus:raise() end end),
    key({ modkey }, "Up", function () awful.client.focus.bydirection("up");   if client.focus then client.focus:raise() end end),
    key({ modkey }, "Left", function () awful.client.focus.bydirection("left"); if client.focus then client.focus:raise() end end),
    key({ modkey }, "Right", function () awful.client.focus.bydirection("right");if client.focus then client.focus:raise() end end),
    key({ modkey, "Shift" }, "Down", function () awful.client.swap.bydirection("down") end),
    key({ modkey, "Shift" }, "Up", function () awful.client.swap.bydirection("up") end),
    key({ modkey, "Shift" }, "Left", function () awful.client.swap.bydirection("left") end),
    key({ modkey, "Shift" }, "Right", function () awful.client.swap.bydirection("right") end),
}
-- 
-- Client manipulation
clientkeys = {
    key({ modkey, "Control" }, "space",  awful.client.floating.toggle),
}
-- 
-- Bind keyboard digits
keynumber = 0
for s = 1, screen.count() do
   keynumber = math.min(9, math.max(#tags[s], keynumber));
end
-- 
-- Tag controls
for i = 1, keynumber do
    table.insert(globalkeys,
        key({ modkey }, i,
            function ()
                local screen = mouse.screen
                if tags[screen][i] then
                    awful.tag.viewonly(tags[screen][i])
                end
            end))
    table.insert(globalkeys,
        key({ modkey, "Shift" }, i,
            function ()
                if client.focus and tags[client.focus.screen][i] then
                    awful.client.movetotag(tags[client.focus.screen][i])
                end
            end))
end
-- 
-- Set keys
root.keys(globalkeys)
-- }}}



-- {{{ Hooks
-- 
-- Hook function to execute when focusing a client
awful.hooks.focus.register(function (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)
    -- Sloppy focus (but disabled for magnifier layout)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
        and awful.client.focus.filter(c) then
            client.focus = c
    end
end)
-- 
-- Hook function to execute when a new client appears
awful.hooks.manage.register(function (c)
    -- If we are not managing this application at startup, move it to the screen where the mouse is
    if not startup and awful.client.focus.filter(c) then
        c.screen = mouse.screen
    end
    -- 
    -- Add a titlebar to each client
    if use_titlebar then
        awful.titlebar.add(c, { modkey = modkey })
    end
    -- 
    -- Set client mouse bindings
    c:buttons({
        button({ }, 1, function (c) client.focus = c; c:raise() end),
        button({ modkey }, 1, awful.mouse.client.move),
        button({ modkey }, 3, awful.mouse.client.resize)
    })
    -- 
    -- New clients may not receive focus if they're not focusable, so set the border anyway
    c.border_width = beautiful.border_width
    c.border_color = beautiful.border_normal
    -- 
    -- Check application->screen/tag mappings and floating state
    local target_screen
    local target_tag
    local target_float
    for index, rule in pairs(apprules) do
        if  (((rule[1] == nil) or (c.class    and c.class    == rule[1]))
        and  ((rule[2] == nil) or (c.instance and c.instance == rule[2]))
        and  ((rule[3] == nil) or (c.name     and string.find(c.name, rule[3], 1, true)))) then
            target_screen = rule[4]
            target_tag    = rule[5]
            target_float  = rule[6]
        end
    end
    -- Apply mappings, if any
    if target_float  then
        awful.client.floating.set(c, target_float)
    end
    if target_screen then
        c.screen = target_screen
        awful.client.movetotag(tags[target_screen][target_tag], c)
    end
    -- 
    -- Focus after tag mapping
    client.focus = c
    -- 
    -- Set client key bindings
    c:keys(clientkeys)
    -- 
    -- Put windows at the end of others instead of setting them as a master
    --awful.client.setslave(c)
    -- ...or do it selectively for certain tags
    if awful.tag.getproperty(awful.tag.selected(mouse.screen), "setslave") then
        awful.client.setslave(c)
    end
    -- 
    -- New floating windows don't cover the wibox and don't overlap until it's unavoidable
    awful.placement.no_offscreen(c)
    --awful.placement.no_overlap(c)
    -- 
    -- Honoring size hints: false to remove gaps between windows
    c.size_hints_honor = false
end)
-- 
-- Hook function to execute when arranging the screen
awful.hooks.arrange.register(function (screen)
    -- Update layout imagebox widget with an icon indicating active layout
    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 end
    end
    -- 
    -- Fine grained border controls
    local visible_clients = awful.client.visible(screen)
    if #visible_clients > 0 then
        for unused, current in pairs(visible_clients) do
            -- Floating clients always have borders
            if awful.client.floating.get(current) or (layout == 'floating') then
                current.border_width = beautiful.border_width
                -- Floating clients always on top
                if not current.fullscreen then
                    current.ontop = true
                end
            -- Don't draw the border if there is only one tiled client visible
            elseif (#visible_clients == 1) or (layout == 'max') then
                visible_clients[1].border_width = 0
            else
                current.border_width = beautiful.border_width
            end
        end
    end
end)
-- }}}

I added "xrandr --output DVI-1 -- right-of DVI-0" to the .xinitrc to get the extended desktop i want.

Any suggestions?

Last edited by Wishes (2009-03-29 10:52:00)

Offline

#2 2009-03-28 14:04:02

Gigamo
Member
Registered: 2008-01-19
Posts: 394

Re: [SOLVED] dual-screen problem with awesome3.2 and firefox/gedit

Have you tried pressing mod+m when you have gedit/firefox focused?

Offline

#3 2009-03-28 16:45:48

Wishes
Member
Registered: 2006-08-06
Posts: 36

Re: [SOLVED] dual-screen problem with awesome3.2 and firefox/gedit

Yeah, doesn't change anything sad

Offline

#4 2009-03-28 18:43:34

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: [SOLVED] dual-screen problem with awesome3.2 and firefox/gedit

I saw this happening prior to 3.2 with Firefox and Gvim - ONLY if they were in the apptags table (mapping them to a specific tag). I asked on the mailing list, some users confirmed, and never found the answer, with 3.2 it was gone.

Edit: after inspecting your configuration there might be one setting that can cause unplanned behaviour (although chances are small that is causing it, I would first try commenting out Firefox from apprules). It's in your arrange hook in border controls:  "Floating clients always on top" try commenting out that setting.

Edit2: Gigamo might be on to something. But you actually don't have "Mod+m" (toggle maximize) defined in your config, it would be (in "Client manipulation"):

key({ modkey }, "m", function (c) c.maximized_horizontal = not c.maximized_horizontal c.maximized_vertical = not c.maximized_vertical end),

Last edited by anrxc (2009-03-28 18:57:11)


You need to install an RTFM interface.

Offline

#5 2009-03-28 20:04:48

Wishes
Member
Registered: 2006-08-06
Posts: 36

Re: [SOLVED] dual-screen problem with awesome3.2 and firefox/gedit

Still the same sad

Edit: i deleted my ~/.mozilla folder. Now firefox starts not overlapping with the wibox, but still a bit overlapping to the other screen, so hat my keystrokes toggle both screens. it seems that it start in floating mode, because i can move it with the mouse. When i move it a bit towarts the wibox and a bit right, it seems to get stuck in the chosen tile-layout and everything is fine... until i quit firefox and start it again.

Edit2: Hmmm, ok, i think i found it... or at least something:

-- New floating windows don't cover the wibox and don't overlap until it's unavoidable
    --awful.placement.no_offscreen(c)  //THIS was first uncommented
    awful.placement.no_overlap(c)  //THIS was first commented

So now with no_overlap it seems to work finde (although i cannot move gedit between the screens with the mouse, but i dont know if this isn't normal. Firefox is moveable between the screens.), no overlapping anymore with the wibox or to the other screen.
When i uncomment both lines, firefox and gedit are starting both on the 2nd screen (the left one), and gedit cannot be moved to the right one (although firefox can be moved.).

Last edited by Wishes (2009-03-28 20:24:52)

Offline

Board footer

Powered by FluxBB