Skip to content

Commit

Permalink
Add taskbar state/progress control api
Browse files Browse the repository at this point in the history
  • Loading branch information
shatyuka committed Jan 4, 2025
1 parent 28e3d7f commit 291957d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion CollapseLauncher/Classes/Helper/WindowUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Hi3Helper.Win32.Native.ManagedTools;
using Hi3Helper.Win32.Native.Structs;
using Hi3Helper.Win32.Screen;
using Hi3Helper.Win32.TaskbarListCOM;
using Hi3Helper.Win32.ToastCOM.Notification;
using Microsoft.Graphics.Display;
using Microsoft.UI;
Expand All @@ -21,7 +22,6 @@
using Microsoft.UI.Xaml.Media;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Windows.Foundation;
using Windows.Graphics;
Expand Down Expand Up @@ -55,6 +55,8 @@ internal static class WindowUtility
internal static WindowId? CurrentWindowId;
internal static OverlappedPresenter? CurrentOverlappedPresenter;

private static readonly TaskbarList Taskbar = new();

internal static DisplayArea? CurrentWindowDisplayArea
{
get
Expand Down Expand Up @@ -857,5 +859,17 @@ private static void Service_ToastNotificationCallback(string app, string arg, Di
// TODO: Make the callback actually usable on elevated app
}
#endregion

#region Taskbar Methods
public static int SetTaskBarState(nint hwnd, TaskbarState state)
{
return Taskbar.SetProgressState(hwnd, state);
}

public static int SetProgressValue(nint hwnd, ulong completed, ulong total)
{
return Taskbar.SetProgressValue(hwnd, completed, total);
}
#endregion
}
}
2 changes: 1 addition & 1 deletion Hi3Helper.Win32

0 comments on commit 291957d

Please sign in to comment.