Coder Social home page Coder Social logo

jeff2ma / launchd-with-networkchange Goto Github PK

View Code? Open in Web Editor NEW
128.0 6.0 21.0 155 KB

A tool with shell script and launchd to trigger actions whenever a Mac's network information is changed.

License: MIT License

Shell 19.41% Python 69.17% AppleScript 11.42%
launchd trigger-actions macos network

launchd-with-networkchange's Introduction

launchd with networkchange

A tool with shell script and launchd to trigger actions whenever a Mac's network information is changed.

[简体中文版使用说明] 请点击这里

Introduction

This repo is an easy way to deal with contexts like:

At workplace, your Mac Device has to make some settings such as change proxy address, set specical pac file, open some apps and so on. While at home your have change it again to others.

With the help of launchd, those operations can be automated. And that's what this repo do! It is fast, easy and safe.

Features

  • Easy to install and uninstall.

  • Password of your system account will be saved in keychain safely.

  • Add example so that your can easily change the code according to your conditions.

How to start

$ git clone https://github.com/Jeff2Ma/launchd-with-networkchange

$ cd launchd-with-networkchange

$ python install.py

Then input the info when is asked.

After that, please edit the code in example.sh according to your conditions.

When your Mac's network change, a notification will show when it run shell script with success.

Notices

  1. When the first run of the script, system will ask you like:

Remember to choose Always Allow.

2)you can make a example.sh copy one and rename it to dynamic.sh, it will be run instead of example.shsee how it work.

  1. If you want to uninstall it, you can run python install.py uninstall.

  2. Check /var/log/system.log if you are having issues with plist.

Contributing

Thanks to this Repo and this Alfred Workflow to provide inspiration for me.

Issues and Pull requests are warm welcome.

launchd-with-networkchange's People

Contributors

jeff2ma avatar simonfang1 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  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  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

launchd-with-networkchange's Issues

can't run

Failed to run ln -s script!
/Users/kemychen/local/launchd-with-networkchange-master/com.devework.onnetworkchange.plist: Path had bad ownership/permissions

请教下关于WiFi开关判定的问题

你好,非常感谢你的这个脚本。
在你的脚本基础上进行修改
想实现在WiFi关闭时退出V2ray
WiFi开启时在不同地点不同模式
但不管怎么修改,都无法实现“WiFi关闭退出V2ray”这个操作
其他的跳不同模式却又正常
麻烦帮忙看下问题出在哪里,谢谢

代码文件:
example.sh.txt

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.