1
0
Fork 0

now my awesome remembers the tiled layout used before switching to maxed or floating; combined tags may be quirky though, I have no intention on improving them since I hardly ever use them

This commit is contained in:
Von Random 2015-03-16 00:45:42 +03:00
parent 0e9fac05b5
commit b1e711fbcc

37
rc.lua
View file

@ -123,6 +123,7 @@ local layouts = {
awful.layout.suit.magnifier awful.layout.suit.magnifier
} }
} }
layouts.tiled['default'] = layouts.tiled[3]
-- }}} -- }}}
-- {{{ Wallpaper -- {{{ Wallpaper
if beautiful.wallpaper then if beautiful.wallpaper then
@ -134,8 +135,10 @@ end
-- {{{ Tags -- {{{ Tags
-- Provide tag names and layout settings if we wish to define them -- Provide tag names and layout settings if we wish to define them
tags = {} tags = {}
saved_layouts = {}
for s = 1, screen.count() do for s = 1, screen.count() do
tags[s] = { name = {}, layout = {} } tags[s] = { name = {}, layout = {} }
saved_layouts[s] = { tiled = {} }
end end
-- screen 1 -- screen 1
--tags[1].name = { --tags[1].name = {
@ -143,7 +146,6 @@ end
-- [9] = 'example2' -- [9] = 'example2'
--} --}
tags[1].layout = { tags[1].layout = {
[2] = layouts.max[1],
[4] = layouts.float[1] [4] = layouts.float[1]
} }
-- screens 2+ -- screens 2+
@ -155,8 +157,15 @@ end
-- Fill the missing values with defaults -- Fill the missing values with defaults
for s = 1, screen.count() do for s = 1, screen.count() do
for tag = 1, 9 do for tag = 1, 9 do
tags[s].name[tag] = tags[s].name[tag] or tag local name = tags[s].name[tag] or tag
tags[s].layout[tag] = tags[s].layout[tag] or layouts.tiled[1] local layout = tags[s].layout[tag] or layouts.tiled['default']
tags[s].name[tag] = name
tags[s].layout[tag] = layout
if enters(layout, layouts.tiled) then
saved_layouts[s].tiled[name] = layout
else
saved_layouts[s].tiled[name] = layouts.tiled['default']
end
end end
end end
-- Set tags instances in wm -- Set tags instances in wm
@ -186,7 +195,13 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
-- {{{ Menu for layoutbox -- {{{ Menu for layoutbox
mylbmenu = awful.menu({ mylbmenu = awful.menu({
items = { items = {
{ 'Tiled', function () awful.layout.set(layouts.tiled[1]) end }, { 'Tiled',
function ()
local screen = mouse.screen
local tag = awful.tag.selected(screen).name
awful.layout.set(saved_layouts[screen].tiled[tag])
end
},
{ 'Maximized', function () awful.layout.set(layouts.max[1]) end }, { 'Maximized', function () awful.layout.set(layouts.max[1]) end },
{ 'Floating', function () awful.layout.set(layouts.float[1]) end } { 'Floating', function () awful.layout.set(layouts.float[1]) end }
} }
@ -268,9 +283,12 @@ for s = 1, screen.count() do
awful.util.table.join( awful.util.table.join(
awful.button({ }, 1, awful.button({ }, 1,
function () function ()
local current_layout = awful.layout.get(mouse.screen) local screen = mouse.screen
local current_layout = awful.layout.get(screen)
if enters(current_layout, layouts.tiled) then if enters(current_layout, layouts.tiled) then
local tag = awful.tag.selected(screen).name
awful.layout.inc(layouts.tiled, 1) awful.layout.inc(layouts.tiled, 1)
saved_layouts[screen].tiled[tag] = awful.layout.get(screen)
end end
end), end),
awful.button({ }, 3, function () mylbmenu:toggle() end) awful.button({ }, 3, function () mylbmenu:toggle() end)
@ -387,11 +405,14 @@ globalkeys = awful.util.table.join(
end), end),
awful.key({ modkey, }, 't', awful.key({ modkey, }, 't',
function () function ()
local current_layout = awful.layout.get(mouse.screen) local screen = mouse.screen
local current_layout = awful.layout.get(screen)
local tag = awful.tag.selected(screen).name
if not enters(current_layout, layouts.tiled) then if not enters(current_layout, layouts.tiled) then
awful.layout.set(layouts.tiled[1]) awful.layout.set(saved_layouts[screen].tiled[tag])
else else
awful.layout.inc(layouts.tiled, 1) awful.layout.inc(layouts.tiled, 1)
saved_layouts[screen].tiled[tag] = awful.layout.get(screen)
end end
end), end),
@ -521,6 +542,7 @@ awful.rules.rules = {
{ {
rule_any = { rule_any = {
class = { class = {
'Audacious',
'Deadbeef', 'Deadbeef',
'Google-musicmanager', 'Google-musicmanager',
'mpv', 'mpv',
@ -606,6 +628,7 @@ awful.rules.rules = {
'eu4', 'eu4',
'witcher2', 'witcher2',
-- non-games -- non-games
'Audacious',
'Qmmp' 'Qmmp'
}, },
instance = { instance = {