Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to hide the window from the taskbar/dock #107

Open
ThuCommix opened this issue Oct 11, 2022 · 3 comments
Open

Possibility to hide the window from the taskbar/dock #107

ThuCommix opened this issue Oct 11, 2022 · 3 comments
Labels
All OS enhancement New feature or request

Comments

@ThuCommix
Copy link

I'm providing my own interface for Spotify with an AvaloniaUI application, and everything is covered through APIs from Spotify except registering a local playback device and play through this. This is only possible with the websdk:

https://developer.spotify.com/documentation/web-playback-sdk/

However as the name suggests it only works in a browser and Avalonia does not support browser like controls (without bundling 200mb chromium) This is where this create project comes to play, I already tried it out and it works absolutely fine with registering the player and having playback BUT: I kinda need to hide the window because in itself it provides no feedback its just for registering the player and having soundout, the JS will be controlled with a websocket connection between the page its displaying and the main Avalonia application.

Is it maybe possible to add the feature that the window can be hidden from the taskbar/dock?

Thanks for reading :)

@ottodobretsberger ottodobretsberger added enhancement New feature or request All OS labels Oct 13, 2022
@vitash
Copy link

vitash commented Feb 13, 2025

I made the following implementation on the windows platform and it works

    [DllImport("user32.dll")]
    public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

    [DllImport("user32.dll")]
    public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

    public static void SetTaskbarHide(nint hWnd) {
        const int GWL_EXSTYLE = -20; 
        const int WS_EX_TOOLWINDOW = 0x80;  

        var currentStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
        var newStyle = currentStyle | WS_EX_TOOLWINDOW;
        SetWindowLong(hWnd, GWL_EXSTYLE, newStyle);
    }

@MikeYeager
Copy link
Collaborator

@vitash Thanks for providing this. It can be a work-around for Windows until we get some time to implement it in Photino.NET for all OSs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
All OS enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants