Giter Club home page Giter Club logo

sublime-suncycle's Introduction

Unmaintained

This project is no longer maintained (except for PR's, which will still be merged). Feel free to create an issue in case you want to take over and I'll transfer the repository.

SunCycle

Sublime Text 3 layout switch based on sunrise and sunset at your location.

Sublime Text Console

Some of Sublime Text's color schemes are at their best either during day or night. This package lets you automatically switch between 2 color schemes (and optionally a theme) based on your local sunrise and sunset (which takes DST into account).

By default, an IP address lookup with freegeoip.net determines your location. So the switch is adjusted when you travel across timezones.

You can hardcode your coordinates in case you don't prefer an IP lookup or it fails.

Installation

Install with Package Control.

Default preferences

{
    "day": {
        "color_scheme": "Packages/User/Solarized (Light) (SL).tmTheme",
        "theme": "Default.sublime-theme"
    },
    "night": {
        "color_scheme": "Packages/User/Solarized (Dark) (SL).tmTheme",
        "theme": "Default.sublime-theme"
    }
}

The optional latitude and longitude configuration properties allow you to specify a fixed location.

Credits

Inspired by NightCycle and based on Michel Anders' blogpost. Thanks to Stijn Mathysen for contributing the IP lookup.

sublime-suncycle's People

Contributors

jannschu avatar smhg avatar stijnster avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

sublime-suncycle's Issues

not working in ST3

{
    "latitude": 39.9777,
    "longitude": -75.166667,
    "day": {
        "color_scheme": "Packages/Solarized Color Scheme/Solarized (light).tmTheme",
        "theme": "Spacegray Light.sublime-theme"
    },
    "night": {
        "color_scheme": "Packages/Solarized Color Scheme/Solarized (dark).tmTheme",
        "theme": "Spacegray.sublime-theme"
    }
}

Not sure what the issue is here, but I'm not seeing any kind of response. I installed this after dark last night, and now it's morning with no changes.

I should note that I'm running Sublime Text 3 with your latest (1 hour ago) update to SunCycle.

only set theme on startup, day -> night, night -> day

Hi,

when developing the ip2loc lookup functionality, I noticed the plugin checks the day/night setting about every 20sec. Therefor it also sets the theme every 20sec.

Wouldn't it be nicer to set the theme only;

  • on startup
  • when day becomes night
  • when night becomes day

That way, we don't force the theme all day long (suppose I'm in an Espresso Libre mood today). I think it would also improve system performance a bit as it doesn't need to apply the theme when it's already set.

We could extract it into a setting of course.

What do you think. I would be happy to take a look at it and create a patch.

Stijn

Error loading colour scheme, happens as soon as the package is installed

Hi,

I just installed the suncycle package, and I constantly get the following error message:

Error loading colour scheme Packages/User/Solarized (Light) (SL).tmTheme: Unable to open Packages/User/Solarized (Light) (SL).tmTheme

This error message keeps popping up during the usage of the editor, and color highlighting stops working.

A bit confused about why this config isn't working...

Here's my config:

{
    "latitude": 35.1579955,
    "longitude": 136.918805,
    "day": {
        "color_scheme": "Packages/Theme - Spacegray/base16-ocean.light.tmTheme",
        "theme": "Spacegray Light.sublime-theme"
    },
    "night": {
        "color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
        "theme": "Spacegray.sublime-theme"
    }
}

Looks like it should work, but there's no change.

Theme stays on day setting, potential IP issue.

Somethings not right with my installation. I've added the correct settings in the plugins user settings:

{
    "day": {
        "color_scheme": "Packages/Material Theme/schemes/Material-Theme-Lighter.tmTheme",
		"theme": "Material-Theme-Lighter.sublime-theme",
    },
    "night": {
        "color_scheme": "Packages/Colorsublime - Themes/Facebook.tmTheme",
		"theme": "Material-Theme-Palenight.sublime-theme",
    }
}

But the theme, no matter what time of day/night, stays on the 'day' setting. I'm assuming this is an IP issue and so i'd like to set my location manually. How do I do that? I don't see any documentation or instructions on how to do that?

Love the plugin! Let me know asap :)

Cheers,
Jon

gracefully fail on missing connection

SunCycle: <urlopen error [Errno 11004] getaddrinfo failed>
SunCycle: Failed to get a result from http://freegeoip.net/json/
Traceback (most recent call last):
  File "SunCycle.py", line 193, in start
    self.settings = Settings(onChange=self.cycle)
  File "SunCycle.py", line 43, in __init__
    self.load()
  File "SunCycle.py", line 139, in load
    sun = self.getSun()
  File "SunCycle.py", line 92, in getSun
    if 'latitude' in result and 'longitude' in result:
TypeError: argument of type 'NoneType' is not iterable

split up classes

It would be nice to have different classes for the different parameters that each trigger each other and in the end the day/night change.

Roughly:

Settings

IP
triggered by settings
(don't know if this really needs to be a separate class, maybe it is just part of coordinates)

Coordinates
triggered by settings and IP

Timezone
triggered by coordinates

SunCycle
triggered by coordinates and timezone

Each in their own file, each unit tested.
Each with their own caching: persistent (to disk) or in memory.

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.