This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/geolocation/packages.el

75 lines
2.4 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- Geolocation Layer packages File for Spacemacs
2015-06-21 14:42:44 +00:00
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq geolocation-packages
2015-06-21 14:42:44 +00:00
'(
osx-location
sunshine
theme-changer
popwin
2015-06-21 14:42:44 +00:00
))
(defun geolocation/init-osx-location ()
2015-06-21 14:42:44 +00:00
"Initialize osx-location"
(use-package osx-location
:if geolocation-enable-osx-location-service-support
2015-06-21 14:42:44 +00:00
:init
(progn
(add-hook 'osx-location-changed-hook
(lambda ()
(setq calendar-latitude osx-location-latitude
calendar-longitude osx-location-longitude)
(unless (bound-and-true-p calendar-location-name)
2015-06-21 14:42:44 +00:00
(setq calendar-location-name
(format "%s, %s"
osx-location-latitude
osx-location-longitude)))))
2015-06-21 14:42:44 +00:00
(osx-location-watch))))
(defun geolocation/init-sunshine ()
2015-06-21 14:42:44 +00:00
"Initialize sunshine"
(use-package sunshine
:if geolocation-enable-weather-forecast
2015-06-21 14:42:44 +00:00
:defer t
:init
(progn
(spacemacs/set-leader-keys
2015-06-21 14:42:44 +00:00
"aw" 'sunshine-forecast
"aW" 'sunshine-quick-forecast)
(evilified-state-evilify sunshine-mode sunshine-mode-map
(kbd "q") 'quit-window
(kbd "i") 'sunshine-toggle-icons))
2015-06-21 14:42:44 +00:00
:config
;; just in case location was not set by user, or on OS X,
;; if wasn't set up automatically, will not work with Emac's
;; default for ;; `calendar-location-name'
2015-06-21 14:42:44 +00:00
(when (not (boundp 'sunshine-location))
(setq sunshine-location (format "%s, %s"
calendar-latitude
calendar-longitude)))))
2015-06-21 14:42:44 +00:00
(defun geolocation/init-theme-changer ()
2015-06-21 14:42:44 +00:00
"Initialize theme-changer"
(use-package theme-changer
:if geolocation-enable-automatic-theme-changer
2015-06-21 14:42:44 +00:00
:config
(progn
(when (> (length dotspacemacs-themes) 1)
(change-theme (nth 0 dotspacemacs-themes)
(nth 1 dotspacemacs-themes))))))
(defun geolocation/post-init-popwin ()
;; Pin the weather forecast to the bottom window
(push '("*Sunshine*" :dedicated t :position bottom)
popwin:special-display-config))