LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 07-02-2010, 07:15 AM   #1
Biowaste
LQ Newbie
 
Registered: Jul 2010
Location: Denmark
Distribution: Archlinux
Posts: 9

Rep: Reputation: 0
Awesome WM 3.4.5-1: Edit Prompt widget help (Lua)


Hi LinuxQuestions,

I'm having problems writing a functional edit prompt. I'm guessing it's just a simple lua syntax problem:

# Purpose: An edit prompt that opens files in a set location using vi.*
*
# Current code:*
*
*-- * awful.key({ modkey }, "e", function ()*
*-- * * * awful.prompt.run({ prompt = "Edit: " }, mypromptbox[mouse.screen].widget,*
*-- * * * * * function (words)*
*-- * * * * * * * sexec("urxvt -e vi /home/lys/docs/", words)*
*-- * * * * * end)*
*-- *end),*
*
# Based off:*
*
* * awful.key({ altkey }, "F3", function ()*
* * * * awful.prompt.run({ prompt = "Dictionary: " }, promptbox[mouse.screen].widget,*
* * * * * * function (words)*
* * * * * * * * sexec("crodict "..words.." | ".."xmessage -timeout 10 -file -")*
* * * * * * end)*
* * end),*
*
# # Src: anrxc's config.

Any help would be appreciated!

EDIT:
I don't know why it inserted all those stars everywhere?
Pasted it from:
http://www.pastey.net/138219

Last edited by Biowaste; 07-02-2010 at 07:22 AM. Reason: Magical stars appearing out of nowhere + correction and clarification.
 
Old 07-02-2010, 10:15 AM   #2
Biowaste
LQ Newbie
 
Registered: Jul 2010
Location: Denmark
Distribution: Archlinux
Posts: 9

Original Poster
Rep: Reputation: 0
double

Last edited by Biowaste; 01-09-2011 at 08:13 PM. Reason: double
 
Old 07-02-2010, 10:16 AM   #3
Biowaste
LQ Newbie
 
Registered: Jul 2010
Location: Denmark
Distribution: Archlinux
Posts: 9

Original Poster
Rep: Reputation: 0
Nevermind. I got help from the IRC, and got it to work. Corrected the "words" setup and found out sexec was set as an alias to
"awful.util.spawn_with_shell". So the finished, working code looks like this:

Code:
    awful.key({ modkey }, "e", function ()
        awful.prompt.run({ prompt = "Edit: " }, mypromptbox[mouse.screen].widget,
            function (words)
                awful.util.spawn_with_shell("urxvt -e vi /home/lys/"..words)
            end)
    end),
 
Old 08-20-2013, 05:02 PM   #4
revarcline
LQ Newbie
 
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
I saw this looking for some neat awesomerc tricks, I just figured I'd clean up the code so it works for anyone/whatever terminal or editor you prefer. editor_cmd is set if you are editing the default rc.lua.

Code:
    awful.key({ modkey }, "e", function ()
        awful.prompt.run({ prompt = "Edit: " }, mypromptbox[mouse.screen].widget,
            function (words)
                awful.util.spawn_with_shell(editor_cmd .. " ~/" .. words)
            end)
    end),
 
  


Reply

Tags
awesome, lua, prompt, wm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Showing a widget above a widget in GTK aarontwc Programming 4 11-26-2008 12:40 PM
help to edit Edit my bootloader's config file from kernel prompt jagdishpandey Linux - Kernel 5 07-03-2007 07:59 AM
Lua not found, yet installed adriv Slackware 20 05-22-2007 12:42 PM
Where do I edit the system wide command prompt? Brakki Linux - General 1 04-13-2004 01:02 AM
Edit from Command Prompt Paul Mon Linux - General 4 09-22-2003 09:20 PM


All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration