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

762
rc.lua
View file

@ -13,32 +13,41 @@ local menubar = require('menubar')
-- enable testing if file exists -- enable testing if file exists
function ifexists(name) function ifexists(name)
local f=io.open(name,'r') local f=io.open(name,'r')
if f ~= nil then io.close(f) return true else return false end if f ~= nil then io.close(f) return true else return false end
end end
-- {{{ Error handling -- {{{ Error handling
-- 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({
title = 'Oops, there were errors during startup!', preset = naughty.config.presets.critical,
text = awesome.startup_errors }) title = 'Oops, there were errors during startup!',
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(
-- Make sure we don't go into an endless error loop 'debug::error',
if in_error then return end function (err)
in_error = true -- Make sure we don't go into an endless error loop
if in_error then
return
end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({
title = 'Oops, an error happened!', preset = naughty.config.presets.critical,
text = err }) title = 'Oops, an error happened!',
in_error = false text = err
end) })
in_error = false
end
)
end end
-- }}} -- }}}
@ -51,7 +60,7 @@ theme.font = 'Terminus 9'
-- set wallpaper -- set wallpaper
local wallpaper = '/home/von/Pictures/wallpaper.png' local wallpaper = '/home/von/Pictures/wallpaper.png'
if ifexists(wallpaper) then if ifexists(wallpaper) then
theme.wallpaper = wallpaper theme.wallpaper = wallpaper
end end
-- This is used later as the default terminal and editor to run. -- This is used later as the default terminal and editor to run.
@ -67,21 +76,20 @@ 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, awful.layout.suit.max,
awful.layout.suit.max, awful.layout.suit.magnifier
awful.layout.suit.magnifier
} }
-- }}} -- }}}
-- {{{ Wallpaper -- {{{ Wallpaper
if beautiful.wallpaper then if beautiful.wallpaper then
for s = 1, screen.count() do for s = 1, screen.count() do
gears.wallpaper.centered(beautiful.wallpaper, s) gears.wallpaper.centered(beautiful.wallpaper, s)
end end
end end
-- }}} -- }}}
@ -89,63 +97,63 @@ end
-- 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 = {}
for s = 1, screen.count() do 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
-- 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 tags[s].name[tag] = tags[s].name[tag] or tag
tags[s].layout[tag] = tags[s].layout[tag] or layouts[3] tags[s].layout[tag] = tags[s].layout[tag] or layouts[3]
end end
end end
-- Set tags instances in wm -- Set tags instances in wm
for s = 1, screen.count() do for s = 1, screen.count() do
tags[s] = awful.tag(tags[s].name, s, tags[s].layout) tags[s] = awful.tag(tags[s].name, s, tags[s].layout)
end end
-- }}} -- }}}
-- {{{ Menu -- {{{ Menu
-- Create a laucher widget and a main menu -- Create a laucher widget and a main menu
restartmenu = { restartmenu = {
{ 'restart', awesome.restart } { 'restart', awesome.restart }
} }
quitmenu = { quitmenu = {
{ 'quit', awesome.quit } { 'quit', awesome.quit }
} }
mymainmenu = awful.menu({ items = { { 'restart', restartmenu, beautiful.awesome_icon }, mymainmenu = awful.menu({
{ 'quit', quitmenu, beautiful.awesome_icon } items = {
} { 'restart', restartmenu, 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
@ -165,262 +173,284 @@ mypromptbox = {}
mylayoutbox = {} mylayoutbox = {}
mytaglist = {} mytaglist = {}
mytaglist.buttons = awful.util.table.join( mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly), awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag), awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle), awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag), awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 5, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end), 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) awful.button({ }, 4, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
) )
mytasklist = {} mytasklist = {}
mytasklist.buttons = awful.util.table.join( mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c) awful.button({ }, 1,
if c == client.focus then function (c)
c.minimized = true if c == client.focus then
else c.minimized = true
-- Without this, the following else
-- :isvisible() makes no sense -- Without this, the following
c.minimized = false -- :isvisible() makes no sense
if not c:isvisible() then c.minimized = false
awful.tag.viewonly(c:tags()[1]) if not c:isvisible() then
end awful.tag.viewonly(c:tags()[1])
-- This will also un-minimize end
-- the client, if needed -- This will also un-minimize
client.focus = c -- the client, if needed
c:raise() client.focus = c
end c:raise()
end), end
awful.button({ }, 3, function () end),
if instance then awful.button({ }, 3,
instance:hide() function ()
instance = nil if instance then
else instance:hide()
instance = awful.menu.clients({ width=250 }) instance = nil
end else
end), instance = awful.menu.clients({ width=250 })
awful.button({ }, 4, function () end
awful.client.focus.byidx(1) end),
if client.focus then client.focus:raise() end awful.button({ }, 4,
end), function ()
awful.button({ }, 5, function () awful.client.focus.byidx(1)
awful.client.focus.byidx(-1) if client.focus then
if client.focus then client.focus:raise() end client.focus:raise()
end)) end
end),
awful.button({ }, 5,
function ()
awful.client.focus.byidx(-1)
if client.focus then
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
mypromptbox[s] = awful.widget.prompt() mypromptbox[s] = awful.widget.prompt()
-- 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.button({ }, 1, function () awful.layout.inc(layouts, 1) end), awful.util.table.join(
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
-- Create a taglist widget awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons) )
)
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.noempty, mytaglist.buttons)
-- Create a tasklist widget -- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
-- Create the wibox -- Create the wibox
mywibox[s] = awful.wibox({ position = 'top', height = '16', screen = s }) mywibox[s] = awful.wibox({ position = 'top', height = '16', screen = s })
local left_layout = wibox.layout.fixed.horizontal() local left_layout = wibox.layout.fixed.horizontal()
local right_layout = wibox.layout.fixed.horizontal() local right_layout = wibox.layout.fixed.horizontal()
if s == 1 then if s == 1 then
left_layout:add(mytextbox) left_layout:add(mytextbox)
right_layout:add(mypromptbox[s]) right_layout:add(mypromptbox[s])
right_layout:add(mytaglist[s]) right_layout:add(mytaglist[s])
if screen.count() == 1 then if screen.count() == 1 then
right_layout:add(wibox.widget.systray()) right_layout:add(wibox.widget.systray())
right_layout:add(mytextclock) right_layout:add(mytextclock)
end end
right_layout:add(mylayoutbox[s]) right_layout:add(mylayoutbox[s])
elseif s == 2 then elseif s == 2 then
left_layout:add(mylayoutbox[s]) left_layout:add(mylayoutbox[s])
left_layout:add(mytextclock) left_layout:add(mytextclock)
left_layout:add(wibox.widget.systray()) left_layout:add(wibox.widget.systray())
left_layout:add(mytaglist[s]) left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s]) left_layout:add(mypromptbox[s])
else else
left_layout:add(mytaglist[s]) left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s]) left_layout:add(mypromptbox[s])
right_layout:add(mylayoutbox[s]) right_layout:add(mylayoutbox[s])
end end
-- Now bring it all together (with the tasklist in the middle) -- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal() local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout) layout:set_left(left_layout)
layout:set_middle(mytasklist[s]) layout:set_middle(mytasklist[s])
layout:set_right(right_layout) layout:set_right(right_layout)
mywibox[s]:set_widget(layout) mywibox[s]:set_widget(layout)
end end
-- }}} -- }}}
-- {{{ Mouse bindings -- {{{ Mouse bindings
root.buttons(awful.util.table.join( root.buttons(
awful.button({ }, 3, function () mymainmenu:toggle() end), awful.util.table.join(
awful.button({ }, 5, awful.tag.viewnext), awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewnext),
)) awful.button({ }, 4, awful.tag.viewprev)
)
)
-- }}} -- }}}
-- {{{ Key bindings -- {{{ Key bindings
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
awful.key({ modkey, }, 'Up', function () awful.screen.focus_relative( 1) end), 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, }, 'Down', function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, 'Left', awful.tag.viewprev ), awful.key({ modkey, }, 'Left', awful.tag.viewprev),
awful.key({ modkey, }, 'Right', awful.tag.viewnext ), awful.key({ modkey, }, 'Right', awful.tag.viewnext),
awful.key({ modkey, }, 'Escape', awful.tag.history.restore), awful.key({ modkey, }, 'Escape', awful.tag.history.restore),
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
end), client.focus:raise()
awful.key({ modkey, }, 'k', end
function () end),
awful.client.focus.byidx(-1) awful.key({ modkey, }, 'k',
if client.focus then client.focus:raise() end function ()
end), awful.client.focus.byidx(-1)
awful.key({ modkey, }, 'w', function () mymainmenu:show() end), if client.focus then
client.focus:raise()
end
end),
awful.key({ modkey, }, 'w', function () mymainmenu:show() end),
-- Layout manipulation -- Layout manipulation
awful.key({ modkey, 'Shift' }, 'j', function () awful.client.swap.byidx( 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, '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' }, 'j', function () awful.screen.focus_relative(1) end),
awful.key({ modkey, 'Control' }, 'k', 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, }, 'u', awful.client.urgent.jumpto),
awful.key({ modkey, }, 'Tab', awful.key({ modkey, }, 'Tab',
function () function ()
awful.client.focus.history.previous() awful.client.focus.history.previous()
if client.focus then if client.focus then
client.focus:raise() client.focus:raise()
end end
end), end),
awful.key({ 'Mod1', }, 'Tab', awful.key({ 'Mod1', }, 'Tab',
function () function ()
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
if client.focus then if client.focus then
client.focus:raise() client.focus:raise()
end end
end), end),
awful.key({ 'Mod1', 'Shift' }, 'Tab', awful.key({ 'Mod1', 'Shift' }, 'Tab',
function () function ()
awful.client.focus.byidx(1) awful.client.focus.byidx(1)
if client.focus then if client.focus then
client.focus:raise() client.focus:raise()
end end
end), end),
-- Standard program -- Standard program
--awful.key({ modkey, 'Control' }, 'r', awesome.restart), --awful.key({ modkey, 'Control' }, 'r', awesome.restart),
--awful.key({ modkey, 'Shift' }, 'q', awesome.quit), --awful.key({ modkey, 'Shift' }, 'q', awesome.quit),
awful.key({ modkey, }, 'l', function () awful.tag.incmwfact( 0.05) end), awful.key({ modkey, }, 'l', function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, 'h', function () awful.tag.incmwfact(-0.05) end), awful.key({ modkey, }, 'h', function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, 'Shift' }, 'h', function () awful.tag.incnmaster( 1) end), awful.key({ modkey, 'Shift' }, 'h', function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, 'Shift' }, 'l', function () awful.tag.incnmaster(-1) end), awful.key({ modkey, 'Shift' }, 'l', function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, 'Control' }, 'h', function () awful.tag.incncol( 1) end), awful.key({ modkey, 'Control' }, 'h', function () awful.tag.incncol( 1) end),
awful.key({ modkey, 'Control' }, 'l', function () awful.tag.incncol(-1) end), awful.key({ modkey, 'Control' }, 'l', function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, 'space', function () awful.layout.inc(layouts, 1) end), awful.key({ modkey, }, 'space', function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, 'Shift' }, 'space', function () awful.layout.inc(layouts, -1) end), awful.key({ modkey, 'Shift' }, 'space', function () awful.layout.inc(layouts, -1) end),
awful.key({ modkey, 'Control' }, 'n', awful.client.restore), awful.key({ modkey, 'Control' }, 'n', awful.client.restore),
-- Prompt -- Prompt
awful.key({ modkey, }, 'r', function () mypromptbox[mouse.screen]:run() end), awful.key({ modkey, }, 'r', function () mypromptbox[mouse.screen]:run() end),
awful.key({ 'Mod1', }, 'F2', function () mypromptbox[mouse.screen]:run() end), awful.key({ 'Mod1', }, 'F2', function () mypromptbox[mouse.screen]:run() end),
awful.key({ modkey, }, 'e', awful.key({ modkey, }, 'e',
function () function ()
awful.prompt.run({ prompt = 'Run Lua code: ' }, awful.prompt.run(
mypromptbox[mouse.screen].widget, { prompt = 'Run Lua code: ' },
awful.util.eval, nil, mypromptbox[mouse.screen].widget,
awful.util.getdir('cache') .. '/history_eval') awful.util.eval, nil,
end), awful.util.getdir('cache') .. '/history_eval'
-- Menubar )
awful.key({ modkey, }, 'p', function () menubar.show() end), end),
-- Glbal commands -- Menubar
awful.key({ modkey, }, 'x', function () awful.util.spawn(terminal) end), awful.key({ modkey, }, 'p', function () menubar.show() end),
awful.key({ modkey, }, 'q', function () awful.util.spawn('/home/von/.local/bin/ticket_watch') end), -- Glbal commands
awful.key({ modkey, }, 'z', function () awful.util.spawn('bash -c "until slock; do :; done"') end), awful.key({ modkey, }, 'x', function () awful.util.spawn(terminal) end),
awful.key({ modkey, }, 'F6', function () awful.util.spawn('/home/von/touchpad_hotkey.sh') end), awful.key({ modkey, }, 'q', function () awful.util.spawn('/home/von/.local/bin/ticket_watch') end),
awful.key({ }, 'Print', function () awful.util.spawn('xfce4-screenshooter -ws /home/von/screenshots') end), awful.key({ modkey, }, 'z', function () awful.util.spawn('bash -c "until slock; do :; done"') end),
awful.key({ modkey, }, 'Print', function () awful.util.spawn('xfce4-screenshooter -fs /home/von/screenshots') end) awful.key({ modkey, }, 'F6', function () awful.util.spawn('/home/von/touchpad_hotkey.sh') end),
-- screenshot via scrot (might be useful at some point awful.key({ }, 'Print', function () awful.util.spawn('xfce4-screenshooter -ws /home/von/screenshots') end),
-- awful.key({ }, 'Print', function() awful.util.spawn('scrot /home/von/screenshots/%Y-%m-%d_%H-%M_all.png') end), awful.key({ modkey, }, 'Print', function () awful.util.spawn('xfce4-screenshooter -fs /home/von/screenshots') end)
-- screenshot via scrot (might be useful at some point
-- awful.key({ }, 'Print', function() awful.util.spawn('scrot /home/von/screenshots/%Y-%m-%d_%H-%M_all.png') end),
) )
clientkeys = awful.util.table.join( clientkeys = awful.util.table.join(
awful.key({ modkey, }, 'f', function (c) c.fullscreen = not c.fullscreen end), awful.key({ modkey, }, 'f', function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, 'Shift' }, 'c', function (c) c:kill() end), awful.key({ modkey, 'Shift' }, 'c', function (c) c:kill() end),
awful.key({ modkey, 'Control' }, 'space', awful.client.floating.toggle ), awful.key({ modkey, 'Control' }, 'space', awful.client.floating.toggle ),
awful.key({ modkey, }, 'Return', function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, 'Return', function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, 'o', awful.client.movetoscreen ), awful.key({ modkey, }, 'o', awful.client.movetoscreen ),
awful.key({ modkey, }, 't', function (c) c.ontop = not c.ontop end), awful.key({ modkey, }, 't', function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, 's', function (c) c.sticky = not c.sticky end), awful.key({ modkey, }, 's', function (c) c.sticky = not c.sticky end),
awful.key({ modkey, }, 'n', awful.key({ modkey, }, 'n',
function (c) function (c)
-- The client currently has the input focus, so it cannot be -- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus. -- minimized, since minimized clients can't have the focus.
c.minimized = true c.minimized = true
end), end),
awful.key({ modkey, }, 'm', awful.key({ modkey, }, 'm',
function (c) function (c)
c.maximized_horizontal = not c.maximized_horizontal c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical c.maximized_vertical = not c.maximized_vertical
end) end)
) )
-- Bind all key numbers to tags. -- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout. -- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9. -- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do for i = 1, 9 do
globalkeys = awful.util.table.join(globalkeys, globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, '#' .. i + 9, awful.key({ modkey }, '#' .. i + 9,
function () function ()
local screen = mouse.screen local screen = mouse.screen
local tag = awful.tag.gettags(screen)[i] local tag = awful.tag.gettags(screen)[i]
if tag then if tag then
awful.tag.viewonly(tag) awful.tag.viewonly(tag)
end end
end), end),
awful.key({ modkey, 'Control' }, '#' .. i + 9, awful.key({ modkey, 'Control' }, '#' .. i + 9,
function () function ()
local screen = mouse.screen local screen = mouse.screen
local tag = awful.tag.gettags(screen)[i] local tag = awful.tag.gettags(screen)[i]
if tag then if tag then
awful.tag.viewtoggle(tag) awful.tag.viewtoggle(tag)
end end
end), end),
awful.key({ modkey, 'Shift' }, '#' .. i + 9, awful.key({ modkey, 'Shift' }, '#' .. i + 9,
function () function ()
if client.focus then if client.focus then
local tag = awful.tag.gettags(client.focus.screen)[i] local tag = awful.tag.gettags(client.focus.screen)[i]
if tag then if tag then
awful.client.movetotag(tag) awful.client.movetotag(tag)
end end
end end
end), end),
awful.key({ modkey, 'Control', 'Shift' }, '#' .. i + 9, awful.key({ modkey, 'Control', 'Shift' }, '#' .. i + 9,
function () function ()
if client.focus then if client.focus then
local tag = awful.tag.gettags(client.focus.screen)[i] local tag = awful.tag.gettags(client.focus.screen)[i]
if tag then if tag then
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)
@ -428,62 +458,134 @@ 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 = { },
border_color = beautiful.border_normal, properties = {
focus = awful.client.focus.filter, border_width = beautiful.border_width,
keys = clientkeys, border_color = beautiful.border_normal,
buttons = clientbuttons } }, focus = awful.client.focus.filter,
-- Floating only rules class based rules keys = clientkeys,
{ rule_any = { class = { 'pinentry', 'Skype', 'Deadbeef', 'Pavucontrol', 'Qmmp', 'Vncviewer', 'plugin-container', 'mpv' }, instance = { 'sun-awt-X11-XFramePeer' } }, buttons = clientbuttons
properties = { floating = true } }, }
-- Mostly floating rules, we want to keep them separately since it's easier to manage },
-- firefox -- Floating only rules class based rules
{ rule = { class = 'Firefox' }, except = { instance = 'Navigator' }, {
properties = { floating = true } }, rule_any = {
-- ardour3 class = {
{ rule = { class = 'Ardour' }, except = { instance = 'ardour_editor' }, 'pinentry',
properties = { floating = true } }, 'Skype',
-- Remove gaps between terminal windows: 'Deadbeef',
-- roxterm 'Pavucontrol',
{ rule = { class = 'Roxterm' }, 'Qmmp',
properties = { size_hints_honor = false } }, 'Vncviewer',
-- Specific desktops rules: place windows only on specific tags by default 'plugin-container',
-- steam 'mpv'
{ rule = { class = 'Steam' }, },
properties = { tag = tags[1][4] } }, instance = {
-- games 'sun-awt-X11-XFramePeer'
{ 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, properties = {
tag = tags[1][5] } } 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 }
},
-- ardour3
{
rule = { class = 'Ardour' },
except = { instance = 'ardour_editor' },
properties = { floating = true }
},
-- Remove gaps between terminal windows:
-- roxterm
{
rule = { class = 'Roxterm' },
properties = { size_hints_honor = false }
},
-- Specific desktops rules: place windows only on specific tags by default
-- steam
{
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]
}
},
-- 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(
-- Enable sloppy focus 'manage',
c:connect_signal('mouse::enter', function(c) function (c, startup)
if (awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and awful.layout.get(c.screen) ~= awful.layout.suit.floating) -- Enable sloppy focus
and awful.client.focus.filter(c) then c:connect_signal(
client.focus = c 'mouse::enter',
end function(c)
end) 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
)
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)
@ -494,6 +596,6 @@ client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_n
awful.util.spawn_with_shell('setxkbmap -layout us,ru -variant altgr-intl,typewriter -option grp:caps_toggle,compose:menu,grp_led:scroll') awful.util.spawn_with_shell('setxkbmap -layout us,ru -variant altgr-intl,typewriter -option grp:caps_toggle,compose:menu,grp_led:scroll')
awful.util.spawn_with_shell('xrdb /home/von/.Xresources') awful.util.spawn_with_shell('xrdb /home/von/.Xresources')
if ifexists('/home/von/.autostart') then if ifexists('/home/von/.autostart') then
awful.util.spawn_with_shell('/home/von/.autostart') awful.util.spawn_with_shell('/home/von/.autostart')
end 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