From d5c82f99827f180459c34192612e24d1571d2be9 Mon Sep 17 00:00:00 2001 From: Jay Bromley Date: Thu, 7 Aug 2008 12:13:54 +0200 Subject: [PATCH] awesomerc: improve management of floating/predefined tags (FS#241) Signed-off-by: Julien Danjou --- awesomerc.lua.in | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index d66795e2..f483d7e0 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -33,11 +33,25 @@ layouts = "floating" } --- Table of clients that should be set floating. -floatings = +-- 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 = { - ["mplayer"] = true, - ["pinentry"] = true + -- by class + ["MPlayer"] = true, + ["pinentry"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and workspace indices. +apptags = +{ + -- ["Firefox"] = { screen = 1, tag = 2 } + -- ["mocp"] = { screen = 2, tag = 4 } } -- Define if we want to use titlebar on all applications. @@ -337,9 +351,28 @@ function hook_manage(c) c.border_width = beautiful.border_width c.border_color = beautiful.border_normal c:focus_set() - if floatings[c.name:lower()] then - c.floating = true + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] then + c.floating = floatapps[cls] + elseif floatapps[inst] then + c.floating = floatapps[inst] end + + -- 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 + -- Honor size hints c.honorsizehints = true end