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

240
rc.lua
View file

@ -21,24 +21,33 @@ end
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
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!',
text = awesome.startup_errors })
text = awesome.startup_errors
})
end
-- Handle runtime errors after startup
do
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
if in_error then return end
if in_error then
return
end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
naughty.notify({
preset = naughty.config.presets.critical,
title = 'Oops, an error happened!',
text = err })
text = err
})
in_error = false
end)
end
)
end
-- }}}
@ -67,8 +76,7 @@ editor_cmd = terminal .. ' -e ' .. editor
modkey = 'Mod4'
-- Table of layouts to cover with awful.layout.inc, order matters.
local layouts =
{
local layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.bottom,
@ -92,28 +100,24 @@ for s = 1, screen.count() do
tags[s] = { name = {}, layout = {} }
end
-- screen 1
--tags[1].name =
--{
--tags[1].name = {
-- [1] = '1:browser',
-- [2] = '2:terminal',
-- [3] = '3:terminal',
-- [4] = '4:float',
-- [9] = '9:mail'
--}
tags[1].layout =
{
tags[1].layout = {
[1] = layouts[2],
[4] = layouts[1],
[5] = layouts[1]
}
-- screens 2+
if screen.count() >= 2 then
--tags[2].name =
--{
--tags[2].name = {
-- [3] = '3:float',
--}
tags[2].layout =
{
tags[2].layout = {
[3] = layouts[1]
}
end
@ -139,13 +143,17 @@ quitmenu = {
{ '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 }
}
})
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
mylauncher = awful.widget.launcher({
image = beautiful.awesome_icon,
menu = mymainmenu
})
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
@ -171,10 +179,11 @@ mytaglist.buttons = awful.util.table.join(
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 5, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
awful.button({ }, 4, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
awful.button({ }, 1,
function (c)
if c == client.focus then
c.minimized = true
else
@ -190,7 +199,8 @@ mytasklist.buttons = awful.util.table.join(
c:raise()
end
end),
awful.button({ }, 3, function ()
awful.button({ }, 3,
function ()
if instance then
instance:hide()
instance = nil
@ -198,14 +208,21 @@ mytasklist.buttons = awful.util.table.join(
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.button({ }, 4,
function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
if client.focus then
client.focus:raise()
end
end),
awful.button({ }, 5, function ()
awful.button({ }, 5,
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
if client.focus then
client.focus:raise()
end
end)
)
for s = 1, screen.count() do
-- 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.
-- We need one layoutbox per screen.
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({ }, 3, 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
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons)
@ -261,37 +281,43 @@ end
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
root.buttons(
awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 5, awful.tag.viewnext),
awful.button({ }, 4, awful.tag.viewprev)
))
)
)
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, 'Up', function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, }, 'Down', function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, 'Left', awful.tag.viewprev ),
awful.key({ modkey, }, 'Right', awful.tag.viewnext ),
awful.key({ modkey, }, 'Left', awful.tag.viewprev),
awful.key({ modkey, }, 'Right', awful.tag.viewnext),
awful.key({ modkey, }, 'Escape', awful.tag.history.restore),
awful.key({ modkey, }, 'j',
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
awful.client.focus.byidx(1)
if client.focus then
client.focus:raise()
end
end),
awful.key({ modkey, }, 'k',
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
if client.focus then
client.focus:raise()
end
end),
awful.key({ modkey, }, 'w', function () mymainmenu:show() end),
-- Layout manipulation
awful.key({ modkey, 'Shift' }, 'j', function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, 'Shift' }, 'k', function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, 'Control' }, 'j', function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, 'Shift' }, 'j', function () awful.client.swap.byidx(1) end),
awful.key({ modkey, 'Shift' }, 'k', function () awful.client.swap.byidx(-1) end),
awful.key({ modkey, 'Control' }, 'j', function () awful.screen.focus_relative(1) end),
awful.key({ modkey, 'Control' }, 'k', function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, 'u', awful.client.urgent.jumpto),
awful.key({ modkey, }, 'Tab',
@ -337,10 +363,12 @@ globalkeys = awful.util.table.join(
awful.key({ modkey, }, 'e',
function ()
awful.prompt.run({ prompt = 'Run Lua code: ' },
awful.prompt.run(
{ prompt = 'Run Lua code: ' },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir('cache') .. '/history_eval')
awful.util.getdir('cache') .. '/history_eval'
)
end),
-- Menubar
awful.key({ modkey, }, 'p', function () menubar.show() end),
@ -414,13 +442,15 @@ for i = 1, 9 do
awful.client.toggletag(tag)
end
end
end))
end)
)
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
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
root.keys(globalkeys)
@ -429,61 +459,133 @@ root.keys(globalkeys)
-- {{{ Rules
awful.rules.rules = {
-- 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,
focus = awful.client.focus.filter,
keys = clientkeys,
buttons = clientbuttons } },
buttons = clientbuttons
}
},
-- 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
-- firefox
{ rule = { class = 'Firefox' }, except = { instance = 'Navigator' },
properties = { floating = true } },
{
rule = { class = 'Firefox' },
except = { instance = 'Navigator' },
properties = { floating = true }
},
-- 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:
-- 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
-- steam
{ rule = { class = 'Steam' },
properties = { tag = tags[1][4] } },
-- games
{ 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,
{
rule_any = { class = { 'Steam' },
instance = { 'Steam.exe' } },
properties = { tag = tags[1][4] }
},
-- 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,
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
-- 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
c:connect_signal('mouse::enter', 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
c:connect_signal(
'mouse::enter',
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
end
end)
end
)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- 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
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
end)
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)

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 puppet setlocal sts=2 sw=2 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
nmap j gj