Added pasting new memes, fixed offsets and changed out tray icon.

This commit is contained in:
Ebbe Baß
2026-08-19 10:15:16 +02:00
parent 4c755919d4
commit b6644ebecf
11 changed files with 226 additions and 9 deletions
@@ -188,6 +188,54 @@ public partial class PickerViewModel : ObservableObject
}
}
/// <summary>
/// Synchronous peek so the Ctrl+V key handler can decide immediately whether to swallow the
/// keystroke (image on the clipboard) or let it through to the search box (plain text).
/// </summary>
public ClipboardImportPayload? ReadClipboardImage()
{
try
{
return _clipboard.TryReadImage();
}
catch (Exception)
{
// Another process holding the clipboard shouldn't break the keystroke entirely.
return null;
}
}
public async Task ImportClipboardAsync(ClipboardImportPayload payload)
{
try
{
if (payload.HasFiles)
{
await ImportPathsAsync(payload.FilePaths!);
return;
}
if (!payload.HasBytes) return;
var name = $"pasted-{DateTime.Now:yyyy-MM-dd-HHmmss}{payload.Extension}";
var record = await _library.ImportBytesAsync(payload.Data!, payload.Extension!, name);
if (record is null)
{
StatusMessage = "Couldn't add that image.";
return;
}
ActiveSource = MemeSource.Local;
RefreshLocalItems();
StatusMessage = $"Pasted {name}";
}
catch (Exception ex)
{
StatusMessage = $"Couldn't paste image: {ex.Message}";
}
}
public async Task ImportPathsAsync(IEnumerable<string> paths)
{
var candidates = paths