-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Load Debian menu entries
require("debian.menu")
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
config = os.getenv("HOME") .. "/.config/awesome/"
beautiful.init(os.getenv("HOME") .. "/.config/awesome/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "x-terminal-emulator"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor
editor_cmd = "gedit "
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- {{{ Layouts
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
--awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier
}
-- }}}
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {
names = { "1", "2", "3", "4" , "5"},--, "6"},
layouts = { layouts[2], layouts[2], layouts[2], layouts[2], layouts[1]}--, layouts[2]}
}
for s = 1, screen.count() do
-- Each screen has its own tag table.
--tags[s] = awful.tag({ 1, 2, 3, 4, 5 }, s, layouts[1])
tags[s] = awful.tag(tags.names, s, tags.layouts)
end
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
dofile(config .. "menu.lua")
-- }}}
-- {{{ Wibox
-- Create a textclock widget
-- dofile(config .. "wibox2.lua")
-- }}}
--en dual screen, quand un tag est sélectionné sur un écran, le même tag
--sur l'autre écran est sélectionné.
for s = 1, screen.count() do
awful.tag.attached_add_signal(s, "property::selected",
function(tag)
if not tag.selected then return end
local idx = nil
for i, v in pairs(screen[s]:tags()) do
if v == tag then
idx = i
break
end
end
if not idx then return end
local c = client.focus
for scr = 1, screen.count() do
if scr ~= s then
if screen[scr]:tags()[idx] ~= nil then
awful.tag.viewonly(screen[scr]:tags()[idx])
end
end
end
client.focus = c
end)
end
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
dofile(config .. "key_bindings.lua")
-- }}}
-- {{{ Rules
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons,
-- floating=false,
size_hints_honor = true,
} },
{ rule = { class = "Avidemux" },
properties = {
tag = tags[1][5] ,
switchtotag = true,
floating = true
}
},
{ rule = { class = "net-sourceforge-dvb-projectx-common-Start" },
properties = {
tag = tags[2][5] ,
switchtotag = true,
floating = true
}
},
{ rule = { class = "Screenruler" },
properties = { floating = true, skip_taskbar = true } },
{ rule = { class = "Gmrun" },
properties = { floating = true,
skip_taskbar = true,
x=1305,
y=1000,ontop =true,} },
{ rule = { class = "Vlc" },
properties = { floating = true,
opacity = 1.0,
ontop =true,
} },
{ rule = { class = "Gimp" },
properties = { floating = true,
opacity = 1.0,
} },
{ rule = { class = "Gcolor2" },
properties = { floating = true,
opacity = 1.0,
ontop =true,
} },
{ rule = { name = "Encodage..." },
properties = { floating = true,
opacity = 1.0,
ontop =true,
} },
{ rule = { name = "Supprimer du contenu" },
properties = { floating = true,
opacity = 1.0,
ontop =true,
} },
{ rule = { class = "Awesome-logout" },
properties = { floating = true,
skip_taskbar = true,
ontop =true, } },
{ rule = { name = "Recherche" },
properties = { floating = true,
skip_taskbar = true,
ontop =true, } },
{ rule = { class = "X-terminal-emulator" },
properties = { opacity=0,}
},
{ rule = { class = "Conky" },
properties = { floating = true,
skip_taskbar = true,
x=1305,
y=1000,} },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
--naughty.notify({ text =c.name })
-- Add a titlebar
--awful.titlebar.add(c, { modkey = modkey })
titlebarClass = { ["Vlc"]= true,
["Gimp"]= true,
["Gcolor2"]= true,
["Lxappearance"]=true,
["Avidemux"]= true,
["net-sourceforge-dvb-projectx-common-Start"]=true, --projectx
["Xfce4-mixer"]= true,
["Gedit"]= true,
}
titlebarName = { ["Encodage..."]= true,
["vts - Gestionnaire de fichiers"]=true,
}
if titlebarClass[c.class] or titlebarName[c.name] then
awful.titlebar.add(c)
end
if c.class == "Vlc" then
c.screen = 1
end
-- Enable sloppy focus
c:add_signal("mouse::enter", function(c)
if awful.layout.get(
c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
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.
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)
client.add_signal("focus", function(c)
--naughty.notify({ text =c.class })
--mytitlebar = titlebar({ position = "top" })
--mytitlebartitle = widget({ type = "textbox", name = "mytitlebartitle" })
--mytitlebar:widgets({ mytitlebartitle })
--c = client.focus
--mytitlebartitle.text = c.name
-- c.titlebar = mytitlebar
c.border_color = beautiful.border_focus
c.opacity = 1
end)
client.add_signal("unfocus", function(c)
c.border_color = beautiful.border_normal
NoOpacityClass = { ["Vlc"]= true,
["Gimp"]= true,
["Gcolor2"]= true,
["Awesome-logout"]= true,
["Avidemux"]= true,
["net-sourceforge-dvb-projectx-common-Start"]=true,
}
if NoOpacityClass[c.class] then
c.opacity = 1
else
c.opacity = 0.75
end
end)
-- }}}
--autostart applications
--http://awesome.naquadah.org/wiki/Autostart#Simple_way
function run_once(prg,arg_string,screen)
if not prg then
do return nil end
end
if not arg_string then
awful.util.spawn_with_shell("pgrep -f -u $USER -x " .. prg .. " || (" .. prg .. ")",screen)
else
awful.util.spawn_with_shell("pgrep -f -u $USER -x " .. prg .. " || (" .. prg .. " " .. arg_string .. ")",screen)
end
end
--run_once("iceweasel",nil,1)
--run_once("gedit",nil,1)
--run_once("gnome-terminal", "-e /home/ll/scripts/podcasts/podcasts.sh",2)
--run_once("killall", "conky",1)
--run_once("conky", "-c /home/ll/conky/awesome/conkyrc",1)
run_once("killall", "xcompmgr",2)
run_once("xcompmgr", "",2)
run_once("killall", "tint2",2)
run_once("tint2", "-c /home/ll/.config/awesome/tint2rc-left",1)
run_once("tint2", "-c /home/ll/.config/awesome/tint2rc-right",2)
run_once("killall", "conky",2)
run_once("~/conky/awesome/run.sh","",1) --informations conky at startup
run_once("conky", "-c ~/conky/awesome/conkyrc-margin", 2)
--margins
awful.screen.padding( screen[1], { bottom = -26} )
awful.screen.padding( screen[2], { right = 95, bottom = 0} )
--awful.screen.padding( screen[2], { bottom = 30} )
As I said, i don't use any widgets : the line -- dofile(config .. "wibox2.lua") is commented.
-- {{{ Wibox
--dofile("/home/ll/.config/awesome/widget_sound.lua")
--dofile("/home/ll/.config/awesome/widget_ram.lua")
--dofile("/home/ll/.config/awesome/widget_cpu.lua")
--require("obvious")
-- {{{ Wibox
-- Create a textclock widget
--mytextclock = awful.widget.textclock({ align = "right"}, " %H:%M ")
-- Create a systray
mysystray = widget({ type = "systray" })
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
--tag List
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
--task List
--[[
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
]]
mylayoutbox[1] = awful.widget.layoutbox(1)
mylayoutbox[2] = awful.widget.layoutbox(2)
mytaglist[1] = awful.widget.taglist(1, awful.widget.taglist.label.all, mytaglist.buttons)
mytaglist[2] = awful.widget.taglist(2, awful.widget.taglist.label.all, mytaglist.buttons)
myspace = widget({ type = "textbox", name = "myspace", align = "right" })
myspace.text = " "
mywibox[1] = awful.wibox({ position = "bottom",x=1242,height=33,width=33,screen = 1})
mywibox[2] = awful.wibox({ position = "bottom",x=10,height=33,width=133,screen = 2})
for s = 1, screen.count() do
--ecran de gauche BAS
--s= 2
--mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a promptbox for each screen
if s==2 then
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
end
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
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)))
-- Create a taglist widget
-- Create a tasklist widget
-- mytasklist[s] = awful.widget.tasklist(function(c)
-- return awful.widget.tasklist.label.currenttags(c, s)
-- end, mytasklist.buttons)
-- Create the wibox
-- mywibox[2] = awful.wibox({ position = "bottom", screen = 1 })
-- mywibox[1] = awful.wibox({ position = "top", screen = 2 })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
-- {
-- mylauncher,
-- myspace,
-- mypromptbox[s],
-- mytaglist[s],
-- mytaglist[2],
mylayoutbox[s],
myspace,
-- mylayoutbox[2],
layout = awful.widget.layout.horizontal.leftright,
-- },
--s == 1 and mytextclock or nil ,
s == 2 and mysystray or nil,
-- mytasklist[s],
-- layout = awful.widget.layout.vertical.topdown
}
--en dual screen, quand un tag est sélectionné sur un écran, le même tag
--sur l'autre écran est sélectionné.
awful.tag.attached_add_signal(s, "property::selected",
function(tag)
if not tag.selected then return end
local idx = nil
for i, v in pairs(screen[s]:tags()) do
if v == tag then
idx = i
break
end
end
if not idx then return end
local c = client.focus
for scr = 1, screen.count() do
if scr ~= s then
if screen[scr]:tags()[idx] ~= nil then
awful.tag.viewonly(screen[scr]:tags()[idx])
end
end
end
client.focus = c
end)
end