GithubHelp home page GithubHelp logo

jibedoubleve / lanceur-bis Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 1.13 MB

A free adaptation of Slickrun written in .NET

License: GNU General Public License v3.0

C# 99.53% Inno Setup 0.36% PowerShell 0.11%
productivity launcher wox launcher-application launchy lanceur slickrun

lanceur-bis's People

Contributors

jibedoubleve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lanceur-bis's Issues

Plugin: Pomodoro

A pomodoro that notify user on a regular basis

Pomodoro cycle

  • Work for 25 minutes
  • Pause for 10 minutes
  • After 4 cycle, a pause of 35 minutes
Command Explanation
pomodoro start Starts the pomodoro with the configured values or default
pomodoro for 4 hours Starts the pomodoro for 4 hours
pomodoro stop Stops the pomodoro
pomodoro set 30 15 40 Set values for (in that order) Work, Pause, Big Pause

Configure GitFlow for PR

Actions

  • Rename branch main to develop
  • Create branch master
  • Add actions to build & test when a PR is done in develop
  • Add actions to build & release when a push is done in master
  • Remove action main_pr

`Querybox` becomes transparent

Quand MainView passe en arrière plan puis en avant plan, le texte reste dans la fenêtre. Il faut que la fenetre disparaisse quand elle passe en arrière plan

Handle process output

When launching alias, we launch process. I should handle error.

Flow.Launcher does it like this:

protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
{
    using var process = Process.Start(startInfo);
    if (process == null)
    {
        Log.Error("|JsonRPCPlugin.ExecuteAsync|Can't start new process");
        return Stream.Null;
    }


    var sourceBuffer = BufferManager.GetStream();
    using var errorBuffer = BufferManager.GetStream();


    var sourceCopyTask = process.StandardOutput.BaseStream.CopyToAsync(sourceBuffer, token);
    var errorCopyTask = process.StandardError.BaseStream.CopyToAsync(errorBuffer, token);


    await using var registeredEvent = token.Register(() =>
    {
        if (!process.HasExited)
            process.Kill();
        sourceBuffer.Dispose();
    });


    try
    {
        // token expire won't instantly trigger the exception, 
        // manually kill process at before
        await process.WaitForExitAsync(token);
        await Task.WhenAll(sourceCopyTask, errorCopyTask);
    }
    catch (OperationCanceledException)
    {
        await sourceBuffer.DisposeAsync();
        return Stream.Null;
    }


    switch (sourceBuffer.Length, errorBuffer.Length)
    {
        case (0, 0):
            const string errorMessage = "Empty JSON-RPC Response.";
            Log.Warn($"|{nameof(JsonRPCPlugin)}.{nameof(ExecuteAsync)}|{errorMessage}");
            break;
        case (_, not 0):
            throw new InvalidDataException(Encoding.UTF8.GetString(errorBuffer.ToArray())); // The process has exited with an error message
    }


    sourceBuffer.Seek(0, SeekOrigin.Begin);
    
    return sourceBuffer;
}

FlowLauncher is using RecyclableMemoryStream

Issue in the options

When loading settings and select the shortcuts list, it's not loaded the first time?

Add counter for non alias

Linked to issue #87

Description

image

Todo

  • Udpate keywords
  • Update plugins
  • Update Macros

Remarks

The counter is not implemented, as plugins are not much used so far. I'll wait for more intensive usage of plugins to decide to implement this or not. (cf. #87)

Create a repository for plugins

Create a repository where user can find & download plugins

Todo

  • Create a GitHub project where you can download the plugins

Fix unit tests

These two tests should be deactivated as the success depends on the state of the machine. In other words, Microsoft To Do version 2.85.53361.0 should be installed. And as soon as this version is updated, these tests will start to fail.

[Theory]
[InlineData(@"C:\Program Files\WindowsApps\Microsoft.Todos_2.73.51701.0_x64__8wekyb3d8bbwe\Todo.exe", "Microsoft.Todos_8wekyb3d8bbwe!App")]
[InlineData(@"C:\ProgramData\chocolatey\bin\ZoomIt64a.exe", "")]
public void ReturnAppUniqueId(string path, string expected)
{
var mgr = new PackagedAppManager();
mgr.GetPackageUniqueIdAsync(path)
.Should().Be(expected);
}
[Theory]
[InlineData(@"C:\Program Files\WindowsApps\Microsoft.Todos_2.73.51701.0_x64__8wekyb3d8bbwe\Todo.exe", true)]
[InlineData(@"C:\ProgramData\chocolatey\bin\ZoomIt64a.exe", false)]
public void CheckIsPackage(string path, bool expected)
{
var mgr = new PackagedAppManager();
mgr.IsPackageAsync(path)
.Should().Be(expected);
}

Plugin: lorem ipsum

Description

With a keyword, some lorem ipsum is set in the clipboard.

Examples:

Command Explanations
lorem Put for instance 150 words in the clipboard
lorem 255 Put 255 words in the clipboard

Documentation

There's a free API HERE

Cannot add packaged app

Todo

  • Fix issue
  • Make new methods async
  • Add icon to alias
  • Move validation out of private async Task<Unit> OnSaveOrUpdateAlias(AliasQueryResult alias). The idea is to create an UpdateAction
  • Optimise UI (show when working)
  • Check whether fix is working when updating an existing keyword

Fix logging

Some logs are incomplete

  • Executing 'C:\Program Files (x86)\Log Reader\Probel.LogReader.exe' with args ''
  • Current QueryResult is null. Should indicate the query text

Rearrange flow in Alias execution

This code can maybe be reordered as followed

private async Task<SearchContext> OnExecuteAliasAsync(ExecutionContext context)
{
context ??= new ExecutionContext();
var cmd = _cmdlineManager.BuildFromText(context.Query);
if (cmd.Parameters.IsNullOrWhiteSpace() && CurrentAlias is ExecutableQueryResult e)
{
cmd = _cmdlineManager.CloneWithNewParameters(e.Parameters, cmd);
}
IEnumerable<QueryResult> results = new List<QueryResult>();
var scope = new Scope<bool>(x => IsSearchActivated = x, false, true);
using (scope.Open())
{
if (CurrentAlias is null)
{
_log.Warning("Current QueryResult is null");
results = DisplayQueryResult.SingleFromResult($"This alias does not exist");
KeepAlive = true;
}
else if (CurrentAlias is IExecutable exec)
{
_log.Trace($"Found {results.Count()} element(s)");
Query = CurrentAlias is IQueryText t ? t.ToQuery() : CurrentAlias.ToQuery();
if (exec is IExecutableWithPrivilege exp)
{
exp.IsPrivilegeOverriden = context.RunAsAdmin;
}
results = await exec.ExecuteAsync(cmd);
KeepAlive = results.Any();
}
else
{
_log.Info($"Alias '{CurrentAlias.Name}', is not executable. Add as a query");
KeepAlive = true;
results = Results;
}
}
return new() { Results = results };
}

 flowchart TD
    id1(Build cmdline from user query)
    id2{{Has cmdline parameters?}}
    id3(Replace params with user params)
    id4{{Is CurrentAlias null}}
    id5(Nothing to execute)
    id6{{Is Executable}}
    id7(Execute it)
    id8(Display results)

    id4 -->|yes| id5
    id4 -->|no| id6
    id6 -->|yes| id1
    id1 --> id2
    id2 -->|no| id3
    id3 --> id7
    id2 -->|yes| id7
    id6 -->|no| id8
    id7 --> id8

Sometimes extract thumbnails fails

Code

throw new COMException($"Error while extracting thumbnail for {fileName}", Marshal.GetExceptionForHR((int)hr));

Logs

Message

Failed to extract thumbnail for C:\Users\jibedoubleve\AppData\Local\Programs\signal-desktop\Signal.exe

Stack trace

System.Runtime.InteropServices.COMException (0x80004005): Error while extracting thumbnail for C:\Users\jibedoubleve\AppData\Local\Programs\signal-desktop\Signal.exe
 ---> System.Runtime.InteropServices.COMException (0x8000000A): The data necessary to complete this operation is not yet available. (0x8000000A)
   at Lanceur.Ui.WindowsThumbnailProvider.GetHBitmap(String fileName, Int32 width, Int32 height, ThumbnailOptions options) in D:\Projects\lanceur-bis\src\Lanceur\Ui\WindowsThumbnailProvider.cs:line 134
   at Lanceur.Ui.WindowsThumbnailProvider.GetThumbnail(String fileName, Int32 width, Int32 height, ThumbnailOptions options) in D:\Projects\lanceur-bis\src\Lanceur\Ui\WindowsThumbnailProvider.cs:line 150
   at Lanceur.Ui.ThumbnailLoader.GetThumbnail(String path, ThumbnailOptions options) in D:\Projects\lanceur-bis\src\Lanceur\Ui\ThumbnailLoader.cs:line 47
   at Lanceur.Ui.ThumbnailLoader.Get(String path) in D:\Projects\lanceur-bis\src\Lanceur\Ui\ThumbnailLoader.cs:line 85

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.