Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Standard awesome library
- awful = require("awful")
- awful.autofocus = require("awful.autofocus")
- awful.rules = require("awful.rules")
- -- Theme handling library
- beautiful = require("beautiful")
- -- Notification library
- naughty = require("naughty")
- -- Hardware library
- vicious = require("vicious")
- ------------------------------------------------------------------------------------
- -- Run once
- lfs = require("lfs")
- -- {{{ Run programm once
- local function processwalker()
- local function yieldprocess()
- for dir in lfs.dir("/proc") do
- -- All directories in /proc containing a number, represent a process
- if tonumber(dir) ~= nil then
- local f, err = io.open("/proc/"..dir.."/cmdline")
- if f then
- local cmdline = f:read("*all")
- f:close()
- if cmdline ~= "" then
- coroutine.yield(cmdline)
- end
- end
- end
- end
- end
- return coroutine.wrap(yieldprocess)
- end
- local function run_once(process, cmd)
- assert(type(process) == "string")
- local regex_killer = {
- ["+"] = "%+", ["-"] = "%-",
- ["*"] = "%*", ["?"] = "%?" }
- for p in processwalker() do
- if p:find(process:gsub("[-+?*]", regex_killer)) then
- return
- end
- end
- return awful.util.spawn(cmd or process)
- end
- -- }}}
- run_once("compton","-no-splash")
- run_once("insync","-no-splash")
- run_once("xscreensaver","-no-splash")
- run_once("ubuntuone-launch")
- --run_once("volumeicon")
- --run_once("bitcoin-qt")
- --run_once("conky")
- run_once("dropboxd","-no-splash")
- --run_once("pidgin",nil,nil,2)
- --run_once("wicd-client",nil,"/usr/bin/python2 -O /usr/share/wicd/gtk/wicd-client.py")
- --run_once("pgl","-no-splash", 6)
- --run_once("tor-browser-en","-no-splash",6)
- ------------------------------------------------------------------------------------
- -- {{{ Error handling
- -- 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,
- title = "Oops, there were errors during startup!",
- text = awesome.startup_errors })
- end
- -- Handle runtime errors after startup
- do
- local in_error = false
- awesome.add_signal("debug::error", function (err)
- -- 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,
- title = "Oops, an error happened!",
- text = err })
- in_error = false
- end)
- end
- -- }}}
- -- {{{ Variable definitions
- -- Themes define colours, icons, and wallpapers
- --beautiful.init("/usr/share/awesome/themes/default/theme.lua")
- beautiful.init(awful.util.getdir("config") .. "/themes/dust/theme.lua")
- -- This is used later as the default terminal and editor to run.
- terminal = "gnome-terminal"
- editor = os.getenv("EDITOR") or "nano"
- editor_cmd = terminal .. " -e " .. editor
- -- 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"
- -- 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.floating,
- awful.layout.suit.tile.top,
- awful.layout.suit.spiral,
- awful.layout.suit.spiral.dwindle,
- awful.layout.suit.fair,
- awful.layout.suit.fair.horizontal,
- 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 = {"☣","☢","ツ","✖","⚡","✉","♬","✇","☠"},
- -- names = {"main","web","devel","rss","twit","irc","gen","music","movies","rrrrr"},
- layout = {layouts[1],layouts[13],layouts[1],layouts[1],layouts[1],layouts[1],layouts[1],layouts[13],layouts[1]},
- icons = {"","","","","","","","","",""}
- }
- for s = 1, screen.count() do
- -- Each screen has its own tag table.
- tags[s] = awful.tag(tags.names, s, tags.layout)
- awful.tag.seticon(tags.icons[1],tags[s][1])
- awful.tag.seticon(tags.icons[2],tags[s][2])
- awful.tag.seticon(tags.icons[3],tags[s][3])
- awful.tag.seticon(tags.icons[4],tags[s][4])
- awful.tag.seticon(tags.icons[5],tags[s][5])
- awful.tag.seticon(tags.icons[6],tags[s][6])
- awful.tag.seticon(tags.icons[7],tags[s][7])
- awful.tag.seticon(tags.icons[8],tags[s][8])
- awful.tag.seticon(tags.icons[9],tags[s][9])
- awful.tag.seticon(tags.icons[10],tags[s][10])
- end
- -- make tag list bigger
- theme.taglist_font = "Sans Bold 20"
- -- }}}
- --for a = 1, 10, 1 do
- --awful.tag.setproperty(tags[1][a], "icon_only", 1)
- --end
- -- {{{ Tags
- -- Define a tag table which hold all screen tags.
- --tags = {}
- --for s = 1, screen.count() do
- -- -- Each screen has its own tag table.
- ---- tags[s] = awful.tag({ "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota" }, s, layouts[1])
- -- tags[s] = awful.tag({ "web_I", "web_II", "term", "files", "devel", "irc", "music", "movies", "pirate" }, s, layouts[1])
- --end
- -- }}}
- -- {{{ Menu
- -- Create a laucher widget and a main menu
- myawesomemenu = {
- -- { "manual", terminal .. " -e man awesome" },
- -- { "edit config", editor_cmd .. " " .. awesome.conffile },
- { "Restart Awesome", awesome.restart },
- { "Suspend","gksu dbus-suspend" },
- { "Log out", awesome.quit },
- { "Shut Down", "gksu shutdown -P now" }
- }
- windowsmenu = {
- { "Word", "/home/msjche/bin/winword", "/home/msjche/.config/awesome/Icons/Word-icon.png" },
- { "Excel", "/home/msjche/bin/excel", "/home/msjche/.config/awesome/Icons/Excel-icon.png" },
- { "PowerPoint", "/home/msjche/bin/powerpnt", "/home/msjche/.config/awesome/Icons/PowerPoint-icon.png" }
- }
- appsmenu = {
- { "Devede", "devede", "/home/msjche/.config/awesome/Icons/devede-icon.png" },
- { "GEdit", "gedit", "/home/msjche/.config/awesome/Icons/gedit-icon.png" },
- { "GIMP", "gimp", "/home/msjche/.config/awesome/Icons/Gimp-icon.png" },
- { "Google Earth", "google-earth", "/home/msjche/.config/awesome/Icons/google_earth.png" },
- { "Guvcview", "guvcview", "/home/msjche/.config/awesome/Icons/guvcview-icon.png" },
- { "K3B", "k3b", "/home/msjche/.config/awesome/Icons/k3b-icon.png" },
- { "Kdenlive", "kdenlive", "/home/msjche/.config/awesome/Icons/kdenlive_icon.png" },
- { "Minitube", "minitube", "/home/msjche/.config/awesome/Icons/minitube-icon.png" },
- { "Rhythmbox", "rhythmbox", "/home/msjche/.config/awesome/Icons/rhythmbox.png" },
- { "Shotwell", "shotwell", "/home/msjche/.config/awesome/Icons/shotwell-icon.png" },
- { "Skype", "skype", "/home/msjche/.config/awesome/Icons/Apps-Skype-icon.png" },
- { "Virtualbox", "virtualbox", "/home/msjche/.config/awesome/Icons/virtualbox-icon.png" }
- }
- mymainmenu = awful.menu({ items = {
- { "awesome", myawesomemenu, "/home/msjche/.config/awesome/Icons/arch.png" },
- { "Pavucontrol", "pavucontrol", "/home/msjche/.config/awesome/Icons/volume-icon.png" },
- { "Thunar", "thunar", "/home/msjche/.config/awesome/Icons/thunar-icon.png" },
- { "Root Thunar", "gksu thunar", "/home/msjche/.config/awesome/Icons/thunar-icon.png" },
- { "SpaceFM", "spacefm", "/home/msjche/.config/awesome/Icons/spacefm.png" },
- { "Root Nautilus", "gksu nautilus", "/home/msjche/.config/awesome/Icons/nautilus.png" },
- { "Sublime", "/opt/sublime-text/sublime_text", "/home/msjche/.config/awesome/Icons/sublime-icon.png" },
- { "Firefox", "firefox", "/home/msjche/.config/awesome/Icons/firefox-icon.png" },
- { "Luakit", "luakit", "/home/msjche/.config/awesome/Icons/Lua-Logo.png" },
- { "Iron", "iron", "/home/msjche/.config/awesome/Icons/iron-browser-icon.png" },
- { "Tor", "tor-browser-en", "/home/msjche/.config/awesome/Icons/Vidalia_icon.png" },
- { "Peer Guardian", "pglgui", "/home/msjche/.config/awesome/Icons/PeerGuardian_icon.png" },
- { "Deluge", "deluge", "/home/msjche/.config/awesome/Icons/Deluge_icon.png" },
- { "Appearance", "lxappearance", "/home/msjche/.config/awesome/Icons/appearance-icon.png" },
- { "Libre Office", " libreoffice", "/home/msjche/.config/awesome/Icons/libreoffice.png" },
- { "Applications", appsmenu, "/home/msjche/.config/awesome/Icons/apps-icon.png" },
- { "MS Office", windowsmenu, "/home/msjche/.config/awesome/Icons/Windows-icon.png" },
- { "Record Desktop", "gtk-recordMyDesktop", "/home/msjche/.config/awesome/Icons/record-icon.png" },
- { "Screen Shot", "gscreenshot", "/home/msjche/.config/awesome/Icons/camera-icon.png" }
- }
- })
- mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
- menu = mymainmenu })
- -- }}}
- --------------------------------------------------------------------------------------------------------------------------------
- -- {{{ Wibox (Top)
- -- Create a textclock widget
- mytextclock = awful.widget.textclock({ align = "right" })
- -- Calendar widget to attach to the textclock
- require('calendar2')
- calendar2.addCalendarToWidget(mytextclock)
- -- Create a systray
- mysystray = widget({ type = "systray" })
- spacetxt = widget({ type = "textbox" })
- spacetxt.text = " || "
- space = widget({ type = "textbox" })
- space.text = " "
- spaceimg = widget({ type = "imagebox" })
- spaceimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/space.png")
- music = widget({ type = "textbox" })
- music.text = " ♫ "
- --------------------------------------------------------------------------------------------
- -- Volume
- volimg = widget({ type = "imagebox" })
- volimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/volume.png")
- volumecfg = {}
- volumecfg.cardid = 0
- volumecfg.channel = "Master"
- volumecfg.widget = widget({ type = "textbox", name = "volumecfg.widget", align = "right" })
- volumecfg_t = awful.tooltip({ objects = { volumecfg.widget },})
- volumecfg_t:set_text("Volume")
- -- command must start with a space!
- volumecfg.mixercommand = function (command)
- local fd = io.popen("amixer -c " .. volumecfg.cardid .. command)
- local status = fd:read("*all")
- fd:close()
- local volume = string.match(status, "(%d?%d?%d)%%")
- volume = string.format("% 3d", volume)
- status = string.match(status, "%[(o[^%]]*)%]")
- if string.find(status, "on", 1, true) then
- volume = volume .. "%"
- else
- volume = volume .. "M"
- end
- volumecfg.widget.text = volume
- end
- volumecfg.update = function ()
- volumecfg.mixercommand(" sget " .. volumecfg.channel)
- end
- volumecfg.up = function ()
- volumecfg.mixercommand(" sset " .. volumecfg.channel .. " 1%+")
- end
- volumecfg.down = function ()
- volumecfg.mixercommand(" sset " .. volumecfg.channel .. " 1%-")
- end
- volumecfg.toggle = function ()
- volumecfg.mixercommand(" sset " .. volumecfg.channel .. " toggle")
- end
- volumecfg.widget:buttons({
- button({ }, 4, function () volumecfg.up() end),
- button({ }, 5, function () volumecfg.down() end),
- button({ }, 1, function () volumecfg.toggle() end)
- })
- volumecfg.update()
- --------------------------------------------------------------------------------------------
- -- MPD
- mpdimg = widget({ type = "imagebox" })
- mpdimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/music.png")
- mpdwidget = widget({ type = "textbox" })
- vicious.register(mpdwidget, vicious.widgets.mpd,
- function (widget, args)
- if args["{state}"] == "Stop" then
- return " - "
- else
- return args["{Artist}"]..' - '.. args["{Title}"]
- end
- end, 10)
- --------------------------------------------------------------------------------------------
- -- Weather
- weatherimg = widget({ type = "imagebox" })
- weatherimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/weather.png")
- -- Weather widget
- weatherwidget = widget({ type = "textbox" })
- weather_t = awful.tooltip({ objects = { weatherwidget },})
- vicious.register(weatherwidget, vicious.widgets.weather,
- function (widget, args)
- weather_t:set_text("City: " .. args["{city}"] .."\nWind: " .. args["{windkmh}"] .. "km/h " .. args["{wind}"] .. "\nSky: " .. args["{sky}"] .. "\nHumidity: " .. args["{humid}"] .. "%")
- return args["{tempf}"] .. " F"
- end, 1800, "KCCR")
- --'1800': check every 30 minutes.
- --'': the WC, CA ICAO code.
- --------------------------------------------------------------------------------------------
- -- Memory
- memimg = widget({ type = "imagebox" })
- memimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/memory.png")
- memwidgettxt = widget({ type = "textbox" })
- vicious.register(memwidgettxt, vicious.widgets.mem, "$2 MB", 10)
- -- Memory widget
- memwidget = awful.widget.progressbar()
- memwidget:set_width(12)
- memwidget:set_vertical(true)
- memwidget:set_height(22)
- memwidget:set_background_color("#494B4F")
- --memwidget:set_border_color("#494B4F")
- memwidget:set_color("#D5C9C9")
- memwidget:set_gradient_colors({ "#D5C9C9", "#D5C9C9", "#D5C9C9" })
- vicious.register(memwidget, vicious.widgets.mem, "$1")
- --------------------------------------------------------------------------------------------
- -- HD
- -- Disk usage widget
- diskwidget = widget({ type = 'imagebox' })
- diskwidget.image = image("/home/msjche/.config/awesome/Icons/Awesome/harddrive.png")
- disk = require("diskusage")
- -- the first argument is the widget to trigger the diskusage
- -- the second/third is the percentage at which a line gets orange/red
- -- true = show only local filesystems
- disk.addToWidget(diskwidget, 75, 90, false)
- hdwidget = widget({ type = "textbox" })
- vicious.register(hdwidget, vicious.widgets.fs, "${/ used_p}%", 15)
- hdwidgetg = awful.widget.progressbar()
- hdwidgetg:set_width(12)
- hdwidgetg:set_vertical(true)
- hdwidgetg:set_height(22)
- hdwidgetg:set_background_color("#494B4F")
- --hdwidgetg:set_border_color("#494B4F")
- hdwidgetg:set_color("#D5C9C9")
- hdwidgetg:set_gradient_colors({ "#D5C9C9", "#D5C9C9", "#D5C9C9" })
- vicious.register(hdwidgetg, vicious.widgets.fs, "${/ used_p}", 120, 60)
- --------------------------------------------------------------------------------------------
- -- CPU
- cpuimg = widget({ type = "imagebox" })
- cpuimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/cpu.png")
- ctext = widget({ type = "textbox"})
- cgraph = awful.widget.graph()
- cgraph:set_width(60):set_height(22)
- cgraph:set_stack(true):set_max_value(400)
- cgraph:set_background_color("#494B4F")
- -- cgraph1:set_border_color("#494B4F")
- cgraph:set_stack_colors({ "#E0D4D4", "#ED4F4F", "#5A4FED", "#55FB41" })
- vicious.register(ctext, vicious.widgets.cpu,
- function (widget, args)
- cgraph:add_value(args[2], 1) -- Core 1
- cgraph:add_value(args[3], 2) -- Core 2
- cgraph:add_value(args[4], 3) -- Core 3
- cgraph:add_value(args[5], 4) -- Core 4
- end, 1)
- --------------------------------------------------------------------------------------------
- -- Network
- upimg = widget({ type = "imagebox" })
- upimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/up.png")
- downimg = widget({ type = "imagebox" })
- downimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/down.png")
- -- Network eth0
- ethimg = widget({ type = "imagebox" })
- ethimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/ethernet.png")
- netwidgetet = widget({type = "textbox"})
- vicious.register(netwidgetet, vicious.widgets.net, '(${eth0 up_kb} up) / (${eth0 down_kb} dn) kps', 1 )
- -- Network wlan0
- wifiimg = widget({ type = "imagebox" })
- wifiimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/wifi.png")
- netwidgetwt = widget({type = "textbox"})
- vicious.register(netwidgetwt, vicious.widgets.net, '(${wlan0 up_kb} up) / (${wlan0 down_kb} dn) kps', 1 )
- -- Wifi
- wifiwidget = widget({ type = "textbox" })
- vicious.register(wifiwidget, vicious.widgets.wifi, "\"${ssid}\" @ ${link}% - ", 10, "wlan0")
- -- Network eth0
- netgrapheth0d = awful.widget.graph()
- netgrapheth0d:set_width(45)
- netgrapheth0d:set_height(22)
- netgrapheth0d:set_background_color("#494B4F")
- netgrapheth0d:set_color("#D5C9C9")
- netgrapheth0d:set_gradient_colors({ "#B3EEFF", "#B3EEFF", "#B3EEFF" })
- netgrapheth0d_t = awful.tooltip({ objects = { netgrapheth0d.widget },})
- vicious.register(netgrapheth0d, vicious.widgets.net,
- function (widget, args)
- netgrapheth0d_t:set_text("Ethernet download: " .. args["{eth0 down_kb}"] .. "kb/s")
- return args["{eth0 down_kb}"]
- end, 1 )
- netgrapheth0u = awful.widget.graph()
- netgrapheth0u:set_width(45)
- netgrapheth0u:set_height(22)
- netgrapheth0u:set_background_color("#494B4F")
- netgrapheth0u:set_color("#D5C9C9")
- netgrapheth0u:set_gradient_colors({ "#B3EEFF", "#B3EEFF", "#B3EEFF" })
- netgrapheth0u_t = awful.tooltip({ objects = { netgrapheth0u.widget },})
- vicious.register(netgrapheth0u, vicious.widgets.net,
- function (widget, args)
- netgrapheth0u_t:set_text("Ethernet upload: " .. args["{eth0 up_kb}"] .. "kb/s")
- return args["{eth0 up_kb}"]
- end, 1 )
- -- Network wlan0
- netgraphwlan0d = awful.widget.graph()
- netgraphwlan0d:set_width(45)
- netgraphwlan0d:set_height(22)
- netgraphwlan0d:set_background_color("#494B4F")
- netgraphwlan0d:set_color("#D5C9C9")
- netgraphwlan0d:set_gradient_colors({ "#B3EEFF", "#B3EEFF", "#B3EEFF" })
- netgraphwlan0d_t = awful.tooltip({ objects = { netgraphwlan0d.widget },})
- vicious.register(netgraphwlan0d, vicious.widgets.net,
- function (widget, args)
- netgraphwlan0d_t:set_text("Wifi download: " .. args["{wlan0 down_kb}"] .. "kb/s")
- return args["{wlan0 down_kb}"]
- end, 1 )
- netgraphwlan0u = awful.widget.graph()
- netgraphwlan0u:set_width(45)
- netgraphwlan0u:set_height(22)
- netgraphwlan0u:set_background_color("#494B4F")
- netgraphwlan0u:set_color("#D5C9C9")
- netgraphwlan0u:set_gradient_colors({ "#B3EEFF", "#B3EEFF", "#B3EEFF" })
- netgraphwlan0u_t = awful.tooltip({ objects = { netgraphwlan0u.widget },})
- vicious.register(netgraphwlan0u, vicious.widgets.net,
- function (widget, args)
- netgraphwlan0u_t:set_text("Wifi upload: " .. args["{wlan0 up_kb}"] .. "kb/s")
- return args["{wlan0 up_kb}"]
- end, 1 )
- --------------------------------------------------------------------------------------------
- -- Uptime
- uptimeimg = widget({ type = "imagebox" })
- uptimeimg.image = image("/home/msjche/.config/awesome/Icons/Awesome/uptime.png")
- uptimewidget = widget({ type = "textbox" })
- vicious.register(uptimewidget, vicious.widgets.uptime,
- function (widget, args)
- return string.format("%2dd %02d:%02d ", args[1], args[2], args[3])
- end, 61)
- --------------------------------------------------------------------------------------------
- -- Create a wibox for each screen and add it
- mywibox = {}
- mypromptbox = {}
- mylayoutbox = {}
- 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)
- )
- mytasklist = {}
- mytasklist.buttons = awful.util.table.join(
- awful.button({ }, 1, function (c)
- if c == client.focus then
- c.minimized = true
- else
- if not c:isvisible() then
- awful.tag.viewonly(c:tags()[1])
- end
- -- This will also un-minimize
- -- the client, if needed
- client.focus = c
- c:raise()
- end
- 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))
- for s = 1, screen.count() do
- -- Create a promptbox for each screen
- mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
- -- 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(
- 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
- mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
- -- 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[s] = awful.wibox({ position = "top", height = "24", screen = s })
- -- Add widgets to the wibox - order matters
- mywibox[s].widgets = {
- {
- -- mylauncher,
- mytaglist[s],
- spacetxt,
- cpuimg,
- space,
- cgraph,
- spacetxt,
- diskwidget,
- space,
- hdwidgetg,
- spacetxt,
- memimg,
- space,
- memwidget,
- space,
- memwidgettxt,
- spacetxt,
- ethimg,
- space,
- netgrapheth0d,
- space,
- downimg,
- space,
- netgrapheth0u,
- space,
- upimg,
- spacetxt,
- wifiimg,
- space,
- netgraphwlan0d,
- space,
- downimg,
- space,
- netgraphwlan0u,
- space,
- upimg,
- spacetxt,
- mypromptbox[s],
- layout = awful.widget.layout.horizontal.leftright
- },
- mylayoutbox[s],
- space,
- mytextclock,
- spacetxt,
- uptimewidget,
- space,
- uptimeimg,
- spacetxt,
- s == 1 and mysystray or nil,
- spacetxt,
- weatherwidget,
- space,
- weatherimg,
- spacetxt,
- volumecfg.widget,
- space,
- volimg,
- spacetxt,
- mpdwidget,
- space,
- mpdimg,
- spacetxt,
- mytasklist[s],
- layout = awful.widget.layout.horizontal.rightleft
- }
- 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
- globalkeys = awful.util.table.join(
- 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
- end),
- awful.key({ modkey, }, "k",
- function ()
- awful.client.focus.byidx(-1)
- if client.focus then client.focus:raise() end
- end),
- awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) 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, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
- awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
- awful.key({ modkey, }, "Tab",
- function ()
- awful.client.focus.history.previous()
- if client.focus then
- client.focus:raise()
- end
- end),
- -- Standard program
- awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
- awful.key({ modkey, "Control" }, "r", awesome.restart),
- awful.key({ modkey, "Shift" }, "q", awesome.quit),
- 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, "Shift" }, "h", 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" }, "l", function () awful.tag.incncol(-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, "Control" }, "n", awful.client.restore),
- -- Prompt
- awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
- awful.key({ modkey }, "x",
- function ()
- awful.prompt.run({ prompt = "Run Lua code: " },
- mypromptbox[mouse.screen].widget,
- awful.util.eval, nil,
- awful.util.getdir("cache") .. "/history_eval")
- end)
- )
- clientkeys = awful.util.table.join(
- 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, "Control" }, "space", awful.client.floating.toggle ),
- awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
- awful.key({ modkey, }, "o", awful.client.movetoscreen ),
- awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
- awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
- awful.key({ modkey, }, "n",
- function (c)
- -- The client currently has the input focus, so it cannot be
- -- minimized, since minimized clients can't have the focus.
- c.minimized = true
- end),
- awful.key({ modkey, }, "m",
- function (c)
- c.maximized_horizontal = not c.maximized_horizontal
- c.maximized_vertical = not c.maximized_vertical
- end)
- )
- -- Compute the maximum number of digit we need, limited to 9
- keynumber = 0
- for s = 1, screen.count() do
- keynumber = math.min(9, math.max(#tags[s], keynumber));
- end
- -- Bind all key numbers to tags.
- -- 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.
- for i = 1, keynumber do
- globalkeys = awful.util.table.join(globalkeys,
- awful.key({ modkey }, "#" .. i + 9,
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewonly(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Control" }, "#" .. i + 9,
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewtoggle(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Shift" }, "#" .. i + 9,
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.movetotag(tags[client.focus.screen][i])
- end
- end),
- awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.toggletag(tags[client.focus.screen][i])
- end
- end),
- awful.key({ }, "XF86AudioRaiseVolume", function () volumecfg.up(0) end),
- awful.key({ }, "XF86AudioLowerVolume", function () volumecfg.down(0) end),
- awful.key({ }, "XF86AudioMute", function () volumecfg.toggle() 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))
- -- Set keys
- root.keys(globalkeys)
- -- }}}
- -- {{{ 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 } },
- { rule = { class = "MPlayer" },
- properties = { floating = true } },
- { rule = { class = "pinentry" },
- properties = { floating = true } },
- { rule = { class = "gimp" },
- properties = { floating = true } },
- -- Set Firefox to always map on tags number 2 of screen 1.
- -- { rule = { class = "Firefox" },
- -- properties = { tag = tags[1][2] } },
- }
- -- }}}
- -- {{{ Signals
- -- Signal function to execute when a new client appears.
- client.add_signal("manage", function (c, startup)
- -- Add a titlebar
- -- awful.titlebar.add(c, { modkey = modkey })
- -- 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) c.border_color = beautiful.border_focus end)
- client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
- -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement