--{{{ Libsio.stderr:write("===== awesome reloaded\r\n")-- module to loadrequire("awful")require("beautiful")require("invaders")require("revelation")require("naughty")require("tabulous")-- uncomment this to activate autotabbingtabulous.autotab_start()require("wicked") -- it's not part of awesome, compil it from git--}}}-- {{{ Variables--{{{ Pathshome_dir = os.getenv("HOME")awesome_dir = home_dir .. "/.config/awesome/"scripts_dir = home_dir .. "/.config/awesome/scripts/"icons_dir = home_dir .. "/.config/awesome/icons/"theme_path = "/usr/share/awesome/themes/default/theme"--}}}---{{{ Autostart-- some useful stuff running at startupos.execute("system-config-printer-applet&")os.execute("/usr/bin/pam-panel-icon&")os.execute("/usr/bin/gnome-volume-control-applet&")os.execute("/usr/bin/draksnapshot-applet&")os.execute("/usr/bin/mdkapplet -f&")os.execute("/usr/bin/net_applet&")os.execute("pactl load-module module-x11-xsmp&")-- os.execute("thunar --daemon&")-- os.execute("bluetooth-applet&")-- generate programs list for dmenuprogslist_path = os.getenv("HOME") .. "/.cache/awesome/proglist"function proglist() local path = os.getenv("PATH") os.execute("paths=$(echo \"" .. path .. "\" | sed 'y/:/ /') ; ls -lL $paths 2>/dev/null | awk '$1 ~ /^[^d].*x/ && NF > 2 { print $NF }' | sort | uniq > " .. progslist_path) -- unregister this function awful.hooks.timer.unregister(proglist)end-- make proglist in background after awesome starts (prevent awesome freeze)awful.hooks.timer.register(5, proglist)proglist(os.getenv("PATH"))-- used with autostart function for reading .desktop--autostart_dir = os.getenv("HOME") .. "/.config/autostart"--autostart(autostart_dir)---}}}--{{{ Various varsterminal = "urxvt"terminal_alt = "xterm"editor = os.getenv("EDITOR") or "vim"editor_cmd = terminal .. " -e " .. editorbrowser = "midori"file_manager = "thunar"file_manager_alt = "nautilus --no-desktop"--}}}-- Define if we want to use titlebar on all applications.use_titlebar = false-- }}}--{{{ Key combinationmodkey = "Mod4"shift = "Shift"modkey2 = "Mod3"control = "Control"alt = "Alt"shift = "Shift"k_n = {}k_m = {modkey}k_ms = {modkey, shift}k_ma = {modkey, alt}k_mc = {modkey, control}k_mcs = { modkey, "Control", "Shift" }k_a = {alt}k_ac = {alt, control}k_as = {alt, shift}k_c = {control}k_cs = {control, shift}k_s = {shift}--}}}--{{{ Layoutslayouts ={ "tile", "tileleft", "tilebottom", "tiletop", "fairh", "fairv", "magnifier", "max", "fullscreen", "spiral", "dwindle", "floating"}--}}}--{{{ Floatings clientsfloatapps ={ ["MPlayer"] = true, ["Firefox Preferences"] = true, ["psi"] = true,i ["et-gtk.py"] = true, ["Wine"] = true, ["NdsCRC.exe"] = true, ["VirtualBox"] = true, ["Evolution" ] = true, ["Transmission"] = true,}--}}}--{{{ Apps to tagsapptags ={ ["Midori"] = { screen = 1, tag = 3 }, ["Pidgin"] = { screen = 1, tag = 5 }, ["Vmware-vmrc"] = { screen = 1, tag = 9 }, ["VirtualBox"] = { screen = 1, tag = 9 }, ["Evolution"] = { screen = 1, tag = 4 }, ["Transmission"] = { screen = 1, tag = 0 },}--}}}--{{{ Colors, fonts...default_mwfact = 0.618033988769beautiful.init(theme_path)--}}}--{{{ Tags screens specific-- Define tags tabletags_name = {}tags_layout = {}tags_mwfact = {}tags_name[1] = { "main", "ssh", "www", "mail", "im", "irrsi", "dev1", "dev2", "dev3", "mpd", "ooo", "vm", "trash", "foo", "bar" }tags_layout[1] = { 1, 1, 1, 1, 12, 4, 1, 1, 12, 1, 1, 1, 1, 1, 1 }tags_mwfact[1] = { default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact, default_mwfact}tags = {}for s = 1, screen.count() do -- Each screen has its own tag table tags[s] = {} -- Create 9 tags per screen for tagnumber,tagname in ipairs(tags_name[s]) do tags[s][tagnumber] = tag({ name = tagname, layout = layouts[tags_layout[s][tagnumber]] }) -- Add tags to screen one by one tags[s][tagnumber].screen = s end -- I'm sure you want to see at least one tag. tags[s][1].selected = trueend--} }}--{{{ Funtions definition--{{{ Utils-- Set background colorfunction bg(color, text) return '<bg color="' .. color .. '" />' .. textend-- Set foreground colorfunction fg(color, text) return '<span color="' .. color .. '">' .. text .. '</span>'end-- Boldify textfunction bold(text) return '<b>' .. text .. '</b>'end-- Widget basefunction widget_base(content) if content and content ~= "" then return fg(beautiful.fg_focus, " [ ") .. content .. fg(beautiful.fg_focus, " ] ") endend-- Widget sectionfunction widget_section(label, content, next_section) local section if content and content ~= nil then if label and label ~= "" then section = bold(label .. ": ") .. content else section = content end if next_section and next_section ~= "" then section = section .. fg(beautiful.hilight, " | ") .. next_section end else section = next_section end return sectionend-- Widget valuefunction widget_value(content, next_value) local value if content and content ~= nil then value = content if next_value and next_value ~= "" then value = value .. fg(beautiful.hilight, " / ") .. next_value end else value = next_value end return valueend-- Read the first line of a filefunction readline(file) local f = io.open(file, "r") if f ~= nil then local c = f:read("*l") f:close() return c else return nil endend-- Return symbol for the given layoutfunction layout_symbol(layout) return fg(beautiful.fg_focus," │" .. layouts_symbol[layout] .. "│ ")endfunction system(cmd) local f = io.popen(cmd) local l = f:read() f:close() return lendfunction execute(cmd) local f = io.popen(cmd) if f ~= nil then local c = f:read() f:close() return c else return nil endend-- Be Careful, function is so shitty !function images(image) return "<bg image='"..image.."' resize=\"true\"/>" endfunction image_un(image) return "<bg image='"..image.."' resize=\"false\"/>" endfunction set_bg( color, text ) return '<bg color="' .. color .. '" />' .. textendfunction set_fg( color, text ) return '<span color="' .. color .. '">' .. text .. '</span>'endfunction set_font( font, text ) return '<span font_desc="' .. font .. '">' .. text .. '</span>'endfunction set_align( alignment, text ) return '<text align="' .. alignment .. '">' .. text .. '</text>'endfunction set_urgent( text ) return set_bg( bg_urgent, set_fg( fg_urgent, text ) )endfunction set_normal( text ) return set_bg( bg_normal, set_fg( fg_normal, text ) )endfunction set_focused( text ) return set_bg( bg_focus, set_fg( fg_focus, text ) )endfunction warning( condition, text )if condition then return set_urgent( text ) else return set_normal( text ) endendfunction splitbywhitespace(str) --stolen from wicked.lua values = {} start = 1 splitstart, splitend = string.find(str, ' ', start) while splitstart do m = string.sub(str, start, splitstart-1) if m:gsub(' ','') ~= '' then table.insert(values, m) endstart = splitend+1splitstart, splitend = string.find(str, ' ', start) end m = string.sub(str, start) if m:gsub(' ','') ~= '' thentable.insert(values, m) end return valuesendfunction to_int( n ) return tonumber( string.format( '%i', n ) )endfunction dbg(vars) local text = "" for i=1, #vars do text = text .. vars[i] .. " | " end naughty.notify({ text = text, timeout = 0 })end--- Spawns cmd if no client can be found matching properties-- If such a client can be found, pop to first tag where it is visible, and give it focus-- @param cmd the command to execute-- @param properties a table of properties to match against clients. Possible entries: any properties of the client objectfunction run_or_raise(cmd, properties) local clients = client.get() for i, c in pairs(clients) do if match(properties, c) then local ctags = c:tags() if table.getn(ctags) == 0 then -- ctags is empty, show client on current tag local curtag = awful.tag.selected() awful.client.movetotag(curtag, c) else -- Otherwise, pop to first tag client is visible on awful.tag.viewonly(ctags[1]) end -- And then focus the client client.focus = c c:raise() return end end awful.util.spawn(cmd)end-- Returns true if all pairs in table1 are present in table2function match (table1, table2) for k, v in pairs(table1) do if table2[k] ~= v then return false end end return trueendfunction autostart(dir) if not dir then do return nil end end local fd = io.popen("ls -1 -F " .. dir) if not fd then do return nil end end for file in fd:lines() do local c= string.sub(file,-1) -- last char if c=='*' then -- executables executable = string.sub( file, 1,-2 ) print("Awesome Autostart: Executing: " .. executable) os.execute(dir .. "/" .. executable .. " &") -- launch in bg elseif c=='@' then -- symbolic links print("Awesome Autostart: Not handling symbolic links: " .. file) else print ("Awesome Autostart: Skipping file " .. file .. " not executable.") end end io.close(fd)end--}}}--{{{ Widgets-- Just a clock, %d/%m/%Y %H:%Mfunction widget_clock() return widget_base(os.date("%H:%M"))endfunction widget_date() return widget_base(os.date("%d/%m/%Y"))end--}}}--{{{ Statusbar--{{{ Clock widget -- clockboxclockbox = widget({ type = "textbox", name = "clockbox", align = "right" })clockbox.text = widget_clock()--}}}--{{{ Date widget -- clockboxdatebox = widget({ type = "textbox", name = "datebox", align = "right" })datebox.text = widget_date()--}}}--{{{ Ram client box -- ramclientboxramclientbox = widget({ type = "textbox", name = "ramclientbox", align = "left" })--}}}--{{{ Systray widget -- mysystraymysystray = widget({ type = "systray", name = "mysystray", align = "right" })--}}}--{{{ Awesome Launche-- Create a laucher widget and a main menumyawesomemenu = { {"manual", terminal .. " -e man awesome" }, {"edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" }, {"restart", awesome.restart }, {"quit", awesome.quit }}mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, { "open terminal", terminal } } })mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })--}}}--{{{ Mpd buttons -- mpdbuttonsmpdbuttonPrecedent = awful.widget.launcher({ name = "mpdbuttonPrecedent", image = icons_dir .. "precendent.png", command = music_prev, align="right", resize="true"})mpdbuttonStop = awful.widget.launcher({ name = "mpdbuttonStop", image = icons_dir .. "stop.png", command = music_stop, align="right", resize="true"})mpdbuttonPause = awful.widget.launcher({ name = "mpdbuttonPause", image = icons_dir .. "play.png", command = music_play, align="right", resize="true"})mpdbuttonSuivant = awful.widget.launcher({ name = "mpdbuttonSuivant", image = icons_dir .. "suivant.png", command = music_next, align="right", resize="true"})--}}}-- music player daemon infompdwidget = widget({ type = 'textbox', name = 'mpdwidget', align = 'right' })wicked.register(mpdwidget, wicked.widgets.mpd, function (widget, args) if args[1]:find("volume:") == nil then return ' <span color="white">MPD: </span>' .. args[1] else return '' end end)---COMMAND { get_volume = 'aumix-text -q| grep \'vol \'| awk \'{print $2}\' | cut -d\',\' -f1' get_temp = 'acpi -tB | awk \'{print $4}\' | cut -d\'.\' -f1' get_music = 'mpc | grep -v %'---}--VOLUME WIDGET { voliconbox = widget({ type = "textbox", name = "voliconbox", align = "right" }) voliconbox.text = image_un(icons_dir .. "sound.png") voliconbox:buttons( { button({ }, 4, function () awful.util.spawn("aumix-text -v +5") end ) } ) voliconbox:buttons( { button({ }, 5, function () awful.util.spawn("aumix-text -v -5") end ) } ) voliconbox:buttons( { button({ }, 1, function () awful.util.spawn("mute") end ) } ) volumew = widget({type = 'progressbar', name = 'volumew', align = 'right'}) volumew.width = 37 volumew.height = 0.50 volumew.border_padding = 0 volumew.border_width = 0 volumew.ticks_count = 10 volumew.vertical = false volumew:bar_properties_set('vol', {bg ='#000000',fg ='#ffffff',bordercolor = '#041F34',fg_off = '#484848',min_value = 0,max_value = 100}) wicked.register(volumew, 'function', function (widget, args) local f = io.popen(get_volume) local l = f:read() f:close() return l end, 4,'vol') volumew:buttons( { button({ }, 4, function () awful.util.spawn(terminal .. " -geometry \"-1-173\" -name ncmpc -e ncmpc") end ) } ) volumew:buttons( { button({ }, 5, function () awful.util.spawn(terminal .. " -geometry \"-1-173\" -name alsamixer -e alsamixer") end ) } ) volumew:buttons( { button({ }, 1, function () awful.util.spawn("aumix-text -v +5") end ) } ) volumew:buttons( { button({ }, 3, function () awful.util.spawn("aumix-text -v -5") end ) } )--}---TEMP WIDGET { tempiconbox = widget({ type = "textbox", name = "tempiconbox",align = "right" }) tempiconbox.text = image_un(icons_dir .. "cpuc.png") tempw = widget({type = 'textbox',name = 'tempw',align = "right"}) wicked.register(tempw, 'function', function (widget,args) local f = io.popen(get_temp) local t = f:read() f:close() return ' '..t..'°' end, 4)---- -}---MEM WIDGET { memiconbox = widget({ type = "textbox", name = "memiconbox", align = "right" }) memiconbox.text = image_un(icons_dir .."mem.png") membarw = widget({type = 'progressbar', name = 'membarw', align = 'right'}) membarw.width = 30 membarw.height = 0.50 membarw.gap = 0 membarw.border_padding = 0 membarw.border_width = 1 membarw.ticks_count = 0 membarw.ticks_gap = 0 membarw:bar_properties_set('mem', {border_color = '#dddddd',fg = '#ffffff',reverse = false,min_value = 0,max_value = 100}) wicked.register(membarw, 'mem', '$1',10,'mem')---}---CPU WIDGET { cpuiconbox = widget({ type = "textbox", name = "cpuiconbox", align = "right" }) cpuiconbox.text = image_un(icons_dir .."cpu2.png") cpugraphwidget = widget({type = 'graph',name = 'cpugraphwidget',align = 'right' }) cpugraphwidget.height = "0.8" cpugraphwidget.width = "30" cpugraphwidget.border_color = '#041f34' cpugraphwidget.grow = 'left' cpugraphwidget:plot_properties_set('cpu',{fg = '#ffffff'}) wicked.register(cpugraphwidget, 'cpu', '$1', 1, 'cpu')---}--------------------------ICONE----------------------------PLAY iplay = widget({ type = "textbox", name = "iplay", align = "right"}) iplay.text = image_un(icons_dir.."play.png") iplay:buttons( { button({ }, 1, function () awful.util.spawn("mpc toggle > /dev/null") end ) } )--STOP istop = widget({ type = "textbox", name = "istop", align = "right"}) istop.text = image_un(icons_dir.."stop.png") istop:buttons( { button({ }, 1, function () awful.util.spawn("mpc stop > /dev/null") end ) } )--PREVIOUS iprev = widget({ type = "textbox", name = "iprev", align = "right"}) iprev.text = image_un(icons_dir.."precendent.png") iprev:buttons( { button({ }, 1, function () awful.util.spawn("mpc prev > /dev/null") end ) } )--NEXT inext = widget({ type = "textbox", name = "inext", align = "right"}) inext.text = image_un(icons_dir.."suivant.png") inext:buttons( { button({ }, 1, function () awful.util.spawn("mpc next > /dev/null") end ) } )--PAUSE ipau = widget({ type = "textbox", name = "ipau", align = "right"}) ipau.text = image_un(icons_dir.."pause.png") ipau:buttons( { button({ }, 1, function () awful.util.spawn("mpc toggle > /dev/null") end ) } )--- STATUSBAR {bar = widget({type="textbox",name="bar",align="right"}) bar.text = " - "space = widget({type="textbox",name="space",align="right"}) space.text = " "lspace = widget({type="textbox",name="lspace",align="left"}) lspace.text = " "mywiboxtop1 = {}mypromptbox = {}mylayoutbox = {}mytaglist1 = {}mytaglist1.buttons = { button({ }, 1, awful.tag.viewonly), button({ modkey }, 1, awful.client.movetotag), button({ }, 3, function (tag) tag.selected = not tag.selected end), button({ modkey }, 3, awful.client.toggletag), button({ }, 4, awful.tag.viewnext), button({ }, 5, awful.tag.viewprev) }mytasklist1 = {}mytasklist1.buttons = { button({ }, 1, function (c) client.focus = c; c:raise() end), button({ }, 3, function () awful.menu.clients({ width=250 }) end), button({ }, 4, function () awful.client.focus.byidx(1) end), button({ }, 5, function () awful.client.focus.byidx(-1) end) }mypromptbox[1] = widget({ type = "textbox", name = "mypromptbox" .. 1, align = "left" })mylayoutbox[1] = widget({ type = "imagebox", name = "mylayoutbox", align = "left" })mylayoutbox[1]:buttons({ button({ }, 1, function () awful.layout.inc(layouts, 1) end), button({ }, 3, function () awful.layout.inc(layouts, -1) end)})-- Create a tasklist widgetmytasklist1[1] = awful.widget.tasklist.new(function(c) return awful.widget.tasklist.label.currenttags(c, 1) end, mytasklist1.buttons)-- Create a taglist widgetmytaglist1 = awful.widget.taglist.new(1, awful.widget.taglist.label.all, mytaglist1.buttons)-- Create the wiboxmywiboxtop1 = wibox({ position = "top", name = "mywiboxtop1" .. 1, fg = beautiful.fg_normal, bg = beautiful.bg_normal })mywiboxbottom1 = wibox({ position = "bottom", name = "mywiboxbottom1" .. 1, fg = beautiful.fg_normal, bg = beautiful.bg_normal })mywiboxtop1.widgets = { mylauncher, mytaglist1, mylayoutbox[1], mypromptbox[1], bar, cpuiconbox, space, cpugraphwidget, bar, memiconbox, space, membarw, bar, tempiconbox, tempw, bar, voliconbox, space, volumew, space, bar, space, iplay, ipau, istop, iprev, inext, space, bar, mpdwidget, bar, space, datebox, clockbox, mysystray}mywiboxbottom1.widgets = { mytasklist1[1]}mywiboxtop1.screen = 1mywiboxbottom1.screen = 1--}}}--{{{ Mouse bindingsawesome.buttons({ button({ }, 3, function () awful.menu.new({ id="mymainmenu", items=mymainmenu }) end), button({ }, 4, awful.tag.viewnext), button({ }, 5, awful.tag.viewprev)})--}}}--{{{ Key bindings--{{{ Tags-- Bind keyboard digits-- Compute the maximum number of digit we need, limited to 9-- Fix for French Keyboardtagkeys = {'#10', '#11', '#12', '#13', '#14', '#15', '#16', '#17', '#18'}keynumber = 0for s = 1, screen.count() do keynumber = math.min(9, math.max(#tags[s], keynumber));endfor i = 1, keynumber do keybinding(k_m, tagkeys[i], function () local screen = mouse.screen if tags[screen][i] then awful.tag.viewonly(tags[screen][i]) end end):add() keybinding(k_mc, tagkeys[i], function () local screen = mouse.screen if tags[screen][i] then tags[screen][i].selected = not tags[screen][i].selected end end):add() keybinding(k_ms, tagkeys[i], function () if client.focus then if tags[client.focus.screen][i] then awful.client.movetotag(tags[client.focus.screen][i]) end end end):add() keybinding(k_mcs, tagkeys[i], function () if client.focus then if tags[client.focus.screen][i] then awful.client.toggletag(tags[client.focus.screen][i]) end end end):add()endkeybinding(k_m, "Left", awful.tag.viewprev):add()keybinding(k_m , "q", awful.tag.viewprev):add()keybinding(k_m, "Right", awful.tag.viewnext):add()keybinding(k_m , "w", awful.tag.viewnext):add()keybinding(k_m, "Escape", awful.tag.history.restore):add()for i = 1, keynumber do keybinding(k_ms, "F" .. i, function () local screen = mouse.screen if tags[screen][i] then for k, c in pairs(awful.client.getmarked()) do awful.client.movetotag(tags[screen][i], c) end end end):add()endkeybinding({ modkey }, "b", function () if mywiboxbottom1.visible == false then mywiboxbottom1.visible = true else mywiboxbottom1.visible = false end --if mywiboxbottom2.visible == false then -- mywiboxbottom2.visible = true --else -- mywiboxbottom2.visible = false --end end):add()--}}}--{{{ Programskeybinding(k_m , "Return", function () awful.util.spawn(terminal) end):add()keybinding(k_ms, "e", function () awful.util.spawn(file_manager) end):add()keybinding(k_mc, "q", function () awful.spawn( terminal_alt ) end):add()keybinding(k_mc, "e", function () awful.spawn( file_manager_alt ) end):add()--}}}--{{{ Awesome quit/restartkeybinding(k_mc , "r", function () mypromptbox.text = awful.util.escape(awful.util.restart())end):add()keybinding({ modkey, "Shift" }, "q", awesome.quit):add()--}}}--{{{ Client manipulationkeybinding({ modkey }, "m", awful.client.maximize):add()keybinding({ modkey }, "f", function () if client.focus then client.focus.fullscreen = not client.focus.fullscreen end end):add()keybinding({ modkey, "Shift" }, "c", function () if client.focus then client.focus:kill() end end):add()keybinding({ modkey }, "j", function () awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end):add()keybinding({ modkey }, "k", function () awful.client.focus.byidx(-1); if client.focus then client.focus:raise() end end):add()keybinding({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end):add()keybinding({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end):add()keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()keybinding({ modkey, "Control" }, "Return", function () if client.focus then client.focus:swap(awful.client.getmaster()) end end):add()keybinding({ modkey }, "o", awful.client.movetoscreen):add()keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add()keybinding({ modkey }, "u", awful.client.urgent.jumpto):add()keybinding({ modkey, "Shift" }, "r", function () if client.focus then client.focus:redraw() end end):add()keybinding({ modkey }, "t", function () if client.focus then awful.titlebar.add(client.focus, { modkey = modkey}) end end):add()keybinding({ modkey, "Shift" }, "t", function () if client.focus then awful.titlebar.remove(client.focus, { modkey = modkey, "Shift"}) end end):add()keybinding({ modkey, "Control" }, "t", function () if client.focus then awful.titlebar.update(client.focus, { modkey = modkey, "Control"}) end end):add()--}}}--{{{ Layout manipulationkeybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add()keybinding({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add()keybinding({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add()keybinding({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add()keybinding({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add()keybinding({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end):add()keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()--}}}--{{{ Screen manipulationkeybinding(k_m,"e", function () awful.screen.focus(1) end):add() -- Screen focus +1keybinding(k_m,"d", function () awful.screen.focus(-1) end):add() -- Screen focus -1--}}}--{{{ Promptskeybinding(k_m , "F1", function () awful.prompt.run({ prompt = "Run: " }, mypromptbox[mouse.screen], awful.util.spawn, awful.completion.bash,awful.util.getdir("cache") .. "/history") end):add()-- bind dmenu on Mod4 + F2dmenu = "dmenu -b -i -fn '" .. beautiful.font .. "' -nb '" .. beautiful.bg_normal .."' -nf '" .. beautiful.fg_normal .. "'"keybinding({ modkey }, "F2", function () local f = io.popen(dmenu .. " <" .. progslist_path) local l = f:lines() for line in l do if line ~= nil then os.execute(line .."&") break end end f:close() end):add()keybinding({ modkey }, "F3", function () awful.prompt.run({ prompt = "SSH: " }, mypromptbox[mouse.screen], function (s) awful.util.spawn("exec xterm -bg black -fg white -e ssh -v " .. s) end) end):add()keybinding(k_m , "F4", function () awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen], awful.util.eval, awful.prompt.bash,awful.util.getdir("cache") .. "/history_eval") end):add()-- Add mod + F5 key binding to start revelationkeybinding({ modkey }, "F5", revelation.revelation):add()keybinding({ modkey, "Ctrl" }, "i", function () local s = mouse.screen if mypromptbox[s].text then mypromptbox[s].text = nil else mypromptbox[s].text = nil if client.focus.class then mypromptbox[s].text = "Class: " .. client.focus.class .. " " end if client.focus.instance then mypromptbox[s].text = mypromptbox[s].text .. "Instance: ".. client.focus.instance .. " " end if client.focus.role then mypromptbox[s].text = mypromptbox[s].text .. "Role: ".. client.focus.role end end end):add()--}}}--{{{ Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on themkeybinding({ modkey }, "s", awful.client.togglemarked):add()for i = 1, keynumber do keybinding({ modkey, "Shift" }, "F" .. i, function () local screen = mouse.screen if tags[screen][i] then for k, c in pairs(awful.client.getmarked()) do awful.client.movetotag(tags[screen][i], c) end end end):add()end-- }}}--{{{ Tabulous, tab manipulationkeybinding({ modkey, "Control" }, "y", function () local tabbedview = tabulous.tabindex_get() local nextclient = awful.client.next(1) if not tabbedview then tabbedview = tabulous.tabindex_get(nextclient) if not tabbedview then tabbedview = tabulous.tab_create() tabulous.tab(tabbedview, nextclient) else tabulous.tab(tabbedview, client.focus_get()) end else tabulous.tab(tabbedview, nextclient) endend):add()keybinding({ modkey, "Shift" }, "y", tabulous.untab):add()keybinding({ modkey }, "y", function () local tabbedview = tabulous.tabindex_get() if tabbedview then local n = tabulous.next(tabbedview) tabulous.display(tabbedview, n) endend):add()--}}}--}}}-- {{{ Hooks-- Hook function to execute when focusing a client.awful.hooks.focus.register(function (c) if not awful.client.ismarked(c) then c.border_color = beautiful.border_focus endend)-- Hook function to execute when unfocusing a client.awful.hooks.unfocus.register(function (c) if not awful.client.ismarked(c) then c.border_color = beautiful.border_normal endend)-- Hook function to execute when marking a clientawful.hooks.marked.register(function (c) c.border_color = beautiful.border_markedend)-- Hook function to execute when unmarking a clientawful.hooks.unmarked.register(function (c) c.border_color = beautiful.border_focusend)-- Hook function to execute when the mouse is over a client.awful.hooks.mouse_enter.register(function (c) -- Sloppy focus, but disabled for magnifier layout if awful.layout.get(c.screen) ~= "magnifier" then client.focus = c endend)-- Hook function to execute when a new client appears.awful.hooks.manage.register(function (c) -- Set floating placement to be smart! if use_titlebar then -- Add a titlebar awful.titlebar.add(c, { modkey = modkey }) end -- Add mouse bindings c:buttons({ button({ }, 1, function (c) client.focus = c; c:raise() end), button({ modkey }, 1, function (c) c:mouse_move() end), button({ modkey }, 3, function (c) c:mouse_resize() end) }) -- New client may not receive focus -- if they're not focusable, so set border anyway. c.border_width = beautiful.border_width c.border_color = beautiful.border_normal client.focus = c -- Check if the application should be floating. local cls = c.class local inst = c.instance if floatapps[cls] then c.floating = floatapps[cls] elseif floatapps[inst] then c.floating = floatapps[inst] end -- Check application->screen/tag mappings. local target if apptags[cls] then target = apptags[cls] elseif apptags[inst] then target = apptags[inst] end if target then c.screen = target.screen awful.client.movetotag(tags[target.screen][target.tag], c) end -- Honor size hints: if you want to drop the gaps between windows, set this to false. c.honorsizehints = trueend)awful.hooks.arrange.register(function (screen) local layout = awful.layout.get(screen) if layout then mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) else mylayoutbox[screen].image = nil end -- Give focus to the latest client in history if no window has focus -- or if the current window is a desktop or a dock one. if not client.focus then local c = awful.client.focus.history.get(screen, 0) if c then client.focus = c end endend)-- Hook called every second to update clockawful.hooks.timer.register(1, function () clockbox.text = widget_clock() datebox.text = widget_date()end)--}}}--{{{ WorkAround-- I hate having to do this, but I really need some of those Java appsawful.util.spawn("wmname compiz")--}}}-- vim: set filetype=lua fdm=marker tabstop=4 shiftwidth=4 expandtab smarttab autoindent smartindent nu: