pop-os / shell

Pop!_OS Shell
GNU General Public License v3.0
4.84k stars 262 forks source link

Extending Launcher? #198

Closed latefield closed 3 years ago

latefield commented 4 years ago

Hey there!

I've been working with the shell all day, and I really think this project is excellent. Thank you very much for all of the hard work.

One of my favorite parts is the launcher, it's a really intuitive way to navigate between the different tiles and launch applications. I also spend a lot of time on Mac OS where I've used quicksilver and, most recently, Alfred.

There are things that I wish it could do, like open a URL in the default browser. I don't know your design concept around the scope of the launcher, but it might be interesting to explore extensions to enable different actions in the launcher.

AdamoPrincipe commented 4 years ago

I use the Ulauncher for that. https://ulauncher.io/

@tinycrimsonpandas maybe you can try that.

dhollinger commented 4 years ago

@AdamoPrincipe Ulauncher is great (I use it, too) but i'd rather not have two launchers running. So, either the ability to extend the Pop Shell Launcher or disable it entirely (in favor of something like uLauncher) would be great.

mmstick commented 4 years ago

Discussions on possible implementations are welcome

latefield commented 4 years ago

I agree that I wouldn't really want to operate two different launchers.

Perhaps there are three options:

If I wanted to take a look at the launcher code as it exists today, where in the source can I find that?

not7cd commented 4 years ago

This file should interest you https://github.com/pop-os/shell/blob/1d9c5b8d7e34763ce2f7b172ee879256e652488d/src/launcher.ts

I would like to create a custom mode, which would invoke a custom command. Custom mode g:$1 would run the custom command like firefox -search "$1"

nicolae-stroncea commented 4 years ago

@not7cd, @tinycrimsonpandas you can change the following things in src/launcher.ts:

Make a google search by typing gg in pop shell launcher

  1. Change the MODES variable to the following: const MODES = [':', 't:', '=','gg'];
  2. Inside of apply method in launcher.ts, add this as the last if check:
    else if (id.startsWith('gg')) {
    const expr = id.slice(2).trim().toString();
    const query = 'https://www.google.com/search?q=' + expr.replace(/ /g, '+');
    const cmd = 'xdg-open ' + query;
    log.debug(cmd);
    spawnCommandLine(cmd);
    }

Launch a webpage by typing url from pop shell launcher

  1. Change the MODES variable to the following: const MODES = [':', 't:', '=','url'];
  2. Inside of apply method in launcher.ts, add this as the last if check:
    else if (id.startsWith('url')){
    let url = id.slice(3).trim().toString();
    if(!(url.startsWith('https:') || url.startsWith('http:'))){
        url = 'https://'.concat(url);
    }
    const cmd = 'xdg-open ' + url;
    log.debug(cmd)
    spawnCommandLine(cmd)
    }

If you want both changes, just add both sectios.

I would add this as a PR, but I'm not sure if @mmstick would like extensions to be done directly inside of launcher.ts.

WatchMkr commented 4 years ago

The next step for us is working through UX interactions between the Activities overview and new Pop Shell functionality. As that work takes shape, the launcher features will come into focus.

A lot of these ideas are great and I suspect many will make it in. Keep them coming! We’ll take a careful and deliberate approach so the result is a cohesive experience throughout the desktop.

anzanhoshin commented 4 years ago

I use the Gnome launcher or Albert to open frequently used documents and files. Without this, I find Pop Launcher pretty useless.

Anzan Hoshin roshi

On Sat., May 2, 2020, 11:53 a.m. WatchMkr, notifications@github.com wrote:

The next step for us is working through UX interactions between the Activities overview and new Pop Shell functionality. As that work takes shape, the launcher features will come into focus.

A lot of these ideas are great and I suspect many will make it in. Keep them coming! We’ll take a careful and deliberate approach so the result is a cohesive experience throughout the desktop.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pop-os/shell/issues/198#issuecomment-622974499, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALCCCKXIDOZRPNEEDXB2XELRPQ6ZJANCNFSM4MLE3H3A .

nicolae-stroncea commented 4 years ago

I would also find a file search ordered by frequently used documents very useful. Since Ulauncher has some extensions for that, maybe they can be forked:

WatchMkr commented 4 years ago

Adding comments from https://github.com/pop-os/shell/issues/257 to consolidate Launcher discussion.

Issue/Bug Description:

I would like to hack around the PopOS launcher to integrate pass with it, much like I used with an albert extension.

However, looking at the source code for the launcher, while is does allow special syntax like :, :t > and =, it does not seem to be made customisable.

I could provide an extension as a PR to this repo but I bet you'd prefer to have those in dedicated repositories. Not everyone uses pass.

Steps to reproduce (if you know):

Expected behavior:

It should work like this:

I open the launcher with <super> - /
I enter :pass in it, this directs the query to the pass extension we are talking about
The extension filters available passwords by fuzzy-matching whatever I put after :pass
On pressing enter on the desired entry, it is copied to my clipboard

Other Notes:

As the PopOS launcher is new and "bare" if I may say, it's probably worth looking at being compatible with extensions from popular launchers like Rofi or Albert. That would save everyone a lot of work.

LouisKottmann commented 4 years ago

I'd like to insist on the:

As the PopOS launcher is new and "bare" if I may say, it's probably worth looking at being compatible with extensions from popular launchers like Rofi or Albert. That would save everyone a lot of work.

I'd even say: maybe it's preferable to just use one of the great launchers out there, unless Pop Launcher does something very specific?

JordyScript commented 3 years ago

Some great suggestions to extend the pop shell launcher. Could we get some feedback on what direction the team is considering? (e.g. allowing for user extensions? baking in the additional functionality outright? not doing anything beyond what launcher does now?)

My own suggestion would be a knowledge management tool that queries a local key value store.

What How
Get to clipboard need [Key]
Save need [KeyWithoutSpaces] [Value]
Delete need delete [Key]
Open Storage file need open
Reload Storage file need reload

Inspiration taken from the need plugin for Wox launcher

To implement the storage file, I would suggest TOML because it's easily human readable and it allows for multiline strings, which you could then insert through directly editing the storage file.

What do you guys think?

JordyScript commented 3 years ago

I'd even say: maybe it's preferable to just use one of the great launchers out there, unless Pop Launcher does something very specific?

What the pop launcher does well is:

The more (well suited) features it offers, the more it enhances the user experience.

mmstick commented 3 years ago

There will be support for custom scripts, plugins, etc. It's the next big area that I'm looking to improve now that the most glaring issues with stacking and tiling have been ironed out.

There will be some improvements to the way the current built-in features work, and some additional built-in features that are necessary for essential system functions. Basic things such as volume control, session control, opening a folder, recent documents, and running a local script.

Ulauncher is a great source of inspiration for how a launcher should ideally function, but the way that their plugins work are sadly not generic enough to port over to Pop Shell. Pop Shell will use a simple launcher API that uses IPC, so libraries won't be required to write plugins for it.

Scripts will declare their accepted prefixes and aliases. The launcher will choose a plugin to query if search box has a compatible query. The plugin will respond to tell the launcher about available options, and each option will have a name, description, icon, and ID. The launcher will pass back an ID if selected, and the plugin will be able to either give more options, give feedback for the entry, do nothing, or close the launcher. The IPC approach is ideal because plugins will need to dynamically update search results as the query is dynamically modified. That should cover virtually everyone's unique needs, and I'll try to make it as simple as possible to write plugins for.