GithubHelp home page GithubHelp logo

horacehylee / shutd Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 364 KB

Auto shutdown utility tool for Windows with popup and snooze features

License: MIT License

Go 98.29% Batchfile 1.71%
shutdown shutdown-helper golang windows snooze shutdown-timer shutdown-manager

shutd's Introduction

๐Ÿ›‘ Shutd

Auto shutdown utility tool for Windows with popup and snooze features

Screenshot

๐Ÿ”จ Build

-ldflags -H=windowsgui compile flags is to avoid opening a console at application startup

go install -ldflags -H=windowsgui ./cmd/shutd

๐Ÿ›  Usage

If wanted to run it sliently (i.e. without any console popup) at start up, you may do the following

(Not sure why simply running shutd.exe in Startup with -ldflags -H=windowsgui could not trigger the shutdown properly)

  1. Create a shutd.vbs at any folder
Set WshShell = CreateObject("WScript.Shell") 
gopath = WshShell.ExpandEnvironmentStrings("%GOPATH%")
WshShell.Run chr(34) & gopath & "\bin\shutd.exe" & Chr(34), 0
Set WshShell = Nothing
  1. Create a shortcut and choose shutd.vbs that you created as target

  2. Move the shortcut to start up folder, simply search Startup from Windows explorer

  3. You should be able to see shutd.exe running in task manager next time when it starts up

โš™ Configuration

Following set of default configurations will be generated under home directory %USERPROFILE%/.shutd.yaml

Feel free to tweak it for your liking

After updated the configuration, shutd will automatically pick up the latest config, no need to restart it manually

startTime: "01:00"
snoozeInterval: 15
notification:
  before: 10
  duration: 10
Property Default Value Remarks
startTime "01:00" Time for auto shutdown
snoozeInterval 15 Minutes that will snooze for shutdown
notification.before 10 Minutes before shutdown for snooze popup notification
notification.duration 10 Minutes for snnoze popup notification to default to not snooze

๐Ÿ“ƒ Logging

Log file will be generated under you home directory %USERPROFILE%/.shutd.log

Troubleshoot error there if wanted

๐Ÿšข Release

go install github.com/mitchellh/gox@latest

gox -os=windows -ldflags -H=windowsgui -output ./build/{{.Dir}}_{{.OS}}_{{.Arch}} ./cmd/shutd

๐Ÿ“œ License

Distributed under the MIT License. See LICENSE for more information.

shutd's People

Contributors

horacehylee avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

shutd's Issues

Bug: Snooze notification popup does not trigger after first closed

Bug: Snooze notification popup does not trigger after first closed

Missing 2nd Snooze notification

time="2022-02-08T10:38:40+08:00" level=info msg="=========================="
time="2022-02-08T10:38:40+08:00" level=info msg=Started
time="2022-02-08T10:38:40+08:00" level=info msg="=========================="
time="2022-02-08T10:38:40+08:00" level=info msg="config: {SnoozeInterval:15 StartTime:01:00 Notification:{Before:10 Duration:10}}"
time="2022-02-08T10:38:40+08:00" level=info msg="job: [shutdown], scheduled: 01:00 (2022-02-09 01:00:00 +0800 CST)"
time="2022-02-08T10:38:40+08:00" level=info msg="job: [snoozeNotification], scheduled: 00:50 (2022-02-09 00:50:00 +0800 CST)"
time="2022-02-08T19:00:00+08:00" level=info msg="=========================="
time="2022-02-08T19:00:00+08:00" level=info msg="Config file changed:C:\\Users\\horac\\.shutd.yaml"
time="2022-02-08T19:00:00+08:00" level=info msg="=========================="
time="2022-02-08T19:00:00+08:00" level=info msg="config: {SnoozeInterval:15 StartTime:01:00 Notification:{Before:10 Duration:10}}"
time="2022-02-08T19:00:00+08:00" level=info msg="job: [shutdown], scheduled: 01:00 (2022-02-09 01:00:00 +0800 CST)"
time="2022-02-08T19:00:00+08:00" level=info msg="job: [snoozeNotification], scheduled: 00:50 (2022-02-09 00:50:00 +0800 CST)"
time="2022-02-09T00:50:00+08:00" level=info msg="=========================="
time="2022-02-09T00:50:00+08:00" level=info msg="Snooze notification"
time="2022-02-09T00:50:00+08:00" level=info msg="=========================="
time="2022-02-09T00:55:20+08:00" level=info msg="snooze is required: true"
time="2022-02-09T00:55:20+08:00" level=info msg="job: [shutdown], scheduled: 01:15 (2022-02-09 01:15:00 +0800 CST)"
time="2022-02-09T00:55:20+08:00" level=info msg="job: [snoozeNotification], scheduled: 01:05 (2022-02-09 01:05:00 +0800 CST)"
time="2022-02-09T00:55:24+08:00" level=info msg="job: [shutdown], scheduled: 01:30 (2022-02-09 01:30:00 +0800 CST)"
time="2022-02-09T00:55:24+08:00" level=info msg="job: [snoozeNotification], scheduled: 01:20 (2022-02-09 01:20:00 +0800 CST)"
time="2022-02-09T00:55:26+08:00" level=info msg="job: [shutdown], scheduled: 01:45 (2022-02-09 01:45:00 +0800 CST)"
time="2022-02-09T00:55:26+08:00" level=info msg="job: [snoozeNotification], scheduled: 01:35 (2022-02-09 01:35:00 +0800 CST)"
time="2022-02-09T00:55:28+08:00" level=info msg="job: [shutdown], scheduled: 02:00 (2022-02-09 02:00:00 +0800 CST)"
time="2022-02-09T00:55:28+08:00" level=info msg="job: [snoozeNotification], scheduled: 01:50 (2022-02-09 01:50:00 +0800 CST)"
time="2022-02-09T01:55:23+08:00" level=info msg="job: [shutdown], scheduled: 02:15 (2022-02-09 02:15:00 +0800 CST)"
time="2022-02-09T01:55:23+08:00" level=info msg="job: [snoozeNotification], scheduled: 02:05 (2022-02-09 02:05:00 +0800 CST)"
time="2022-02-09T02:14:41+08:00" level=info msg="job: [shutdown], scheduled: 02:30 (2022-02-09 02:30:00 +0800 CST)"
time="2022-02-09T02:14:41+08:00" level=info msg="job: [snoozeNotification], scheduled: 02:20 (2022-02-09 02:20:00 +0800 CST)"

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.