Coder Social home page Coder Social logo

zebradil / tw-wifi-contexter Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 7 KB

Simple hook for taskwarrior which switches context according to WIFI SSID.

License: MIT License

Makefile 6.29% Python 93.71%
taskwarrior productivity task-manager tasklist

tw-wifi-contexter's Introduction

tw-wifi-contexter

Simple hook for taskwarrior which switches context according to WIFI SSID. Currently only MacOS is supported.

The hook executes on each invocation of task command. If it can get WIFI SSID, that SSID is listed in config, and according context is not set, then the hook sets this context. If SSID is unknown or appropriate context already active, the hook does nothing.

Usage

All you need is to copy hook in hooks directory and create config. Config is ini-file with one section [DEFAULT]. Keys are contexts, values are lists of SSIDs. For example:

[DEFAULT]
work=office, office_guest
home=MY_WIFI_SPOT
# Copy `on-launch.switch-context.py` to hooks directory (it's `~/.task/hooks` by default).
cp src/on-launch.switch-context.py ~/.task/hooks/

# Create ini config in hooks directory
cp ssid_context_map.ini.example ~/.task/hooks/ssid_context_map.ini

# Set mappings: context-to-SSIDs
vim ~/.task/hooks/ssid_context_map.ini

TODO

  • support for Windows and Linux
  • tests
  • on/off hook switcher in taskwarrior config
  • action for unknown SSID

tw-wifi-contexter's People

Contributors

zebradil avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

tw-wifi-contexter's Issues

Failed with disabled WiFi

Traceback (most recent call last):
  File "/Users/glashevich/.task/hooks/on-launch.switch-context.py", line 83, in <module>
    main()
  File "/Users/glashevich/.task/hooks/on-launch.switch-context.py", line 14, in main
    ssid = get_ssid()
  File "/Users/glashevich/.task/hooks/on-launch.switch-context.py", line 69, in get_ssid
    return get_ssid_macosx()
  File "/Users/glashevich/.task/hooks/on-launch.switch-context.py", line 53, in get_ssid_macosx
    key, val = [x.strip() for x in row.split(':', 1)]
ValueError: not enough values to unpack (expected 2, got 1)

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.