awesomerc: split promptbox by screen (FS#332)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-13 11:28:36 +02:00
parent bc5569ab94
commit 68ac8e1c65
1 changed files with 13 additions and 11 deletions

View File

@ -118,7 +118,6 @@ mytasklist.label = awful.widget.tasklist.label.currenttags
mytextbox = widget({ type = "textbox", name = "mytextbox", align = "right" }) mytextbox = widget({ type = "textbox", name = "mytextbox", align = "right" })
-- Set the default text in textbox -- Set the default text in textbox
mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>" mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>"
mypromptbox = widget({ type = "textbox", name = "mypromptbox", align = "left" })
-- Create a laucher widget -- Create a laucher widget
mylauncher = awful.widget.launcher({ name = "mylauncher", mylauncher = awful.widget.launcher({ name = "mylauncher",
@ -144,15 +143,17 @@ end
-- Create a wibox for each screen and add it -- Create a wibox for each screen and add it
mywibox = {} mywibox = {}
mypromptbox = {}
for s = 1, screen.count() do for s = 1, screen.count() do
mywibox[s] = wibox({ position = "top", name = "mywibox" .. s, mywibox[s] = wibox({ position = "top", name = "mywibox" .. s,
fg = beautiful.fg_normal, bg = beautiful.bg_normal }) 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 -- Add widgets to the wibox - order matters
mywibox[s]:widgets({ mywibox[s]:widgets({
mytaglist, mytaglist,
mytasklist, mytasklist,
mylauncher, mylauncher,
mypromptbox, mypromptbox[s],
mytextbox, mytextbox,
mylayoutbox[s], mylayoutbox[s],
s == 1 and mysystray or nil 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 }, "Return", function () awful.util.spawn(terminal) end):add()
keybinding({ modkey, "Control" }, "r", function () keybinding({ modkey, "Control" }, "r", function ()
mypromptbox.text = mypromptbox[mouse.screen].text =
awful.util.escape(awful.util.restart()) awful.util.escape(awful.util.restart())
end):add() end):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add() keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
@ -253,24 +254,25 @@ keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -
-- Prompt -- Prompt
keybinding({ modkey }, "F1", function () 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() os.getenv("HOME") .. "/.cache/awesome/history") end):add()
keybinding({ modkey }, "F4", function () 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() os.getenv("HOME") .. "/.cache/awesome/history_eval") end):add()
keybinding({ modkey, "Ctrl" }, "i", function () keybinding({ modkey, "Ctrl" }, "i", function ()
if mypromptbox.text then local s = mouse.screen
mypromptbox.text = nil if mypromptbox[s].text then
mypromptbox[s].text = nil
else else
mypromptbox.text = nil mypromptbox[s].text = nil
if client.focus.class then if client.focus.class then
mypromptbox.text = "Class: " .. client.focus.class .. " " mypromptbox[s].text = "Class: " .. client.focus.class .. " "
end end
if client.focus.instance then if client.focus.instance then
mypromptbox.text = mypromptbox.text .. "Instance: ".. client.focus.instance .. " " mypromptbox[s].text = mypromptbox[s].text .. "Instance: ".. client.focus.instance .. " "
end end
if client.focus.role then 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 end
end):add() end):add()