diff --git a/bindings.lua b/bindings.lua index cc2845d..e7c5587 100644 --- a/bindings.lua +++ b/bindings.lua @@ -9,14 +9,15 @@ awful.button({ }, 5, awful.tag.viewprev) )) -- }}} +local function spawnf(cmd) return function() awful.util.spawn(cmd) end end mpdmap = { name = "MPD", m = mpd.ctrl.toggle, n = mpd.ctrl.next, N = mpd.ctrl.prev, - s = function() awful.util.spawn("mpd") end, - g = function () awful.util.spawn(cmd.mpd_client) end + s = spawnf("mpd"), + g = spawnf(cmd.mpd_client) } mpdpromts = { name = "MPD PROMPTS", @@ -28,9 +29,25 @@ mpdpromts = { progmap = { name = "PROGRAMS", - f = function () awful.util.spawn(cmd.browser) end, - i = function () awful.util.spawn(cmd.im_client) end, - m = function () awful.util.spawn(cmd.mail_client) end + f = spawnf(cmd.browser), + i = spawnf(cmd.im_client), + I = spawnf(cmd.irc_client), + m = spawnf(cmd.mail_client) +} + +adapters = { u = "wwan", w = "wlan", b = "bluetooth" } +function rfkill(cmd) + map={ name = string.upper(cmd) } + for key, adapter in pairs(adapters) do + map[key] = spawnf("sudo rfkill "..cmd.." "..adapter) + end + print(map["name"]) + return map +end +wirelessmap = { + name = "RFKILL", + b = function () mb.grab(rfkill("block")) end, + u = function () mb.grab(rfkill("unblock")) end } -- {{{ Key bindings @@ -59,7 +76,7 @@ globalkeys = awful.util.table.join( awful.screen.focus_relative(-1) end), - awful.key({ }, "Menu", aweswt.switch), + awful.key({ }, "Menu", spawnf('wmselect')), --}}} --{{{ Layout manipulation @@ -98,13 +115,14 @@ globalkeys = awful.util.table.join( awful.key({ modkey, "Control" }, "r", awesome.restart), awful.key({ modkey, "Shift" }, "q", awesome.quit), - awful.key({ modkey, }, "Return", function () awful.util.spawn(cmd.terminal) end), + awful.key({ modkey, }, "Return", spawnf(cmd.terminal)), --{{{ Modal mappings awful.key({ modkey }, "m", function () mb.grab(mpdmap, true) end), awful.key({ modkey, "Shift" }, "m", function () mb.grab(mpdpromts) end), awful.key({ modkey }, "c", function () mb.grab(progmap) end), + awful.key({ modkey }, "w", function () mb.grab(wirelessmap) end), --}}} @@ -112,7 +130,7 @@ globalkeys = awful.util.table.join( awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2%-")end ), awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2%+")end ), - awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle") end), + awful.key({ }, "XF86AudioMute", spawnf("amixer set Master toggle")), awful.key({ }, "XF86AudioPlay", mpd.ctrl.toggle), awful.key({ }, "XF86AudioNext", mpd.ctrl.next), awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev), @@ -122,7 +140,7 @@ globalkeys = awful.util.table.join( -- {{{ teardrops awful.key({ }, "F12", function () teardrop(cmd.terminal,"center","center", 0.99, 0.7)end ), awful.key({ modkey }, "`", function () teardrop("urxvtc -e ncmpcpp","bottom","center", 0.99, 0.4)end ), - awful.key({ }, "Print", function () teardrop("urxvtc -e alsamixer","top","center", 0.99, 0.4)end ), + awful.key({ }, "Print", function () teardrop("galsamixer","top","center", 0.99, 0.4)end ), -- }}} --{{{ Prompt diff --git a/wibox.lua b/boxes.lua similarity index 100% rename from wibox.lua rename to boxes.lua diff --git a/modalbind.lua b/modalbind.lua index ee56437..c8e3959 100644 --- a/modalbind.lua +++ b/modalbind.lua @@ -19,11 +19,12 @@ M.grab = function(keymap, stay_in_mode) if keymap[key] then keygrabber.stop() - keymap[key]() if stay_in_mode then + keymap[key](key) M.grab(keymap, true) else hide_box() + keymap[key](key) return true end end diff --git a/mpd.lua b/mpd.lua index aeade91..ad52474 100644 --- a/mpd.lua +++ b/mpd.lua @@ -1,13 +1,10 @@ ---assert(package.loadlib(MY_PATH .. "./mpdc.so", "luaopen_mpdc")) -require "mpdc" +local awful = awful local M = {} local type = "" -- local functions local show, mpc_play_search, notify -local conn = nil - local defaults = {} local settings = {} @@ -21,21 +18,6 @@ end -- {{{ basic functions -M.connect = function () - print("Connecting to mpd") - conn = mpdc.open(settings.host, settings.port) -end - -M.disconnect = function() - if conn ~= nil then conn:close() end - conn = nil -end - -M.ensure_connection = function() - -- connect on first call - if conn == nil then M.connect() end -end - -- }}} -- {{{ mpd.ctrl submodule @@ -43,31 +25,27 @@ end M.ctrl = {} M.ctrl.toggle = function () - M.ensure_connection() - conn:toggle() + awful.util.spawn("mpc toggle") end M.ctrl.play = function () - M.ensure_connection() - conn:play() - -- TODO widget updating + awful.util.spawn("mpc play") end M.ctrl.pause = function () - M.ensure_connection() - conn:pause() + awful.util.spawn("mpc pause") end M.ctrl.next = function () - M.ensure_connection() - conn:next() - -- TODO widget updating + awful.util.spawn("mpc next") end M.ctrl.prev = function () - M.ensure_connection() - conn:prev() - -- TODO widget updating + awful.util.spawn("mpc prev") +end + +M.ctrl.clear = function () + awful.util.spawn("mpc clear") end -- }}} @@ -116,11 +94,8 @@ function show() end function mpc_play_search(s) - if clear_before then conn:clear() end - local result, num = conn:isearch(type, s) - notify("Found " .. (num) .. " matches"); - conn:iadd(result) - conn:play() + if clear_before then M.ctrl.clear() end + awful.util.spawn("mpc search " .. type .. " | mpc add; mpc play") end -- }}} diff --git a/obvious b/obvious index dccf3cb..c5b8844 160000 --- a/obvious +++ b/obvious @@ -1 +1 @@ -Subproject commit dccf3cb530ff250c0e5db363d04e1ef803cb3808 +Subproject commit c5b884459194a15a38b88c99d5558a64efaf4e89 diff --git a/rc.lua b/rc.lua index 5cd37d5..efbcd62 100644 --- a/rc.lua +++ b/rc.lua @@ -30,9 +30,11 @@ layouts = awful.layout.suit.floating } -dofile (MY_PATH .. "tags.lua") -dofile (MY_PATH .. "wibox.lua") -dofile (MY_PATH .. "bindings.lua") -dofile (MY_PATH .. "rules.lua") -dofile (MY_PATH .. "signals.lua") +awful.util.spawn("wmname LG3D") + +dofile (MY_PATH .. "/tags.lua") +dofile (MY_PATH .. "/boxes.lua") +dofile (MY_PATH .. "/bindings.lua") +dofile (MY_PATH .. "/rules.lua") +dofile (MY_PATH .. "/signals.lua") -- dofile (MY_PATH .. "uzbl.lua") diff --git a/rules.lua b/rules.lua index 475b6f5..1322c82 100644 --- a/rules.lua +++ b/rules.lua @@ -26,6 +26,9 @@ awful.rules.rules = { { rule = { class = "Firefox", instance = "Navigator" }, properties = { tag = tags[rule_screen][2], floating = false, minimized = false } }, + { rule = { class = "Webbrowser", instance = "Navigator" }, + properties = { tag = tags[rule_screen][2], + floating = false, minimized = false } }, { rule = { class = "Pidgin" }, properties = { tag = tags[rule_screen][3], opacity = 0.9 } }, { rule = { role = "buddy_list" }, diff --git a/vicious b/vicious index dcc2b60..2d8d7d7 160000 --- a/vicious +++ b/vicious @@ -1 +1 @@ -Subproject commit dcc2b60cd85dabd716e2bb8c49d9703f050eaff5 +Subproject commit 2d8d7d752bc54310634c44f2d90e4c54357ba989