You are not logged in.

#276 2013-11-12 21:11:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

subraizada3 wrote:

... it shows qalc qalculate >qalculate-gtk qalculate-gtk

Thanks for testing, but that result should not be - I can't replicate it here.  Did you keep the "| sort -u" at the end of the tab completion line in the config?  Neither interrobang nor percontation sorts the results, instead they are piped through 'sort'.

Since > comes before any alphanumeric characters, all desktop entries should come first.  Could this be a locale issue?  What is the output of the following:

echo -e "qalc\nqalculate\n>qalculate-gtk\nqalculate-gtk" | sort

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#277 2013-11-12 21:15:51

subraizada3
Member
Registered: 2013-06-02
Posts: 90

Re: Interrobang: a tiny menu packing a big bang (syntax)

The configuration file is the same as the default except for the addition of desktop and path before the %s%s (so yes, there is a sort -u at the end)

The output is this (even if I do sort -u):
qalc
qalculate
>qalculate-gtk
qalculate-gtk

My locale is en_US.UTF-8

Offline

#278 2013-11-13 14:43:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Ah, I suspect you have an alias for sort, right?  The results you get are the output from `sort -d`.  If you want to keep this script/alias, then change your interrobang config to use `... | /usr/bin/sort -u` in place of `... | sort -u`.

Also, for executing desktops I decided not to reinvent the wheel.  It turns out there are many different format strings that can be placed in the Exec lines of desktop files, and parsing for all of them would not be hard, but it would take quite a bit of code.  I realized this should not be done in either interrobang or percontation, and I considered writing another companion tool for this.  But I'm sure such tools already exist, so instead I've set interobang to replace the ">" at the start of the line with "!desktop" in the last command processing stage, so if you wish to launch desktop files, just define a custom bang in your config to deal with them.

Here's a python script by Xyne which should do the job.  Perhaps mimeo which is referred to there could also do it.  I just don't have the experience with .desktop files to know how to use them, but I imaging there are several such tools out there.

I've put example bangs in the default config that will show how to just execute the desktop file ignoring any parameters, or alternatively how to do the same while passing the parameters.  The latter would require a tool like Xyne's linked above to parse these parameters.

----

EDIT:
As it is much easier to provide support for something I have written, I threw together my own .desktop execution tool.  It is included in the interrobang repo, and builds with everything else, but it is not installed by default.  The PKGBUILD on github has a commented line that can be uncommented to install this tool with everything else - but I'll leave it up to users interested in this option to do this themselves.  Note also that desktop files that have Terminal=true are hardcoded to run with urxvt, if you use a different terminal, just modify the definition on line 10 of desktop-exec.c before compiling.  I've added another commented line to the PKGBUILD that will simplify this change (the sed command).

This PKGBUILD will not be uploaded to the AUR.  There is no point in resubmitting the source tarball to the AUR when the only changes are in comments in the PKGBUILD which you'd have to edit anyways.  These changes will be included  though whenever there is other reason to update the AUR tarball - like a (symbolic only) bump to a version 1 'release'.

Last edited by Trilby (2013-11-13 17:08:02)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#279 2013-11-13 21:53:34

subraizada3
Member
Registered: 2013-06-02
Posts: 90

Re: Interrobang: a tiny menu packing a big bang (syntax)

I looked through /etc/bash.bashrc, /etc/profile, ~/.bashrc, and ~/.bash_profile. None of them have any aliases for sort. I don't remember setting any aliases for sort. This system is 100% stock Arch in terms of sort. I set it to /usr/bin/sort -u in .interrobangrc but it still shows results in the same order. Weird.

Yet another reason for me to stop procrastinating on my launcher I guess.

Offline

#280 2013-11-18 18:35:11

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,095
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Hey Trilby,

Sorry to bug you about this again, but I'm still having a serious piece of trouble getting my shell aliases to be recognized. Here is my current config file (located at $XDG_CONFIG_HOME/interrobang/config):

# Set Options
set font       = -xos4-terminus-medium-r-normal--13-*-*-*-*-*-iso10646-1
set geometry   = bottom
set colors     = #68B0E0 #101010 #242424 #48E084 #484848 #64FFAA
set border     = 1px #4C7899
set bangchar   = :
set autocomp   = 1
set list       = true
set last       = true
#set shell      = /usr/bin/zsh
#set flags      = -c

# Define Bangs
bang exec      = $TERMINAL -e "zsh -c %s"
bang calc      = notify-send "$(echo '%s'|bc -l)"
bang echo      = notify-send "%s"
bang web       = $BROWSER "%s"
bang man       = $TERMINAL -e "man %s"

# Define Tabs
tab default    = percontation "%s" %s | sort -u
tab calc       = S1="%s%s"; S2="${S1/\:calc/}"; echo ":calc $(echo $S2 | bc -l)"

If I uncomment the zsh line, interrobang becomes incapable of launching any program at all. Beyond that, including `-i` on the flags line does not include my aliases in the completion options (even if I could launch them; they aren't there). Thoughts?

All the best,

-HG

Offline

#281 2013-11-18 19:05:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

HalosGhost wrote:

Sorry to bug you about this again ...

Don't be sorry, without input from people using the features that I don't use, I'd never know there were problems to fix.

I just fixed the shell option issue - it was a really silly error: I was "free"ing the stored option before it was used.  This works now and I just tested it with zsh.

I haven't tested aliases yet - I may try some soon, but this is all offloaded to the shell, so it should work as well as running the shell from a command line (as long as the shell flag is set to "-ic").

As for completing aliases, that is an entirely different issue.  There is nothing in the completion tools to provide aliases (yet).  This will be another good thing to add to percontation.  This should be pretty easy to do, it would just have to scan a file for "alias" and "function" keywords and grab the next word.  What it won't be able to do easily is decide which shell rc file(s) to parse, particularly due to the possibility of including other files, and the various syntaxes with which this can be done.  What I'll likely do is allow a percontation option as follows:

percontation aliases=/path/to/rc-or-alias-file

Note, this obviously isn't written yet, but can be expected within the next few days.  For now, you can write your own completion mini-script, an awk one-liner should do it:

PRE="%s"; MATCH=%s; awk '/alias/ && /'"$MATCH"'/ { printf "'"$PRE"' %%s\n", $0; }' .interrobangrc

A more realistic example to use aliases *with* other options:

PRE="%s"; MATCH=%s; sort -u <(percontation "$PRE" $MATCH) <(awk '/alias/ && /'"$MATCH"'/ { printf "'"$PRE"' %%s\n", $0; }' .interrobangrc)

This latter version is untested, so may need troubleshooting.

EDIT: fixed odd typo that came from the fact I was testing on something other than aliases.  Actually this still wont quite work as is, the $0 needs to be adjusted.

Last edited by Trilby (2013-11-18 22:29:22)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#282 2013-11-18 19:15:03

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,095
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Trilby wrote:

I just fixed the shell option issue - it was a really silly error: I was "free"ing the stored option before it was used.  This works now and I just tested it with zsh.

Roger that; just updated and it works just fine.

As for completing aliases, that is an entirely different issue.  There is nothing in the completion tools to provide aliases (yet).  This will be another good thing to add to percontation.  This should be pretty easy to do, it would just have to scan a file for "alias" and "function" keywords and grab the next word.  What it won't be able to do easily is decide which shell rc file(s) to parse, particularly due to the possibility of including other files, and the various syntaxes with which this can be done.  What I'll likely do is allow a percontation option as follows:

percontation aliases=/path/to/rc-or-alias-file

That seems fine, though there could be a pitfall in that zsh offers a suffix alias for file-type associations that you would need to account for.

I look forward to seeing what gets worked in smile

All the best,

-HG

Offline

#283 2013-11-18 19:53:35

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Suffix aliases don't need anything different for completion, right - they are just file names.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#284 2013-11-18 21:02:41

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,095
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Trilby wrote:

Suffix aliases don't need anything different for completion, right - they are just file names.

Well, they'd complete file names based on the association. But the thing I was talking about was that suffix aliases are defined by the command `alias -s ext='program'`, so the schema you talked about for recognizing aliases wouldn't look quite the same.

All the best,

-HG

Offline

#285 2013-11-18 21:30:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Ah, yes, that'd be pretty trivial to ignore those.  But still I'm not sure what the first part of that means "they'd complete file names based on the association" the file name is just the file name - those are already completed.  Nothing new is needed for these filetype aliases: they should complete and run already (as long as you use the "-ic" flag).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#286 2013-11-18 21:37:34

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,095
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

Trilby wrote:

Ah, yes, that'd be pretty trivial to ignore those.  But still I'm not sure what the first part of that means "they'd complete file names based on the association" the file name is just the file name - those are already completed.  Nothing new is needed for these filetype aliases: they should complete and run already (as long as you use the "-ic" flag).

Oh, yeah, I see what you're saying. What I was talking about was inconsequential. So long as percontation recognizes that it shouldn't be touching suffix aliases, then it's no big deal.

All the best,

-HG

Offline

#287 2014-11-21 21:55:31

Greduan
Member
Registered: 2013-04-19
Posts: 58
Website

Re: Interrobang: a tiny menu packing a big bang (syntax)

I just wanted to say thank you for this cool little app. smile

I thought of it as simply an alternative to dmenu with bang support until I re-read the original post and found out that it actually supports tab-completion. This makes it _so_ much more useful than dmenu.

Thank you very much. smile

Offline

#288 2015-10-25 09:01:12

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: Interrobang: a tiny menu packing a big bang (syntax)

Trilby wrote:

You'll have to revise the bang character in the tab completion line for calc as well:

- tab calc      = str="%s%s"; echo "!calc $(echo ${str#\!calc} | bc -l)"
+ tab calc      = str="%s%s"; echo ":calc $(echo ${str#\:calc} | bc -l)"

Aaargh, a one liner in the config to remind me would have been a great help smile

ps I started a thread to share configs for interrobang
https://bbs.archlinux.org/viewtopic.php … 8#p1573538

Last edited by chickenPie4tea (2015-10-25 09:35:32)


You can like linux without becoming a fanatic!

Offline

Board footer

Powered by FluxBB