You are not logged in.
Hey all,
I've just started using AwesomeWM with #! and I gotta say....it's eponymous.
The problem is though, I'm not very familiar (read: not familiar at all) with Lua and that config file is confusing! I was thinking that in this thread could be a consortium of all #!ers with Awesome, where we could share configs / widgets / etc., much like the recently-created FVWM thread(s). What do you guys think? Just to get it started here's my setup:
As you can see, it's pretty basic. I'm trying to figure out widgets and conky right now.
Oh and here's the threads already, though some of them are old:
http://crunchbanglinux.org/forums/topic … wesome-wm/
http://crunchbanglinux.org/forums/topic … wesome-wm/
http://crunchbanglinux.org/forums/topic … nstalling/
Punch all your friends.
Offline
nice, sunjack is pretty awesome with awesome.. probably be able to help you out. it really looks like an awesome wm though!
... and a kind word. -Duke
Offline
^
Yeah it is pretty awesome! Thanks...I hope to make it awesomer with time!
Punch all your friends.
Offline
Cool man, i hope someday there is AwesomeWM tutorial here.
I've use AwesomeWM several times but not too fond with the language.
I'm even unable to create double statusbar or editing the the statusbar it self. 
Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
@muzieca, yeah, lua is interesting...
but I'm working on getting a config working well and hope to post here soon! what are your problems with the panel (called a wibox in awesome)? who knows, maybe i know something!
Punch all your friends.
Offline
@mahatman2:
Currently, i'm playing with ScrotWM, but i'll give Awesome WM another try.
I'll let you know if i've got some problems.
thanks in advance, mate.
Cheers.
Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
^ hey, no problem. It's what Opensource is all about! 
Punch all your friends.
Offline
Someone need help? 
May I say I'm not good with lua, I use intuition 
"I'd rather run Linux on a 6.5KHz machine through an ARM emulator than run Vista"
Offline
Someone need help?
May I say I'm not good with lua, I use intuition

Intuition with talent, that's all i can say. 
Need help? of course mate, i've always wondering what did you do on awful.widget.launcher.
I've seen it several times on your screenshots, and i like it very much.
i have no idea how to change that awesome_icon with text "menu" launcher.
is that an image? if it was an image, any idea for the ideal size? if it's not an image, how to make the launcher just like you did?
Too many questions here, sorry, can't helped it. 
Thanks in advance mate.
Last edited by muzieca (2011-03-02 09:52:07)
Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
mylauncher = widget({ type = "textbox" })
mylauncher.text = ' <span color="'..beautiful.fg_focus..'" > MENU</span>'
mylauncher:buttons(awful.util.table.join( awful.button({}, 1, nil, function () mymainmenu:toggle(mainmenu_args) end)))the launcher widget shuold textbox type [ widget({ type = "textbox" }) ]
for the text change the launcher.text
Last edited by SuNjACk (2011-03-02 10:03:54)
"I'd rather run Linux on a 6.5KHz machine through an ARM emulator than run Vista"
Offline
@SuNjACk
That's do the trick. It works just like i wanted to.
Thank you very much. I'm really appreciated it.
Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
@SuNjACk
That's do the trick. It works just like i wanted to.
Thank you very much. I'm really appreciated it.
you're welcome 
"I'd rather run Linux on a 6.5KHz machine through an ARM emulator than run Vista"
Offline
There is mine ...
rc.lua :
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Load Debian menu entries
require("debian.menu")
-- Enable mocp
function moc_control (action)
local moc_info,moc_state
if action == "next" then
io.popen("mocp --next")
elseif action == "previous" then
io.popen("mocp --previous")
elseif action == "stop" then
io.popen("mocp --stop")
elseif action == "play_pause" then
moc_info = io.popen("mocp -i"):read("*all")
moc_state = string.gsub(string.match(moc_info, "State: %a*"),"State: ","")
if moc_state == "PLAY" then
io.popen("mocp --pause")
elseif moc_state == "PAUSE" then
io.popen("mocp --unpause")
elseif moc_state == "STOP" then
io.popen("mocp --play")
end
end
end
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/kooka/.config/awesome/themes/zenburn/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"
altkey = "Mod1"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier
}
-- }}}
-- {{{ Tags
tags = {
names = { "web", "devel", "music", "misc", 5, 6, 7, 8, 9 },
layout = { layouts[10], layouts[2], layouts[10], layouts[10], layouts[2],
layouts[1], layouts[1], layouts[1], layouts[1]
}}
for s = 1, screen.count() do
tags[s] = awful.tag(tags.names, s, tags.layout)
for i, t in ipairs(tags[s]) do
awful.tag.setproperty(t, "hide", (i==5 or i==6 or i==7 or i==8 or i==9) and true)
end
end
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "Restart Awesome", awesome.restart },
{ "Logout", awesome.quit }
}
launchers = {
{ "Pcmanfm", "pcmanfm" },
{ "Thunar (root)", "gksu thunar" },
{ "Picasa", "picasa" },
{ "Spotify", "playonlinux --run Spotify" }
}
moc = {
{ "Play", "mocp -p" },
{ "Pause", "mocp -P" },
{ "Prev", "mocp -r" },
{ "Next", "mocp -f" },
{ "Stop", "mocp -s" }
}
photo = {
{ "Jbrout", "jbrout" },
{ "PostR", "postr" },
{ "Darktable", "darktable" },
{ "Pinta", "pinta" },
{ "Phatch", "phatch" },
{ "Tintii", "tintii" }
}
config = {
{ "Edition Rc.lua", "geany /home/kooka/.config/awesome/rc.lua" },
{ "Edition Conkyrc-eeepc", "geany /home/Stockage/Projets/Conky/.conkyrc_eeepc" },
{ "Edition Zshrc", "geany /home/kooka/.zshrc" },
{ "Edition Xdefaults", "geany /home/kooka/.Xdefaults" },
{ "Edition Screenrc", "geany /home/kooka/.screenrc" },
{ "Script Sauvergarde", "urxvt -e sh -c 'sudo /home/Stockage/Projets/Bash/sauvegarde.sh'" },
{ "Script Mise-à-jour", "urxvt -e sh -c 'sudo /home/Stockage/Projets/Bash/maj.sh'" },
{ "Edition Script Post_install", "geany /home/Stockage/Projets/Bash/postinstall_script.sh" }
}
prefs = {
{ "Volume sonore", "gnome-alsamixer" },
{ "Luminosité", "urxvt -e sh -c 'sudo /home/Stockage/Projets/Bash/brightness_select.sh'" },
{ "Gouvernor CPU", "urxvt -e sh -c 'sudo /home/Stockage/Projets/Bash/governor.sh'" }
}
screenshots = {
{ "Now", "scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f /home/Stockage/Images/ScreenShoots & gpicview /home/Stockage/Images/ScreenShoots/$f'" },
{ "Wait 5s", "scrot -d 5 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f /home/Stockage/Images/ScreenShoots & gpicview /home/Stockage/Images/ScreenShoots/$f'" },
{ "Wait 10s", "scrot -d 10 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f /home/Stockage/Images/ScreenShoots & gpicview /home/Stockage/Images/ScreenShoots/$f'" },
{ "Kooka-Shadow", "urxvt -e sh -c '/home/Stockage/Projets/Bash/kooka-shadow'" },
{ "Kooka-Polaroid", "urxvt -e sh -c '/home/Stockage/Projets/Bash/kooka-polaroid'" },
{ "Kooka-Screen", "urxvt -e sh -c '/home/Stockage/Projets/Bash/kooka-screen'" }
}
logout = {
{ "Reboot", '/home/Stockage/Projets/Bash/redemarrage.sh'},
{ "Shutdown", '/home/Stockage/Projets/Bash/extinction.sh'},
}
mymainmenu = awful.menu({ items = { { "Open Terminal", terminal },
{ "Launchers", launchers },
{ "MoC-Player", moc },
{ "Photo", photo },
{ "Debian", debian.menu.Debian_menu.Debian },
{ "Screenshots", screenshots },
{ "Config", config },
{ "Prefs", prefs },
{ "Awesome", myawesomemenu },
{ "Logout", logout }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
-- }}}
-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right"}, " %a %d %b, %H:%M:%S ", 1)
-- Create a systray
mysystray = widget({ type = "systray" })
-- 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 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)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", height = "22", 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],
mytextclock,
s == 1 and mysystray or nil,
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),
-- Dmenu
awful.key({ modkey, }, "BackSpace", function ()
awful.util.spawn("dmenu_run -i -p 'Run command:' -nb '" ..
beautiful.bg_normal .. "' -nf '" .. beautiful.fg_normal ..
"' -sb '" .. beautiful.bg_focus ..
"' -sf '" .. beautiful.fg_focus .. "'")
end),
-- GmRun
awful.key({ modkey, }, "g", function () awful.util.spawn("gmrun") end),
-- Mocp
awful.key({ "Control", }, "Right", function () moc_control("next") end),
awful.key({ "Control", }, "Left", function () moc_control("previous") end),
awful.key({ "Control", }, "Up", function () moc_control("stop") end),
awful.key({ "Control", }, "Down", function () moc_control("play_pause") end),
-- Volume
awful.key({ }, "XF86AudioLowerVolume", function() awful.util.spawn("amixer -q set Master 5-% unmute") end),
awful.key({ }, "XF86AudioRaiseVolume", function() awful.util.spawn("amixer -q set Master 5+% unmute") end),
awful.key({ }, "XF86AudioMute", function() awful.util.spawn("amixer -q set Master toggle") end),
awful.key({ modkey, }, "Down", function() awful.util.spawn("amixer -q set Master 5-% unmute") end),
awful.key({ modkey, }, "Up", function() awful.util.spawn("amixer -q set Master 5+% unmute") end),
awful.key({ "Control", }, "space", function() awful.util.spawn("amixer -q set Master toggle") end),
-- Prompt
awful.key({ modkey }, "p", 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) 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.
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 require("scratch")
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 } },
{ rule = { class = "chromium-browser" },
properties = { tag = tags[1][web] } },
{ rule = { class = "Pidgin" },
properties = { tag = tags[1][web] } },
{ rule = { class = "urxvt" },
properties = { tag = tags[1][devel] } },
{ rule = { class = "geany" },
properties = { tag = tags[1][devel] } },
{ rule = { class = "pcmanfm" },
properties = { tag = tags[1][devel] } }
-- 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)
-- }}}
os.execute("nm-applet &")
os.execute("xrdb -load ~/.Xdefaults &")
os.execute("xfce4-power-manager &")
os.execute("volti &")
os.execute("trayfreq &")
os.execute("chromium-browser --restore-last-session &")
os.execute("pidgin &")
os.execute("conky -c /home/Stockage/Projets/Conky/.conkyrc_eeepc &")My Fluidr (= Fickr) : http://www.fluidr.com/photos/kookadimi/sets
Offline
@Kookaburra
That was nice setup, Maybe i'm going to get some inspiration from your settings.
Thanks for posting your rc.lua.
Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
@Kookaburra, I got a lot out of your menu, thanks! 
Here's my rc.lua:
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Run or Raise
require("aweror")
-- Scratchpad
require("scratch")
-- Widgets!
require("vicious")
-- Dynamic Tagging Tool
require("shifty")
-- Load Debian menu entries
require("debian.menu")
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/case/.config/awesome/themes/dinosaur/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "terminator"
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, --1
awful.layout.suit.tile, --2
awful.layout.suit.tile.left, --3
awful.layout.suit.tile.bottom, --4
awful.layout.suit.tile.top, --5
awful.layout.suit.fair, --6
awful.layout.suit.fair.horizontal, --7
awful.layout.suit.spiral, --8
awful.layout.suit.spiral.dwindle, --9
awful.layout.suit.max, --10
awful.layout.suit.max.fullscreen, --11
awful.layout.suit.magnifier --12
}
-- }}}
-- {{{ Shifty config
-- tag settings
shifty.config.tags = {
["home"] = { init = true, position = 1, exclusive = false, mwfact = 0.50, },
["www"] = { position = 2, exclusive = false, layout = awful.layout.suit.floating, },
["gimp"] = { layout = "float" },
["word"] = { layout = awful.layout.suit.fair },
}
-- client settings
-- order here matters, early rules will be applied first
shifty.config.apps = {
{ match = { "Google-chrome", "jumanji", "uzbl%", "midori" } , tag = "www" } ,
{ match = { "terminator"} , honorsizehints = false, slave = true, tag = "term" } ,
{ match = { "thunar" }, slave = true } ,
{ match = { "gimp" }, tag = "gimp" },
{ match = { "abiword", "libreoffice" }, tag = "word" },
--[[{ match = { "" }, buttons = {
button({ }, 1, function (c) client.focus = c; c:raise() end),
button({ modkey }, 1, function (c) awful.mouse.client.move() end),
button({ modkey }, 3, awful.mouse.client.resize ), }, },--]]
}
-- tag defaults
shifty.config.defaults = {
layout = awful.layout.suit.tile,
ncol = 1,
mwfact = 0.50,
floatBars=true,
}
shifty.init()
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "restart", awesome.restart },
{ "logout", awesome.quit }
}
-- {{{ Build the individual app lists first
app_tools = {
{ "search", "catfish" },
{ "archive", "file-roller" },
{ "text", "gedit" },
{ "term", "terminator" },
{ "file", "thunar" },
{ '<span color="red">file</span>', "gksudo thunar" },
{ "calc", "gcalctool" } }
app_web = {
{ "midori", "midori" },
{ "chrome", "google-chrome" },
{ "jumanji", "jumanji" },
{ "uzbl", "uzbl-tabbed" },
{ "gFTP", "gftp" },
{ "torrent", "transmission" },
{ "irc", "xchat" },
{ "chat", "gajim" },
{ "heybuddy", "heybuddy" } }
app_img = {
{ "gimp", "gimp" },
{ "view", "viewnior" },
{ "color", "gcolor2" } }
app_media = {
{ "vlc", "vlc"},
{ "decibel", "decibel-audio-player" },
{ "pithos", "pithos" },
{ "pogo", "pogo" },
{ "rip", "asunder" },
{ "mix", "xfce4-mixer" } }
app_work = {
{ "abiword", "abiword" },
{ "gnumeric", "gnumeric" },
{ "gummi", "gummi" },
{ "libreoffice", "libreoffice" } }
apps_menu = {
{ "tools", app_tools },
{ "web", app_web },
{ "img", app_img },
{ "media", app_media },
{ "work", app_work } }
--same thing with settings
set_term = {
{ "man", 'terminator --command="man terminator"' },
{ "config", 'gedit ~/.config/terminator/config' } }
set_display = {
{ "grandr", "grandr" },
{ "xrandr", "xrandr" },
{ "man xrandr", 'terminator --command="man xrandr"' } }
set_system = {
{ "printing", "gksudo system-config-printer" },
{ "gparted", "gksudo gparted" },
{ "gdm", "gksudo gdmsetup" },
{ "synaptic", "gksudo synaptic" } }
settings_menu = {
{ "term", set_term },
{ "display", set_display },
{ "defaults", 'terminator --command="sudo update-alternatives --all"' },
{ "gtk", "lxappearance" },
{ "screensaver", "xscreensaver-demo" },
{ "system", set_system } }
--and the end stuff
screenshots = {
{ "Now", "scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f /home/case/images/screenshots/$f'" },
{ "Wait 5s", "scrot -d 5 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f /home/case/images/screenshots/$f'" } }
help_menu = {
{ "awesome wiki", "midori https://awesome.naquadah.org/wiki/Main_Page" } }
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "web", "midori" },
{ "text", "gedit" },
{ "word", "abiword" },
{ "zim", "zim" },
{ "file", "thunar" },
{ "apps", apps_menu },
{ "settings", settings_menu },
{ "screenshot", screenshots },
{ "help", help_menu }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
-- }}}
-- {{{ Wibox
-- {{{ for volume widget
volumecfg = {}
volumecfg.cardid = 0
volumecfg.channel = "Master"
volumecfg.widget = widget({ type = "textbox", name = "volumecfg.widget", align = "right" })
-- 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 = " -- "
end
if (volume == " 100%") then
volume = "100%"
end
volumecfg.widget.text = volume
end
volumecfg.update = function ()
volumecfg.mixercommand(" sget " .. volumecfg.channel)
end
volumecfg.up = function ()
volumecfg.mixercommand(" sset " .. volumecfg.channel .. " 5%+")
end
volumecfg.down = function ()
volumecfg.mixercommand(" sset " .. volumecfg.channel .. " 5%-")
end
volumecfg.toggle = function ()
volumecfg.mixercommand(" sset " .. volumecfg.channel .. " toggle")
end
volumecfg.widget:buttons(awful.util.table.join(
awful.button({ }, 4, function () volumecfg.up() end),
awful.button({ }, 5, function () volumecfg.down() end),
awful.button({ }, 1, function () volumecfg.toggle() end)))
volumecfg.update()
-- }}}
-- Reusable separators
separator = widget({ type = "imagebox" })
separator.image = image(beautiful.widget_sep)
deadspace = widget({ type = "imagebox" })
deadspace.image = image(beautiful.widget_dead)
--deadspace = widget({ type = "textbox" })
-- Icons
volicon = widget({ type = "imagebox" })
volicon.image = image(beautiful.widget_vol)
volicon:buttons(awful.util.table.join(
awful.button({ }, 4, function () volumecfg.up() end),
awful.button({ }, 5, function () volumecfg.down() end),
awful.button({ }, 1, function () volumecfg.toggle() end)))
-- {{{ Vicious Widgets
--gmail widget
gmailicon = widget({ type = "imagebox" })
gmailicon.image = image(beautiful.widget_gmail)
gmailicon_none = widget({ type = "imagebox" })
gmailicon_none.image = image(beautiful.widget_gmail_none)
gmailWidget = widget({type = "textbox" })
vicious.register(gmailWidget, vicious.widgets.gmail, " ${count}", 30) --[[
function (widget, args)
if args["{count}"] == 0 then return nil
else return {separator, ' ' .. args["{count}"], gmailicon} end end, 30)--]]
--battery widget
baticon = widget({type = "imagebox" })
baticon.image = image(beautiful.widget_bat)
baticon:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("xfce4-power-manager-settings") end)))
batWidget = widget({type = "textbox" })
vicious.register(batWidget, vicious.widgets.bat, " $2$1", 30, "BAT1")
batWidget:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("xfce4-power-manager-settings") end)))
-- }}}
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" }, '<span color="white">%l:%M|%a %e</span>')
-- Create a systray
mysystray = widget({ type = "systray" })
-- 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 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, prompt = '<span color="red">></span>', })
-- 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
widgetz = {
s ==1 and mysystray or nil,
mypromptbox[s],
{
deadspace, volumecfg.widget, volicon,
separator, batWidget, baticon,
separator, gmailWidget, gmailicon,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace, deadspace, deadspace, deadspace, deadspace,
deadspace,
mytextclock,
layout = awful.widget.layout.horizontal.rightleft
},
layout = awful.widget.layout.horizontal.leftright
}
mywibox[s] = awful.wibox({ position = "top", height = "24", screen = s })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
--[[ { ------------------------------------------------------WIBOX-------
-- mylauncher, --traditional version
mytaglist[s],
mylayoutbox[s],
mypromptbox[s], separator,
layout = awful.widget.layout.horizontal.leftright
},
deadspace, mytextclock,
separator, s == 1 and mysystray or nil,
separator, volumecfg.widget, volicon,
separator, batWidget, baticon,
separator, gmailWidget, gmailicon,
separator, mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft --]]
---[[ --crazy version!
layout = awful.widget.layout.vertical.flex,
widgetz,
{
mylauncher, deadspace, mylayoutbox[s],
mytaglist[s], separator,
mytasklist[s], separator,
layout = awful.widget.layout.horizontal.leftright,
} --]]
}
end
shifty.taglist = mytaglist
-- }}}
-- {{{ 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, "Shift" }, "Left", shifty.shift_prev ),
awful.key({ modkey, "Shift" }, "Right", shifty.shift_next ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "t", function () shifty.add({ rel_index = 1}) end),
awful.key({ modkey, "Shift" }, "t", function () shifty.add({ rel_index = 1, nopopup = true }) end),
awful.key({ modkey, }, "r", shifty.rename),
awful.key({ modkey, }, "w", shifty.del),
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, "Shift" }, "`", 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, "Control" }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Control", "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
---[[ Volume
awful.key({}, "XF86AudioLowerVolume", function() volumecfg.down() end),
awful.key({}, "XF86AudioRaiseVolume", function() volumecfg.up() end),
awful.key({}, "XF86AudioMute", function () volumecfg.toggle() end),
--]]
-- Brightness (uses my brightness thing)
awful.key({ modkey }, "F5", function() awful.util.spawn_with_shell("brightness -1") end),
awful.key({ modkey }, "F6", function() awful.util.spawn_with_shell("brightness +1") end),
--ScratchPad
awful.key({ modkey, }, "s", function() scratch.pad.toggle() end),
--awful.key({}, "F12", function () scratch.drop("terminator", "top") end),
-- Prompt
awful.key({ modkey, }, "space", function () mypromptbox[mouse.screen]:run() end),
awful.key({ modkey }, "z",
function ()
awful.prompt.run({ prompt = '<span color="green">Lua></span>' },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end)
)
-- Client Keybindings
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, }, "c", function (c) c:kill() end),
awful.key({ modkey, "Alt" }, "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, "Control" }, "t", function (c) c.ontop = not c.ontop 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),
awful.key({ modkey, }, "d", function (c) scratch.pad.set(c, 0.50, 0.50, true) end)
)
-- {{{ bindings / global / shifty.getpos
for i=1, ( shifty.config.maxtags or 9 ) do
globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey }, i,
function ()
local t = awful.tag.viewonly(shifty.getpos(i))
end))
globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey, "Control" }, i,
function ()
local t = shifty.getpos(i)
t.selected = not t.selected
end))
globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey, "Control", "Shift" }, i,
function ()
if client.focus then
awful.client.toggletag(shifty.getpos(i))
end
end))
-- move clients to other tags
globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey, "Shift" }, i,
function ()
if client.focus then
local t = shifty.getpos(i)
awful.client.movetotag(t)
awful.tag.viewonly(t)
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
-- [ror]
globalkeys = awful.util.table.join(globalkeys, aweror.genkeys(modkey))
root.keys(globalkeys)
shifty.config.globalkeys = globalkeys
shifty.config.clientkeys = clientkeys
-- }}}
-- {{{ 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 } },
{ rule = { class = "zathura" },
properties = { floating = true } },
{ rule = { class = "pidgin" },
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
c.opacity = 1
end)
--[[ FOCUS OPACITY
client.add_signal("unfocus", function(c)
c.border_color = beautiful.border_normal
c.opacity = 0.7
end)--]]
-- }}}
-- {{{ Autostart
awful.util.spawn_with_shell("awesome-autostart")
-- }}}It uses shifty for dynamic tagging, which is great only I can't name a new tag "ad hoc". If anyone knows how to get this to happen, please let me know.
EDIT: in case anyone else wants to use Shifty, I found this patch (right under my nose, in the awesome wiki
): https://awesome.naquadah.org/wiki/Talk:Shifty
PS. screenshot here
Last edited by mahatman2 (2011-03-05 23:00:37)
Punch all your friends.
Offline
Well, it's not much changes in rc.lua, just adding some simple syntax.
-- Standard awesome library
require("vicious")
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Load Debian menu entries
require("debian.menu")
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/usr/share/awesome/themes/MuziAwesomeTheme/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"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier
}
-- }}}
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tagnames = { "term", "net", "file", "media", "misc" }
taglayouts = {
awful.layout.suit.tile.left,
awful.layout.suit.floating,
awful.layout.suit.floating,
awful.layout.suit.floating,
awful.layout.suit.floating }
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = {}
for tagnumber = 1, 5 do
-- Add tags and name them.
tags[s][tagnumber] = tag(tagnames[tagnumber])
-- Add tags to screen one by one, giving them their layouts at the same time.
tags[s][tagnumber].screen = s
awful.layout.set(taglayouts[tagnumber], tags[s][tagnumber])
end
-- I'm sure you want to see at least one tag.
tags[s][1].selected = true
end
end
-- }}}
-- {{{ 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 },
{ "Debian", debian.menu.Debian_menu.Debian },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
-- }}}
-- {{{ Wibox
-- {{{ Reusable separators
spacer = widget({ type = "textbox" })
separator = widget({ type = "imagebox" })
spacer.text = " "
separator.image = image(beautiful.widget_sep)
-- }}}
-- CPU Icon
cpuicon = widget({ type = "imagebox" })
cpuicon.image = image(beautiful.widget_cpu)
-- CPU
cpuwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(cpuwidget, vicious.widgets.cpu, "$1%")
-- MEM Icon
memicon = widget({ type = "imagebox" })
memicon.image = image(beautiful.widget_mem)
-- MEM
memwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(memwidget, vicious.widgets.mem, "$1%", 13)
-- Swap Icon
swapicon = widget({ type = "imagebox" })
swapicon.image = image(beautiful.widget_swap)
-- SWAP
swapwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(swapwidget, vicious.widgets.mem, "$5%", 13)
-- Root Icon
rooticon = widget({ type = "imagebox" })
rooticon.image = image(beautiful.widget_root)
--FS Root
fsrwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(fsrwidget, vicious.widgets.fs, "Root:${/ used_p}%")
-- Home Icon
homeicon = widget({ type = "imagebox" })
homeicon.image = image(beautiful.widget_home)
--FS Home
fshwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(fshwidget, vicious.widgets.fs, "Home:${/home used_p}%")
-- Data1 Icon
fsd1icon = widget({ type = "imagebox" })
fsd1icon.image = image(beautiful.widget_fsd1)
--FS Data01
fsd1widget = widget({ type = "textbox" })
-- Register widget
vicious.register(fsd1widget, vicious.widgets.fs, "Data1:${/mnt/DATA01 used_p}%")
-- Data2 Icon
fsd2icon = widget({ type = "imagebox" })
fsd2icon.image = image(beautiful.widget_fsd2)
--FS Data02
fsd2widget = widget({ type = "textbox" })
-- Register widget
vicious.register(fsd2widget, vicious.widgets.fs, "Data2:${/mnt/DATA02 used_p}%")
-- {{{ Network usage
dnicon = widget({ type = "imagebox" })
upicon = widget({ type = "imagebox" })
dnicon.image = image(beautiful.widget_netdn)
upicon.image = image(beautiful.widget_netup)
-- Upload
upwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(upwidget, vicious.widgets.net, "${ppp0 up_kb}")
-- Download
dnwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(dnwidget, vicious.widgets.net, "${ppp0 down_kb}")
-- }}}
-- 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 = {}
my2ndwibox = {}
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)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
my2ndwibox = 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],
separator, dnwidget, dnicon,
separator, upwidget, upicon,
separator, fsd2widget, fsd2icon,
separator, fsd1widget, fsd1icon,
separator, fshwidget, homeicon,
separator, fsrwidget, rooticon,
separator, swapwidget, swapicon,
separator,memwidget, memicon,
separator, cpuwidget, cpuicon, separator,
layout = awful.widget.layout.horizontal.rightleft
}
my2ndwibox.widgets = { mytextclock,
s == 1 and mysystray or nil,
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),
-- 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) 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.
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 } },
{ 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)
-- }}}Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
have nothing to di so I'll post my config(s)
rc.lua
require("awful")
require("awful.rules")
require("awful.autofocus")
require("awful.startup_notification")
require("beautiful")
require("vicious")
--require("mainmenu")
require("freedesktop.utils")
require("freedesktop.menu")
require("widgets")
require("volume")
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/sunny/.config/awesome/theme.lua")
--wallpaper_cmd = { "nitrogen --restore" }
exec = awful.util.spawn
terminal = "urxvtc"
cli_editor = "vim"
gui_editor = "geany"
browser = "chromium"
gui_fm = "pcmanfm"
cli_fm = terminal .. " -e ranger"
system_monitor = terminal .. " -e htop"
media_player = "gnome-mplayer"
music_player = terminal .. " -e ncmpcpp"
smallterminal = terminal .. ' -title "SmallTerm" -geometry 67x07-200-100'
gtk_settings = "lxappearance"
-- Default modkey.
modkey = "Mod4"
altkey = "Mod1"
--// Set wallpaper //
exec("nitrogen --restore", false)
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.bottom,
awful.layout.suit.fair,
awful.layout.suit.tile.top,
awful.layout.suit.spiral,
awful.layout.suit.magnifier,
awful.layout.suit.max,
}
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
tags[s] = awful.tag({ "O_o", ">_<", "T_T", "-_-", "^_^" }, s, layouts[1])
end
--/// Mouse bindings ///
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle(desktopmenu_args) end),
awful.button({ }, 5, awful.tag.viewnext),
awful.button({ }, 4, awful.tag.viewprev)
))
--/// GLOBAL KEYS BINDINGS
globalkeys = awful.util.table.join(
--// Focus //--
awful.key({ modkey, }, "Left",
function () awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "Right",
function () awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
--// Tag control //--
awful.key({ altkey, "Control" }, "Left", awful.tag.viewprev ),
awful.key({ altkey, "Control" }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Up", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "Down", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, altkey, }, "Up", function () awful.client.incwfact( 0.05) end),
awful.key({ modkey, altkey, }, "Down", function () awful.client.incwfact(-0.05) end),
awful.key({ modkey, "Control" }, "Up", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "Down", function () awful.tag.incncol(-1) end),
awful.key({ modkey, "Shift" }, "Up", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "Down", function () awful.tag.incnmaster(-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),
--// Awesome restart and quit //--
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Control" }, "q", awesome.quit),
--// Layout manipulation //--
awful.key({ modkey, "Shift" }, "Left", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Shift" }, "Right", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
--// Standard program //--
awful.key({ modkey, }, "Return", function () exec(terminal, false) end),
awful.key({ altkey, }, "F2", function () awful.util.spawn("dmenu-bind") end),
awful.key({ modkey }, "r", function () awful.util.spawn("gmrun") end),
awful.key({ modkey, }, "w", function () exec(browser) end),
awful.key({ modkey, }, "f", function () exec(cli_fm) end),
awful.key({ modkey, }, "v", function () exec(media_player) end),
awful.key({ modkey, }, "h", function () exec(system_monitor, false) end),
-- awful.key({ modkey, }, "g", function () exec("gimp") end),
awful.key({ modkey, }, "e", function () exec(gui_editor) end),
awful.key({ modkey, }, "a", function () exec(gtk_settings) end),
awful.key({ modkey, }, "n", function () exec(music_player, false) end),
-- awful.key({ modkey, }, "t", function () exec("transmission", false) end),
-- awful.key({ modkey, }, "l", function () exec("xscreensaver-command -l", false) end),
awful.key({ modkey, }, "p", function () exec("pidgin", true) end),
awful.key({ modkey, altkey }, "Return", function () exec(smallterminal, false) end),
awful.key({ modkey, altkey }, "f", function () exec(gui_fm) end),
-- awful.key({ modkey, altkey }, "e", function () exec(terminal .. " -e alsamixer -D equal", false) end),
awful.key({ modkey, altkey }, "n", function () exec("nitrogen --sort=alpha") end),
awful.key({ modkey, altkey }, "a", function () exec(terminal .. " -e alsamixer", false) end),
awful.key({ }, "XF86Launch2", function () exec("/home/sunny/bin/spegni", false) end),
--// Volume Control //--
awful.key({ }, "XF86AudioRaiseVolume", function () volumecfg.up() end),
awful.key({ }, "XF86AudioLowerVolume", function () volumecfg.down() end),
awful.key({ }, "XF86AudioMute", function () volumecfg.toggle() end),
--// MPD control //--
awful.key({ modkey }, "XF86AudioPlay", function () exec("/home/sunny/bin/mpd-toggle", false) end),
awful.key({ }, "XF86AudioPlay", function () exec("mpc -q toggle", false) end),
awful.key({ }, "XF86AudioStop", function () exec("mpc -q stop", false) end),
awful.key({ }, "XF86AudioNext", function () exec("mpc -q next", false) end),
awful.key({ }, "XF86AudioPrev", function () exec("mpc -q prev", false) end),
--// Menu //--
awful.key({ modkey }, "Escape", function () mymainmenu:toggle(keymenu_args) end),
awful.key({ altkey }, "Tab", function () awful.menu.menu_keys.down = { "Down", "Alt_L" }
local cmenu = awful.menu.clients({width=245}, keymenu_args ) end)
)
--///
--/// CLIENT KEYS
clientkeys = awful.util.table.join(
-- Kill
awful.key({ modkey }, "c", function (c) c:kill() end),
-- Floating
awful.key({ altkey }, "space", awful.client.floating.toggle ),
-- Swap to master
awful.key({ altkey }, "Return", function (c) c:swap(awful.client.getmaster()) end),
-- Redraw
awful.key({ modkey }, "F1", function (c) c:redraw() end),
-- Fullscreen
awful.key({ modkey }, "F11", function (c) c.fullscreen = not c.fullscreen end),
-- On Top
awful.key({ modkey }, "F5", function (c) c.ontop = not c.ontop end),
-- Remove Titlebars
awful.key({ modkey }, "F3", function (c) if c.titlebar
then awful.titlebar.remove(c)
else awful.titlebar.add(c) end end),
awful.key({ modkey }, "#84", function (c) awful.placement.centered(c) end),
awful.key({ modkey }, "#79", function (c) awful.placement.center_horizontal(c) end),
awful.key({ modkey }, "#87", function (c) awful.placement.center_vertical(c) end),
--// Toggle maximize //
-- Full
awful.key({ altkey }, "#84", function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical end),
-- Vertical
awful.key({ modkey }, "KP_Next", function (c) c.maximized_vertical = not c.maximized_vertical end),
-- Horizontal
awful.key({ modkey }, "KP_Prior", function (c) c.maximized_horizontal = not c.maximized_horizontal end),
--// Move clients (up,down,left,right) //
awful.key({ modkey }, "#80", function (c) awful.client.moveresize( 0,-30, 0, 0) end),
awful.key({ modkey }, "#88", function (c) awful.client.moveresize( 0, 30, 0, 0) end),
awful.key({ modkey }, "#83", function (c) awful.client.moveresize(-30, 0, 0, 0) end),
awful.key({ modkey }, "#85", function (c) awful.client.moveresize( 30, 0, 0, 0) end),
-- To margins (up,down,left,right)
awful.key({modkey,altkey}, "#80", function (c) local g = c:geometry(); g.y = 16; c:geometry(g) end),
awful.key({modkey,altkey}, "#88", function (c)
local g = c:geometry()
local screen_area = screen[c.screen].workarea
g.y = screen_area.y + screen_area.height - g.height
c:geometry(g)
end),
awful.key({modkey,altkey}, "#83", function (c) local g = c:geometry(); g.x= 0; c:geometry(g) end),
awful.key({modkey,altkey}, "#85", function (c)
local g = c:geometry()
local screen_area = screen[c.screen].workarea
g.x = screen_area.x + screen_area.width - g.width
c:geometry(g)
end),
--// Resize clients (up,down,left,right) //
awful.key({ altkey, }, "#80", function (c) awful.client.moveresize( 0, 0, 0,-30) end),
awful.key({ altkey, }, "#88", function (c) awful.client.moveresize( 0, 0, 0, 30) end),
awful.key({ altkey, }, "#83", function (c) awful.client.moveresize( 0, 0,-30, 0 )
awful.palcement.no_offscreen(c) end),
awful.key({ altkey, }, "#85", function (c) awful.client.moveresize( 0, 0, 30, 0 ) end)
)
--///
-- Compute the maximum number of digit we need, limited to 9
keynumber = 5
--[[keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end]]
-- Bind all key numbers to tags.
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,
size_hints_honor = true, },
--[[ callback = awful.titlebar.add]] },
{ rule_any = { class = { "MPlayer", "Gnome-mplayer", "Gpicview", "feh" }, },
properties = { floating = true },
callback = awful.placement.centered },
{ rule = { name = "SmallTerm" },
properties = { floating = true, ontop = true, },},
--[[ { rule = { class = "Chromium-browser" },
properties = { tag = tags[1][2], switchtotag = true,
maximized_horizontal = true,
maximized_vertical = true, }, }, ]]
{ rule = { class = "Gimp" },
properties = { tag = tags[1][5], switchtotag = true,
floating = true, }, },
{ rule = { class = "Tint2" }, properties = { skip_taskbar = true },},
}
-- Signals
client.add_signal("manage", function (c, startup)
awful.client.setslave(c)
if not startup then
-- 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)
--// Set cursor theme //--
exec("xsetroot -cursor_name left_ptr", false)widgets.lua
require("awful")
require("beautiful")
require("vicious")
require("mainmenu")
require("freedesktop.utils")
require("freedesktop.menu")
require("volume")
beautiful.init("/home/sunny/.config/awesome/theme.lua")
-- MainMenu
mymainmenu = myrc.mainmenu.build()
mylauncher = widget({ type = "textbox" })
mylauncher.text = ' <span color="'..beautiful.fg_focus..'" > MENU</span>'
mylauncher:buttons(awful.util.table.join( awful.button({}, 1, nil, function () mymainmenu:toggle(mainmenu_args) end)))
mainmenu_args = { coords={ x=0, y=0 }, keygrabber = true }
desktopmenu_args = { keygrabber = true }
keymenu_args = { coords={ x=200, y=100 }, keygrabber = true }
-- text color
focus_col = '<span color="'..beautiful.fg_focus..'">'
null_col = '</span>'
--/// Start a layoutbox ///
mylayoutbox = {}
--/// Taglist
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
--///
--/// Clock widget ///
datewidget = widget({ type = "textbox" })
vicious.register(datewidget, vicious.widgets.date, '%A %d %B', 10)
--/// CPU widget ///
cpuperc = widget({ type = "textbox" })
cpuperc.width = "50"
cpuperc.align = "left"
vicious.register(cpuperc, vicious.widgets.cpu, 'Cpu '..focus_col..'$1%'..null_col..' ', 1)
--/// Mem Widget ///
memwidget = widget({ type = "textbox" })
memwidget.align = "left"
vicious.register(memwidget, vicious.widgets.mem, 'Mem '..focus_col..'$1%'..null_col..' $2MB', 17)
--/// Battery widget ///
batwidget = widget({ type = "textbox" })
batwidget.align = "left"
vicious.register(batwidget, vicious.widgets.bat, 'Bat '..focus_col..'$2%'..null_col..' $1', 23, "BAT0")
--/// Temp widget ///
tempwidget1 = widget({ type = "textbox" })
tempwidget1.align = "left"
vicious.register(tempwidget1, vicious.widgets.thermal, 'Temp '..focus_col..'$1'..null_col..'', 43, "thermal_zone0")
tempwidget2 = widget({ type = "textbox" })
tempwidget2.align = "left"
vicious.register(tempwidget2, vicious.widgets.thermal, '-'..focus_col..'$1'..null_col..' C°', 43, "thermal_zone1")
--/// Net Widget
netwidget = widget({ type = "textbox" })
netwidget.width = "120"
netwidget.align = "center"
vicious.register(netwidget, vicious.widgets.net,
function (widget, args)
if args["{ppp0 carrier}"] == 1 then
return '(P) Ul '..focus_col..args["{ppp0 up_kb}"]..null_col..' Dl '..focus_col..args["{ppp0 down_kb}"]..null_col..''
else
if args["{wlan0 carrier}"] == 1 then
return '(W) Ul '..focus_col..args["{wlan0 up_kb}"]..null_col..' Dl '..focus_col..args["{wlan0 down_kb}"]..null_col..''
else
return 'Netwok Disabled '
end
end
end, 1)
--///
--/// MPD widget
mpdwidget = widget({ type = "textbox" })
mpdwidget.align = "left"
vicious.register(mpdwidget, vicious.widgets.mpd,
function (widget, args)
if args["{state}"] == "N/A" then return " MPD closed"
else
if args["{state}"] == "Stop" then return " MPD stopped"
else
if args["{state}"] == "Pause" then
return '|| '..focus_col..args["{Title}"]..null_col..' - '..args["{Artist}"]
else
return '> '..focus_col..args["{Title}"]..null_col..' - '..args["{Artist}"]
end
end
end
end, 2)
mpdwidget:buttons(awful.util.table.join(
awful.button({ }, 1, function () exec("mpc toggle") end)))
--///
--/// separator ///
sep = widget({ type = "textbox", align = "center" })
sep.text = '<span color="#444" > :: </span>'
--/// DRAW WIDGETS
for s = 1, screen.count() do
--// Layoutbox //
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)
))
--// Taglist //
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
--// I Wibox
mywibox = {}
mywibox[s] = awful.wibox({ position = "top", height = "16", screen = s })
mywibox[s].widgets = {
{
-- mylauncher, sep,
sep,
mytaglist[s], sep,
cpuperc, sep,
memwidget, sep,
tempwidget1, tempwidget2, sep,
batwidget, sep,
netwidget, sep,
volumetext, sep,
mpdwidget,
layout = awful.widget.layout.horizontal.leftright
},
mylayoutbox[s], sep,
datewidget, sep,
layout = awful.widget.layout.horizontal.rightleft
}
--mywibox[s].border_width = "1"
--mywibox[s].border_color = beautiful.fg_focus
--mywibox[s].width = "1364"
--//
end
--///volume.lua
require("awful")
require("beautiful")
beautiful.init("/home/sunny/.config/awesome/theme.lua")
--/// Volume Config and widget
volumecfg = {}
volumecfg.cardid = 0
volumecfg.channel = "Master"
volumetext = widget({ type = "textbox", name = "volumetext", align = "right" })
volumetext.align = "center"
-- 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 = "MUTE"
end
volumetext.text = 'Vol <span color="'..beautiful.fg_focus..'">'..volume..'</span>'
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
volumetext:buttons(awful.util.table.join(
awful.button({ }, 4, function () volumecfg.up() end),
awful.button({ }, 5, function () volumecfg.down() end),
awful.button({ }, 1, function () volumecfg.toggle() end),
awful.button({ }, 3, function () exec(terminal .. " -e alsamixer") end)))
volumecfg.update()
volumetimer = timer({ timeout = 30 })
volumetimer:add_signal( "timeout", function() volumecfg.update() end)
volumetimer:start()
--///theme.lua
--// Main
theme = {}
theme.wallpaper_cmd = { " " }
--//
--/// Styles
theme.font = "glisp 8"
--themedir2 = "~/.config/awesome/themes/buttons"
themedir = "~/.config/awesome/themes"
--// Colors
theme.fg_normal = "#888888"
theme.fg_focus = "#ffffff"
theme.fg_urgent = "#000000"
theme.bg_normal = "#060606d9"
theme.bg_focus = "#000000d9"
theme.bg_urgent = "#ffc0c0"
--//
--// Borders
theme.border_width = "2"
theme.border_normal = "#282828"
theme.border_focus = theme.fg_focus
theme.border_marked = "#000000"
--//
--// Titlebars
theme.titlebar_fg_normal = "#808080"
theme.titlebar_fg_focus = "#ffffff"
theme.titlebar_bg_normal = "#363636ff"
theme.titlebar_bg_focus = "#000000ff"
theme.titlebar_font = theme.font or "cure 8"
--//
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
-- titlebar_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- Example:
theme.taglist_bg_focus = "#121212"
theme.taglist_fg_focus = "#f0f0f0"
theme.tasklist_bg_focus = theme.bg_normal
--////
--// Mouse finder
theme.mouse_finder_color = "#CC9393"
-- mouse_finder_[timeout|animate_timeout|radius|factor]
--//
--// Menu
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_bg_normal = "#101010ff"
theme.menu_bg_focus = "#101010ff"
theme.menu_fg_normal = theme.fg_normal
theme.menu_fg_focus = theme.fg_focus
theme.menu_border_width = "0"
theme.menu_height = "18"
theme.menu_width = "120"
--//
--//// Icons
--// Taglist
theme.taglist_squares_sel = themedir .."/taglist/squarefz.png"
theme.taglist_squares_unsel = themedir .."/taglist/squarez.png"
theme.taglist_squares_resize = "true"
--//
--// Misc
--theme.awesome_icon = themedir .."/awesome-icon.png"
--theme.menu_submenu_icon = "~/.config/awesome/themes/default/submenu.png"
--theme.tasklist_floating_icon = "~/.config/awesome/themes/default/tasklist/floatingw.png"
--//
--// Layout
theme.layout_tile = themedir .."/layouts/tile.png"
theme.layout_tileleft = themedir .."/layouts/tileleft.png"
theme.layout_tilebottom = themedir .."/layouts/tilebottom.png"
theme.layout_tiletop = themedir .."/layouts/tiletop.png"
theme.layout_fairv = themedir .."/layouts/fairv.png"
theme.layout_fairh = themedir .."/layouts/fairh.png"
theme.layout_spiral = themedir .."/layouts/spiral.png"
theme.layout_dwindle = themedir .."/layouts/dwindle.png"
theme.layout_max = themedir .."/layouts/max.png"
theme.layout_fullscreen = themedir .."/layouts/fullscreen.png"
theme.layout_magnifier = themedir .."/layouts/magnifier.png"
theme.layout_floating = themedir .."/layouts/floating.png"
--//
--// Titlebar
--[[theme.titlebar_close_button_focus = themedir .."/close-focused.png"
theme.titlebar_close_button_normal = themedir .."/close-unfocused.png"
theme.titlebar_maximized_button_focus_active = themedir .."/maximize-focused.png"
theme.titlebar_maximized_button_normal_active = themedir .."/maximize-unfocused.png"
theme.titlebar_maximized_button_focus_inactive = themedir .."/maximize-focused.png"
theme.titlebar_maximized_button_normal_inactive = themedir .."/maximize-unfocused.png"]]
--//
--////
return thememainmenu.lua
local awful = require("awful")
local beautiful = require("beautiful")
local freedesktop_utils = require("freedesktop.utils")
local freedesktop_menu = require("freedesktop.menu")
--local themes = require("myrc.themes")
local io = io
local table = table
local awesome = awesome
local ipairs = ipairs
local os = os
local string = string
local mouse = mouse
local lookup_icon = freedesktop_utils.lookup_icon
module("myrc.mainmenu")
local env = {}
-- Reserved.
function init(enviroment)
env = enviroment
end
-- Creates main menu
-- Note: Uses beautiful.icon_theme and beautiful.icon_theme_size
-- env - table with string constants - command line to different apps
function build()
local terminal = "urxvtc "
local man = "urxvtc -e man "
local editor = "urxvtc -e vim "
local browser = "chromium-browser "
local run = "gmrun "
local fileman = "pcmanfm "
local xkill = env.xkill or "xkill" .. " "
local shutdown = "/home/sunny/bin/gui-logout"
local opera = "opera"
local torrent = "transmission"
local mediaplayer = "gnome-mplayer"
local messenger = "pidgin"
-- freedesktop_utils.terminal = terminal
-- freedesktop_utils.icon_theme = beautiful.icon_theme
-- freedesktop_utils.icon_sizes = {beautiful.icon_theme_size}
local myawesomemenu = {
{ "Edit config", editor .. awful.util.getdir("config") .. "/rc.lua"},
{ "Edit theme", editor .. awful.util.getdir("config") .. "/theme.lua" },
{ "Edit widgets", editor .. awful.util.getdir("config") .. "/widgets.lua" },
{ "Edit main menu", editor .. awful.util.getdir("config") .. "/mainmenu.lua" },
{ "Restart", awesome.restart },
{ "Stop", awesome.quit }
}
local appmenu_items = {}
for _, item in ipairs(freedesktop_menu.new()) do table.insert(appmenu_items, item) end
local mymainmenu_items = {
{ "Run", run, lookup_icon({ icon = 'gnome-run'}) },
{ "Terminal", terminal, lookup_icon({ icon = 'utilities-terminal' }) },
{ "File Manager", fileman, lookup_icon({ icon = 'file-manager' }) },
{ "Chromium", browser, lookup_icon({ icon = 'chromium-browser' }) },
{ "Opera", opera, lookup_icon({ icon = 'opera' }) },
{ "Torrents", torrent, lookup_icon({ icon = 'transmission' }) },
{ "Pidgin", messenger, lookup_icon({ icon = 'pidgin' }) },
{ " ", nil, nil}, --separator
{ "Applications", appmenu_items, lookup_icon({ icon = "start-here" }) },
{ " ", nil, nil}, --separator
{ "Awesome", myawesomemenu, lookup_icon({ icon = "gnome-klotski" }) },
{ "Quit", shutdown, lookup_icon({ icon = 'gnome-shutdown' }) }
}
--[[ local mymainmenu_items_tail = {
{ " ", nil, nil}, --separator
-- { "Xkill", xkill },
-- { "Run", run },
{ "Quit", shutdown, lookup_icon({ icon = 'gnome-shutdown' }) },
}]]
-- local mymainmenu_items = {}
-- for _, item in ipairs(mymainmenu_items_head) do table.insert(mymainmenu_items, item) end
-- for _, item in ipairs(freedesktop_menu.new()) do table.insert(mymainmenu_items, item) end
-- for _, item in ipairs(mymainmenu_items_tail) do table.insert(mymainmenu_items, item) end
-- return awful.menu({ items = mymainmenu_items, x = 0, y = 0})
return awful.menu({ items = mymainmenu_items })
endthen there other file for building the freedesktop menu
"I'd rather run Linux on a 6.5KHz machine through an ARM emulator than run Vista"
Offline
@sunjack: nice! I like that modular approach...maybe I'll get me some modules up in here.

Punch all your friends.
Offline
Hey Guys, post some screenshots !!! 
My Fluidr (= Fickr) : http://www.fluidr.com/photos/kookadimi/sets
Offline
Offline
Offline
Did you know how to remove "icons" in the taskbar (just keep text) ? I follow the tips of the Awesome Wiki, but it was no up-to-date and nothing works 
just some fews modifications for me ...
Last edited by Kookaburra (2011-03-05 11:50:58)
My Fluidr (= Fickr) : http://www.fluidr.com/photos/kookadimi/sets
Offline
Did you know how to remove "icons" in the taskbar (just keep text) ? I follow the tips of the Awesome Wiki, but it was no up-to-date and nothing works
just some fews modifications for me ...
Have you tried to modify /usr/share/awesome/lib/awful/taskbar.lua ?
Last edited by SuNjACk (2011-03-05 16:11:09)
"I'd rather run Linux on a 6.5KHz machine through an ARM emulator than run Vista"
Offline
[
Have you tried to modify /usr/share/awesome/lib/awful/taskbar.lua ?
No, because I don't want to break something ... I have no idea to what I have to change for it ??? 
The "tasklist.lua" :
---------------------------------------------------------------------------
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2008-2009 Julien Danjou
-- @release v3.4.9
---------------------------------------------------------------------------
-- Grab environment we need
local capi = { screen = screen,
image = image,
client = client }
local ipairs = ipairs
local type = type
local setmetatable = setmetatable
local table = table
local common = require("awful.widget.common")
local beautiful = require("beautiful")
local client = require("awful.client")
local util = require("awful.util")
local tag = require("awful.tag")
local layout = require("awful.widget.layout")
--- Tasklist widget module for awful
module("awful.widget.tasklist")
-- Public structures
label = {}
local function tasklist_update(w, buttons, label, data, widgets)
local clients = capi.client.get()
local shownclients = {}
for k, c in ipairs(clients) do
if not (c.skip_taskbar or c.hidden
or c.type == "splash" or c.type == "dock" or c.type == "desktop") then
table.insert(shownclients, c)
end
end
clients = shownclients
common.list_update(w, buttons, label, data, widgets, clients)
end
--- Create a new tasklist widget.
-- @param label Label function to use.
-- @param buttons A table with buttons binding to set.
function new(label, buttons)
local w = {
layout = layout.horizontal.flex
}
local widgets = { }
widgets.imagebox = { }
widgets.textbox = { margin = { left = 2,
right = 2 },
bg_resize = true,
bg_align = "right"
}
local data = setmetatable({}, { __mode = 'kv' })
local u = function () tasklist_update(w, buttons, label, data, widgets) end
for s = 1, capi.screen.count() do
tag.attached_add_signal(s, "property::selected", u)
capi.screen[s]:add_signal("tag::attach", u)
capi.screen[s]:add_signal("tag::detach", u)
end
capi.client.add_signal("new", function (c)
c:add_signal("property::urgent", u)
c:add_signal("property::floating", u)
c:add_signal("property::maximized_horizontal", u)
c:add_signal("property::maximized_vertical", u)
c:add_signal("property::name", u)
c:add_signal("property::icon_name", u)
c:add_signal("property::icon", u)
c:add_signal("property::skip_taskbar", u)
c:add_signal("property::hidden", u)
c:add_signal("tagged", u)
c:add_signal("untagged", u)
end)
capi.client.add_signal("unmanage", u)
capi.client.add_signal("list", u)
capi.client.add_signal("focus", u)
capi.client.add_signal("unfocus", u)
u()
return w
end
local function widget_tasklist_label_common(c, args)
if not args then args = {} end
local theme = beautiful.get()
local fg_focus = args.fg_focus or theme.tasklist_fg_focus or theme.fg_focus
local bg_focus = args.bg_focus or theme.tasklist_bg_focus or theme.bg_focus
local fg_urgent = args.fg_urgent or theme.tasklist_fg_urgent or theme.fg_urgent
local bg_urgent = args.bg_urgent or theme.tasklist_bg_urgent or theme.bg_urgent
local fg_minimize = args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize
local bg_minimize = args.bg_minimize or theme.tasklist_bg_minimize or theme.bg_minimize
local floating_icon = args.floating_icon or theme.tasklist_floating_icon
local font = args.font or theme.tasklist_font or theme.font or ""
local bg = nil
local text = "<span font_desc='"..font.."'>"
local name
local status_image
if client.floating.get(c) and floating_icon then
status_image = capi.image(floating_icon)
end
if c.minimized then
name = util.escape(c.icon_name) or util.escape(c.name) or util.escape("<untitled>")
else
name = util.escape(c.name) or util.escape("<untitled>")
end
if capi.client.focus == c then
bg = bg_focus
if fg_focus then
text = text .. "<span color='"..util.color_strip_alpha(fg_focus).."'>"..name.."</span>"
else
text = text .. name
end
elseif c.urgent and fg_urgent then
bg = bg_urgent
text = text .. "<span color='"..util.color_strip_alpha(fg_urgent).."'>"..name.."</span>"
elseif c.minimized and fg_minimize and bg_minimize then
bg = bg_minimize
text = text .. "<span color='"..util.color_strip_alpha(fg_minimize).."'>"..name.."</span>"
else
text = text .. name
end
text = text .. "</span>"
return text, bg, status_image, c.icon
end
--- Return labels for a tasklist widget with clients from all tags and screen.
-- It returns the client name and set a special
-- foreground and background color for focused client.
-- It also puts a special icon for floating windows.
-- @param c The client.
-- @param screen The screen we are drawing on.
-- @param args The arguments table.
-- bg_focus The background color for focused client.
-- fg_focus The foreground color for focused client.
-- bg_urgent The background color for urgent clients.
-- fg_urgent The foreground color for urgent clients.
-- @return A string to print, a background color and a status image.
function label.allscreen(c, screen, args)
return widget_tasklist_label_common(c, args)
end
--- Return labels for a tasklist widget with clients from all tags.
-- It returns the client name and set a special
-- foreground and background color for focused client.
-- It also puts a special icon for floating windows.
-- @param c The client.
-- @param screen The screen we are drawing on.
-- @param args The arguments table.
-- bg_focus The background color for focused client.
-- fg_focus The foreground color for focused client.
-- bg_urgent The background color for urgent clients.
-- fg_urgent The foreground color for urgent clients.
-- @return A string to print, a background color and a status image.
function label.alltags(c, screen, args)
-- Only print client on the same screen as this widget
if c.screen ~= screen then return end
return widget_tasklist_label_common(c, args)
end
--- Return labels for a tasklist widget with clients from currently selected tags.
-- It returns the client name and set a special
-- foreground and background color for focused client.
-- It also puts a special icon for floating windows.
-- @param c The client.
-- @param screen The screen we are drawing on.
-- @param args The arguments table.
-- bg_focus The background color for focused client.
-- fg_focus The foreground color for focused client.
-- bg_urgent The background color for urgent clients.
-- fg_urgent The foreground color for urgent clients.
-- @return A string to print, a background color and a status image.
function label.currenttags(c, screen, args)
-- Only print client on the same screen as this widget
if c.screen ~= screen then return end
-- Include sticky client too
if c.sticky then return widget_tasklist_label_common(c, args) end
for k, t in ipairs(capi.screen[screen]:tags()) do
if t.selected then
local ctags = c:tags()
for _, v in ipairs(ctags) do
if v == t then
return widget_tasklist_label_common(c, args)
end
end
end
end
end
--- Return label for only the currently focused client.
-- It returns the client name and set a special
-- foreground and background color for focused client.
-- It also puts a special icon for floating windows.
-- @param c The client.
-- @param screen The screen we are drawing on.
-- @param args The arguments table.
-- bg_focus The background color for focused client.
-- fg_focus The foreground color for focused client.
-- bg_urgent The background color for urgent clients.
-- fg_urgent The foreground color for urgent clients.
-- @return A string to print, a background color and a status image.
function label.focused(c, screen, args)
-- Only print client on the same screen as this widget
if c.screen == screen and capi.client.focus == c then
return widget_tasklist_label_common(c, args)
end
end
setmetatable(_M, { __call = function(_, ...) return new(...) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80Some could help me ? 
My Fluidr (= Fickr) : http://www.fluidr.com/photos/kookadimi/sets
Offline
Umm, is this what you want to see on your tasklist? Text only, without apps icons?
if you do,well this is might be not the best option, but at least it work for me.
All i do is just remove the c.icon from this line on the tasklist.lua.
on the line no. 124,
originally, it would be look like this:
return text, bg, status_image, c.iconto this:
return text, bg, status_imageit works for me, so i think it would works on yours too.
Hope this help.
Oh, almost forgot, i'm still using Awesome v.3.4.6 , but i think the syntax is similar with Awesome v.3.4.9.
Last edited by muzieca (2011-03-05 18:23:04)
Motorbike, Openbox, and Coffee addict.
--muzi--
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.