From 68ac8e1c659666e49045dad60d07db4951a7bbd2 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 13 Oct 2008 11:28:36 +0200 Subject: [PATCH] awesomerc: split promptbox by screen (FS#332) Signed-off-by: Julien Danjou --- awesomerc.lua.in | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 2dabb433..c8c54dc2 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -118,7 +118,6 @@ mytasklist.label = awful.widget.tasklist.label.currenttags mytextbox = widget({ type = "textbox", name = "mytextbox", align = "right" }) -- Set the default text in textbox mytextbox.text = " " .. AWESOME_RELEASE .. " " -mypromptbox = widget({ type = "textbox", name = "mypromptbox", align = "left" }) -- Create a laucher widget mylauncher = awful.widget.launcher({ name = "mylauncher", @@ -144,15 +143,17 @@ end -- Create a wibox for each screen and add it mywibox = {} +mypromptbox = {} for s = 1, screen.count() do mywibox[s] = wibox({ position = "top", name = "mywibox" .. s, fg = beautiful.fg_normal, bg = beautiful.bg_normal }) + mypromptbox[s] = widget({ type = "textbox", name = "mypromptbox" .. s, align = "left" }) -- Add widgets to the wibox - order matters mywibox[s]:widgets({ mytaglist, mytasklist, mylauncher, - mypromptbox, + mypromptbox[s], mytextbox, mylayoutbox[s], s == 1 and mysystray or nil @@ -219,7 +220,7 @@ keybinding({ modkey }, "Escape", awful.tag.history.restore):add() keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add() keybinding({ modkey, "Control" }, "r", function () - mypromptbox.text = + mypromptbox[mouse.screen].text = awful.util.escape(awful.util.restart()) end):add() keybinding({ modkey, "Shift" }, "q", awesome.quit):add() @@ -253,24 +254,25 @@ keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, - -- Prompt keybinding({ modkey }, "F1", function () - awful.prompt.run({ prompt = "Run: " }, mypromptbox, awful.util.spawn, awful.completion.bash, + awful.prompt.run({ prompt = "Run: " }, mypromptbox[mouse.screen], awful.util.spawn, awful.completion.bash, os.getenv("HOME") .. "/.cache/awesome/history") end):add() keybinding({ modkey }, "F4", function () - awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox, awful.util.eval, awful.prompt.bash, + awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen], awful.util.eval, awful.prompt.bash, os.getenv("HOME") .. "/.cache/awesome/history_eval") end):add() keybinding({ modkey, "Ctrl" }, "i", function () - if mypromptbox.text then - mypromptbox.text = nil + local s = mouse.screen + if mypromptbox[s].text then + mypromptbox[s].text = nil else - mypromptbox.text = nil + mypromptbox[s].text = nil if client.focus.class then - mypromptbox.text = "Class: " .. client.focus.class .. " " + mypromptbox[s].text = "Class: " .. client.focus.class .. " " end if client.focus.instance then - mypromptbox.text = mypromptbox.text .. "Instance: ".. client.focus.instance .. " " + mypromptbox[s].text = mypromptbox[s].text .. "Instance: ".. client.focus.instance .. " " end if client.focus.role then - mypromptbox.text = mypromptbox.text .. "Role: ".. client.focus.role + mypromptbox[s].text = mypromptbox[s].text .. "Role: ".. client.focus.role end end end):add()