Hello there,

So I got this idea into my head to make an odvious "widget" for poping
up a run prompt. I have it already shoved into my rc.lua, but I
figured I'd split it out for the good of all. Anyway, modularization
and scope is kind of still confusing me. Some of my kind Awesome dev
friends tried to help me in IRC previously, but I must still not be
getting something. Attached are some patches for what I'm trying to
accomplish. Could someone suggest why this doesn't work as I'd expect?

Patches are attached. One of them is just what I did to my rc.lua --
did I do something wrong there? The other is the actual obvious
patch-email.

Thanks guys!

-Andrei "Garoth" Thorp
diff --git a/awesome/rc.lua b/awesome/rc.lua
index 250c979..c8844ac 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -5,6 +5,7 @@ require("awful")
 require("beautiful")
 require("naughty")
 require("mpd")
+require("obvious.popup_run_prompt")
 
 -- Settings
 theme_path = os.getenv("HOME") .. "/.config/awesome/dark.theme.lua"
@@ -726,6 +727,8 @@ bind({ modkey }, "F1",
                 )
         end)
 
+bind({ modkey }, "F2", obvious.popup_run_prompt.run_prompt)
+
 -- Set keys
 root.keys(globalkeys)
 -- }}}
From 5c903d8db0d4b6b4da99051c9dfa5cb0394e47a8 Mon Sep 17 00:00:00 2001
From: Andrei 'Garoth' Thorp <gar...@gmail.com>
Date: Mon, 22 Jun 2009 22:43:10 -0400
Subject: [PATCH] WIP: Broken pop-up run prompt

---
 init.lua                  |    1 +
 popup_run_prompt/init.lua |   66 +++++++++++++++++++++++++++++++++++++++++++++
 popup_run_prompt/readme   |    7 +++++
 3 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 popup_run_prompt/init.lua
 create mode 100644 popup_run_prompt/readme

diff --git a/init.lua b/init.lua
index 9e24099..743cac4 100644
--- a/init.lua
+++ b/init.lua
@@ -7,5 +7,6 @@ require("obvious.clock")
 require("obvious.battery")
 require("obvious.volume_alsa")
 require("obvious.wlan")
+require("obvious.popup_run_prompt")
 
 module("obvious")
diff --git a/popup_run_prompt/init.lua b/popup_run_prompt/init.lua
new file mode 100644
index 0000000..38b8a14
--- /dev/null
+++ b/popup_run_prompt/init.lua
@@ -0,0 +1,66 @@
+------------------------------------------
+-- Author: Andrei "Garoth" Thorp        --
+-- Copyright 2009 Andrei "Garoth" Thorp --
+------------------------------------------
+
+local mouse = mouse
+local awful = awful
+local widget = widget
+local screen = screen
+local io = io
+
+io.write("GENERATING WIDGETS")
+runwibox = {}
+mypromptbox = {}
+for s = 1, screen.count() do
+    io.write(".")
+    mypromptbox[s] = widget({
+            type = "textbox",
+            name = "mypromptbox" .. s,
+            align = "left"
+    })
+
+    runwibox[s] = awful.wibox({
+            position = "float",
+            fg = beautiful.fg_normal,
+            bg = beautiful.bg_normal,
+            border_width = 1,
+            border_color = beautiful.bg_focus,
+            screen = s
+    })
+    runwibox[s]:geometry({
+            width = screen[s].geometry.width * 0.6,
+            height = 22,
+            x = screen[s].geometry.x + screen[s].geometry.width * 0.2,
+            y = screen[s].geometry.y + screen[s].geometry.height - 22,
+    })
+    runwibox[s].opacity = 0.7
+    runwibox[s].visible = false
+    runwibox[s].ontop = true
+
+    -- Widgets for prompt wibox
+    runwibox[s].widgets = {
+            mypromptbox[s],
+    }
+end
+io.write("\n")
+
+function run_prompt_callback()
+    runwibox[mouse.screen].visible = false
+end
+
+function run_prompt()
+    io.write("REACHED run_prompt\n")
+    runwibox[mouse.screen].visible = true
+
+    awful.prompt.run({ prompt = "  Run~  " },
+            mypromptbox[mouse.screen],
+            awful.util.spawn,
+            awful.completion.shell,
+            awful.util.getdir("cache") .. "/history",
+            100,
+            run_prompt_callback
+    )
+end
+
+module("obvious.popup_run_prompt")
diff --git a/popup_run_prompt/readme b/popup_run_prompt/readme
new file mode 100644
index 0000000..a4f6c91
--- /dev/null
+++ b/popup_run_prompt/readme
@@ -0,0 +1,7 @@
+Pop-Up Run Prompt
+
+This widget's purpose is to give you a pop-up run prompt.
+TODO describe it, add code to make it slide.
+
+To use it, include it into your rc.lua by inserting this line:
+TODO this
-- 
1.6.3.3

Reply via email to