Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WinMsg displays a message in the full-screen window and exits after timeout. Designed for use with Sunshine/Moonlight streaming.

NotificationsYou must be signed in to change notification settings

CrazyCoder/WinMsg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a very basic Windows GUI application that takes amessage to display and atimeout as the parametersand does exactly that. The message is displayed in the center of the blackfull-screen window in large white text,then the app exits automatically.

Example

I wrote it forSunshine /Moonlightstreaming as a companion application when running command-line tools on a host via Moonlight.

The common use case is to control the host PC state (Shut down /Sleep /Hibernate) with the toolslikeNirCmd.

Instead of the black screen and an error dialog, if the connection is aborted unexpectedly, the user will see themessage from this app, then the stream will close gracefully after the app exists.

This project page and documentation below also serve as a guide how to set up sleep/shutdown via Sunshine appshortcuts for Moonlight so that you can manually control your host state directly from a client.

Of course, there are other solutions for that:

  • add anUndo command in Sunshine to run a tool that will suspend the PC when the app you stream exists
  • configure Windows Power profile to sleep/hibernate/shutdown after N minutes of inactivity
  • if streaming from Steam Deck,useMoonDeck/MoonDeck Buddyto control the PC state
  • for true nerds, use HomeAssistant withHASS Agent andaWOL switch so that you can control the host PC via voicecommands, HA dashboard, CLI and automations

While all the above will work just fine, sometimes you may want to manually force the streaming host to sleep directlyfrom the client. That is where the below guide should help.

Usage

winmsg.exe [<message>] [<timeout>]

The message is the actual message to display, make sure to surround it with double quotes if it contains spaces.Timeout is the time in milliseconds to display the message. The app exits after timeout.

Example:

winmsg.exe "Going to sleep..." 5000

This will show the "Going to sleep..." message in the center of the black screen and exit after 5 seconds (5000ms).

If no parameters are provided, the app will show the empty black screen with no text and exit after 5 seconds.

Sample Sunshine Application configuration to suspend the PC via NirCmd

Click to show the screenshot

Sunshine Sleep App

Open Applications settings in Sunshine Web UI (https://<sunshine-pc>:47990/apps), clickAdd New.

Make sure to download and installNirCmd so that it's available in yourPATH (or adjust theDetached Command to use the full path tonircmd.exe). This app can do many things, includingputting the PC in sleep mode (standby command), shutting down the PC (exitwin shutdown),rebooting (exitwin reboot), andmuch more.

In this example, we use the following command in theDetached Commands section (to be run in the background):

nircmd.exe cmdwait 20000 standby

cmdwait 20000 waits 20 seconds before forcing the PC to sleep, this allows Moonlight to disconnect properly andSunshine to run "Undo" commands, if needed. Feel free to use a shorter delay.

As the mainCommand we use this 'winmsg.exe' tool to display a message and exit after timeout:

winmsg.exe "Sleeping..." 5000

Recommended options:

  • Global Prep Commands:Disabled — this allows the command to run faster as the global Do/Undo commands will notrun
  • Continue streaming if the application exits quickly:Uncheck — the app will quick quickly anyway, we don't wantany special handling by Sunshine
  • Continue streaming until all app processes exit:Uncheck — also not needed for our case
  • Exit Timeout: 0 — for faster exit if forced by the client
  • cmdwait value should be greater thanwinmsg timeout (20000 > 5000 in this example)

If you run the configuredSleep app via Moonlight, it will start the streaming session, run thenircmd.exe inbackground with the timeout, runwinmsg.exe as your main streaming app, you will see the specified message, after5 seconds the app will exit, Moonlight will close the streaming session and then the PC with Sunshine will go to sleepafter ~15 more seconds.

Click for Moonlight Sleep shortcut sample

Sunshine Sleep App

Compiling

This project can be built on Windows withMinGW/CMake.

Insidemingw64 shell,cd into the project root directory, then:

pacman -S mingw-w64-x86_64-ninjapacman -S mingw-w64-x86_64-cmakemkdir buildcd buildcmake ..cmake --build . --config Release

winmsg.exe file will be in thebuild directory.

You can also useJetBrains CLion IDE to open this project and build it right awayas it already comes with MinGW toolchain and CMake build tool.

Or just download the pre-compiled binary from theReleases page.

About

WinMsg displays a message in the full-screen window and exits after timeout. Designed for use with Sunshine/Moonlight streaming.

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp