Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- L O A D L I B R A R Y -------------------------------------------------
- require("awful")
- require("awful.autofocus")
- require("awful.rules")
- require("beautiful")
- require("naughty")
- --calendar = require{"calendar"}
- --require("vicious")
- --shifty = require("shifty")
- vicious = require("vicious")
- --require{"calendar"}
- cal = require("cal")
- -- E R R O R S -------------------------------------------------------------
- if awesome.startup_errors then
- naughty.notify({ preset = naughty.config.presets.critical,
- title = "Oops, there were errors during startup!",
- text = awesome.startup_errors })
- end
- do
- local in_error = false
- awesome.add_signal("debug::error", function (err)
- 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
- -- T H E M E ---------------------------------------------------------------
- beautiful.init("/home/funeralismatic/.config/awesome/themes/funeralismatic/theme.lua")
- -- V A R I A B L E S -------------------------------------------------------
- terminal = "terminator"
- editor = os.getenv("EDITOR") or "nano"
- editor_cmd = terminal .. " -e " .. editor
- -- D E F A U L T M O D K E Y ---------------------------------------------
- modkey = "Mod4"
- -- L A Y O U T T A B L E -------------------------------------------------
- layouts = {
- awful.layout.suit.floating,
- awful.layout.suit.tile.left,
- awful.layout.suit.tile,
- awful.layout.suit.tile.bottom,
- awful.layout.suit.max
- -- 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.fullscreen,
- -- awful.layout.suit.magnifier
- }
- -- T A G S -----------------------------------------------------------------
- tags = {
- names = { "main", "internet", "terminal", "media", "design", "other"},
- layout = { layouts[2], layouts[3], layouts[5], layouts[1], layouts[2], layouts[1]}
- }
- for s = 1, screen.count() do
- tags[s] = awful.tag(tags.names, s, tags.layout)
- end
- -- M E N U -----------------------------------------------------------------
- -- AWESOME MENU --
- myawesomemenu = {
- { "manual", terminal .. " -e man awesome" },
- { "edit config", editor_cmd .. " " .. awesome.conffile },
- { "restart", awesome.restart },
- { "quit", awesome.quit }
- }
- -- INTERNET MENU --
- myinternetmenu = {
- { "Chromium", "chromium" },
- { "Firefox", "firefox" },
- { "Thunderbird", "thunderbird" },
- { "Deluge", "deluge" },
- { "lICQ", "licq" },
- { "Skype", "skype" },
- { "Vacuum IM", "vacuum" }
- }
- -- DESIGN MENU --
- mydesignmenu = {
- { "Inkscape", "inkscape" },
- { "Font Editor", "fontforge" },
- { "MyPaint", "mypaint" },
- { "gimp", "gimp" }
- }
- -- MULTIMEDIA MENU --
- mymediamenu = {
- { "Deadbeef", "deadbeef" },
- { "Volume", "aumix" },
- { "XfBurn", "xfburn" }
- }
- -- SETTINGS MENU --
- mysettingsmenu = {
- { "Awesome", myawesomemenu, beautiful.awesome_icon },
- { "hTop", terminal .. " -e htop" },
- { "GTK+ Theme", "lxappearance" },
- { "Task Manager", "lxtask" },
- { "Terminal", terminal },
- { "ROOT Terminal", "ktsuss --user root terminator" },
- { "Connections", "ktsuss --user root nm-connection-editor" },
- { "Qt Configure", "qtconfig" },
- { "Gparted", "ktsuss --user root gparted-pkexec" }
- }
- -- OFFICE MENU --
- myofficemenu = {
- { "Reader", "evince" },
- { "Charmap", "mucharmap" },
- { "Clipboard Manager", "parcellite" },
- { "Calculator", "mate-calc" },
- { "Osmo", "osmo" }
- }
- -- MAIN MENU --
- mymainmenu = awful.menu({ items = {
- { "Internet", myinternetmenu, beautiful.awesome_icon },
- { "Design", mydesignmenu, beautiful.awesome_icon },
- { "Multimedia", mymediamenu, beautiful.awesome_icon },
- { "Settings", mysettingsmenu, beautiful.awesome_icon },
- { "Office", myofficemenu, beautiful.awesome_icon },
- { "Editra", "editra" },
- { "Archive Manager", "engrampa" },
- { "File Manager", "spacefm" },
- { "RecordMyDesktop", "gtk-recordmydesktop" },
- { "NEStopia", "nestopia" },
- { "zDoom", "zdoom" }
- }})
- -- R E G I S T E R W I D G E T S -----------------------------------------
- -- MENU LAUNCHER --
- mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), menu = mymainmenu })
- -- INTERNET WIDGET --
- netwidget_down = widget({ type = "textbox" })
- vicious.register(netwidget_down, vicious.widgets.net, '<span color="#000000">${usb0 down_kb}</span>', 1)
- netwidget_up = widget({ type = "textbox" })
- vicious.register(netwidget_up, vicious.widgets.net, '<span color="#000000">${usb0 up_kb}</span>', 1)
- --VOLUME WIDGET --
- volwidget = widget({ type = "textbox" })
- vicious.register(volwidget, vicious.widgets.volume, "$1%", 5, "Master")
- volwidget:buttons(awful.util.table.join(
- awful.button({ }, 1, function () awful.util.spawn("aumix", false) end),
- awful.button({ }, 2, function () awful.util.spawn("amixer sset Master toggle", false) end),
- awful.button({ }, 4, function () awful.util.spawn("aumix -v +5", false) end),
- awful.button({ }, 5, function () awful.util.spawn("aumix -v -5", false) end)
- ))
- -- IMAGES --
- netimg = widget({ type = "imagebox" })
- netimg.image = image("/home/funeralismatic/.config/awesome/icons/net_icon.png")
- volimg = widget({ type = "imagebox" })
- volimg.image = image("/home/funeralismatic/.config/awesome/icons/volume.png")
- kbdimg = widget({ type = "imagebox" })
- kbdimg.image = image("/home/funeralismatic/.config/awesome/icons/keyboard.png")
- clkimg = widget({ type = "imagebox" })
- clkimg.image = image("/home/funeralismatic/.config/awesome/icons/clock.png")
- arr = widget({ type = "imagebox" })
- arr.image = image("/home/funeralismatic/.config/awesome/icons/arr.png")
- -- DEADBEEF ALL-IN-ONE WIDGET --
- dbpp = widget({ type = "imagebox" })
- dbpp.image = image("/home/funeralismatic/.config/awesome/icons/deadbeef.png")
- dbpp:buttons(awful.util.table.join(
- awful.button({ }, 1, function () awful.util.spawn("deadbeef --play-pause", false) end),
- awful.button({ }, 2, function () awful.util.spawn("deadbeef --stop", false) end),
- awful.button({ }, 8, function () awful.util.spawn("deadbeef --prev", false) end),
- awful.button({ }, 9, function () awful.util.spawn("deadbeef --next", false) end),
- awful.button({ }, 3, function () awful.util.spawn("amixer sset Master toggle", false) end),
- awful.button({ }, 4, function () awful.util.spawn("aumix -v +5", false) end),
- awful.button({ }, 5, function () awful.util.spawn("aumix -v -5", false) end)
- ))
- dbpp:add_signal("mouse::enter", function() coverart_show() end)
- dbpp:add_signal("mouse::leave", function() coverart_hide() end)
- -- DEADBEEF POPUP NOTIFICATION --
- local coverart_nf
- function coverart_show()
- local artcache = '/home/funeralismatic/.cache/deadbeef/covers'
- local artist_var = io.popen("deadbeef --nowplaying %a", "r")
- local artist = artist_var:read()
- local title_var = io.popen("deadbeef --nowplaying %t", "r")
- local title = title_var:read()
- local album_var = io.popen("deadbeef --nowplaying %b", "r")
- local album = album_var:read()
- local year_var = io.popen("deadbeef --nowplaying %y", "r")
- local year = year_var:read()
- local time_var = io.popen("deadbeef --nowplaying \"%e | %l\"", "r")
- local time = time_var:read()
- local img = string.format("%s/%s/%s.jpg", artcache, artist, album)
- local ico = image(img)
- local txt = string.format('%s\nby %s\nfrom %s\n%s', title, artist, album, time)
- coverart_nf = naughty.notify({icon = ico, icon_size = 72, text = txt,
- position = "top_right", timeout = 10 })
- end
- function coverart_hide()
- if coverart_nf ~= nil then
- naughty.destroy(coverart_nf)
- end
- end
- -- TIME-DATE WIDGET --
- datewidget = widget({ type = "textbox" })
- vicious.register(datewidget, vicious.widgets.date, "%H:%M:%S", 1)
- --cal.register(datewidget, "<b>%s</b>")
- today = awful.tooltip({objects = {datewidget,clkimg},})
- function get_today()
- return os.date('<span background="#000" color="#fff"> %A, %d.%m.%Y </span>')
- end
- today:set_text(get_today())
- -- DEFAULT CLOCK WIDGET --
- --mytextclock = awful.widget.textclock({ align = "right" })
- -- SYSTEM TRAY WIDGET --
- mysystray = widget({ type = "systray" })
- -- SEPARATORS --
- spacer = widget({ type = "textbox" })
- separator = widget({ type = "imagebox" })
- spacer.text = " "
- separator.image = image(beautiful.widget_sep)
- -- KEYBOARD WIDGET --
- -- widget --
- kbdwidget = widget({type = "textbox", name = "kbdwidget"})
- kbdwidget.border_color = beautiful.fg_normal
- kbdwidget.text = "en"
- -- dbus --
- dbus.request_name("session", "ru.gentoo.kbdd")
- dbus.add_match("session", "interface='ru.gentoo.kbdd',member='layoutChanged'")
- dbus.add_signal("ru.gentoo.kbdd", function(...)
- local data = {...}
- local layout = data[2]
- lts = {[0] = "en", [1] = "ru"}
- kbdwidget.text = " "..lts[layout].." "
- end
- )
- -- CREATE WIDGETS --
- mywibox = {}
- mywiboxtray = {}
- mypromptbox = {}
- mylayoutbox = {}
- -- TAGLIST --
- 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({ }, 5, awful.tag.viewnext),
- awful.button({ }, 4, awful.tag.viewprev)
- )
- -- TASKLIST --
- 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
- 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
- -- PROMPTBOX WIGDET --
- mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
- -- LAYOUT WIDGET --
- 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)))
- -- TAGS --
- mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
- -- TASKLIST --
- mytasklist[s] = awful.widget.tasklist(function(c)
- return awful.widget.tasklist.label.currenttags(c, s)
- end,
- mytasklist.buttons)
- -- TASKLIST ICONS ONLY --
- --mytasklist[s] = awful.widget.tasklist(function(c)
- -- local task = { awful.widget.tasklist.label.currenttags(c, s) }
- -- return '', task[2], task[3], task[4]
- --end, mytasklist.buttons)
- -- WIBOX --
- mywibox[s] = awful.wibox({ position = "top", screen = s, height="24" })
- mywibox[s].widgets = {{
- mylauncher,
- --separator,
- mylayoutbox[s],
- separator,
- mytaglist[s],
- -- mypromptbox[s],
- separator,
- layout = awful.widget.layout.horizontal.leftright},
- spacer,
- datewidget,
- clkimg,
- separator,
- kbdwidget,
- kbdimg,
- separator,
- netwidget_up,
- netimg,
- netwidget_down,
- separator,
- volwidget,
- volimg,
- separator,
- dbpp,
- separator,
- -- s == 1 and mysystray or nil,
- s == 1 or nil,
- -- separator,
- mytasklist[s],
- layout = awful.widget.layout.horizontal.rightleft
- }
- -- BOTTOM WIBOX WITH TRAY --
- mywiboxtray[s] = awful.wibox({ position = "bottom", screen = s, width="380", height="24", align="right"})
- mywiboxtray[s].visible = false
- mywiboxtray[s].widgets = {{
- mypromptbox[s],
- layout = awful.widget.layout.horizontal.leftright},
- s == 1 and mysystray or nil,
- -- s == 1 or nil,
- -- mysystray[s],
- arr,
- 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)
- ))
- -- K E Y B I N D I N G S ---------------------------------------------------
- globalkeys = awful.util.table.join(
- awful.key({}, "Menu", function() mymainmenu:toggle() end),
- awful.key({modkey}, "b", function() mywiboxtray[mouse.screen].visible = not mywiboxtray[mouse.screen].visible end),
- -- KEYBOARD LAYOUT SWITCH --
- -- awful.key({modkey,}, "space", function() kbdcfg.switch() end),
- -- VOLUME CONTROL --
- awful.key({}, "XF86AudioRaiseVolume", function() awful.util.spawn("aumix -v +5") end),
- awful.key({}, "XF86AudioLowerVolume", function() awful.util.spawn("aumix -v -5") end),
- awful.key({}, "XF86AudioMute", function() awful.util.spawn("amixer sset Master toggle") end),
- -- SCREENSHOT --
- awful.key({"Control", "Shift"}, "Print", function() awful.util.spawn("screengrab --region") end),
- awful.key({"Control",}, "Print", function() awful.util.spawn("screengrab --active") end),
- awful.key({}, "Print", function() awful.util.spawn("screengrab --fullscreen") end),
- -- LOCK SCREEN --
- awful.key({modkey,}, "l", function() awful.util.spawn("xautolock -locknow") end),
- -- APPLICATIONS --
- awful.key({"Control", "Shift"}, "Escape", function() awful.util.spawn("lxtask") end),
- -- TAGS SWITCH --
- awful.key({modkey,}, "Left", awful.tag.viewprev),
- awful.key({modkey,}, "Right", awful.tag.viewnext),
- awful.key({modkey,}, "Escape", awful.tag.history.restore),
- -- CLIENT SWITCH --
- awful.key({modkey, "Control"}, "Tab", function() awful.client.focus.history.previous() if client.focus then client.focus:raise() end end),
- awful.key({modkey,}, "Tab", function() awful.client.focus.byidx(1) if client.focus then client.focus:raise() end end),
- awful.key({modkey, "Shift"}, "Tab", function() awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end),
- -- Layout manipulation
- awful.key({modkey, "Control"}, ".", function () awful.client.swap.byidx( 1) end),
- awful.key({modkey, "Control"}, ",", function () awful.client.swap.byidx( -1) end),
- awful.key({modkey, "Shift"}, ".", function () awful.screen.focus_relative( 1) end),
- awful.key({modkey, "shift"}, ",", function () awful.screen.focus_relative(-1) end),
- awful.key({modkey,}, "u", awful.client.urgent.jumpto),
- -- 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, }, "equal", function () awful.tag.incmwfact( 0.05) end),
- awful.key({ modkey, }, "minus", 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", awful.client.floating.toggle),
- -- 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" }, "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)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))
- 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 } },
- -- Set Firefox to always map on tags number 2 of screen 1.
- -- { rule = { class = "Firefox" },
- -- properties = { tag = tags[1][2] } },
- { rule = { class = "Gimp" },
- properties = { tag = tags[1][5] } },
- { rule = { class = "Terminator" },
- properties = { tag = tags[1][3] } },
- { rule = { class = "Chromium" },
- properties = { tag = tags[1][2] } },
- { rule = { class = "Deadbeef" },
- properties = { tag = tags[1][4] } },
- { rule = { class = "Vacuum" },
- properties = { tag = tags[1][2] } },
- { rule = { class = "Firefox" },
- properties = { tag = tags[1][2] } },
- { rule = { class = "Thunderbird" },
- properties = { tag = tags[1][2] } },
- { rule = { class = "Licq" },
- properties = { tag = tags[1][2] } },
- { rule = { class = "mplayer2" },
- properties = { tag = tags[1][4] } },
- { rule = { class = "Aumix" },
- properties = { floating = true } },
- { rule = { class = "Xev" },
- properties = { floating = true } },
- { rule = { class = "Lxtask" },
- properties = { floating = true } },
- { rule = { class = "Terminator" },
- properties = { floating = false } },
- }
- -- }}}
- -- {{{ 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::click", 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)
- -- awful.placement.under_mouse(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)
- -- }}}
- -- A U T O S T A R T --
- -- awful.util.spawn_with_shell("")
- -- echo "dbpp.visible=true" | awesome-client
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement