Skip to content

Commit 7b5be27

Browse files
committed
Add copy link to clipboard command
#32
1 parent dab09f4 commit 7b5be27

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Flow.Launcher.Plugin.OneNote/Icons/IconProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class IconProvider : BaseModel
3030
public string Warning => settings.IconTheme == IconTheme.Color
3131
? $"{IC.ImagesDirectory}{IC.Warning}.{GetIconThemeString(IconTheme.Dark)}.png"
3232
: GetIconPath(IC.Warning);
33+
public static GlyphInfo Clipboard { get; } = new("/Resources/#Segoe Fluent Icons", "\uf0e3"); // Clipboard
3334

3435
public int CachedIconCount => iconCache.Keys.Count(k => char.IsDigit(k.Split('.')[1][1]));
3536
public DirectoryInfo GeneratedImagesDirectoryInfo { get; }

Flow.Launcher.Plugin.OneNote/ResultCreator.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Concurrent;
32
using System.Collections.Generic;
43
using System.Linq;
54
using System.Threading.Tasks;
@@ -313,14 +312,15 @@ public List<Result> ContextMenu(Result selectedResult)
313312
return true;
314313
}
315314
});
315+
316316

317317
string autoCompleteText = GetAutoCompleteText(item);
318318
results.Add(new Result
319319
{
320320
Title = "Show in Notebook Explorer",
321321
SubTitle = autoCompleteText,
322322
AddSelectedCount = false,
323-
Score = 0,
323+
Score = 10,
324324
IcoPath = iconProvider.NotebookExplorer,
325325
Action = _ =>
326326
{
@@ -329,6 +329,20 @@ public List<Result> ContextMenu(Result selectedResult)
329329
return false;
330330
}
331331
});
332+
333+
results.Add(new Result
334+
{
335+
Title = "Copy link to clipboard",
336+
Glyph = IconProvider.Clipboard,
337+
Score = 0,
338+
AddSelectedCount = false,
339+
Action = _ =>
340+
{
341+
OneNoteApp.ComObject.GetHyperlinkToObject(item.Id, string.Empty, out var hyperlink);
342+
context.API.CopyToClipboard(hyperlink);
343+
return true;
344+
}
345+
});
332346
}
333347
return results;
334348
}

0 commit comments

Comments
 (0)