Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Standard awesome library
- require("awful")
- require("awful.autofocus")
- require("awful.rules")
- -- Theme handling library
- require("beautiful")
- -- Notification library
- require("naughty")
- --require("vicious")
- -- Custom libraries
- require("revelation")
- require("shifty")
- require("wicked")
- require("teardrop")
- -- {{{ Variable definitions
- -- Themes define colours, icons, and wallpapers
- beautiful.init("/home/lidstah/.config/awesome/themes/lapin/theme.lua")
- -- This is used later as the default terminal and editor to run.
- terminal = "urxvt"
- editor = os.getenv("EDITOR") or "editor"
- 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"
- modkey2 = "Mod3"
- -- Table of layouts to cover with awful.layout.inc, order matters.
- layouts =
- {
- 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,
- awful.layout.suit.floating
- }
- -- }}}
- -- {{{ Tags
- shifty.config.tags = {
- ["[main]"] = { position = 1, init = true },
- ["[www]"] = { position = 2, init = true, spawn = browser,},
- ["[gimp]"] = { position = 6, exclusive = true, nopopup = true, spawn = gimp, },
- ["[sys]"] = { position = 5, init = true, exclusive = true, nopopup = true, },
- ["[msg]"] = { position = 7, exclusive = true, nopopup = true, },
- ["[view]"] = { position = 8, exclusive = true, nopopup = true, },
- ["[dev]"] = { position = 9, init = true, nopopup = true },
- ["[float]"] = { position = 12, nopopup = true, init = true, layout = "floating" }
- }
- shifty.taglist = mytaglist
- -- Clients rules
- shifty.config.apps = {
- { match = {"Transmission","Tucan.py" }, tag = "[bt]" },
- { match = {"^Download$", "Preferences", "VideoDownloadHelper", "PokerTH" }, float = true, intrusive = true },
- { match = {"Firefox","Iceweasel","Vimperator","Shiretoko"} , tag = "[www]" } ,
- { match = { "WeeChat 0.2.6.2","weechat-curses","weechat","irssi" }, tag = "[main]" },
- { match = {"Gimp" }, tag = "[gimp]", float = true },
- { match = {"gimp-image-window" }, slave = true },
- { match = {"MPlayer","ffplay" }, float = true },
- { match = {"mutt" }, tag = "[mail]", },
- { match = {"med" }, tag = "[med]" },
- { match = {"Pidgin" }, tag = "[main]" },
- { match = {"htop" }, tag = "[sys]", },
- { match = {"VirtualBox" }, tag = "[vbox]", float = true },
- { match = {"lxappearence" }, float = true },
- { match = {"gpicview", "gqview" }, float = true, tag = "[view]" },
- { match = { "" },
- buttons = 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),
- awful.button({ modkey }, 8, awful.mouse.client.resize))
- }
- }
- -- Options par défaut.
- shifty.config.defaults = {
- layout = awful.layout.suit.tile,
- ncol = 1,
- mwfact = 0.50,
- floatBars=true,
- }
- -- }}}
- -- {{{ Menu
- -- Create a laucher widget and a main menu
- myawesomemenu = {
- { "manual", terminal .. " -e man awesome" },
- { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
- { "restart", awesome.restart },
- { "quit", awesome.quit }
- }
- mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
- -- { "Debian", debian.menu.Debian_menu.Debian },
- { "open terminal", terminal }
- }
- })
- mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
- menu = mymainmenu })
- -- }}}
- -- {{{ Wibox
- -- Create a textclock widget
- mytextclock = awful.widget.textclock({ align = "right" })
- -- Create a systray
- mysystray = widget({ type = "systray" })
- -- Create a wibox for each screen and add it
- mywibox = {}
- mywibox2 = {}
- 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 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))
- 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)
- -- Widget FS (/home)
- fswidget = widget({
- type = 'textbox',
- name = 'fswidget',
- align = 'right'
- })
- wicked.register(fswidget, wicked.widgets.fs,
- '<span color="#dca3a3">${/home used}</span>/<span color="#c3bf9f">${/home size}</span>', 120)
- -- Icones, separateurs, %, [ et ]
- mycpuicon = widget({ type = "imagebox", name = "mycpuicon" })
- mycpuicon.image = image(beautiful.widget_cpu)
- myneticon = widget({ type = "imagebox", name = "myneticon" })
- myneticonup = widget({ type = "imagebox", name = "myneticonup" })
- myneticonup.image = image(beautiful.widget_netup)
- myneticon.image = image(beautiful.widget_net)
- myvolicon = widget({ type = "imagebox", name = "myvolicon" })
- myvolicon.image = image(beautiful.widget_vol)
- mymeteoicon = widget({ type = "imagebox", name = "mymeteoicon" })
- mymeteoicon.image = image(beautiful.widget_meteo)
- mymusicicon = widget({ type = "imagebox", name = "mymusicicon"})
- mymusicicon.image = image(beautiful.widget_music)
- myspacer = widget({ type = "textbox", name = "myspacer" })
- myseparator = widget({ type = "textbox", name = "myseparator" })
- mystarter = widget({ type = "textbox", name = "mystarter" })
- myender = widget({ type = "textbox", name = "myender" })
- myspacer.text = " "
- myseparator.text = "|"
- mystarter.text = "["
- myender.text = "]"
- mydiskicon = widget({ type = "imagebox", name = "mydiskicon" })
- mytimeicon = widget({ type = "imagebox", name = "mytimeicon" })
- mytimeicon.image = image(beautiful.widget_date)
- mydiskicon.image = image(beautiful.widget_fs)
- mymailicon = widget({ type = "imagebox", name = "mymailicon" })
- mymailicon.image = image(beautiful.widget_mail)
- mypercent = widget({
- type = 'textbox',
- name = 'mypercent',
- align = 'right'
- })
- mypercent.text='<span color="#c3bf9f">%</span>'
- -- Widget Mail
- mailwidget = widget({
- type = 'textbox',
- name = 'mailwidget',
- align = 'right'
- })
- function check_mail()
- local f = io.popen('ls -alF /home/lidstah/Mail/mbox/new/ | grep kadath | wc -l')
- local mailnum = f:read("*all")
- f:close()
- mailwidget.text = mailnum
- end
- -- Widget Volume
- volwidget = widget({
- type = 'textbox',
- name = 'volwidget',
- align = 'right'
- })
- pb_volume = widget({ type = "progressbar", name = "pb_volume", align = "right" })
- pb_volume.width = 10
- pb_volume.height = 0.65
- pb_volume.border_padding = 1
- pb_volume.border_width = 1
- pb_volume.ticks_count = 0
- pb_volume.gap = 0
- pb_volume.vertical = true
- pb_volume:bar_properties_set("volu",
- {
- ["bg"] = "#1f1f1f",
- ["fg"] = "#c3bf9f",
- ["fg_center"] = "#f0dfaf",
- ["fg_end"] = "#dca3a3",
- ["fg_off"] = "black",
- ["border_color"] = "#FFFFFF",
- ["min_value"] = 0,
- ["max_value"] = 100,
- ["reverse"] = false
- })
- function volume()
- local f = io.popen("aumix -q | grep vol | awk {'print $3'}")
- local vol = f:read("*all")
- f:close()
- volwidget.text = vol
- pb_volume:bar_data_add("volu",vol)
- end
- -- Widget uptime
- uptime_widget = widget({
- type = 'textbox',
- name = 'uptime_widget',
- align = 'right'
- })
- wicked.register(uptime_widget, wicked.widgets.uptime, '<span color="#c3bf9f">Up: $2d $3h</span>',3600)
- -- Widget meteo
- meteo_widget = widget({
- type = 'textbox',
- name = 'meteo_widget',
- align = 'right'
- })
- function meteo()
- local f = io.popen("cat /tmp/weather.txt")
- local met = f:read("*all")
- f:close()
- meteo_widget.text = met
- end
- -- Widget CPU
- cpugraphwidget = widget({
- type = 'graph',
- name = 'cpugraphwidget',
- align = 'right'
- })
- cpugraphwidget.height = 0.85
- cpugraphwidget.width = 35
- cpugraphwidget.bg = '#333333'
- cpugraphwidget.border_color = 'white'
- cpugraphwidget.grow = 'left'
- cpugraphwidget:plot_properties_set('cpu', {
- fg = '#c3bf9f',
- fg_center = '#f0dfaf',
- fg_end ='#dca3a3',
- vertical_gradient = false
- })
- wicked.register(cpugraphwidget, wicked.widgets.cpu, '$1', 20, 'cpu')
- -- Net Widget
- netwidget = widget({
- type = 'textbox',
- name = 'netwidget',
- align = 'right'
- })
- wicked.register(netwidget, wicked.widgets.net, ' <span color="#dca3a3">${eth0 down}</span>/<span color="#c3bf9f">${eth0 up}</span> ', 2, nil, 3)
- -- Icones mémoire & widget mémoire
- mymemicon = widget({ type = "imagebox", name = "mymemicon" })
- mymemicon.image = image(beautiful.widget_mem)
- membarwidget = widget({
- type = 'progressbar',
- name = 'membarwidget',
- align = 'right'
- })
- membarwidget.width = 40
- membarwidget.height = 0.65
- membarwidget.gap = 0
- membarwidget.border_padding = 1
- membarwidget.border_width = 1
- membarwidget.ticks_count = 0
- membarwidget.ticks_gap = 0
- membarwidget.vertical = false
- membarwidget:bar_properties_set('mem', {
- bg = '#2f2f2f',
- fg = '#c3bf9f',
- fg_center = '#f0dfaf',
- fg_end = '#dca3a3',
- fg_off = '#222222',
- reverse = false,
- min_value = 0,
- max_value = 100
- })
- wicked.register(membarwidget, wicked.widgets.mem, '$1', 20, 'mem')
- -- mpd widget
- mpdwidget = widget({
- type = 'textbox',
- name = 'mpdwidget',
- align = 'right'
- })
- wicked.register(mpdwidget, wicked.widgets.mpd, '<span color="#c3bf9f">$1</span>', 5)
- -- Create the wibox
- mywibox[s] = awful.wibox({ position = "top", screen = s })
- mywibox2[s] = awful.wibox({ position = "bottom", screen = s })
- -- Add widgets to the wibox - order matters
- mywibox[s].widgets = {
- {
- -- mylauncher,
- mytaglist[s],
- mypromptbox[s],
- layout = awful.widget.layout.horizontal.leftright
- },
- mylayoutbox[s],
- -- memwidget,
- -- mytextclock, mytimeicon,
- -- s == 1 and mysystray or nil,
- myender, myspacer,
- mypercent, volwidget, myspacer, pb_volume, myvolicon, myseparator,
- myspacer,
- mpdwidget, mymusicicon, myseparator,
- myspacer,
- fswidget, mydiskicon, myseparator,
- myspacer,
- myneticonup, netwidget, myneticon, myseparator,
- myspacer,
- cpugraphwidget, mycpuicon, myseparator,
- myspacer,
- membarwidget, mymemicon, mystarter,
- -- mytasklist[s],
- layout = awful.widget.layout.horizontal.rightleft
- }
- mywibox2[s].widgets = {
- {
- mylauncher,
- layout = awful.widget.layout.horizontal.leftright
- },
- s == 1 and mysystray or nil,
- myender, myspacer,
- uptime_widget, myspacer, mytextclock, mytimeicon, myseparator, myspacer, mailwidget, mymailicon, myspacer, myseparator, myspacer, meteo_widget, myspacer, mymeteoicon, myspacer, mystarter,
- 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, "Shift" }, "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(true) end),
- -- Layout manipulationi
- -- awful
- awful.key({ modkey, }, "Tab", function () awful.client.focus.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, "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, "Shift" }, "Tab",
- function ()
- awful.client.focus.history.previous()
- if client.focus then
- client.focus:raise()
- end
- end),
- -- Shifty
- -- awful.key({ modkey, "Shift" }, "t", shifty.add),
- -- awful.key({ modkey }, "r", shifty.rename),
- -- awful.key({ modkey }, "w", shifty.del),
- awful.key({ modkey, "Shift" }, "Left", shifty.shift_prev ),
- awful.key({ modkey, "Shift" }, "Right", shifty.shift_next ),
- -- awful.key({ modkey }, "Escape", function() awful.tag.history.restore() end), -- move to prev tag by history
- awful.key({ modkey, "Shift" }, "n", shifty.send_prev), -- move client to prev tag
- awful.key({ modkey }, "n", shifty.send_next),
- -- shifty.config.clientkeys = clientkeys
- -- Teardrop
- awful.key({ modkey },"x", function () teardrop("urxvt", "center", "center", 0.5) end),
- awful.key({ modkey },"w", function () teardrop("vimprobable", "center", "center", 0.5) end),
- -- Standard program
- -- awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
- awful.key({ modkey, "Control" }, "r", awesome.restart),
- awful.key({ modkey, "Control" }, "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 }, "Down", revelation.revelation),
- -- Keybindings Perso
- awful.key({ }, "#122", function () awful.util.spawn("aumix -q -v-10") end),
- awful.key({ }, "#123", function () awful.util.spawn("aumix -q -v+10") end),
- awful.key({ modkey, }, "#122", function() awful.util.spawn("mpc --no-status prev") end),
- awful.key({ modkey, }, "#123", function() awful.util.spawn("mpc --no-status next") end),
- awful.key({ modkey, }, "#121", function() awful.util.spawn("mpc --no-status toggle") end),
- awful.key({ modkey}, "Return", function () awful.util.spawn(terminal) end),
- -- Prompt
- awful.key({ modkey }, "BackSpace", function () mypromptbox[mouse.screen]:run() end)
- )
- clientkeys = awful.util.table.join(
- awful.key({ modkey, }, "s", function (c) c.ontop = not c.ontop end ),
- awful.key({ modkey, }, "s", function (c) c.sticky = not c.sticky end ),
- awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
- awful.key({ modkey }, "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, }, "n", function (c) c.minimized = not c.minimized 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.
- 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)
- shifty.config.globalkeys = globalkeys
- shifty.config.clientkeys = clientkeys
- -- }}}
- -- Old timers, deprecated.
- --awful.hooks.timer.register(2, function () volume() end)
- --awful.hooks.timer.register(30, function () check_mail() end)
- --awful.hooks.timer.register(60, function () meteo() end)
- -- Timers
- myvoltimer = timer({ timeout = 2 })
- myvoltimer:add_signal("timeout", function() volume() end)
- myvoltimer:start()
- mymailtimer = timer({ timeout = 30 })
- mymailtimer:add_signal("timeout", function() check_mail() end)
- mymailtimer:start()
- mymeteotimer = timer({ timeout = 120 })
- mymeteotimer:add_signal("timeout", function() meteo() end)
- mymeteotimer:start()
- -- {{{ 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)
- shifty.init()
- 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)
- -- }}}
- -- }}}
- -- Signals pour la transparence.
- --
- -- client.add_signal("focus", function(c)
- -- c.border_color = beautiful.border_focus
- -- if c.opacity < 1.0 then
- -- c.opacity = beautiful.opacity_focus
- -- end
- -- end)
- --client.add_signal("unfocus", function(c)
- -- c.border_color = beautiful.border_normal
- -- if c.opacity < 1.0 then
- -- c.opacity = beautiful.opacity_normal
- -- end
- -- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement