Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elv13 prompt hook v2 #483

Merged
merged 3 commits into from Nov 8, 2015
Merged

Conversation

blueyed
Copy link
Member

@blueyed blueyed commented Sep 27, 2015

Continuation of #52, assumes #34 to be merged.

/cc @Elv13

@psychon
Copy link
Member

psychon commented Sep 28, 2015

Fine by me

@Elv13
Copy link
Member

Elv13 commented Sep 28, 2015

+1

So, I guess you want to rebase this one first?

@blueyed
Copy link
Member Author

blueyed commented Sep 28, 2015

Rebased. Let's see if it still passes.. ;)

@blueyed
Copy link
Member Author

blueyed commented Sep 28, 2015

@Elv13 mentioned that this would be (would have a potential for) a nice addition to the default config, but that could be done in a new PR.

@blueyed
Copy link
Member Author

blueyed commented Sep 28, 2015

Rebased and seems to be fine - but #489 should go in first.

@Elv13
Copy link
Member

Elv13 commented Sep 29, 2015

While I think about it, another PR should also add an API to add new default hooks for the prompt. This could be used to implement VI style prompt shortcuts by adding escape. For this, layered keygrabbers would also need to be properly supported, but this is just an example (EMACS mode could be implemented (well, extended given CTRL+A/E and some others are already implemented) directly).

/me also wonder is generic hooks for modified text could be added to implement syntax highlight, but this is just dreaming and would required substantial changes to decouple the prompt text and the displayed one

@bew
Copy link
Contributor

bew commented Sep 29, 2015

@Elv13 I'm currently doing a big library, which will have (with a lot of other features) layered grabbers and dynamic keymap, for every possible use, from tag management to prompt editText with vim style keybinds.. This is in WIP, and doesn't work ATM, but it will ;)

Maybe when finished (in a long time..) I will make a separate library with only key* stuff. For those who doesn't want the full lib.

@Elv13
Copy link
Member

Elv13 commented Sep 29, 2015

@Bew78LesellB Well, I guess the issues with layered grabbers should be treated as bugs in Awesome and fixed internally rather than adding an abstraction layer on top the the current API (the internal one should handle it)

@bew
Copy link
Contributor

bew commented Sep 29, 2015

@Elv13 yeah this is another way to think the issue, but I still didn't progress in the study of Awesome's C code, so I'm currently making what I'm good at.. (love lua now!)
If you can fix this internally, this will surely speed-up things!

@blueyed
Copy link
Member Author

blueyed commented Sep 29, 2015

@Bew78LesellB
I am not sure that you will need too much from the C side in awesome.

I think it would be a great opportunity for you to address this where it's meant to be fixed. Whenever you work around something, just consider fixing it in the core.. :)

@bew
Copy link
Contributor

bew commented Sep 30, 2015

@blueyed Oh I never thought of that !

The thing is that I added some concept in my lib, on top of the lua api (well, in fact, on top of the capi, I'm rewriting a lua api..), and I think everything with theses concepts..

As they are kind of specific to me, I'm not sure it's a good idea to add them in the core of awesome..

@blueyed blueyed added this to the next: pull requests to be merged soon milestone Oct 27, 2015
@blueyed
Copy link
Member Author

blueyed commented Oct 27, 2015

Rebased on master (fixing a conflict), added some doc, moving to "next" milestone.

@blueyed
Copy link
Member Author

blueyed commented Oct 29, 2015

I've also made the hook's return value handling a bit smarter in blueyed@7925e6a. Does that make sense?

@blueyed
Copy link
Member Author

blueyed commented Nov 5, 2015

@psychon @Elv13 ping

@psychon
Copy link
Member

psychon commented Nov 6, 2015

Uhm. Your latest commit looks fine to me (thanks!) and the rest was already decided to be good before, right? So I guess everything is good (sorry, I don't really want to look too deeply into the prompt code.)

@blueyed
Copy link
Member Author

blueyed commented Nov 6, 2015

blueyed@7925e6a is also new.

@psychon
Copy link
Member

psychon commented Nov 6, 2015

I trust you on that one. :-)

@Elv13
Copy link
Member

Elv13 commented Nov 6, 2015

+1

Elv13 and others added 3 commits November 8, 2015 12:31
Example:

awful.prompt.run({ prompt = "Run: ", hooks = {
    {{         },"Return",function(command)
         local result = awful.util.spawn(command)
         mypromptbox[mouse.screen].widget:set_text(type(result) == "string" and result or "")
         return true
    end},
    {{"Mod1"   },"Return",function(command)
         local result = awful.util.spawn(command,{sticky=true})
         mypromptbox[mouse.screen].widget:set_text(type(result) == "string" and result or "")
         return true
    end},
    {{"Shift"  },"Return",function(command)
         local result = awful.util.spawn(command,{ontop=true,floating=true})
         mypromptbox[mouse.screen].widget:set_text(type(result) == "string" and result or "")
         return true
    end}
    }
},...)
This is meant to avoid boilerplate code when creating prompt hooks.
blueyed added a commit that referenced this pull request Nov 8, 2015
@blueyed blueyed merged commit aec751f into awesomeWM:master Nov 8, 2015
@blueyed blueyed deleted the Elv13-prompt_hook_v2 branch November 8, 2015 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants