1
0
Fork 0

remove lua expandtab and fix indentation in rc.lua

This commit is contained in:
Von Random 2014-08-06 21:41:13 +04:00
parent 21cd79a751
commit 010a22cac1
2 changed files with 433 additions and 331 deletions

224
rc.lua
View file

@ -21,24 +21,33 @@ end
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) -- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({
preset = naughty.config.presets.critical,
title = 'Oops, there were errors during startup!', title = 'Oops, there were errors during startup!',
text = awesome.startup_errors }) text = awesome.startup_errors
})
end end
-- Handle runtime errors after startup -- Handle runtime errors after startup
do do
local in_error = false local in_error = false
awesome.connect_signal('debug::error', function (err) awesome.connect_signal(
'debug::error',
function (err)
-- Make sure we don't go into an endless error loop -- Make sure we don't go into an endless error loop
if in_error then return end if in_error then
return
end
in_error = true in_error = true
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({
preset = naughty.config.presets.critical,
title = 'Oops, an error happened!', title = 'Oops, an error happened!',
text = err }) text = err
})
in_error = false in_error = false
end) end
)
end end
-- }}} -- }}}
@ -67,8 +76,7 @@ editor_cmd = terminal .. ' -e ' .. editor
modkey = 'Mod4' modkey = 'Mod4'
-- Table of layouts to cover with awful.layout.inc, order matters. -- Table of layouts to cover with awful.layout.inc, order matters.
local layouts = local layouts = {
{
awful.layout.suit.floating, awful.layout.suit.floating,
awful.layout.suit.tile, awful.layout.suit.tile,
awful.layout.suit.tile.bottom, awful.layout.suit.tile.bottom,
@ -92,28 +100,24 @@ for s = 1, screen.count() do
tags[s] = { name = {}, layout = {} } tags[s] = { name = {}, layout = {} }
end end
-- screen 1 -- screen 1
--tags[1].name = --tags[1].name = {
--{
-- [1] = '1:browser', -- [1] = '1:browser',
-- [2] = '2:terminal', -- [2] = '2:terminal',
-- [3] = '3:terminal', -- [3] = '3:terminal',
-- [4] = '4:float', -- [4] = '4:float',
-- [9] = '9:mail' -- [9] = '9:mail'
--} --}
tags[1].layout = tags[1].layout = {
{
[1] = layouts[2], [1] = layouts[2],
[4] = layouts[1], [4] = layouts[1],
[5] = layouts[1] [5] = layouts[1]
} }
-- screens 2+ -- screens 2+
if screen.count() >= 2 then if screen.count() >= 2 then
--tags[2].name = --tags[2].name = {
--{
-- [3] = '3:float', -- [3] = '3:float',
--} --}
tags[2].layout = tags[2].layout = {
{
[3] = layouts[1] [3] = layouts[1]
} }
end end
@ -139,13 +143,17 @@ quitmenu = {
{ 'quit', awesome.quit } { 'quit', awesome.quit }
} }
mymainmenu = awful.menu({ items = { { 'restart', restartmenu, beautiful.awesome_icon }, mymainmenu = awful.menu({
items = {
{ 'restart', restartmenu, beautiful.awesome_icon },
{ 'quit', quitmenu, beautiful.awesome_icon } { 'quit', quitmenu, beautiful.awesome_icon }
} }
}) })
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, mylauncher = awful.widget.launcher({
menu = mymainmenu }) image = beautiful.awesome_icon,
menu = mymainmenu
})
-- Menubar configuration -- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it menubar.utils.terminal = terminal -- Set the terminal for applications that require it
@ -174,7 +182,8 @@ mytaglist.buttons = awful.util.table.join(
) )
mytasklist = {} mytasklist = {}
mytasklist.buttons = awful.util.table.join( mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c) awful.button({ }, 1,
function (c)
if c == client.focus then if c == client.focus then
c.minimized = true c.minimized = true
else else
@ -190,7 +199,8 @@ mytasklist.buttons = awful.util.table.join(
c:raise() c:raise()
end end
end), end),
awful.button({ }, 3, function () awful.button({ }, 3,
function ()
if instance then if instance then
instance:hide() instance:hide()
instance = nil instance = nil
@ -198,14 +208,21 @@ mytasklist.buttons = awful.util.table.join(
instance = awful.menu.clients({ width=250 }) instance = awful.menu.clients({ width=250 })
end end
end), end),
awful.button({ }, 4, function () awful.button({ }, 4,
function ()
awful.client.focus.byidx(1) awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end if client.focus then
client.focus:raise()
end
end), end),
awful.button({ }, 5, function () awful.button({ }, 5,
function ()
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end if client.focus then
end)) client.focus:raise()
end
end)
)
for s = 1, screen.count() do for s = 1, screen.count() do
-- Create a promptbox for each screen -- Create a promptbox for each screen
@ -213,11 +230,14 @@ for s = 1, screen.count() do
-- Create an imagebox widget which will contains an icon indicating which layout we're using. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen. -- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s) mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join( mylayoutbox[s]:buttons(
awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)
)
)
-- Create a taglist widget -- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons) mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons)
@ -261,11 +281,13 @@ end
-- }}} -- }}}
-- {{{ Mouse bindings -- {{{ Mouse bindings
root.buttons(awful.util.table.join( root.buttons(
awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 5, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewnext),
awful.button({ }, 4, awful.tag.viewprev) awful.button({ }, 4, awful.tag.viewprev)
)) )
)
-- }}} -- }}}
-- {{{ Key bindings -- {{{ Key bindings
@ -279,12 +301,16 @@ globalkeys = awful.util.table.join(
awful.key({ modkey, }, 'j', awful.key({ modkey, }, 'j',
function () function ()
awful.client.focus.byidx(1) awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end if client.focus then
client.focus:raise()
end
end), end),
awful.key({ modkey, }, 'k', awful.key({ modkey, }, 'k',
function () function ()
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end if client.focus then
client.focus:raise()
end
end), end),
awful.key({ modkey, }, 'w', function () mymainmenu:show() end), awful.key({ modkey, }, 'w', function () mymainmenu:show() end),
@ -337,10 +363,12 @@ globalkeys = awful.util.table.join(
awful.key({ modkey, }, 'e', awful.key({ modkey, }, 'e',
function () function ()
awful.prompt.run({ prompt = 'Run Lua code: ' }, awful.prompt.run(
{ prompt = 'Run Lua code: ' },
mypromptbox[mouse.screen].widget, mypromptbox[mouse.screen].widget,
awful.util.eval, nil, awful.util.eval, nil,
awful.util.getdir('cache') .. '/history_eval') awful.util.getdir('cache') .. '/history_eval'
)
end), end),
-- Menubar -- Menubar
awful.key({ modkey, }, 'p', function () menubar.show() end), awful.key({ modkey, }, 'p', function () menubar.show() end),
@ -414,13 +442,15 @@ for i = 1, 9 do
awful.client.toggletag(tag) awful.client.toggletag(tag)
end end
end end
end)) end)
)
end end
clientbuttons = awful.util.table.join( clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end), awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move), awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize)) awful.button({ modkey }, 3, awful.mouse.client.resize)
)
-- Set keys -- Set keys
root.keys(globalkeys) root.keys(globalkeys)
@ -429,61 +459,133 @@ root.keys(globalkeys)
-- {{{ Rules -- {{{ Rules
awful.rules.rules = { awful.rules.rules = {
-- All clients will match this rule. -- All clients will match this rule.
{ rule = { }, {
properties = { border_width = beautiful.border_width, rule = { },
properties = {
border_width = beautiful.border_width,
border_color = beautiful.border_normal, border_color = beautiful.border_normal,
focus = awful.client.focus.filter, focus = awful.client.focus.filter,
keys = clientkeys, keys = clientkeys,
buttons = clientbuttons } }, buttons = clientbuttons
}
},
-- Floating only rules class based rules -- Floating only rules class based rules
{ rule_any = { class = { 'pinentry', 'Skype', 'Deadbeef', 'Pavucontrol', 'Qmmp', 'Vncviewer', 'plugin-container', 'mpv' }, instance = { 'sun-awt-X11-XFramePeer' } }, {
properties = { floating = true } }, rule_any = {
class = {
'pinentry',
'Skype',
'Deadbeef',
'Pavucontrol',
'Qmmp',
'Vncviewer',
'plugin-container',
'mpv'
},
instance = {
'sun-awt-X11-XFramePeer'
}
},
properties = {
floating = true
}
},
-- Mostly floating rules, we want to keep them separately since it's easier to manage -- Mostly floating rules, we want to keep them separately since it's easier to manage
-- firefox -- firefox
{ rule = { class = 'Firefox' }, except = { instance = 'Navigator' }, {
properties = { floating = true } }, rule = { class = 'Firefox' },
except = { instance = 'Navigator' },
properties = { floating = true }
},
-- ardour3 -- ardour3
{ rule = { class = 'Ardour' }, except = { instance = 'ardour_editor' }, {
properties = { floating = true } }, rule = { class = 'Ardour' },
except = { instance = 'ardour_editor' },
properties = { floating = true }
},
-- Remove gaps between terminal windows: -- Remove gaps between terminal windows:
-- roxterm -- roxterm
{ rule = { class = 'Roxterm' }, {
properties = { size_hints_honor = false } }, rule = { class = 'Roxterm' },
properties = { size_hints_honor = false }
},
-- Specific desktops rules: place windows only on specific tags by default -- Specific desktops rules: place windows only on specific tags by default
-- steam -- steam
{ rule = { class = 'Steam' }, {
properties = { tag = tags[1][4] } }, rule_any = { class = { 'Steam' },
-- games instance = { 'Steam.exe' } },
{ rule_any = { class = { 'dota_linux', 'hl2_linux', 'Strife', 'ck2', 'Pandora', 'witcher2', 'Symphony.bin.x86_64', 'Civ5XP', 'game.x86_64', 'deponia_tcj' }, instance = { 'Civ4BeyondSword.exe', 'KB.exe' } }, properties = { tag = tags[1][4] }
properties = { border_width = 0, },
-- games = float / fullscreen
{
rule_any = {
class = {
'dota_linux',
'hl2_linux',
'Strife',
'ck2',
'Pandora',
'witcher2',
'Symphony.bin.x86_64',
'Civ5XP',
'game.x86_64',
'deponia_tcj'
},
instance = {
'Civ4BeyondSword.exe',
'KB.exe'
}
},
properties = {
border_width = 0,
floating = true, floating = true,
tag = tags[1][5] } } tag = tags[1][5]
}
},
-- games = maximized
{
rule_any = {
instance = {
'BGEE.exe',
'Baldur.exe'
}
},
properties = {
border_width = 0,
tag = tags[1][2]
}
}
} }
-- }}} -- }}}
-- {{{ Signals -- {{{ Signals
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
client.connect_signal('manage', function (c, startup) client.connect_signal(
'manage',
function (c, startup)
-- Enable sloppy focus -- Enable sloppy focus
c:connect_signal('mouse::enter', function(c) c:connect_signal(
if (awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and awful.layout.get(c.screen) ~= awful.layout.suit.floating) 'mouse::enter',
and awful.client.focus.filter(c) then function(c)
if (awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and awful.layout.get(c.screen) ~= awful.layout.suit.floating) and awful.client.focus.filter(c) then
client.focus = c client.focus = c
end end
end) end
)
if not startup then if not startup then
-- Set the windows at the slave, -- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master. -- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c) -- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position. -- Put windows in a smart way, only if they do not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c) awful.placement.no_overlap(c)
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end
end end
end) end
)
client.connect_signal('focus', function(c) c.border_color = beautiful.border_focus end) client.connect_signal('focus', function(c) c.border_color = beautiful.border_focus end)
client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end) client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end)

2
vimrc
View file

@ -30,7 +30,7 @@ autocmd FileType ruby setlocal sts=2 sw=2 expandtab
autocmd FileType eruby setlocal sts=2 sw=2 expandtab autocmd FileType eruby setlocal sts=2 sw=2 expandtab
autocmd FileType puppet setlocal sts=2 sw=2 expandtab autocmd FileType puppet setlocal sts=2 sw=2 expandtab
autocmd FileType python setlocal sts=4 sw=4 expandtab autocmd FileType python setlocal sts=4 sw=4 expandtab
autocmd FileType lua setlocal sts=4 sw=4 expandtab "autocmd FileType lua setlocal sts=4 sw=4 expandtab
" next line in wrapped lines " next line in wrapped lines
nmap j gj nmap j gj