gnunn1 / tilix

A tiling terminal emulator for Linux using GTK+ 3
https://gnunn1.github.io/tilix-web
Mozilla Public License 2.0
5.42k stars 292 forks source link

Add gnome shell search provider #48

Open brunelli opened 8 years ago

brunelli commented 8 years ago

GNOME Terminal has a search feature that allows you to search terminal outputs, see here.

It has a GNOME Shell search provider (very useful) and it even lets you search using regex.

It'd be very nice to have this feature added into Terminix too.

alex285 commented 8 years ago

Terminix also has an identical search to Gnome Terminal, with Regex. But has no search provider though. Do you want to change the subject to search provider?

brunelli commented 8 years ago

Oh... After reading your comment I finally found it!

But that are some issues with it:

I'll change the title, thanks.

gnunn1 commented 8 years ago

I liked your idea of emulating the Nautilus search, how about this? I moved the Revealer (i.e. the slider) out of the overlay and made it a peer to the terminal so now it pushes the terminal down when revealed. I also tried to make it more compact by moving the options into a menu button.

screenshot from 2016-01-22 20-52-13

bilelmoussaoui commented 8 years ago

Looks better! maybe showing the number of the results somewhere too?

gnunn1 commented 8 years ago

Unfortunately the terminal widget I'm using doesn't support things like showing the number of results or highlighting all matches. You can see the docs for it here if interested: https://developer.gnome.org/vte/0.40/VteTerminal.html

brunelli commented 8 years ago

Really a improvement!

I was playing a bit with it and ended up with this:

139590d8-c14a-11e5-895e-c1edc149bd57

It mixes up a bit the current status of searching in Epiphany with the upcoming Nautilus search.

Also, maybe the checkboxes should be changed to ON/OFF switchers.

gnunn1 commented 8 years ago

That looks great, thanks a lot for taking the time to do this, let me see what I can do to emulate it. I particularly like how you have the options right after the search box which follows the flow of a user does a search, much better then at the end where I have it.

With respect to switches, Gnome HIG is to use switches for hardware devices (i.e. like the terminal bell in preferences) and checkbuttons for options which is the case here.

https://developer.gnome.org/hig/stable/switches.html.en

brunelli commented 8 years ago

Nice, thanks for point to the HIG! I was a little confused because the new Nautilus search uses a switcher to turn on/off the "Search Subfolders" option.

gnunn1 commented 8 years ago

Here's what have now, based on brunellli's mockup. BTW what icons are you using in that mockup, like them better then ones I'm using, if they are part of standard icon themes I'll look into switching.

screenshot from 2016-01-23 17-16-45

bilelmoussaoui commented 8 years ago

@gnunn1 the icons are go-up-symbolic and go-down-symbolic i guess

gnunn1 commented 8 years ago

That's what I'm using already, I guess it's just differences in icon packs (I'm using Moka)

On Sat, Jan 23, 2016 at 5:21 PM, Bilal Elmoussaoui <notifications@github.com

wrote:

@gnunn1 https://github.com/gnunn1 the icons are go-up-symbolic and go-down-symbolic i guess

— Reply to this email directly or view it on GitHub https://github.com/gnunn1/terminix/issues/48#issuecomment-174226880.

bilelmoussaoui commented 8 years ago

The default icons(Adwaita) are the same as in the mockup of @brunelli

gnunn1 commented 8 years ago

Improved search box rolled out with 0.45, going to edit this to just reflect the search provider enhancement.

bilelmoussaoui commented 8 years ago

Btw, the next and previous need to be marked as insensitive if there's no more previous/next results ! :+1:

gnunn1 commented 8 years ago

Good point, the find previous/next does return a bool indicating whether a match is found, so I couldn't make the buttons insensitive until at least one failure happened. There is also the wrap around option that this would need to work with as well.

I'll play around with it and see if some sort of reasonable behavior can be achieved.

gnunn1 commented 8 years ago

Gnome search provider is dependent on #24, adding DBus support.

dsboger-zz commented 8 years ago

According to [1], if your application is a GApplication and it does not override the default command line argument parsing function, it is very simple to make it DBus-activatable. I can make a simple PR to enable that it that is the case.

[1] https://wiki.gnome.org/HowDoI/DBusApplicationLaunching

gnunn1 commented 8 years ago

I looked at that link, from a code perspective Terminix should work with this as I am using the built-in command line handling for GTKApplication. If you have time to put together a PR for this that would be great. Note I do override the local handling but that's only there from when I was debugging and the value it returns indicates default processing should continue, I'll remove it though as it adds no value.

The gnome-search-provider does require a specific interface to be implemented though:

https://developer.gnome.org/SearchProvider/

If you want to go further and write some D code to tackle that as well I'd be happy to accept a PR here too, but it might be a bit of effort as D does not have great integration with DBus at this point. I can give you some more detailed thoughts on this if you want to try though.

dsboger-zz commented 8 years ago

Well, I've done the easy part, i.e. sent a PR that makes Terminix DBus activatable. Works For Me.

I've also investigated the state of DBus bindings for D. I looked at ddbus [1] and dbus-d (last commit 8 years old) [2], but it seems both lack support for dictionary type, which is required by the GetResultMetas method of the search provider. I've reported an issue [3] in ddbus asking if there are plans to support dictionary types. I don't think I can move any further than that by now, as I'm not a D programmer, have only basic knowledge of DBus and no experience with language bindings whatsoever.

EDIT: Feel free to drop some ideas, as I may try to dig deeper when I have the chance.

[1] https://github.com/trishume/ddbus [2] http://www.dsource.org/projects/dbus-d/ [3] https://github.com/trishume/ddbus/issues/3

gnunn1 commented 8 years ago

My plan was to leverage the existing DBus support in GtkD, see here for the docs for DBusServer as a starting point. GtkD already supports Dictionary and I'd strongly prefer to stick with this implementation because it fits in seamlessly since Terminix is already using GtkD for the user interface.

The issue with the GtkD implementation is that it is low level with callbacks requiring C functions declared in D versus extern. I'd want to wrap this to make it more user friendly and to allow DBus to interface easily with D objects/delegates which is what the library at [1] is doing. So essentially a composite approach where we would use a similar style to [1] but based on the existing GtkD APIs instead of re-importing the C functions and introducing a potentially different memory management strategy.

This is a fair amount of work and this feature, while nice to have, isn't critical so for me this is somewhat low priority.

bijanbina commented 8 years ago

Hi, sorry to interrupt. here I created a minimal working example of gnome-search-provider which is based on cosimoc work. (it upgraded to support gnome 3.20 and maded more minimal). just think that it may helpful to you.

vaijab commented 8 years ago

I am not trying to push or anything. I just wanted to say that I used to use gnome search to switch between terminals quite a lot when I was using gnome-terminal. It is very handy.