Git Product home page Git Product logo

notifu's People

Contributors

ixe013 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

notifu's Issues

After clicking on a notification, focus on ShellExperienceHost.exe is never relinquished

All the context for this issue can be found here: https://stackoverflow.com/q/68522402/61624

I will inline that information:

I want a cygwin shell script to create a Windows notification (one of those events you see in the lower right-hand corner). When you click on the notification, I want it to bring another application into focus.

Here's how I'll use this: from the command line, I'll run tests. When they finish, I want to be notified by that with the notification. If I click on that notification, I want cygwin to go back into focus so I can decide what to do next.


Okay this was a huge pain to figure out, so it's worth writing down somewhere to help others. It's not hard to create a notification. It's not hard to focus an application. But it is hard to create a notification that focus is a window when clicked.

First I will start with the script:

set -ex

notification_exit_code=0 # default value, exited successfully
# create a notification that says "Build Done". When notifu64 exits, it's exit code tells why it exited (see below)
notifu64.exe /i 'C:\\cygwin64\\Cygwin-Terminal.ico' /t info /p "Build Done" /m "Build Done" || notification_exit_code=$?

# these are some of the ways the notification could have exited
user_clicked_on_notification=3
notification_timeout=4
user_clicked_on_notification_icon=7
if [[ "$notification_exit_code" -eq "$user_clicked_on_notification" ]] || [[ "$notification_exit_code" -eq "$user_clicked_on_notification_icon" ]]
then
  # The order of the steps is very important or else the window will remain in the background. I figured out these steps from here: https://stackoverflow.com/a/59819671/61624
  nircmd win activate process mintty.exe
  nircmd win settopmost process mintty.exe 1
  nircmd win settopmost process mintty.exe 0
  nircmd win focus process mintty.exe
  # I'm not sure why, but "activate" resizes the window. This puts it back the way it always is on my computer: maximized
  nircmd win max process mintty.exe
fi
if [[ "$notification_exit_code" -eq "$notification_timeout" ]]
then
  # this makes the taskbar icon highlighted to remind me that the build is done even if I don't want to look at it immediately
  nircmd win flash process mintty.exe
fi

notifu64.exe is a commandline tool that can create windows notifications.

nircmd is a commandline tool that can control various aspects of the Windows operating system. In this script, I use it to control application windows.


This is 99% of the way there. The problem is the window still doesn't have focus, even though it brings it to the front. You actually have to click on it. It's the ShellExperienceHost.exe that maintains focus, and I can't figure out how to stop that from happening.

License is not clear BSD-3

Looks like the license this package is issued under is not registering as a standard BSD-3, did you make any modifications to the BSD-3 license?

/d Does Not Work On Windows 11

/d Does Not Work On Windows 11

The pop-up goes away after a few seconds no matter what.

Edit: Known issue but here in case someone runs into it.

Modern Windows version will dismiss the pop-up before the timeout expires.

Mark Project As Archived

Suggest marking this project As Archived

Settings > Danger Zone > Archive this repository

Since clearly no longer supported.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.