You are not logged in.

#251 2013-10-12 11:36:13

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

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

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)"

Last edited by Trilby (2013-10-12 13:51:36)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#252 2013-10-12 13:13:12

riivo
Member
Registered: 2008-08-25
Posts: 112

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

Aha. You also had a typo (both occurrences need to be changed), but the point is clear. Thanks.

Offline

#253 2013-10-12 13:50:40

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

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

What's the typo? EDIT: nevermind, found it.

Last edited by Trilby (2013-10-12 13:51:46)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#254 2013-10-23 14:43:50

Vixus
Member
Registered: 2012-11-02
Posts: 60

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

Been a long time user of interrobang... and am having some (rather mundane) issues with config files.
Basically, there seems to be some 'internal' configuration state that gets only partially overwritten by new config files. A system reboot would probably clear this up but I was wondering how this works exactly?

Offline

#255 2013-10-23 15:29:20

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

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

That cannot be the case.  A reboot or a relaunch of interrobang would have the very same effect.  Nothing is stored between invocations of interrobang: it launches, runs, and exits completely.

If you describe the symptoms we may be able to find a better diagnosis.

There are some default values compiled in for options that are not set in the config file, but any config file setting will override these.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#256 2013-10-23 23:02:23

Vixus
Member
Registered: 2012-11-02
Posts: 60

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

Sure.

Basically, changing settings in ~/.interrobangrc does not seem to have any effect.

For instance, I edited my set colors line and ran interrobang again.. but nothing had changed. I then changed my geometry settings, which did seem to apply correctly.
As an experiment I then ran interrobang like so:

interrobang </usr/share/interrobang/config

Which then reset the colours to vanilla but kept the geometry settings from ~/.interrobangrc

Very curious..

Offline

#257 2013-10-23 23:14:00

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

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

Holy **#$&, something is really wrong.  It seems whether or not interrobang uses the proper rc file depends on what working directory it is launched from.  That is very bad.

Could this explain your symptoms?

FWIW, interrobang </usr/share/interrobang/config should not really do anything, you'd need the "-" on the command line to read the config from stdin.

EDIT: nevermind.  My symptoms were from a very odd coincidence.  I don't have XDG_CONFIG_HOME set, but I did - for some reason - clone the interrobang repo into my home directory and forgot about it.  So when the program attempts to chdir to XDG_CONFIG_HOME  then read "interrobang/config" the chdir failed, but there still was an interrobang/config there to read.  (EDIT2: I just pushed a change to cope with this "corner case" but I doubt this is relevant for your symptoms).

--------

Vixus,

To ensure we're on the same page, you do not have and $XDG_CONFIG_HOME/interrobang/config, or a $HOME/.config/interrobang/config file right?  If not, can you post what is in your ~/.interrobangrc?

Last edited by Trilby (2013-10-23 23:27:09)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#258 2013-10-25 13:53:35

Vixus
Member
Registered: 2012-11-02
Posts: 60

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

My config: http://ix.io/8Kp

Ok, scratch all this. I've been a grade-A idiot. Sorry for wasting your time... -.-
I had a line in sxhkd that overrides the colour setting...

Last edited by Vixus (2013-10-25 13:57:42)

Offline

#259 2013-10-25 21:13:34

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

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

I'm glad it's sorted ... and just a little bit more glad it wasn't my keyboard and chair this time (all errors are PEBKAC errors).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#260 2013-11-04 15:35:26

crackhead
Member
Registered: 2010-02-04
Posts: 8

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

Hi Trilby,
I think autocompletion broke with the latest commit. I updated recently and now I'm not able to execute a command by pressing Enter as soon as it's the first option in the completion list.
Let's say I type "int" and interrobang is the first command in the completion list. I used to be able to start it then by pressing Enter. Now it returns an error that the command was not found.
Autocompletion is enabled in my config.
I'm actually not sure if it was always like this or just changed recently, too much reliance on muscle memory. Just thought I'd mention it because it'd be great if that worked in any case.
Thanks for your great apps. Also a fan of slider here.

Edit: Just updated and issue is fixed. Thanks Trilby!

Last edited by crackhead (2013-11-10 05:39:52)

Offline

#261 2013-11-04 15:38:59

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

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

Ah, that's what it was.  Sorry, you are right, I did just break this.

I was trying to fix another issue, and I took out a couple lines that I didn't think were needed, but they provided the behavior you describe.  $DAYJOB is currently a bit $EXPLITIVE, so give me a few days to patch this up.  For now, hitting tab once then enter should work.

EDIT: scratch that.  The above reason for the delay was also a good excuse to take a break and look at the code.  It turns out it was very easy (I think).  Please confirm if the last push fixed it for you ... or produced any unwanted side effects.

Last edited by Trilby (2013-11-04 15:45:27)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#262 2013-11-10 01:44:20

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

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

I just installed this from the AUR. Though these buttons aren't required to use interrobang, pressing the up or down keys while it is open still makes it segfault and core dump.

In response to the previous post, if I type firefo and press enter, it still doesn't launch the only result (I'll let you people take a guess what it is).
Edit: turns out autocompletion isn't enabled in the default .interrobangrc. It works now that I have enabled it.

I'm using a dmenu variant from the AUR (demnu-launch and dmenu2) that also gets results from the .desktop files which would usually be present in the applications menu of DEs like gnome/kde. Very useful on evilwm and other lightweight window managers that don't have a menu. I find this to be essential for a launcher, which is what interrobang is supposed to be.
EDIT: Reread the first post. interrobang isn't supposed to display options. But the first post also says it is supposed to be a launcher, and I find this very necessary for a launcher. Eventually I'll stop procrastinating and make my own launcher that does what I want.

It would be useful to have a bang like !term that displayed the first (or last) line of command output directly in interrobang.
So if I did !in date, it would replace the right side where it shows the results with the output from date. For people that use minimal WMs like evilwm, this would be way more convenient than having to open up or switch to urxvt every time they wanted to check the time or date.

Overall, this is a great tool and is probably replacing dmenu_run for me.

Last edited by subraizada3 (2013-11-10 02:15:48)

Offline

#263 2013-11-10 02:39:11

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

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

subraizada3 wrote:

I just installed this from the AUR. Though these buttons aren't required to use interrobang, pressing the up or down keys while it is open still makes it segfault and core dump.

I see this does happen, but only if it is completely empty when you hit one of those keys, right?  I'll fix that shortly.

subraizada3 wrote:

In response to the previous post, if I type firefo and press enter, it still doesn't launch the only result ...

While this would be the case even with the default config, I see the installed defaults aren't being loaded if there is not other config file - this too will be fixed shortly.

subraizada3 wrote:

I'm using a dmenu variant from the AUR (demnu-launch and dmenu2) that also gets results from the .desktop files

This should not be in interrobang itself, but rather a custom bang or run_hook.  This would be very easy to put together - in fact I think someone in this thread already did, but as I don't use any .desktop files, I've never checked it out.  If you use a minimal WM, why do you care about .desktop files?  What is in a .desktop that isn't also just a command in /usr/bin?

subraizada3 wrote:

It would be useful to have a bang like !term that displayed the first (or last) line of command output directly in interrobang.

Like the above, this is already there.  See the 'calc' example in the default config and revise it for your command of interest.

subraizada3 wrote:

Overall, this is a great tool and is probably replacing dmenu_run for me.

Thanks, I'm glad it's useful.

EDIT: both of the noted bugs are fixed with the latest push to github (initial up/down arrow + failure to read default config).

Last edited by Trilby (2013-11-10 03:04:15)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#264 2013-11-10 05:41:26

crackhead
Member
Registered: 2010-02-04
Posts: 8

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

Thanks Trilby, updating it fixed my issue. No other problems atm!
Splendid work!

Offline

#265 2013-11-10 14:24:29

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

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

To follow up on the .desktop question - I think percontation (the companion program to interrobang which does the default completion) could certainly use some love.  If you can describe a usecase for .desktop files being used by interrobang, I'd be happy to code that in - but I feel like I'm missing something, because as I understand it, .desktop files provide icons and drag-drop abilities to programs.  Interrobang just starts programs, there is no place for icons or drag-drop, so I don't understand the desire for the .desktop middleman.  But if this is just a failure of my imagination, let me know how this would be used, and it will then be written.

Last edited by Trilby (2013-11-10 14:24:56)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#266 2013-11-10 21:04:23

alban
Member
Registered: 2013-05-12
Posts: 15

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

Hi,

I just notice after an update of interrobang today that I have something wrong with the calc bang completion.
When I type :
    - !calc 3+2
    - TAB
    - +1
an additional part is written at the end of the line.
It seems like it is the end of my config file.
I have tried with the example config file, to check if my config was broken, but it is the same thing. It was not present before (my last update before today was at the beginning of october). Someone else has the same thing?

Thanks,
Alban

Offline

#267 2013-11-10 22:07:08

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

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

Whoa - yup, I can confirm that.  I think I know what it is ... standby.

EDIT: found it, and (pretty sure) I fixed it.  I'm getting pretty good at breaking this thing - definitely putting the bleeding in bleeding edge.

Last edited by Trilby (2013-11-10 22:12:27)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#268 2013-11-11 09:12:52

alban
Member
Registered: 2013-05-12
Posts: 15

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

Yeap, corrected for me. Thanks !

Offline

#269 2013-11-12 14:47:44

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

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

Trilby wrote:

If you use a minimal WM, why do you care about .desktop files?  What is in a .desktop that isn't also just a command in /usr/bin?

Desktop files are fewer in number. There are a lot of dependencies that go into /usr/bin but never get used. One example is HPLIP - it has about 15 commands that can be called from a terminal. QEMU also provides a bunch of commands. And then there are the dependencies of many programs that sometimes have their own terminal commands. Once I launch the X server, I'm not going to be using startx. And a launcher would never be used to launch grep or ls or cat or pwd. None of the mentioned commands will be used outside of a terminal (at least for me), so it just clutters up the list of applications.

If you rarely use a program and it has some easy to forget command, finding it in a list of 100 .desktop files is easier than going through the 1000 programs in /usr/bin.
And then there are the occasions when you're bored and you install 30 games from the repositories at once. It's much easier to try them all and keep the ones you like / remove the ones you dont like if you're just looking for them in a list of 100 programs than it is to find them in a list of 1000.





Trilby wrote:

as I understand it, .desktop files provide icons and drag-drop abilities to programs.

They do, but that's not all they do.
From the Wiki on desktop entries:

[Desktop Entry]
Type=Application                          # Indicates the type as listed above
Version=1.0                               # The version of the desktop entry specification to which this file complies
Name=jMemorize                            # The name of the application
Comment=Flash card based learning tool    # A comment which can/will be used as a tooltip
Exec=jmemorize                            # The executable of the application.
Icon=jmemorize                            # The name of the icon that will be used to display this entry
Terminal=false                            # Describes whether this application needs to be run in a terminal or not
Categories=Education;Languages;Java;      # Describes the categories in which this entry should be shown

These aren't all the entries that can go into a .desktop. How I see it is that interrobang either keeps a cache of appropriate entries or parses them on each run. Only entries with Type=Application would need to be stored or parsed. Interrobang would get the name of the application, the comment, the terminal command, and also whether to run it in a terminal. The other things, like the picture, would not be useful to interrobang. It would then include applications in the search results based on name or comment and either launch using the command or launch in a terminal using the command.

The advantage of this is that you could also search by comment, so if I type in browser firefox would show up.
Another advantage is that (if like my dmenu you set desktop results to show up in the results before commands in /usr/bin), more relevant results will come up first instead of stuff that I never use but still matches the text I entered. Biasing results based on how often they are run could also help do this though. (I think that might already be implemented)
It is much easier to manage .desktop files - if an application was installed as a dependency for something but created a .desktop file, I just move it into a folder I created in the directory of desktop files. The application still stays in my path (the program is in /usr/bin), it doesn't show up in the search results, and the program that depends on it still runs. All I need to do is sudo mv /usr/share/applications/someapp.desktop /usr/share/applications/backup. If I start using it later, I can move the .desktop file back into the directory with the others.
If there is a terminal app that someone launches frequently, making a desktop file is as easy as

sudo echo "[Desktop Entry]\nType=Application\nName=AppName\nCommand=command\nTerminal=true" >/usr/share/applications/appname.desktop







subraizada3 wrote:

It would be useful to have a bang like !term that displayed the first (or last) line of command output directly in interrobang.

Trilby wrote:

Like the above, this is already there.  See the 'calc' example in the default config and revise it for your command of interest.

I'm not very good at bash programming but I've made some progress.
Currently I have

bang date = echo "\"%s\""
tab date = ignore="%s%s"; echo "`date`"

This kind of works - it only displays the last word outputted by date - 2013 (instead of something like Tue Nov 12 08:46:58 CST 2013).

Last edited by subraizada3 (2013-11-12 14:49:21)

Offline

#270 2013-11-12 14:56:14

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

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

subraizada3 wrote:

Desktop files are fewer in number ... None of the mentioned commands will be used outside of a terminal (at least for me), so it just clutters up the list of applications.

Thanks, that does make a lot of sense now.  I'll get to work on a .desktop completion mechanism for percontation (which is the completion tool for interrobang - and another example of a binary you probably wouldn't run on its own).

I'll also see if I can get a better entry for date/time.

EDIT: for the date, the results you describe are due to having "set last=true" so the completion options on the right of the bar only show the last 'word' of each option.  Three options:

1) Set last = false, but this will affect other tab completion

2) Press <tab> after typing !date so "date" is chaged to the current date, perhaps using something like the following in your config:

tab date = ignore="%s%s"; echo $(date "+%%A %%d %%B %%Y %%H:%%M%%P")

3) The simplest and most direct way to make what you're trying to do work is this:

tab date = ignore="%s%s"; echo "$(date | sed 's/ /\n/g')"

Number 3 is a bit odd, so an explanation: The sed command replaces every space with a newline, so each "word" of the result of date becomes a different tab completion option.  All these options are then displayed in full because every option only has one word, so there is no last-word issue.  This becomes more clear if you hit tab again or use the arrow keys - each 'word' of the date is a different completion entry.

Last edited by Trilby (2013-11-12 15:11:47)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#271 2013-11-12 15:58:59

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

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

Trilby, you should check out j4-dmenu-desktop.  It is the i3-dmenu-desktop rewritten in C.  The i3-dmenu-desktop does exactly what this user is asking for above with the .dekstop files.  So maybe you could pull inspiration from there...


Edit: Here is the github page.  It is in the AUR as j4-dmenu-desktop-git.

Last edited by WonderWoofy (2013-11-12 16:00:17)

Offline

#272 2013-11-12 16:03:12

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

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

Eh ... what else does it do?  That's a lot of code  - I can do better than that wink


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#273 2013-11-12 16:16:05

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

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

It makes you pancakes I think.

I just figured it would be a good place to just look to see how others used the .desktop files.  Being a standalone window manager user (like you) I never really think about those things or how they might incorporate themselves into these DEs.  I have faith in your coding, as I use your tools.  My suggestion to look over that project was not to tell you to use it, just that it has been done before, so it might serve as a point of reference.

Offline

#274 2013-11-12 18:48:17

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

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

No worries, I did take a look, and it may come in handy at some point.

I just pushed a very alpha version of desktop file support.  It is disabled by default, but there are commented examples in the config on how it can be used.  This has been added as an optional parameter to 'percontation' when using it for completion.

Percontation requires at least two parameters for all but the last word of input, and the last word of input.  Call these parameters N and N-1.  If there are more than 2 parameters, the N-2 ... 1 parameters can be one of the following:

1) path - leads to the current default behavior
2) desktop  - searches for desktop files with names starting with the entered text
3) desktop+ - searches through desktop files for names starting with entered text, or comments including the entered text.

These can be used in conjuntion, so `percontation desktop path "%s" %s` will combine the default output with the desktop output, but it will sort the desktop entries first.  `percontation path desktop "%s" %s` would have the same output, but putting desktop entries last.  Note that "path" is only the default if nothing else is specificed, so `percontation desktop "%s" %s` will show *only* desktop file entries.

Desktop entries are displayed in the completion list with a DESK_CHAR prefix which (for now) is just a ">".  I'll likely change this eventually to a character than can't be in file names (I think < qualifies) and then have interrobang hide this character but highlight the entry in a different color, or some such.

I've even started on passing parameters to the desktop files.  To see an example, enable desktop completion in your config, then enter the following in interrobang:

fire<tab> bbs.archlinux.org

Assuming you have firefox installed, this will complete to ">firefox " then you will add the url, and be brought here.

This is limited, as I just learned there are many format strings that can be in desktop files that I'll have to deal with - for example, some of them allow for a program like mupdf to open multiple instances, one for each file provided.  Interrobang can't do this (yet).  Though I suspect that is a sufficiently narrow corner case to not be to important.  In fact I may ditch parameters to desktop files all together.  If one was going to type in parameters, they'd probably not use the desktop file ... but we'll see.

EDIT: I forgot, another current limitation is that this only checks "/usr/share/applications" for desktop files.  This was just to see if it works.  Once it is working, this will be trivially easy to include ~/.local/share/applications, or wherever else these things tend to hide.

Last edited by Trilby (2013-11-12 18:58:30)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#275 2013-11-12 19:29:52

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

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

That update came way faster than expected.
It works, at least for me. The only thing stopping me from replacing dmenu_run is that evilwm has problems launching it with XMODIFIERS="" sad

The option in percontation to sort desktop and path files isn't perfect (but it works a bit).
I have a programs called qalc, qalculate, and qalculate-gtk (which is a great calculator by the way). There is also a desktop file for qalculate-gtk.
When I type in qal, it shows qalc qalculate >qalculate-gtk qalculate-gtk
So though desktop files come before similarly named path files, path files that are first in terms of alphabetical order still come first, which kind of defeats the one of the purposes of desktop files in interrobang/dmeu (not having to go though dependencies to launch the program).

Offline

Board footer

Powered by FluxBB