diff --git a/#rc.lua# b/#rc.lua# new file mode 100644 index 0000000..58c628f --- /dev/null +++ b/#rc.lua# @@ -0,0 +1,500 @@ +-- Standard awesome library +require("awful") +require("awful.autofocus") +require("awful.rules") + +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("obvious") +--obvious +require("obvious.popup_run_prompt") +require("obvious.battery") +require("obvious.wlan") +require("obvious.clock") +require("obvious.volume_alsa") +require("obvious.net") + +require("vicious") +-- Load Debian menu entries +require("debian.menu") + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua") + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "sh /home/guerre/lock" +xterm="xterm" +firefoxbeta="sh /home/guerre/Descargas/firefox/firefox" +start="sh /home/guerre/.awesomestart" +--brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +--brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" + +-- 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.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 +-- Define a tag table which hold all screen tags. + +-- ************************************** +-- {{{ Tags +-- Define a tag table which hold all screen tags. +tags = {} +tags.settings = { + { name = "xterm's", layout = layouts[5] }, + { name = "www", layout = layouts[9] }, + { name = "im", layout = layouts[1] }, + { name = "irc", layout = layouts[1] }, + { name = "media", layout = layouts[12] }, + { name = "work", layout = layouts[3] }, + { name = "docs", layout = layouts[3] }, + { name = "prog", layout = layouts[3] }, + { name = "sys", layout = layouts[1] } +} + +for s = 1, screen.count() do + tags[s] = {} + for i, v in ipairs(tags.settings) do + tags[s][i] = tag({ name = v.name }) + tags[s][i].screen = s + awful.tag.setproperty(tags[s][i], "layout", v.layout) + end + tags[s][1].selected = true +end +-- }}} + +-- Initialize widget +memwidget = awful.widget.progressbar() +-- Progressbar properties +memwidget:set_width(8) +memwidget:set_height(10) +memwidget:set_vertical(true) +memwidget:set_background_color("#494B4F") +memwidget:set_border_color(nil) +memwidget:set_color("#AECF96") +memwidget:set_gradient_colors({ "#AECF96", "#88A175", "#FF5656" }) +-- Register widget +vicious.register(memwidget, vicious.widgets.mem, "$1", 13) + +-- {{{ 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 = {} +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 }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { + { + mylauncher, + mytaglist[s], + mypromptbox[s], + volicon, + spacer, + batterywidget, + baticon, + spacer, + memwidget, + spacer, + memicon, + --obvious.battery(), + --obvious.volume_alsa(), + layout = awful.widget.layout.horizontal.leftright + }, + mylayoutbox[s], + obvious.battery(), + --obvious.volume_alsa(), + mytextclock, + s == 1 and mysystray or nil, + mytasklist[s], + layout = awful.widget.layout.horizontal.rightleft + } +end +-- }}} + +-- {{{ Battery state +-- Widget icon +baticon = widget({ type = "imagebox", name = "baticon" }) + +-- Initialize widget +batterywidget = widget({type = "textbox", name = "batterywidget", align = "right" }) +function batteryInfo(adapter) + spacer = " " + local fcur = io.open("/sys/class/power_supply/"..adapter.."/charge_now") + local fcap = io.open("/sys/class/power_supply/"..adapter.."/charge_full") + local fsta = io.open("/sys/class/power_supply/"..adapter.."/status") + local cur = fcur:read() + local cap = fcap:read() + local sta = fsta:read() + local battery = math.floor(cur * 100 / cap) + if sta:match("Charging") then + baticon.image=image(confdir.."/icons/power-ac.png") + elseif sta:match("Discharging") then + baticon.image=image(confdir.."/icons/power-bat.png") + if tonumber(battery) > 25 and tonumber(battery) < 75 then + --battery = battery + elseif tonumber(battery) < 25 then + if tonumber(battery) < 10 then + naughty.notify({ title = "Battery Warning" + , text = "Battery low!"..spacer..battery.."%"..spacer.."left!" + , timeout = 5 + , position = "top_right" + , fg = beautiful.fg_focus + , bg = beautiful.bg_focus + }) + end + --battery = battery + else + --battery = battery + end + else + baticon.image=image(confdir.."/icons/power-ac.png") + --battery = "A/C" + end + battery = battery + batterywidget.text = spacer..battery.."%"..spacer + fcur:close() + fcap:close() + fsta:close() +end +-- }}} + +-- {{{ Volume state +-- Widget +volicon = widget({ type = "imagebox", name = "volicon" }) +-- Register widget +vicious.register(volicon, vicious.widgets.volumecontrol, + function (widget, args) + if args[1] == "mute" then + volicon.image=image(confdir.."/icons/vol-mute.png") + elseif args[1] == "hi" then + volicon.image=image(confdir.."/icons/vol-hi.png") + elseif args[1] == "med" then + volicon.image=image(confdir.."/icons/vol-med.png") + else + volicon.image = image(confdir.."/icons/vol-low.png") + end + end, + 1, "Master") + + +-- {{{ 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(true) end), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + -- awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({ modkey, }, "t", function () awful.util.spawn(xterm) end), + awful.key({ modkey }, "i", function () awful.util.spawn(firefoxbeta) end), + awful.key({ modkey }, "o", function () awful.util.spawn(start) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful$ + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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, }, "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 = "Navigator" }, + properties = { tag = tags[1][2] } }, + { rule = { class = "VirtualBox" }, + properties = { tag = tags[1][9] } }, + { rule = { class = "pidgin" }, + properties = { tag = tags[1][3] } }, + { rule = { class = "emesene" }, + properties = { tag = tags[1][3] } }, + { rule = { class = "Controler.py" }, + properties = { tag = tags[1][3] } }, + +} +-- }}} + +-- {{{ 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) +-- }}} diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/icons/LICENSE b/icons/LICENSE new file mode 100644 index 0000000..ce5da9d --- /dev/null +++ b/icons/LICENSE @@ -0,0 +1,12 @@ +All 'awesome' icons in this package were created by Adrian C. (anrxc). +They are licensed under the same terms as the awesome distribution itself +- GNU General Public License version 2. To view a human-readable summary +of this license, visit: http://creativecommons.org/licenses/GPL/2.0/ + +The widget icons with the exception of: 'chat', 'crypt', 'power' and +'rss' icons (which were made by me) were originally made by 'sm4tik' +for purposes of 'dzen', I could not find any licensing information +attached to those original bitmaps. Assuming they are in the public +domain I am licensing the widget icons under the terms of the +Creative Commons Attribution-Share Alike license. To view a copy of +this license, visit: http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/icons/awesome.png b/icons/awesome.png new file mode 100644 index 0000000..44697e6 Binary files /dev/null and b/icons/awesome.png differ diff --git a/icons/bat.png b/icons/bat.png new file mode 100644 index 0000000..37081f5 Binary files /dev/null and b/icons/bat.png differ diff --git a/icons/cal.png b/icons/cal.png new file mode 100644 index 0000000..fdb2701 Binary files /dev/null and b/icons/cal.png differ diff --git a/icons/chat.png b/icons/chat.png new file mode 100644 index 0000000..5dd010e Binary files /dev/null and b/icons/chat.png differ diff --git a/icons/cpu.png b/icons/cpu.png new file mode 100644 index 0000000..b80080c Binary files /dev/null and b/icons/cpu.png differ diff --git a/icons/crypto.png b/icons/crypto.png new file mode 100644 index 0000000..20f0313 Binary files /dev/null and b/icons/crypto.png differ diff --git a/icons/disk.png b/icons/disk.png new file mode 100644 index 0000000..db9a6fe Binary files /dev/null and b/icons/disk.png differ diff --git a/icons/down.png b/icons/down.png new file mode 100644 index 0000000..53c2d89 Binary files /dev/null and b/icons/down.png differ diff --git a/icons/info.png b/icons/info.png new file mode 100644 index 0000000..fd54609 Binary files /dev/null and b/icons/info.png differ diff --git a/icons/layouts/copia de dwindle.png b/icons/layouts/copia de dwindle.png new file mode 100644 index 0000000..55fdca8 Binary files /dev/null and b/icons/layouts/copia de dwindle.png differ diff --git a/icons/layouts/copia de fairh.png b/icons/layouts/copia de fairh.png new file mode 100644 index 0000000..0333710 Binary files /dev/null and b/icons/layouts/copia de fairh.png differ diff --git a/icons/layouts/copia de fairv.png b/icons/layouts/copia de fairv.png new file mode 100644 index 0000000..65f0e59 Binary files /dev/null and b/icons/layouts/copia de fairv.png differ diff --git a/icons/layouts/copia de floating.png b/icons/layouts/copia de floating.png new file mode 100644 index 0000000..e4543ac Binary files /dev/null and b/icons/layouts/copia de floating.png differ diff --git a/icons/layouts/copia de fullscreen.png b/icons/layouts/copia de fullscreen.png new file mode 100644 index 0000000..3bf6329 Binary files /dev/null and b/icons/layouts/copia de fullscreen.png differ diff --git a/icons/layouts/copia de magnifier.png b/icons/layouts/copia de magnifier.png new file mode 100644 index 0000000..71e0a31 Binary files /dev/null and b/icons/layouts/copia de magnifier.png differ diff --git a/icons/layouts/copia de max.png b/icons/layouts/copia de max.png new file mode 100644 index 0000000..4111cec Binary files /dev/null and b/icons/layouts/copia de max.png differ diff --git a/icons/layouts/copia de spiral.png b/icons/layouts/copia de spiral.png new file mode 100644 index 0000000..2f266d4 Binary files /dev/null and b/icons/layouts/copia de spiral.png differ diff --git a/icons/layouts/copia de tile.png b/icons/layouts/copia de tile.png new file mode 100644 index 0000000..a098c34 Binary files /dev/null and b/icons/layouts/copia de tile.png differ diff --git a/icons/layouts/copia de tilebottom.png b/icons/layouts/copia de tilebottom.png new file mode 100644 index 0000000..d1f4dab Binary files /dev/null and b/icons/layouts/copia de tilebottom.png differ diff --git a/icons/layouts/copia de tileleft.png b/icons/layouts/copia de tileleft.png new file mode 100644 index 0000000..74fe702 Binary files /dev/null and b/icons/layouts/copia de tileleft.png differ diff --git a/icons/layouts/copia de tiletop.png b/icons/layouts/copia de tiletop.png new file mode 100644 index 0000000..b69f0bb Binary files /dev/null and b/icons/layouts/copia de tiletop.png differ diff --git a/icons/layouts/dwindle.png b/icons/layouts/dwindle.png new file mode 100644 index 0000000..55fdca8 Binary files /dev/null and b/icons/layouts/dwindle.png differ diff --git a/icons/layouts/fairh.png b/icons/layouts/fairh.png new file mode 100644 index 0000000..0333710 Binary files /dev/null and b/icons/layouts/fairh.png differ diff --git a/icons/layouts/fairv.png b/icons/layouts/fairv.png new file mode 100644 index 0000000..65f0e59 Binary files /dev/null and b/icons/layouts/fairv.png differ diff --git a/icons/layouts/floating.png b/icons/layouts/floating.png new file mode 100644 index 0000000..e4543ac Binary files /dev/null and b/icons/layouts/floating.png differ diff --git a/icons/layouts/fullscreen.png b/icons/layouts/fullscreen.png new file mode 100644 index 0000000..3bf6329 Binary files /dev/null and b/icons/layouts/fullscreen.png differ diff --git a/icons/layouts/magnifier.png b/icons/layouts/magnifier.png new file mode 100644 index 0000000..71e0a31 Binary files /dev/null and b/icons/layouts/magnifier.png differ diff --git a/icons/layouts/max.png b/icons/layouts/max.png new file mode 100644 index 0000000..4111cec Binary files /dev/null and b/icons/layouts/max.png differ diff --git a/icons/layouts/spiral.png b/icons/layouts/spiral.png new file mode 100644 index 0000000..2f266d4 Binary files /dev/null and b/icons/layouts/spiral.png differ diff --git a/icons/layouts/tile.png b/icons/layouts/tile.png new file mode 100644 index 0000000..a098c34 Binary files /dev/null and b/icons/layouts/tile.png differ diff --git a/icons/layouts/tilebottom.png b/icons/layouts/tilebottom.png new file mode 100644 index 0000000..d1f4dab Binary files /dev/null and b/icons/layouts/tilebottom.png differ diff --git a/icons/layouts/tileleft.png b/icons/layouts/tileleft.png new file mode 100644 index 0000000..74fe702 Binary files /dev/null and b/icons/layouts/tileleft.png differ diff --git a/icons/layouts/tiletop.png b/icons/layouts/tiletop.png new file mode 100644 index 0000000..b69f0bb Binary files /dev/null and b/icons/layouts/tiletop.png differ diff --git a/icons/mail.png b/icons/mail.png new file mode 100644 index 0000000..56989f0 Binary files /dev/null and b/icons/mail.png differ diff --git a/icons/mem.png b/icons/mem.png new file mode 100644 index 0000000..16adb2f Binary files /dev/null and b/icons/mem.png differ diff --git a/icons/music.png b/icons/music.png new file mode 100644 index 0000000..4c2764d Binary files /dev/null and b/icons/music.png differ diff --git a/icons/pacman.png b/icons/pacman.png new file mode 100644 index 0000000..466c34f Binary files /dev/null and b/icons/pacman.png differ diff --git a/icons/phones.png b/icons/phones.png new file mode 100644 index 0000000..8b6c26a Binary files /dev/null and b/icons/phones.png differ diff --git a/icons/power-bat-high.png b/icons/power-bat-high.png new file mode 100644 index 0000000..37081f5 Binary files /dev/null and b/icons/power-bat-high.png differ diff --git a/icons/power.png b/icons/power.png new file mode 100644 index 0000000..b8add29 Binary files /dev/null and b/icons/power.png differ diff --git a/icons/rss.png b/icons/rss.png new file mode 100644 index 0000000..62d361e Binary files /dev/null and b/icons/rss.png differ diff --git a/icons/sat.png b/icons/sat.png new file mode 100644 index 0000000..485f36e Binary files /dev/null and b/icons/sat.png differ diff --git a/icons/sun.png b/icons/sun.png new file mode 100644 index 0000000..2f22c8e Binary files /dev/null and b/icons/sun.png differ diff --git a/icons/taglist/squarefz.png b/icons/taglist/squarefz.png new file mode 100644 index 0000000..f0c1912 Binary files /dev/null and b/icons/taglist/squarefz.png differ diff --git a/icons/taglist/squarefza.png b/icons/taglist/squarefza.png new file mode 100644 index 0000000..012383e Binary files /dev/null and b/icons/taglist/squarefza.png differ diff --git a/icons/taglist/squarez.png b/icons/taglist/squarez.png new file mode 100644 index 0000000..3b8ba81 Binary files /dev/null and b/icons/taglist/squarez.png differ diff --git a/icons/taglist/squareza.png b/icons/taglist/squareza.png new file mode 100644 index 0000000..94736d4 Binary files /dev/null and b/icons/taglist/squareza.png differ diff --git a/icons/temp.png b/icons/temp.png new file mode 100644 index 0000000..2e712e9 Binary files /dev/null and b/icons/temp.png differ diff --git a/icons/time.png b/icons/time.png new file mode 100644 index 0000000..3fb987d Binary files /dev/null and b/icons/time.png differ diff --git a/icons/titlebar/close_focus.png b/icons/titlebar/close_focus.png new file mode 100644 index 0000000..6b037ed Binary files /dev/null and b/icons/titlebar/close_focus.png differ diff --git a/icons/titlebar/close_normal.png b/icons/titlebar/close_normal.png new file mode 100644 index 0000000..66ecf40 Binary files /dev/null and b/icons/titlebar/close_normal.png differ diff --git a/icons/titlebar/floating_focus_active.png b/icons/titlebar/floating_focus_active.png new file mode 100644 index 0000000..cd367c1 Binary files /dev/null and b/icons/titlebar/floating_focus_active.png differ diff --git a/icons/titlebar/floating_focus_inactive.png b/icons/titlebar/floating_focus_inactive.png new file mode 100644 index 0000000..2ae6e94 Binary files /dev/null and b/icons/titlebar/floating_focus_inactive.png differ diff --git a/icons/titlebar/floating_normal_active.png b/icons/titlebar/floating_normal_active.png new file mode 100644 index 0000000..3d17780 Binary files /dev/null and b/icons/titlebar/floating_normal_active.png differ diff --git a/icons/titlebar/floating_normal_inactive.png b/icons/titlebar/floating_normal_inactive.png new file mode 100644 index 0000000..3faa1a3 Binary files /dev/null and b/icons/titlebar/floating_normal_inactive.png differ diff --git a/icons/titlebar/maximized_focus_active.png b/icons/titlebar/maximized_focus_active.png new file mode 100644 index 0000000..6b235a5 Binary files /dev/null and b/icons/titlebar/maximized_focus_active.png differ diff --git a/icons/titlebar/maximized_focus_inactive.png b/icons/titlebar/maximized_focus_inactive.png new file mode 100644 index 0000000..53d914b Binary files /dev/null and b/icons/titlebar/maximized_focus_inactive.png differ diff --git a/icons/titlebar/maximized_normal_active.png b/icons/titlebar/maximized_normal_active.png new file mode 100644 index 0000000..dc59180 Binary files /dev/null and b/icons/titlebar/maximized_normal_active.png differ diff --git a/icons/titlebar/maximized_normal_inactive.png b/icons/titlebar/maximized_normal_inactive.png new file mode 100644 index 0000000..7dc97ee Binary files /dev/null and b/icons/titlebar/maximized_normal_inactive.png differ diff --git a/icons/titlebar/ontop_focus_active.png b/icons/titlebar/ontop_focus_active.png new file mode 100644 index 0000000..16b44d5 Binary files /dev/null and b/icons/titlebar/ontop_focus_active.png differ diff --git a/icons/titlebar/ontop_focus_inactive.png b/icons/titlebar/ontop_focus_inactive.png new file mode 100644 index 0000000..219d3ca Binary files /dev/null and b/icons/titlebar/ontop_focus_inactive.png differ diff --git a/icons/titlebar/ontop_normal_active.png b/icons/titlebar/ontop_normal_active.png new file mode 100644 index 0000000..ba39ce8 Binary files /dev/null and b/icons/titlebar/ontop_normal_active.png differ diff --git a/icons/titlebar/ontop_normal_inactive.png b/icons/titlebar/ontop_normal_inactive.png new file mode 100644 index 0000000..2d0de52 Binary files /dev/null and b/icons/titlebar/ontop_normal_inactive.png differ diff --git a/icons/titlebar/sticky_focus_active.png b/icons/titlebar/sticky_focus_active.png new file mode 100644 index 0000000..3e897c7 Binary files /dev/null and b/icons/titlebar/sticky_focus_active.png differ diff --git a/icons/titlebar/sticky_focus_inactive.png b/icons/titlebar/sticky_focus_inactive.png new file mode 100644 index 0000000..04f425c Binary files /dev/null and b/icons/titlebar/sticky_focus_inactive.png differ diff --git a/icons/titlebar/sticky_normal_active.png b/icons/titlebar/sticky_normal_active.png new file mode 100644 index 0000000..3e6b39f Binary files /dev/null and b/icons/titlebar/sticky_normal_active.png differ diff --git a/icons/titlebar/sticky_normal_inactive.png b/icons/titlebar/sticky_normal_inactive.png new file mode 100644 index 0000000..c7b96a5 Binary files /dev/null and b/icons/titlebar/sticky_normal_inactive.png differ diff --git a/icons/up.png b/icons/up.png new file mode 100644 index 0000000..e79b296 Binary files /dev/null and b/icons/up.png differ diff --git a/icons/vol.png b/icons/vol.png new file mode 100644 index 0000000..31b396f Binary files /dev/null and b/icons/vol.png differ diff --git a/icons/wifi.png b/icons/wifi.png new file mode 100644 index 0000000..d3db077 Binary files /dev/null and b/icons/wifi.png differ diff --git a/obvious b/obvious new file mode 160000 index 0000000..71cf36f --- /dev/null +++ b/obvious @@ -0,0 +1 @@ +Subproject commit 71cf36fa106523a2a03d4c7906a00d3637836a21 diff --git a/osk.lua b/osk.lua new file mode 100644 index 0000000..d4f5bf4 --- /dev/null +++ b/osk.lua @@ -0,0 +1,90 @@ +---------------------------------------------------- +-- On Screen Keyboard for the awesome window manager +---------------------------------------------------- +-- Coded by: farhaven +-- Hacked by: Adrian C. +-- Licensed under the WTFPL version 2 +-- * http://sam.zoy.org/wtfpl/COPYING +---------------------------------------------------- +-- To use this module add: +-- require("osk") +-- to your rc.lua, and call it from a keybinding: +-- osk(position, screen) +-- +-- Parameters: +-- position - optional, "bottom" by default +-- screen - optional, screen.count() by default +---------------------------------------------------- + +-- Grab environment +local util = require("awful.util") +local wibox = require("awful.wibox") +local button = require("awful.button") +local layout = require("awful.widget.layout") +local table = table +local ipairs = ipairs +local tostring = tostring +local setmetatable = setmetatable +local capi = { + widget = widget, + screen = screen, + fake_input = root.fake_input +} + +-- OSK: On Screen Keyboard for the awesome window manager +module("osk") + +-- Variable definitions +local kbd = {} +kbd.codes = { + q=24, w=25, e=26, r=27, t=28, z=52, u=30, i=31, o=32, p=33, ["."]=60, + a=38, s=39, d=40, f=41, g=42, h=43, j=44, k=45, l=46, + Caps=66, y=29, x=53, c=54, v=55, b=56, n=57, m=58, Spc=65, Ret=36, Del=22, +} + +-- Create a chain of key widgets for an OSK row +local function create_button_row(...) + local widgets = { layout = layout.horizontal.flex } + + for _, i in ipairs(arg) do + local w = capi.widget({ type = "textbox" }) + w:margin({ top = 10, left = 10, right = 10, bottom = 10 }) + w.border_width = 1 + w.text_align = "center" + w.border_color = "#1E2320" + w.text = util.escape(tostring(i)) + w:buttons(util.table.join( + button({ }, 1, nil, function () + capi.fake_input("key_press", kbd.codes[i]) + capi.fake_input("key_release", kbd.codes[i]) + end) + )) + + table.insert(widgets, w) + end + + return widgets +end + +-- Create a wibox holding OSK rows and toggle its visibility +setmetatable(_M, { __call = function (_, pos, scr) + if not kbd.init then + kbd.box = wibox({ + height = 100, + position = pos or "bottom", + screen = scr or capi.screen.count(), + fg = "#F0DFAF", + bg = "#4F4F4F", + widgets = { + { create_button_row("q", "w", "e", "r", "t", "z", "u", "i", "o", "p", ".") }, + { create_button_row("a", "s", "d", "f", "g", "h", "j", "k", "l") }, + { create_button_row("Caps", "y", "x", "c", "v", "b", "n", "m", "Spc", "Ret", "Del") }, + layout = layout.vertical.flex + } + }) + kbd.init = true + kbd.box.visible = false + end + + kbd.box.visible = not kbd.box.visible +end }) diff --git a/rc.lua b/rc.lua new file mode 100644 index 0000000..cf7e258 --- /dev/null +++ b/rc.lua @@ -0,0 +1,471 @@ +-- Standard awesome library +require("awful") +require("awful.autofocus") +require("awful.rules") + +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("obvious") +--obvious +require("obvious.popup_run_prompt") +--require("obvious.battery") +require("obvious.wlan") +require("obvious.clock") +require("obvious.volume_alsa") +require("obvious.net") + +require("vicious") +-- Load Debian menu entries +require("debian.menu") + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +beautiful.init("/usr/share/awesome/themes/default/theme.lua") + +-- Variable with the config directory +confdir = awful.util.getdir("config") + + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "xscreensaver-command -lock" +--lock= "sh /home/fguerrer/lock" +xterm="xterm" +weechat = terminal .. " -name weechat -e weechat-curses" +firefoxbeta="sh /home/guerre/Descargas/firefox/firefox" +start="sh /home/guerre/.awesomestart" +--brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +--brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" + +-- 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.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 +-- Define a tag table which hold all screen tags. + +-- ************************************** +-- {{{ Tags +-- Define a tag table which hold all screen tags. +tags = {} +tags.settings = { + { name = "1", layout = layouts[5] }, + { name = "2", layout = layouts[9] }, + { name = "3", layout = layouts[1] }, + { name = "4", layout = layouts[1] }, + { name = "5", layout = layouts[12] }, + { name = "6", layout = layouts[12] }, + { name = "7", layout = layouts[12] }, + { name = "8", layout = layouts[3] }, + { name = "9", layout = layouts[1] } +} + +for s = 1, screen.count() do + tags[s] = {} + for i, v in ipairs(tags.settings) do + tags[s][i] = tag({ name = v.name }) + tags[s][i].screen = s + awful.tag.setproperty(tags[s][i], "layout", v.layout) + end + tags[s][1].selected = true +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, beautiful.awesome_icon }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "open terminal", terminal } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) +-- }}} +-- Reusable separators. +spacer = widget({ type = "textbox", name = "spacer" }) +separator = widget({ type = "textbox", name = "separator" }) +spacer.text = " " +separator.text = "|" +--clock +clockicon = widget({ type = "imagebox", name = "clockicon"}) +clockicon.image = image(confdir.."/icons/time.png") + +-- Volúmen Alsa + volicon = widget({ type = "imagebox" }) + volicon.image = image(confdir.."/icons/vol.png") + volwidget = widget({ type = "textbox" }) + vicious.register(volwidget, vicious.widgets.volume, " Vol: $1% ", 2, "PCM") + +-- Mouse-Buttons +volicon:buttons(awful.util.table.join( +awful.button({ }, 1, function () awful.util.spawn("amixer -q sset PCM toggle", false) end), +awful.button({ }, 4, function () awful.util.spawn("amixer -q sset PCM 1%+",false) end), +awful.button({ }, 5, function () awful.util.spawn("amixer -q sset PCM 1%-",false) end))) + +-- + + +-- }}} +-- 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 = {} +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 }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { + { + mylauncher, + mytaglist[s], + mypromptbox[s], + layout = awful.widget.layout.horizontal.leftright + }, + mylayoutbox[s], + s == 1 and mysystray or nil, + mytextclock, + clockicon, + spacer, + separator, + volwidget, + volicon, + separator, + spacer, + cpuwidget, + --obvious.volume_alsa(), + mytasklist[s], + layout = awful.widget.layout.horizontal.rightleft + } +end +-- }}} + + +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(true) end), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + -- awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + -- awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({ modkey, }, "t", function () awful.util.spawn(xterm) end), + awful.key({ modkey }, "i", function () awful.util.spawn(firefoxbeta) end), + awful.key({ modkey }, "o", function () awful.util.spawn(start) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + awful.key({}, "#123", function () awful.util.spawn("amixer -q sset Master 5+", false) end), + awful.key({}, "#122", function () awful.util.spawn("amixer -q sset Master 5-", false) end), + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + end), + + awful.key({ modkey }, "s", + function () + awful.prompt.run({ prompt = "SSH: " }, + mypromptbox[mouse.screen].widget, + function (s) + awful.util.spawn(terminal .. " -e ssh -p60 -l ipaddress " .. s) + end) + 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, }, "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 = { instance = "Navigator" }, + properties = { tag = tags[1][2] } }, + { rule = { instance = "Firefox" }, + properties = { tag = tags[1][2] } }, + { rule = { class = "VirtualBox" }, + properties = { tag = tags[1][9] } }, + { rule = { class = "Pidgin" }, + properties = { tag = tags[1][5] } }, + { rule = { class = "emesene" }, + properties = { tag = tags[1][5] } }, + { rule = { class = "Controler.py" }, + properties = { tag = tags[1][5] } }, + { rule = { instance = "weechat" }, + properties = { tag = tags[1][9] } }, + { rule = { class = "weechat 0.3.0" }, + properties = { tag = tags[1][9] } }, + { rule = { class = "weechat-curses" }, + properties = { tag = tags[1][4] } }, + { rule = { class = "Mail" }, + properties = { tag = tags[1][6] } }, + { rule = { class = "Thunderbird" }, + properties = { tag = tags[1][6] } }, + { rule = { class = "Skype" }, + properties = { tag = tags[1][9] } }, + +} +-- }}} + +-- {{{ 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) +-- }}} diff --git a/rc.lua-f b/rc.lua-f new file mode 100644 index 0000000..82e80ce --- /dev/null +++ b/rc.lua-f @@ -0,0 +1,428 @@ +-- Standard awesome library +require("awful") +require("awful.autofocus") +require("awful.rules") + +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("obvious") +--obvious +require("obvious.popup_run_prompt") +require("obvious.battery") +require("obvious.wlan") +require("obvious.clock") +require("obvious.volume_alsa") +require("obvious.net") + +require("vicious") +-- Load Debian menu entries +require("debian.menu") + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua") + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "sh /home/guerre/lock" +xterm="xterm" +firefoxbeta="sh /home/guerre/Descargas/firefox/firefox" +start="sh /home/guerre/.awesomestart" +--brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +--brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" + +-- 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.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 +-- Define a tag table which hold all screen tags. + +-- ************************************** +-- {{{ Tags +-- Define a tag table which hold all screen tags. +tags = {} +tags.settings = { + { name = "xterm's", layout = layouts[5] }, + { name = "www", layout = layouts[9] }, + { name = "im", layout = layouts[1] }, + { name = "irc", layout = layouts[1] }, + { name = "media", layout = layouts[12] }, + { name = "work", layout = layouts[3] }, + { name = "docs", layout = layouts[3] }, + { name = "prog", layout = layouts[3] }, + { name = "sys", layout = layouts[1] } +} + +for s = 1, screen.count() do + tags[s] = {} + for i, v in ipairs(tags.settings) do + tags[s][i] = tag({ name = v.name }) + tags[s][i].screen = s + awful.tag.setproperty(tags[s][i], "layout", v.layout) + end + tags[s][1].selected = true +end +-- }}} + +-- Initialize widget +memwidget = awful.widget.progressbar() + + +-- {{{ 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 + + +-- {{{ Mouse bindings +-- 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 = {} +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 }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { + { + mylauncher, + mytaglist[s], + mypromptbox[s], + --volicon, + -- spacer, + -- batterywidget, + --baticon, + --spacer, + --memwidget, + --spacer, + --memicon, + --obvious.battery(), + --obvious.volume_alsa(), + layout = awful.widget.layout.horizontal.leftright + }, + mylayoutbox[s], + obvious.battery(), + --obvious.volume_alsa(), + mytextclock, + s == 1 and mysystray or nil, + mytasklist[s], + layout = awful.widget.layout.horizontal.rightleft + } +end +-- }}} + + +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(true) end), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + -- awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({ modkey, }, "t", function () awful.util.spawn(xterm) end), + awful.key({ modkey }, "i", function () awful.util.spawn(firefoxbeta) end), + awful.key({ modkey }, "o", function () awful.util.spawn(start) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful$ + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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, }, "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 = "Navigator" }, + properties = { tag = tags[1][2] } }, + { rule = { class = "VirtualBox" }, + properties = { tag = tags[1][9] } }, + { rule = { class = "pidgin" }, + properties = { tag = tags[1][3] } }, + { rule = { class = "emesene" }, + properties = { tag = tags[1][3] } }, + { rule = { class = "Controler.py" }, + properties = { tag = tags[1][3] } }, + +} +-- }}} + +-- {{{ 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) +-- }}} diff --git a/rc.lua.2 b/rc.lua.2 new file mode 100644 index 0000000..498d02d --- /dev/null +++ b/rc.lua.2 @@ -0,0 +1,635 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") + +-- Load Debian menu entries +-- require("debian.menu") + +-- Functions + +-- Battery widget function + + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +-- theme_path = "/usr/share/awesome/themes/dark/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "urxvt" +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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["xmessage"] = true, +-- ["pinentry"] = true, +-- ["gimp"] = true, + -- by instance +-- ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ +["arora"] = { screen = 1, tag = 2 }, +["okular"] = { screen = 1, tag = 4 }, +["kwrite"] = { screen = 1, tag = 4 }, +["kate"] = { screen = 1, tag = 4}, +["kspread"] = { screen = 1, tag = 4 }, +["kstars"] = { screen = 1, tag = 8 }, +["stellarium"] = { screen = 1, tag = 8 }, +["kaffeine"] = { screen = 1, tag = 6 }, +["mixer"] = { screen = 1, tag = 6 }, +["ncmpc"] = { screen = 1, tag = 6 }, +["install"] = { screen = 1, tag = 5 }, +["vim"] = { screen = 1, tag = 4 }, +["fixe"] = { screen = 1, tag = 7 }, +["server"] = { screen = 1, tag = 7 }, +["router"] = { screen = 1, tag = 7 }, +["kmldonkey"] = { screen = 1, tag = 7 }, +["dolphin"] = { screen = 1, tag = 5 }, +["mc"] = { screen = 1, tag = 5 }, +["kismet"] = { screen = 1, tag = 7 }, +["centerim"] = { screen = 1, tag = 3 }, + -- ["mocp"] = { screen = 2, tag = 4 }, +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +-- Define tags table. +tags_names = {"main", "www", "im", "doc", "admin", "multi", "net", "other"} +tags_layout = { + +layouts[1], +layouts[7], +layouts[1], +layouts[1], +layouts[1], +layouts[1], +layouts[1], +layouts[1] + +} +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create x tags per screen. Change x valor for configure number of tags. + x = 8 + for tagnumber = 1, x do + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(tags_layout[tagnumber], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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 }, + { "suspend", "sudo pm-suspend" }, + { "hibernate", "sudo pm-hibernate" }, + { "reboot", "sudo shutdown -r now" }, + { "halt", "sudo shutdown -h now" } +} + +adminmenu = { + { "install", install }, + { "file manager", "dolphin" }, + { "mc", mc }, + { "mixer", mixer } +} + +docmenu = { + { "writer", "kwrite" }, + { "kate", kate }, + { "spreadsheet", "kspread" }, + { "vim", vim }, + { "okular", "okular" } +} + +netmenu = { + { "ssh fixe", fixe }, + { "ssh server", server }, + { "ssh router", router }, + { "kismet", kismet }, + { "kmldonkey", "kmldonkey" } +} + +sciencemenu = { + { "kstars", "kstars" }, + { "stellarium", "stellarium" } +} + +mediamenu = { + { "ncmpc", ncmpc }, + { "kaffeine", "kaffeine" } +} + +wwwmenu = { + { "arora", "arora" }, + { "centerim", messenger} +} + +mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, +{ "documents", docmenu }, +{ "net", netmenu }, +{ "www", wwwmenu }, +{ "media", mediamenu }, +{ "science", sciencemenu }, +{ "admin", adminmenu }, +{ "open terminal", terminal } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + mywibox2[s] = wibox({ position = "bottom", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + + -- Create battery widget + batterywidget = widget({type = "textbox", name = "batterywidget", align = "right" }) + + -- Create volume widget + tb_volume = widget({ type = "textbox", name = "tb_volume", align = "right" }) + tb_volume:buttons({ + button({ }, 4, function () volume("up", tb_volume) end), +button({ }, 5, function () volume("down", tb_volume) end), +button({ }, 1, function () volume("mute", tb_volume) end) + }) + volume("update", tb_volume) + + -- Create CPU widget + cpuinfo = widget({ type = "textbox", align = "right" }) + + -- Create RAM widget + meminfo = widget({ type = "textbox", align = "right" }) + + -- Create temp widget + tempinfo = widget({ type = "textbox", align = "right" }) + + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mypromptbox[s], + cpuinfo, + meminfo, + tempinfo, + batterywidget, + tb_volume, + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s + + mywibox2[s].widgets = { mytasklist[s], + s == 1 and mysystray or nil } + mywibox2[s].screen = s + +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-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), + + -- Programs + awful.key({modkey, }, "n", function () awful.util.spawn("arora", false) end), + awful.key({modkey, }, "p", function () awful.util.spawn("okular", false) end), + awful.key({modkey, }, "a", function () awful.util.spawn("dolphin", false) end), + awful.key({modkey, "Shift" }, "a", function () awful.util.spawn(mc, false) end), + awful.key({modkey, }, "e", function () awful.util.spawn("kate", false) end), + awful.key({modkey, "Control" }, "e", function () awful.util.spawn("kwrite", false) end), + awful.key({modkey, "Shift" }, "e", function () awful.util.spawn(vim, false) end), + awful.key({modkey, }, "t", function () awful.util.spawn("kspread", false) end), + awful.key({modkey, }, "s", function () awful.util.spawn("kstars", false) end), + awful.key({modkey, "Shift" }, "s", function () awful.util.spawn("stellarium", false) end), + awful.key({modkey, }, "v", function () awful.util.spawn("kaffeine", false) end), + awful.key({modkey, }, "i", function () awful.util.spawn(install, false) end), + awful.key({modkey, }, ".", function () awful.util.spawn(fixe, false) end), + awful.key({modkey, "Shift" }, ".", function () awful.util.spawn(server, false) end), + awful.key({modkey, "Control" }, ".", function () awful.util.spawn(router, false) end), + awful.key({modkey, }, "-", function () awful.util.spawn(kismet, false) end), + awful.key({modkey, }, "d", function () awful.util.spawn("kmldonkey", false) end), + awful.key({modkey, }, "z", function () awful.util.spawn(mixer, false) end), + awful.key({modkey, }, "t", function () awful.util.spawn(ncmpc, false) end), + awful.key({modkey, }, ",", function () awful.util.spawn(messenger, false) end), + + -- Multimedia keys + + awful.key( { }, "#123", function () volume("up", tb_volume) end), + awful.key( { }, "#122", function () volume("down", tb_volume) end), + awful.key( { }, "#121", function () volume("mute", tb_volume) end), + + -- Prompts + + -- manual + + awful.key({ modkey }, "F1", function () awful.prompt.run({ prompt = "Manual: " }, mypromptbox[mouse.screen].widget, + function (host) awful.util.spawn( terminal.. " -e man " .. host, false) end) + end), + + -- exe + + awful.key({ modkey }, "F2", function () mypromptbox[mouse.screen]:run() end), + + -- calculate + + awful.key({ modkey }, "F3", function () awful.prompt.run({ prompt = "Calculate: " }, mypromptbox[mouse.screen].widget, + function (expr) + awful.util.spawn_with_shell("echo '" .. expr .. ' = ' .. awful.util.eval("return (" .. expr .. ")") .. "' | xmessage -center -timeout 10 -file -", false) + end) + end), + + -- spanish dictionary + + awful.key({ modkey }, "F4", function () awful.prompt.run({ prompt = "Spanish dictionary: " }, mypromptbox[mouse.screen].widget, + function (swords) + awful.util.spawn_with_shell("~/.config/awesome/scripts/dictspanish " .. swords .. " | xmessage -center -timeout 20 -file -", false) + end) + end), + + -- english dictionary + + awful.key({ modkey, "Shift" }, "F4", function () awful.prompt.run({ prompt = "English dictionary: " }, mypromptbox[mouse.screen].widget, + function (ewords) + awful.util.spawn_with_shell("~/.config/awesome/scripts/dictenglish " .. ewords .. " | xmessage -center -timeout 20 -file -", false) + end) + end), + + -- lua code + + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + table.foreach(awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), function(_, k) table.insert(globalkeys, k) end) + table.foreach(awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), function(_, k) table.insert(globalkeys, k) end) + table.foreach(awful.key({ modkey, "Shift" }, i, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.movetotag(tags[client.focus.screen][i]) + end + end), function(_, k) table.insert(globalkeys, k) end) + table.foreach(awful.key({ modkey, "Control", "Shift" }, i, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), function(_, k) table.insert(globalkeys, k) end) + table.foreach(awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end), function(_, k) table.insert(globalkeys, k) end) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () +-- mytextbox.text = os.date(" %a %b %d, %H:%M ") + mytextbox.text = os.date(" %H:%M ") +end) + +-- Hook called every 20 seconds +awful.hooks.timer.register(20, function() + batteryInfo("BAT1") + volume("update", tb_volume) + meminfo.text = activeram() +end) + +-- Hook called every 1 seconds +awful.hooks.timer.register(1, function() + cpuinfo.text = activecpu() + tempinfo.text = get_temp() +end) + +-- }}} diff --git a/rc.lua.30082011 b/rc.lua.30082011 new file mode 100644 index 0000000..b24d0ab --- /dev/null +++ b/rc.lua.30082011 @@ -0,0 +1,546 @@ +-- Standard awesome library +require("awful") +require("awful.autofocus") +require("awful.rules") + +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("obvious") +--obvious +require("obvious.popup_run_prompt") +require("obvious.battery") +require("obvious.wlan") +require("obvious.clock") +require("obvious.volume_alsa") +require("obvious.net") + +require("vicious") +-- Load Debian menu entries +require("debian.menu") + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +beautiful.init("/usr/share/awesome/themes/default/theme.lua") + +-- Variable with the config directory +confdir = awful.util.getdir("config") + + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "sh /home/guerre/lock" +xterm="xterm" +weechat = terminal .. " -name weechat -e weechat-curses" +firefoxbeta="sh /home/guerre/Descargas/firefox/firefox" +start="sh /home/guerre/.awesomestart" +--brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +--brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" + +-- 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.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 +-- Define a tag table which hold all screen tags. + +-- ************************************** +-- {{{ Tags +-- Define a tag table which hold all screen tags. +tags = {} +tags.settings = { + { name = "1", layout = layouts[5] }, + { name = "2", layout = layouts[9] }, + { name = "3", layout = layouts[1] }, + { name = "4", layout = layouts[1] }, + { name = "5", layout = layouts[12] }, + { name = "6", layout = layouts[3] }, + { name = "7", layout = layouts[3] }, + { name = "8", layout = layouts[3] }, + { name = "9", layout = layouts[1] } +} + +for s = 1, screen.count() do + tags[s] = {} + for i, v in ipairs(tags.settings) do + tags[s][i] = tag({ name = v.name }) + tags[s][i].screen = s + awful.tag.setproperty(tags[s][i], "layout", v.layout) + end + tags[s][1].selected = true +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, beautiful.awesome_icon }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "open terminal", terminal } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) +-- }}} +-- Reusable separators. +spacer = widget({ type = "textbox", name = "spacer" }) +separator = widget({ type = "textbox", name = "separator" }) +spacer.text = " " +separator.text = "|" +--clock +clockicon = widget({ type = "imagebox", name = "clockicon"}) +clockicon.image = image(confdir.."/icons/time.png") +-- Icon +memicon = widget({ type = "imagebox", name = "memicon"}) +memicon.image = image(confdir.."/icons/mem.png") +--Widget +memwidget = widget({ type = "textbox", name = "memwidget"}) +-- Register widget +vicious.register(memwidget, vicious.widgets.mem, "$2 MB", 11) +--ok + +-- CPU + cpuico = widget({ type = "imagebox" }) + cpuico.image = image(confdir.."/icons/cpu.png") + cpuwidget = widget({ type = "textbox" }) +-- Register widget + vicious.register(cpuwidget, vicious.widgets.cpu, " Cpu: $1% ") +-- Monitor de Red + netup = widget({ type = "imagebox" }) + netup.image = image(confdir.."/icons/up.png" ) + netdown = widget({ type = "imagebox" }) + netdown.image = image(confdir.."/icons/down.png" ) + rednet = widget({ type = "textbox" }) + vicious.register(rednet, vicious.widgets.net, " ${wlan0 up_kb} - ${wlan0 down_kb} ", 3) + +-- Volúmen Alsa + volicon = widget({ type = "imagebox" }) + volicon.image = image(confdir.."/icons/vol.png") + volwidget = widget({ type = "textbox" }) + vicious.register(volwidget, vicious.widgets.volume, " Vol: $1% ", 2, "PCM") + +-- Mouse-Buttons +volicon:buttons(awful.util.table.join( +awful.button({ }, 1, function () awful.util.spawn("amixer -q sset PCM toggle", false) end), +awful.button({ }, 4, function () awful.util.spawn("amixer -q sset PCM 1%+",false) end), +awful.button({ }, 5, function () awful.util.spawn("amixer -q sset PCM 1%-",false) end))) + +-- + +-- Widget icon +baticon = widget({ type = "imagebox", name = "baticon" }) +-- Initialize widget +batwidget = widget({ type = "textbox", name = "batwidget" }) +-- Register widget +vicious.register(batwidget, vicious.widgets.bat, + function (widget, args) + if args[1] == "⌁" then + baticon.image=image(confdir.. "/icons/power-ac.png") + return "" + elseif args[1] == "+" then + baticon.image=image(confdir.. "/icons/power-ac.png") + return "("..args[2]..")" + else + if args[2] > 70 then + baticon.image=image(confdir.. "/icons/power-bat-high.png") + return "("..args[2]..")" + elseif args[2] > 40 and args[2] <= 70 then + baticon.image=image(confdir.. "/icons/power-bat.png") + return "("..args[2]..")" + elseif args[2] > 10 and args[2] <= 40 then + baticon.image=image(confdir.. "/icons/power-bat-low2.png") + return "("..args[2]..")" + elseif args[2] > 5 and args[2] <= 10 then + baticon.image=image(confdir.. "/icons/power-bat-low.png") + return "("..args[2]..")" + else + baticon.image=image(confdir.. "/icons/power-bat-low.png") + naughty.notify({ title = "Battery Warning" + , text = "Battery low! "..args[1].."% left!" + , timeout = 5 + , position = "top_right" + , fg = beautiful.fg_focus + , bg = beautiful.bg_focus + }) + return "("..args[2]..")" + end + end + end, + 23, "BAT0") +-- }}} + +-- }}} +-- 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 = {} +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 }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { + { + mylauncher, + mytaglist[s], + mypromptbox[s], + layout = awful.widget.layout.horizontal.leftright + }, + mylayoutbox[s], + s == 1 and mysystray or nil, + mytextclock, + + --baticon, + --batwidget, + clockicon, + separator, + spacer, + spacer, + obvious.battery(), + spacer, + separator, + spacer, + cpuwidget, + cpuico, + separator, + netdown, + rednet, + netup, + separator, + memwidget, + spacer, + memicon, + separator, + volwidget, + volicon, + separator, + spacer, + --cpuwidget, + --obvious.volume_alsa(), + mytasklist[s], + layout = awful.widget.layout.horizontal.rightleft + } +end +-- }}} + + +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(true) end), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + -- awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + -- awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({ modkey, }, "t", function () awful.util.spawn(xterm) end), + awful.key({ modkey }, "i", function () awful.util.spawn(firefoxbeta) end), + awful.key({ modkey }, "o", function () awful.util.spawn(start) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + awful.key({}, "#123", function () awful.util.spawn("amixer -q sset Master 5+", false) end), + awful.key({}, "#122", function () awful.util.spawn("amixer -q sset Master 5-", false) end), + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful$ + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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, }, "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 = { instance = "Navigator" }, + properties = { tag = tags[1][2] } }, + { rule = { instance = "Firefox" }, + properties = { tag = tags[1][2] } }, + { rule = { class = "VirtualBox" }, + properties = { tag = tags[1][9] } }, + { rule = { class = "Pidgin" }, + properties = { tag = tags[1][5] } }, + { rule = { class = "emesene" }, + properties = { tag = tags[1][4] } }, + { rule = { class = "Controler.py" }, + properties = { tag = tags[1][4] } }, + { rule = { instance = "weechat" }, + properties = { tag = tags[1][4] } }, + { rule = { class = "weechat 0.3.0" }, + properties = { tag = tags[1][4] } }, + { rule = { class = "weechat-curses" }, + properties = { tag = tags[1][4] } }, + { rule = { class = "Mail" }, + properties = { tag = tags[1][6] } }, + { rule = { class = "Thunderbird" }, + properties = { tag = tags[1][6] } }, + { rule = { class = "Skype" }, + properties = { tag = tags[1][9] } }, + +} +-- }}} + +-- {{{ 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) +-- }}} diff --git a/rc.lua.backup b/rc.lua.backup new file mode 100644 index 0000000..860ec63 --- /dev/null +++ b/rc.lua.backup @@ -0,0 +1,535 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("wicked") +-- Load Debian menu entries +require("debian.menu") + + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +-- Widgets using wicked, modified by Comtom + +-- Grafico de uso de RAM +membarwidget = widget({ + type = 'progressbar', + name = 'membarwidget', + align = 'right' +}) + +membarwidget:bar_properties_set('mem', { +width = 40, +height = 0.65, +gap = 0, +border_padding = 1, +border_width = 1, +ticks_count = 0, +ticks_gap = 0, +vertical = false +}) + +membarwidget:bar_properties_set('mem', { +bg = '#333333', +fg = '#525C6B', +fg_center = '#525C6B', +fg_end = '#525C6B', +fg_off = '#333333', +border_color = '#0a0a0a', +reverse = false, +min_value = 0, +max_value = 100 +}) + +wicked.register(membarwidget, wicked.widgets.mem, '$1', 2, 'mem') + +-- Grafico de CPU +cpugraphwidget = widget({ + type = 'graph', + name = 'cpugraphwidget', + align = 'right' +}) + +cpugraphwidget.height = 0.85 +cpugraphwidget.width = 45 +cpugraphwidget.bg = '#333333' +cpugraphwidget.border_color = '#0a0a0a' +cpugraphwidget.grow = 'left' + +cpugraphwidget:plot_properties_set('cpu', { + fg = '#AEC6D8', + fg_center = '#285577', + fg_end = '#285577', + vertical_gradient = false +}) + +wicked.register(cpugraphwidget, wicked.widgets.cpu, '$1', 2, 'cpu') + +-- file system +fswidget = widget({ + type = 'textbox', + name = 'fswidget', + align = "right" +}) +wicked.register(fswidget, wicked.widgets.fs, + ' Disk / ${/ usep}% ', 30) + +-- 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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["wicd-client.py"] = true, + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + ["Navigator"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, + ["pidgin"] = { screen = 1, tag = 3 }, + ["xchat"] = { screen = 1, tag = 4 }, + ["xterm"] = { screen = 1, tag = 1 } + +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +tags_names = {"xterm", "www", "im", "irc", "media", "misc", "doc", "prog", "sys"} + + +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + --tags[s][tagnumber] = tag(tagnumber) version mas vieja ! + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true + -- layout 5 para la tag 1 + awful.layout.set(layouts[5], tags[s][1]) +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "Nautilus", browser } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + fswidget, + cpugraphwidget, + membarwidget, + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + awful.key({ modkey, }, "i", function() awful.util.spawn(initawesome) end), + -- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash) + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/rc.lua.backup2410 b/rc.lua.backup2410 new file mode 100644 index 0000000..4b14b14 --- /dev/null +++ b/rc.lua.backup2410 @@ -0,0 +1,500 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("wicked") +--require("obvious") +-- Load Debian menu entries +require("debian.menu") +--obvious +--require("obvious.popup_run_prompt") +--require("obvious.battery") +--require("obvious.wlan") +--require("obvious.clock") +--require("obvious.volume_alsa") +--require("obvious.net") +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "sh /home/guerre/lock" +brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" +-- Widgets using wicked, modified by Comtom + +os.execute("/home/guerre/.awesomestart") + + +-- 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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["wicd-client.py"] = true, + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + ["nautilus"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + ["Navigator"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, + ["pidgin"] = { screen = 1, tag = 3 }, + --["xchat"] = { screen = 1, tag = 4 }, + -- ["xterm"] = { screen = 1, tag = 1 } + ["ocp"] = { screen = 1, tag = 1 }, + ["alsamixer"] = { screen = 1, tag = 1 }, + ["htop"] = { screen = 1, tag = 1 }, + ["screen"] = { screen = 1, tag = 1 }, + ["VirtualBox"] = { screen =1, tag = 9 } + + + +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +tags_names = {"xterm", "www", "im", "work", "media", "misc", "doc", "prog", "vbox"} + + +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + --tags[s][tagnumber] = tag(tagnumber) version mas vieja ! + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true + -- layout 5 para la tag 1 + awful.layout.set(layouts[5], tags[s][1]) + -- awful.layou.set(layouts[10], tags[s][2]) +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "Nautilus", browser } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + -- obvious.battery(), + --obvious.volume_alsa(), + --obvious.wlan(), + -- obvious.net(), + --obvious.clock(), + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({}, "XF86MonBrightnessUp", function () awful.util.spawn(brilloup) end), + awful.key({}, "XF86MonBrightnessDown", function () awful.util.spawn(brillodown) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash) + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/rc.lua.backup2410.1 b/rc.lua.backup2410.1 new file mode 100644 index 0000000..db5609f --- /dev/null +++ b/rc.lua.backup2410.1 @@ -0,0 +1,500 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("wicked") +require("obvious") +-- Load Debian menu entries +require("debian.menu") +--obvious +require("obvious.popup_run_prompt") +require("obvious.battery") +--require("obvious.wlan") +require("obvious.clock") +require("obvious.volume_alsa") +--require("obvious.net") +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "sh /home/guerre/lock" +brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" +-- Widgets using wicked, modified by Comtom + +os.execute("/home/guerre/.awesomestart") + + +-- 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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["wicd-client.py"] = true, + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + ["nautilus"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + ["Navigator"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, + ["pidgin"] = { screen = 1, tag = 3 }, + --["xchat"] = { screen = 1, tag = 4 }, + -- ["xterm"] = { screen = 1, tag = 1 } + ["ocp"] = { screen = 1, tag = 1 }, + ["alsamixer"] = { screen = 1, tag = 1 }, + ["htop"] = { screen = 1, tag = 1 }, + ["screen"] = { screen = 1, tag = 1 }, + ["VirtualBox"] = { screen =1, tag = 9 } + + + +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +tags_names = {"xterm", "www", "im", "work", "media", "misc", "doc", "prog", "vbox"} + + +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + --tags[s][tagnumber] = tag(tagnumber) version mas vieja ! + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true + -- layout 5 para la tag 1 + awful.layout.set(layouts[5], tags[s][1]) + -- awful.layou.set(layouts[10], tags[s][2]) +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "Nautilus", browser } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + obvious.battery(), + obvious.volume_alsa(), + --obvious.wlan(), + -- obvious.net(), + --obvious.clock(), + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({}, "XF86MonBrightnessUp", function () awful.util.spawn(brilloup) end), + awful.key({}, "XF86MonBrightnessDown", function () awful.util.spawn(brillodown) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash) + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/rc.lua.dual b/rc.lua.dual new file mode 100644 index 0000000..8a8416e --- /dev/null +++ b/rc.lua.dual @@ -0,0 +1,598 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("wicked") +-- Load Debian menu entries +require("debian.menu") + + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" + +os.execute("/home/guerre/.awesomestart") +wallpaper_cmd = { "awsetbg -f /home/guerre/Imágenes/San_Diego_Reflecting_Pond-1280x800.jpg" } + +-- Widgets using wicked, modified by Comtom +-- Widgets using wicked +-- Merory usage +memwidget = widget({ + type = 'textbox', + name = 'memwidget', + align = "right" +}) +wicked.register(memwidget, wicked.widgets.mem, + ' RAM: $1% ($2Mb/$3Mb) || ') + +--date +datewidget = widget({ + type = 'textbox', + name = 'datewidget', +}) +wicked.register(datewidget, wicked.widgets.date, + ' %c') + +-- file system +fswidget = widget({ + type = 'textbox', + name = 'fswidget', + align = "right" +}) +wicked.register(fswidget, wicked.widgets.fs, + ' DiskUsage: /root ${/ usep}% , /home ${/home usep}% (${/home used}/${/home size}) || ', 30) + +-- cpu +cpuwidget = widget({ + type = 'textbox', + name = 'cpuwidget', + align = "right" +}) +wicked.register(cpuwidget, wicked.widgets.cpu, + ' CPU: $1% $2% || ') + +-- net +netwidget = widget({ + type = 'textbox', + name = 'netwidget', + align = "right" +}) +wicked.register(netwidget, wicked.widgets.net, + ' NET: ${wlan0 down}/${wlan0 up} (${wlan0 rx}/${wlan0 tx})', +nil, nil, 3) + +-- statebar in the bottom +mystatebar = wibox( {position = "bottom", fg = beautiful.fg_normal, bg = beautiful.bg_normal} ) +mystatebar.widgets = { + datewidget, + fswidget, + cpuwidget, + memwidget, + netwidget, +} +mystatebar.screen = 1 + + + +-- Grafico de uso de RAM +membarwidget = widget({ + type = 'progressbar', + name = 'membarwidget', + align = 'right' +}) + +membarwidget:bar_properties_set('mem', { +width = 40, +height = 0.65, +gap = 0, +border_padding = 1, +border_width = 1, +ticks_count = 0, +ticks_gap = 0, +vertical = false +}) + +membarwidget:bar_properties_set('mem', { +bg = '#333333', +fg = '#525C6B', +fg_center = '#525C6B', +fg_end = '#525C6B', +fg_off = '#333333', +border_color = '#0a0a0a', +reverse = false, +min_value = 0, +max_value = 100 +}) + +wicked.register(membarwidget, wicked.widgets.mem, '$1', 2, 'mem') + +-- Grafico de CPU +cpugraphwidget = widget({ + type = 'graph', + name = 'cpugraphwidget', + align = 'right' +}) + +cpugraphwidget.height = 0.85 +cpugraphwidget.width = 45 +cpugraphwidget.bg = '#333333' +cpugraphwidget.border_color = '#0a0a0a' +cpugraphwidget.grow = 'left' + +cpugraphwidget:plot_properties_set('cpu', { + fg = '#AEC6D8', + fg_center = '#285577', + fg_end = '#285577', + vertical_gradient = false +}) + +wicked.register(cpugraphwidget, wicked.widgets.cpu, '$1', 2, 'cpu') + +-- file system +fswidget = widget({ + type = 'textbox', + name = 'fswidget', + align = "right" +}) +wicked.register(fswidget, wicked.widgets.fs, + ' Disk / ${/ usep}% ', 30) + +-- 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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["wicd-client.py"] = true, + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + ["Navigator"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, + ["pidgin"] = { screen = 1, tag = 3 }, + ["xchat"] = { screen = 1, tag = 4 }, + ["xterm"] = { screen = 1, tag = 1 } + +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +tags_names = {"xterm", "www", "im", "irc", "media", "misc", "doc", "prog", "sys"} + + +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + --tags[s][tagnumber] = tag(tagnumber) version mas vieja ! + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true + -- layout 5 para la tag 1 + awful.layout.set(layouts[5], tags[s][1]) +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "Nautilus", browser } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + fswidget, + cpugraphwidget, + membarwidget, + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + awful.key({ modkey, }, "i", function() awful.util.spawn(initawesome) end), + -- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash) + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/rc.lua.new b/rc.lua.new new file mode 100644 index 0000000..6f20b14 --- /dev/null +++ b/rc.lua.new @@ -0,0 +1,436 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") + +-- Load Debian menu entries +require("debian.menu") + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + -- ["Firefox"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + tags[s][tagnumber] = tag(tagnumber) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/rc.lua~ b/rc.lua~ new file mode 100644 index 0000000..7b06081 --- /dev/null +++ b/rc.lua~ @@ -0,0 +1,467 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") + +-- Load Debian menu entries +require("debian.menu") + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" + +-- 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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["wicd-client.py"] = true, + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + ["Navigator"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, + ["pidgin"] = { screen = 1, tag = 3 }, + ["xchat"] = { screen = 1, tag = 4 }, + ["xterm"] = { screen = 1, tag = 1 } + +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +tags_names = {"xterm", "www", "im", "irc", "media", "misc", "doc", "prog", "sys"} + + +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + --tags[s][tagnumber] = tag(tagnumber) + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true + -- layout 5 para la tag 1 + awful.layout.set(layouts[5], tags[s][1]) +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "Nautilus", browser } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + awful.key({ modkey, }, "i", function() awful.util.spawn(initawesome) end), + -- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash) + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/rc2410.lua b/rc2410.lua new file mode 100644 index 0000000..4b14b14 --- /dev/null +++ b/rc2410.lua @@ -0,0 +1,500 @@ +-- Standard awesome library +require("awful") +-- Theme handling library +require("beautiful") +-- Notification library +require("naughty") +require("wicked") +--require("obvious") +-- Load Debian menu entries +require("debian.menu") +--obvious +--require("obvious.popup_run_prompt") +--require("obvious.battery") +--require("obvious.wlan") +--require("obvious.clock") +--require("obvious.volume_alsa") +--require("obvious.net") +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +-- The default is a dark theme +theme_path = "/usr/share/awesome/themes/default/theme.lua" +-- Uncommment this for a lighter theme +-- theme_path = "/usr/share/awesome/themes/sky/theme.lua" + +-- Actually load theme +beautiful.init(theme_path) + +-- This is used later as the default terminal and editor to run. +terminal = "x-terminal-emulator" +editor = os.getenv("EDITOR") or "editor" +editor_cmd = terminal .. " -e " .. editor +browser = "nautilus --no-desktop --browser" +initawesome = "sh /home/guerre/.awesomestart" +icewe= "iceweasel" +lock= "sh /home/guerre/lock" +brilloup= "sh /home/guerre/scripts/video_brightnessup.sh" +brillodown= "sh /home/guerre/scripts/video_brightnessdown.sh" +-- Widgets using wicked, modified by Comtom + +os.execute("/home/guerre/.awesomestart") + + +-- 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.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.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating +} + +-- Table of clients that should be set floating. The index may be either +-- the application class or instance. The instance is useful when running +-- a console app in a terminal like (Music on Console) +-- x-terminal-emulator -name mocp -e mocp +floatapps = +{ + -- by class + ["wicd-client.py"] = true, + ["MPlayer"] = true, + ["pinentry"] = true, + ["gimp"] = true, + ["nautilus"] = true, + -- by instance + ["mocp"] = true +} + +-- Applications to be moved to a pre-defined tag by class or instance. +-- Use the screen and tags indices. +apptags = +{ + ["Navigator"] = { screen = 1, tag = 2 }, + -- ["mocp"] = { screen = 2, tag = 4 }, + ["pidgin"] = { screen = 1, tag = 3 }, + --["xchat"] = { screen = 1, tag = 4 }, + -- ["xterm"] = { screen = 1, tag = 1 } + ["ocp"] = { screen = 1, tag = 1 }, + ["alsamixer"] = { screen = 1, tag = 1 }, + ["htop"] = { screen = 1, tag = 1 }, + ["screen"] = { screen = 1, tag = 1 }, + ["VirtualBox"] = { screen =1, tag = 9 } + + + +} + +-- Define if we want to use titlebar on all applications. +use_titlebar = false +-- }}} + +-- {{{ Tags +tags_names = {"xterm", "www", "im", "work", "media", "misc", "doc", "prog", "vbox"} + + +-- Define tags table. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = {} + -- Create 9 tags per screen. + for tagnumber = 1, 9 do + --tags[s][tagnumber] = tag(tagnumber) version mas vieja ! + tags[s][tagnumber] = tag(tags_names[tagnumber]) + -- Add tags to screen one by one + tags[s][tagnumber].screen = s + awful.layout.set(layouts[1], tags[s][tagnumber]) + end + -- I'm sure you want to see at least one tag. + tags[s][1].selected = true + -- layout 5 para la tag 1 + awful.layout.set(layouts[5], tags[s][1]) + -- awful.layou.set(layouts[10], tags[s][2]) +end +-- }}} + +-- {{{ Wibox +-- Create a textbox widget +mytextbox = widget({ type = "textbox", align = "right" }) +-- Set the default text in textbox +mytextbox.text = " " .. awesome.release .. " " + +-- 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.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal }, + { "Debian", debian.menu.Debian_menu.Debian }, + { "Nautilus", browser } + } + }) + +mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), + menu = mymainmenu }) + +-- Create a systray +mysystray = widget({ type = "systray", align = "right" }) + +-- 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, function (tag) tag.selected = not tag.selected end), + 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({ align = "left" }) + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) + 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] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + -- Add widgets to the wibox - order matters + mywibox[s].widgets = { mylauncher, + mytaglist[s], + mytasklist[s], + mypromptbox[s], + -- obvious.battery(), + --obvious.volume_alsa(), + --obvious.wlan(), + -- obvious.net(), + --obvious.clock(), + mytextbox, + mylayoutbox[s], + s == 1 and mysystray or nil } + mywibox[s].screen = s +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(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( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Shift" }, "q", awesome.quit), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey, }, "b", function() awful.util.spawn(browser) end), + awful.key({ modkey, }, "i", function() awful.util.spawn(icewe) end), + awful.key({ modkey }, "r", obvious.popup_run_prompt.run_prompt), + awful.key({ modkey, }, "c", function() awful.util.spawn(lock) end), + awful.key({}, "XF86MonBrightnessUp", function () awful.util.spawn(brilloup) end), + awful.key({}, "XF86MonBrightnessDown", function () awful.util.spawn(brillodown) end), +-- Prompt + awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end), + + -- Prompt + --awful.key({ modkey }, "F2", function () awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash) + -- end), + + awful.key({ modkey }, "F2", + function () + awful.prompt.run({ prompt = "Run: " }, + mypromptbox[mouse.screen].widget, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache") .. "/history") + 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) +) + +-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them +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", awful.client.togglemarked), + 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 + +for i = 1, keynumber do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, i, + function () + local screen = mouse.screen + if tags[screen][i] then + tags[screen][i].selected = not tags[screen][i].selected + end + end), + awful.key({ modkey, "Shift" }, i, + 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, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "F" .. i, + function () + local screen = mouse.screen + if tags[screen][i] then + for k, c in pairs(awful.client.getmarked()) do + awful.client.movetotag(tags[screen][i], c) + end + end + end)) +end + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Hooks +-- Hook function to execute when focusing a client. +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +-- Hook function to execute when unfocusing a client. +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +-- Hook function to execute when marking a client +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +-- Hook function to execute when unmarking a client. +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus, but disabled for magnifier layout + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end +end) + +-- Hook function to execute when a new client appears. +awful.hooks.manage.register(function (c, startup) + -- If we are not managing this application at startup, + -- move it to the screen where the mouse is. + -- We only do it for filtered windows (i.e. no dock, etc). + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + if use_titlebar then + -- Add a titlebar + awful.titlebar.add(c, { modkey = modkey }) + end + -- Add mouse bindings + c: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) + )) + -- New client may not receive focus + -- if they're not focusable, so set border anyway. + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Check if the application should be floating. + local cls = c.class + local inst = c.instance + if floatapps[cls] ~= nil then + awful.client.floating.set(c, floatapps[cls]) + elseif floatapps[inst] ~= nil then + awful.client.floating.set(c, floatapps[inst]) + end + + -- Check application->screen/tag mappings. + local target + if apptags[cls] then + target = apptags[cls] + elseif apptags[inst] then + target = apptags[inst] + end + if target then + c.screen = target.screen + awful.client.movetotag(tags[target.screen][target.tag], c) + end + + -- Do this after tag mapping, so you don't see it on the wrong tag for a split second. + client.focus = c + + -- Set key bindings + c:keys(clientkeys) + + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Honor size hints: if you want to drop the gaps between windows, set this to false. + -- c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen. +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local layout = awful.layout.getname(awful.layout.get(screen)) + if layout and beautiful["layout_" ..layout] then + mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) + else + mylayoutbox[screen].image = nil + end + + -- Give focus to the latest client in history if no window has focus + -- or if the current window is a desktop or a dock one. + if not client.focus then + local c = awful.client.focus.history.get(screen, 0) + if c then client.focus = c end + end +end) + +-- Hook called every minute +awful.hooks.timer.register(60, function () + mytextbox.text = os.date(" %a %b %d, %H:%M ") +end) +-- }}} diff --git a/scratchpad.lua b/scratchpad.lua new file mode 100644 index 0000000..72d546d --- /dev/null +++ b/scratchpad.lua @@ -0,0 +1,136 @@ +--------------------------------------------------------------- +-- Basic scratchpad manager for the awesome window manager +--------------------------------------------------------------- +-- Blame: Adrian C. +-- Licensed under the WTFPL version 2 +-- * http://sam.zoy.org/wtfpl/COPYING +--------------------------------------------------------------- +-- To use this module add: +-- require("scratchpad") +-- to the top of your rc.lua, and call: +-- scratchpad.set(c, width, height, sticky, screen) +-- from a clientkeys binding, and: +-- scratchpad.toggle(screen) +-- from a globalkeys binding. +-- +-- Parameters: +-- c - Client to scratch or un-scratch +-- width - Width in absolute pixels, or width percentage +-- when <= 1 (0.50 (50% of the screen) by default) +-- height - Height in absolute pixels, or height percentage +-- when <= 1 (0.50 (50% of the screen) by default) +-- sticky - Visible on all tags, false by default +-- screen - Screen (optional), mouse.screen by default +--------------------------------------------------------------- + +-- Grab environment +local awful = require("awful") +local capi = { + mouse = mouse, + client = client, + screen = screen +} + +-- Scratchpad: Basic scratchpad manager for the awesome window manager +module("scratchpad") + +local scratch = {} + +-- Scratch the focused client, or un-scratch and tile it. If another +-- client is already scratched, replace it with the focused client. +function set(c, width, height, sticky, screen) + local width = width or 0.50 + local height = height or 0.50 + local sticky = sticky or false + local screen = screen or capi.mouse.screen + + local function setscratch(c) + -- Scratchpad is floating + awful.client.floating.set(c, true) + + -- Scratchpad geometry and placement + local screengeom = capi.screen[screen].workarea + + if width <= 1 then width = screengeom.width * width end + if height <= 1 then height = screengeom.height * height end + + c:geometry({ -- Client is always centered on screen + x = screengeom.x + (screengeom.width - width) / 2, + y = screengeom.y + (screengeom.height - height) / 2, + width = width, height = height + }) + + -- Scratchpad properties + c.ontop = true + c.above = true + c.skip_taskbar = true + if sticky then c.sticky = true end + if c.titlebar then awful.titlebar.remove(c) end + + -- Scratchpad should not loose focus + c:raise() + capi.client.focus = c + end + + -- Prepare a table for storing clients, + if not scratch.pad then scratch.pad = {} + -- add unmanage signal for scratchpad clients + capi.client.add_signal("unmanage", function (c) + local oc = scratch.pad[screen] + if oc == c then + scratch.pad[screen] = nil + end + end) + end + + -- If the scratcphad is emtpy, store the client, + if not scratch.pad[screen] then + scratch.pad[screen] = c + -- then apply geometry and properties + setscratch(c) + else -- If a client is already scratched, + local oc = scratch.pad[screen] + -- compare it with the focused client + if oc == c then + -- If it matches then unscratch and clear the table + awful.client.floating.toggle(oc); oc.sticky = false + oc.ontop = false; oc.above = false + scratch.pad[screen] = nil + else -- If they don't match, unscratch and replace it + oc.hidden = false; oc.sticky = false + oc.ontop = false; oc.above = false + awful.client.floating.toggle(oc) + scratch.pad[screen] = c + setscratch(c) + end + end +end + +-- Move the scratchpad to the current workspace, focus and raise it +-- when it's hidden, or hide it when it's visible. +function toggle(screen) + local screen = screen or capi.mouse.screen + + -- Check if we have a client on storage, + if scratch.pad and + scratch.pad[screen] ~= nil + then -- and get it out, to play + local c = scratch.pad[screen] + + -- If it's visible on another tag hide it, + if c:isvisible() == false then c.hidden = true; + -- and move it to the current worskpace + awful.client.movetotag(awful.tag.selected(screen), c) + end + + -- Focus and raise if it's hidden, + if c.hidden then + awful.placement.centered(c) + c.hidden = false + c:raise() + capi.client.focus = c + else -- hide it if it's not + c.hidden = true + end + end +end diff --git a/teardrop.lua b/teardrop.lua new file mode 100644 index 0000000..8645154 --- /dev/null +++ b/teardrop.lua @@ -0,0 +1,128 @@ +---------------------------------------------------------------- +-- Drop-down applications manager for the awesome window manager +---------------------------------------------------------------- +-- Blame: Adrian C. +-- Licensed under the WTFPL version 2 +-- * http://sam.zoy.org/wtfpl/COPYING +---------------------------------------------------------------- +-- To use this module add: +-- require("teardrop") +-- to the top of your rc.lua, and call it from a keybinding: +-- teardrop(prog, vert, horiz, width, height, sticky, screen) +-- +-- Parameters: +-- prog - Program to run; "urxvt", "gmrun", "thunderbird" +-- vert - Vertical; "bottom", "center" or "top" (default) +-- horiz - Horizontal; "left", "right" or "center" (default) +-- width - Width in absolute pixels, or width percentage +-- when <= 1 (1 (100% of the screen) by default) +-- height - Height in absolute pixels, or height percentage +-- when <= 1 (0.25 (25% of the screen) by default) +-- sticky - Visible on all tags, false by default +-- screen - Screen (optional), mouse.screen by default +---------------------------------------------------------------- + +-- Grab environment +local pairs = pairs +local awful = require("awful") +local setmetatable = setmetatable +local capi = { + mouse = mouse, + client = client, + screen = screen +} + +-- Teardrop: Drop-down applications manager for the awesome window manager +module("teardrop") + +local dropdown = {} + +-- Create a new window for the drop-down application when it doesn't +-- exist, or toggle between hidden and visible states when it does +function toggle(prog, vert, horiz, width, height, sticky, screen) + local vert = vert or "top" + local horiz = horiz or "center" + local width = width or 1 + local height = height or 0.25 + local sticky = sticky or false + local screen = screen or capi.mouse.screen + + if not dropdown[prog] then + dropdown[prog] = {} + + -- Add unmanage signal for teardrop programs + capi.client.add_signal("unmanage", function (c) + for scr, cl in pairs(dropdown[prog]) do + if cl == c then + dropdown[prog][scr] = nil + end + end + end) + end + + if not dropdown[prog][screen] then + spawnw = function (c) + dropdown[prog][screen] = c + + -- Teardrop clients are floaters + awful.client.floating.set(c, true) + + -- Client geometry and placement + local screengeom = capi.screen[screen].workarea + + if width <= 1 then width = screengeom.width * width end + if height <= 1 then height = screengeom.height * height end + + if horiz == "left" then x = screengeom.x + elseif horiz == "right" then x = screengeom.width - width + else x = screengeom.x+(screengeom.width-width)/2 end + + if vert == "bottom" then y = screengeom.height + screengeom.y - height + elseif vert == "center" then y = screengeom.y+(screengeom.height-height)/2 + else y = screengeom.y - screengeom.y end + + -- Client properties + c:geometry({ x = x, y = y, width = width, height = height }) + c.ontop = true + c.above = true + c.skip_taskbar = true + if sticky then c.sticky = true end + if c.titlebar then awful.titlebar.remove(c) end + + c:raise() + capi.client.focus = c + capi.client.remove_signal("manage", spawnw) + end + + -- Add manage signal and spawn the program + capi.client.add_signal("manage", spawnw) + awful.util.spawn(prog, false) + else + -- Get a running client + c = dropdown[prog][screen] + + -- Switch the client to the current workspace + if c:isvisible() == false then c.hidden = true; + awful.client.movetotag(awful.tag.selected(screen), c) + end + + -- Focus and raise if hidden + if c.hidden then + -- Make sure it is centered + if vert == "center" then awful.placement.center_vertical(c) end + if horiz == "center" then awful.placement.center_horizontal(c) end + c.hidden = false + c:raise() + capi.client.focus = c + else -- Hide and detach tags if not + c.hidden = true + local ctags = c:tags() + for i, t in pairs(ctags) do + ctags[i] = nil + end + c:tags(ctags) + end + end +end + +setmetatable(_M, { __call = function(_, ...) return toggle(...) end }) diff --git a/vicious b/vicious new file mode 160000 index 0000000..e252fd9 --- /dev/null +++ b/vicious @@ -0,0 +1 @@ +Subproject commit e252fd955ab7da046e83910f1909ab9deed0dc81 diff --git a/zenburn.lua b/zenburn.lua new file mode 100644 index 0000000..5648764 --- /dev/null +++ b/zenburn.lua @@ -0,0 +1,143 @@ +------------------------------- +-- "Zenburn" awesome theme -- +-- By Adrian C. (anrxc) -- +-- License: GNU GPL v2 -- +------------------------------- + + +-- {{{ Main +theme = {} +theme.confdir = awful.util.getdir("config") +theme.wallpaper_cmd = { "/usr/bin/nitrogen --restore" } +--theme.wallpaper_cmd = { "awsetbg /usr/share/awesome/themes/zenburn/zenburn-background.png" } +-- }}} + + +-- {{{ Styles +theme.font = "Profont 8" + +-- {{{ Colors +theme.fg_normal = "#DCDCCC" +theme.fg_focus = "#F0DFAF" +theme.fg_urgent = "#CC9393" +theme.bg_normal = "#3F3F3F" +theme.bg_focus = "#1E2320" +theme.bg_urgent = theme.bg_normal +-- }}} + +-- {{{ Borders +theme.border_width = 1 +theme.border_focus = "#6F6F6F" +theme.border_normal = theme.bg_normal +theme.border_marked = theme.fg_urgent +-- }}} + +-- {{{ Titlebars +theme.titlebar_bg_focus = theme.bg_normal +theme.titlebar_bg_normal = theme.bg_normal +-- theme.titlebar_[normal|focus] +-- }}} + +-- {{{ Widgets +theme.fg_widget = "#AECF96" +theme.fg_center_widget = "#88A175" +theme.fg_end_widget = "#FF5656" +theme.fg_off_widget = "#494B4F" +theme.fg_netup_widget = "#7F9F7F" +theme.fg_netdn_widget = theme.fg_urgent +theme.bg_widget = theme.bg_normal +theme.border_widget = theme.bg_normal +-- }}} + +-- {{{ Mouse finder +theme.mouse_finder_color = theme.fg_urgent +-- theme.mouse_finder_[timeout|animate_timeout|radius|factor] +-- }}} + +-- {{{ Tooltips +-- theme.tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] +-- }}} + +-- {{{ Taglist and Tasklist +-- theme.[taglist|tasklist]_[bg|fg]_[focus|urgent] +-- }}} + +-- {{{ Menu +-- theme.menu_[bg|fg]_[normal|focus] +-- theme.menu_[height|width|border_color|border_width] +-- }}} +-- }}} + + +-- {{{ Icons +-- +-- {{{ Taglist icons +theme.taglist_squares_sel = theme.confdir .. "/icons/taglist/squarefz.png" +theme.taglist_squares_unsel = theme.confdir .. "/icons/taglist/squareza.png" +--theme.taglist_squares_resize = "false" +-- }}} + +-- {{{ Misc icons +--theme.awesome_icon = theme.confdir .. "/icons/awesome.png" +--theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png" +--theme.tasklist_floating_icon = "/usr/share/awesome/themes/default/tasklist/floatingw.png" +-- }}} + +-- {{{ Layout icons +theme.layout_tile = theme.confdir .. "/icons/layouts/tile.png" +theme.layout_tileleft = theme.confdir .. "/icons/layouts/tileleft.png" +theme.layout_tilebottom = theme.confdir .. "/icons/layouts/tilebottom.png" +theme.layout_tiletop = theme.confdir .. "/icons/layouts/tiletop.png" +theme.layout_fairv = theme.confdir .. "/icons/layouts/fairv.png" +theme.layout_fairh = theme.confdir .. "/icons/layouts/fairh.png" +theme.layout_spiral = theme.confdir .. "/icons/layouts/spiral.png" +theme.layout_dwindle = theme.confdir .. "/icons/layouts/dwindle.png" +theme.layout_max = theme.confdir .. "/icons/layouts/max.png" +theme.layout_fullscreen = theme.confdir .. "/icons/layouts/fullscreen.png" +theme.layout_magnifier = theme.confdir .. "/icons/layouts/magnifier.png" +theme.layout_floating = theme.confdir .. "/icons/layouts/floating.png" +-- }}} + +-- {{{ Widget icons +theme.widget_cpu = theme.confdir .. "/icons/cpu.png" +theme.widget_bat = theme.confdir .. "/icons/bat.png" +theme.widget_mem = theme.confdir .. "/icons/mem.png" +theme.widget_fs = theme.confdir .. "/icons/disk.png" +theme.widget_net = theme.confdir .. "/icons/down.png" +theme.widget_netup = theme.confdir .. "/icons/up.png" +theme.widget_wifi = theme.confdir .. "/icons/wifi.png" +theme.widget_mail = theme.confdir .. "/icons/mail.png" +theme.widget_vol = theme.confdir .. "/icons/vol.png" +theme.widget_org = theme.confdir .. "/icons/cal.png" +theme.widget_date = theme.confdir .. "/icons/time.png" +theme.widget_crypto = theme.confdir .. "/icons/crypto.png" +-- }}} + +-- {{{ Titlebar icons +theme.titlebar_close_button_focus = theme.confdir .. "/icons/titlebar/close_focus.png" +theme.titlebar_close_button_normal = theme.confdir .. "/icons/titlebar/close_normal.png" + +theme.titlebar_ontop_button_focus_active = theme.confdir .. "/icons/titlebar/ontop_focus_active.png" +theme.titlebar_ontop_button_normal_active = theme.confdir .. "/icons/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_inactive = theme.confdir .. "/icons/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_inactive = theme.confdir .. "/icons/titlebar/ontop_normal_inactive.png" + +theme.titlebar_sticky_button_focus_active = theme.confdir .. "/icons/titlebar/sticky_focus_active.png" +theme.titlebar_sticky_button_normal_active = theme.confdir .. "/icons/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_inactive = theme.confdir .. "/icons/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_inactive = theme.confdir .. "/icons/titlebar/sticky_normal_inactive.png" + +theme.titlebar_floating_button_focus_active = theme.confdir .. "/icons/titlebar/floating_focus_active.png" +theme.titlebar_floating_button_normal_active = theme.confdir .. "/icons/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_inactive = theme.confdir .. "/icons/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_inactive = theme.confdir .. "/icons/titlebar/floating_normal_inactive.png" + +theme.titlebar_maximized_button_focus_active = theme.confdir .. "/icons/titlebar/maximized_focus_active.png" +theme.titlebar_maximized_button_normal_active = theme.confdir .. "/icons/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_inactive = theme.confdir .. "/icons/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_inactive = theme.confdir .. "/icons/titlebar/maximized_normal_inactive.png" +-- }}} +-- }}} + + +return theme