You are not logged in.
Ahh, yes. I do have my geometry set to the bottom of the screen. I was under the impression, the list would pop-up similarly to how dmenu_run does it (that way, screen real estate could be saved). But if tha'ts not the case, then I imagine it works fine.
All the best,
-HG
Offline
Alright, I have a question related to the issue I filed regarding $BROWSER. What is the correct way to declare the bang? I have $BROWSER correctly declared for zsh (exported in $HOME/.zsh_env) but it does not appear to work in interrobang. The current declaration is as follows:
:web $BROWSER "%s"
But I have tried with $BROWSER being quoted as well, and being in the same quotes as the "%s". That is:
"$BROWSER %s"
None of it seems to work for me. Thoughts?
All the best,
-HG
Offline
Either one should work. Are you launching interrobang from a key binding? If so, try launching it from a terminal.
If it works when launched from within the terminal, but not from a key binding, this would mean the BROWSER variable was not set "high enough" - i.e., it was set only in the local session. Programs inherit environment variables from their calling process.
Many people set environment variables *within* a given session, so only child programs actually inherit those settings. This is one of the many reasons I'm not a fan of relying on environment variables: they can work great, but they give many false impressions and make it easy to do things sloppily.
EDIT: tone is lost in electronic text - I am not implying that *you* are doing anything sloppy, just explaining that while I'm happy to provide options to use environment variables, I'm luke-warm at best to the idea, and not surprised to hear they lead to inconsistent behavior.
Last edited by Trilby (2013-04-10 17:05:52)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Either one should work. Are you launching interrobang from a key binding? If so, try launching it from a terminal.
If it works when launched from within the terminal, but not from a key binding, this would mean the BROWSER variable was not set "high enough" - i.e., it was set only in the local session. Programs inherit environment variables from their calling process.
Many people set environment variables *within* a given session, so only child programs actually inherit those settings. This is one of the many reasons I'm not a fan of relying on environment variables: they can work great, but they give many false impressions and make it easy to do things sloppily.
Actually, running it from a terminal was a good call as it throws an error, but it still fails to work. Interrobang returns:
sh: /usr/bin/dwb google.com: No such file or directory
This means that the variable was expanded correctly, but for some reason, it fails to open the web page correctly. This is the correct syntax for opening a URL in dwb. Further thoughts?
EDIT: tone is lost in electronic text - I am not implying that *you* are doing anything sloppy, just explaining that while I'm happy to provide options to use environment variables, I'm luke-warm at best to the idea, and not surprised to hear they lead to inconsistent behavior.
Haha, it's alright, I wouldn't be shocked at all if this is my fault.
All the best,
-HG
Offline
Just updated and I noticed I can't seem to get bang-specific completions to work at all. I believe this was fixed not too long time ago but it still appears to be around Gotta try more evil'n'geeky things with this interrobang.
TAB(pdf) compgen -P "%s" -cf ~/Downloads/%s <--- Doesn't work
TAB() compgen -P "%s" -cf ~/Downloads/%s <--- Works
Offline
@shinryuu, bang-specific completions work here. Do you have it after the definition of the pdf bang? Can you share your config?
@HG, that is not an error message from interrobang, that is an error message from your default shell. It shows that the default shell was sent that command and didn't know what to do with it. I'm not sure what else to do with that. If you copy and paste that output exactly onto a command line, does it work as expected?
Last edited by Trilby (2013-04-10 21:12:20)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
If you copy and paste that output exactly onto a command line, does it work as expected?
Yup, works perfectly.
All the best,
-HG
Offline
How about `/bin/sh -c /usr/bin/dwb google.com`?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
How about `/bin/sh -c /usr/bin/dwb google.com`?
Well, that works, but it opens a new instance of dwb rather than just opening a new tab in the already-open instance. Still runs though. Also runs fine if I specify `/bin/zsh` rather than "sh". Any other thoughts?
Also, I know that error is being thrown from the shell, not from interrobang itself (the "sh:" gave it away ), but as this doesn't appear to happen when running from the shell, I suspected interrobang.
All the best,
-HG
Last edited by HalosGhost (2013-04-10 21:24:45)
Offline
No idea, your shell can't find /usr/bin/dwb. The error message is the string that is passed to the shell, and it is the shell giving the error.
But, some more tests: is this from a bang, or just typed in manually? or both?
If it's only with a bang, can you post (the relevant parts) of your config?
Last edited by Trilby (2013-04-10 21:27:10)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
@Trilby
Oh.. It seems they have to be under the bangs. No wonder they didn't work because I made "TAB(yourcommand)" section into interrobangrc file to keep things "cleaner". My bad but this is now solved!
:pdf mupdf %s
TAB(pdf) compgen -P "%s" -cf ~/Downloads/%s
Offline
No idea, your shell can't find /usr/bin/dwb. The error message is the string that is passed to the shell, and it is the shell giving the error.
But, some more tests: is this from a bang, or just typed in manually? or both?
If it's only with a bang, can you post (the relevant parts) of your config?
This is exclusively with a bang. But I've already posted the relevant part of my config. It has something to do with the $BROWSER variable. If I let it stay dwb and not $BROWSER, it works fine.
All the best,
-HG
Offline
Shinryuu, they don't need to be immediately after, so if you want to organize you can have a section for all the bangs, then a section for all the TAB()s. It's just that the TAB(x) has to refer to a defined 'x' bang and the file is only read through once.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Firstly, Interrobang is awesome, thanks!
Secondly, How can I get it to automatically escape spaces in filenames? If I type a file path with spaces in, using TAB to complete each part, I get file not found for each of the filename segments because the spaces aren't escaped. e.g.
vlc /home/thrall/dancing turnips.avi
fails. It works if I type in the filename without using tab-completion and manually escape the space. If I try to avoid needing to escape the space, by starting the path with a quote, tab-completion doesn't work.
I currently have this line noise in my .interrobangrc:
TAB() compgen -P "%s" -fc %s | sort -u | while read s; do s=${s/\(/\\(}; s=${s/\)/\\)}; s=${s/\[/\\[}; s=${s/\]/\\]}; [[ -d ${s##* } ]] && echo "$s/" || echo "$s "; done
Offline
That line should do exactly what you are looking for. Can you post/link your fill interrobangrc?
EDIT: sorry, it actually doesn't. It escapes parentheses and brackets, but not spaces. I'm not sure how to build that in to the completer. Someone with more bash skills is welcome to contribute one though. This is all handled external from interrobang, and it would seem bash's compgen doesn't escape spaces in filenames. The man page says it should - but it fails to do so even when ran from the command line.
Last edited by Trilby (2013-04-21 23:18:25)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Weee, this seems to be exactly that thing i was looking for, only that i was never really sure what i was looking for. Thanks
Anyway, i think i found a minor Bug. When setting a font in interrobangrc, the default font string is overwriten by the new string, but not terminated. If the new font string is longer than the default it works, but if its shorter both strings are mixed, which usually fails. I just added
font[strlen(c)-1] = 0;
to terminate the string, that fixed the issue.
Ceterum autem censeo Systemdinem esse delendam
Offline
Thanks, I just fixed that on github.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Just wondering: is there a way to insert the contents of the clipboard into the command?
Offline
In what way? If you have xsel installed you could incorporate that into a completion command.
TAB() echo "%s%s$(xsel)"
This would make any press of tab insert the contents of the primary selection.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
In what way? If you have xsel installed you could incorporate that into a completion command.
TAB() echo "%s%s$(xsel)"
This would make any press of tab insert the contents of the primary selection.
Clever. Thanks. I was thinking of dmenu, where you can press Ctrl+y to insert the contents of the primary selection at the current text position. I was just thinking of being able to paste a word into the command prompt to look it up with an online dictionary search.
Last edited by Baryon (2013-05-07 21:28:56)
Offline
Ah, then I'd definitely use a bang-specific completer for that, something like this following semi-pseudo code
!dict $BROWSER http://made-up-dictionary-website.com/opt?=%s
TAB(dict) echo "%s%s$(xsel)
I've just looked into whether I can add a key binding (like shift-insert) to paste from the primary selection - I'll see if this will work smoothly.
EDIT: looked into it, figured it out, implemented it, and pushed it to git. This is brand new, so please report any bugs, but it seems I have a Shift+Insert binding working to paste from the primary selection.
Last edited by Trilby (2013-05-07 21:57:28)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
EDIT: looked into it, figured it out, implemented it, and pushed it to git. This is brand new, so please report any bugs, but it seems I have a Shift+Insert binding working to paste from the primary selection.
Wow, you're fast. I've given it a cursory look and it seems to be working and nothing seems to be broken. Well done! Thanks!
Don't know if someone's done this before, but I put in a crude python calculator, which is probably very buggy but at least it does arithmetic on demand:
;c zenity --info --text=$(python -c "print(%s)")
TAB(c) echo "%s$(python -c "print(%s)")"
Just to show the diversity of uses that interrobang can be put to, I suppose.
Last edited by Baryon (2013-05-08 19:13:25)
Offline
Don't know if someone's done this before, but I put in a crude python calculator, which is probably very buggy but at least it does arithmetic on demand
I achieve this by using the following:
!calc notify-send "$(echo '%s'|bc -l)"
Obviously, this requires `bc` to be installed and to have some notification framework running, but it runs beautifully.
All the best,
-HG
Last edited by HalosGhost (2013-05-09 09:57:36)
Offline
Try these:
!calc echo "I never get to run %s"
TAB(calc) S1="%s%s"; S2="${S1/\!calc/}"; echo "!calc $(echo $S2 | bc -l)"
Use TAB to get the answer. Too see by example type "!calc (3+2)/2<TAB>"
EDIT: a useful byproduct of this method, is that you can continue with calculations on the result. The above calculation could also be done by typing "!calc 3+2<tab>/2<tab>"
Last edited by Trilby (2013-05-09 11:10:16)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Try these:
!calc echo "I never get to run %s" TAB(calc) S1="%s%s"; S2="${S1/\!calc/}"; echo "!calc $(echo $S2 | bc -l)"
Use TAB to get the answer. Too see by example type "!calc (3+2)/2<TAB>"
EDIT: a useful byproduct of this method, is that you can continue with calculations on the result. The above calculation could also be done by typing "!calc 3+2<tab>/2<tab>"
Okay, that's brilliant. Mine was nice for single calculations, but this is wonderful. Thank you for that
All the best,
-HG
Offline