Skip to content

Commit

Permalink
Use sphinx with restructuredText for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed Feb 6, 2018
1 parent 9531b0a commit e8ce8b0
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 151 deletions.
151 changes: 0 additions & 151 deletions README.md

This file was deleted.

147 changes: 147 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
.. |travis-ci| image:: https://travis-ci.org/JakobGM/astrality.svg?branch=master
:target: https://travis-ci.org/JakobGM/astrality

.. |coveralls| image:: https://coveralls.io/repos/github/JakobGM/astrality/badge.svg?branch=master
:target: https://coveralls.io/github/JakobGM/astrality?branch=master

.. |logo| image:: https://github.com/JakobGM/astrality/raw/master/docs/astrality_logo.png

===============================================================================
|logo| Astrality - A Dynamic Configuration File Manager |travis-ci| |coveralls|
===============================================================================

What Does It Do?
================

Astrality is a tool for managing configuration files and scheduling tasks related to those files.

You can create templates for your configuration files, and Astrality will replace placeholders within those templates with ``context`` values defined in a central configuration file. Furthermore, you can dynamically manipulate that ``context`` at predefined times and events.

**Possible use cases are:**

* Insert environment variables (e.g. ``$USER``) and command substitutions (e.g. ``$(xrandr | grep -cw connected)``) into configuration files that do not support them.
* Create a single source of truth for configuration options. Change your preferred font type or color scheme, and instantly see that change be applied across several different applications.
* Change your desktop wallpaper when your specific location (given by latitude and longitude) experiences dawn, noon, sunset, and dusk. It adapts to the length of day through the year. Make your `Conky modules <https://github.com/brndnmtthws/conky>`_ change font color accordingly.
* And much more... An example configuration with several examples is included.

The configuration format uses the flexible `YAML <http://docs.ansible.com/ansible/latest/YAMLSyntax.html#yaml-basics>`_ format, and the template language uses the `Jinja2 syntax <http://jinja.pocoo.org/docs/2.10/>`_, which is easy to get started with, but allows complex templating for those who need it.

It is relatively easy to create ``modules`` to your own liking. Pull requests with new themes, conky modules, and improvements are very welcome.

Getting Started
===============

Prerequisites
-------------
Astrality requires `python 3.6 <https://www.python.org/downloads/>`_ or greater. The included configuration for Astrality also contains modules which utilize `conky <https://wiki.archlinux.org/index.php/Conky>`_ and `feh <https://wiki.archlinux.org/index.php/feh>`_. You can either disable these modules or install their dependencies. An example installation on ArchLinux would be:

.. code-block:: console
sudo pacman -Syu conky feh python
The default configuration also uses the `Nerd Font <https://github.com/ryanoasis/nerd-fonts>`_ "FuraCode Nerd Font". Install it if you don't change the font in your configuration. On ArchLinux, it can be installed with the ``nerd-fonts-complete`` AUR package:

.. code-block:: console
yaourt -S nerd-fonts-complete
Installation
------------

Create a new virtualenv for python 3.6 (or use your system python 3.6 if you prefer). Install Astrality from `pypi <https://pypi.org/project/astrality/>`_ like so:

.. code-block:: console
pip3 install astrality
You should now be able to start `astrality` from your command line, but first, let's create an example configuration:

.. code-block:: console
astrality --create-example-config
And now start `astrality`:

.. code-block:: console
astrality
Your wallpaper should now be automatically changed during the different times of day.


Example initialization using the `i3 tiling window manager <https://github.com/i3/i3>`_:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add the following line to ``$XDG_CONFIG_HOME/i3/config``:

.. code-block:: console
exec --no-startup-id "astrality"
Configuration
=============
The configuration directory for astrality is determined in the following way:

* If ``$ASTRALITY_CONFIG_HOME`` is set, use that folder as the configuration directory, else...
* If ``$XDG_CONFIG_HOME`` is set, use ``$XDG_CONFIG_HOME/astrality``, else...
* Use ``~/.config/astrality``, if it contains a ``astrality.yaml`` file, else...
* Use an example configuration.

The configuration file for astrality should be placed at the root of the astrality configuration directory and an example configuration can be found `here <https://github.com/JakobGM/astrality/blob/master/astrality.conf.example>`_.

Edit the configuration file in order to add your current location, given by your GPS coordinates (longitude, latitude, and elevation). These coordinates can be obtained from `this website <https://www.latlong.net/>`_.

Compton
-------
If you are using the `compton <https://github.com/chjj/compton>`_ compositor, you should disable any shadows and dims which could be applied to the conky wallpaper modules. Here is an example configuration from ``$XDG_CONFIG_HOME/compton/compton.conf``:

.. code-block:: lua
inactive-dim = 0.1;
shadow = true;
shadow-exclude = [
"! name~=''",
"class_g = 'Conky'"
]
mark-ovredir-focused = true;
How to add new wallpaper theme
------------------------------
Say you would want to create a new wallpaper theme called ``nature``. First create a new subdirectory in ``$XDG_CONFIG_HOME/astrality/wallpaper_themes`` named ``nature``:

.. code-block:: console
mkdir -p $XDG_CONFIG_HOME/astrality/wallpaper_themes/nature
Then place pictures `supported by feh <http://search.cpan.org/~kryde/Image-Base-Imlib2-1/lib/Image/Base/Imlib2.pm#DESCRIPTION>`_ in the newly created directory. You **have** to use the following filenames::

sunrise.*
morning.*
afternoon.*
sunset.*
night.*

Where the ``*`` suffixes can be any combination of file types supported by feh.

The images are not required to be different, in case if you do not have enough fitting wallpapers to choose from. You can use identical copies for some or all of the time periods, or even better, create a symbolic links. For example:

.. code-block:: console
# Let sunrise be the same picture as sunset
ln -s sunrise.jpg sunrise.jpg
Then you have to add the following line to the ``[Appearance]`` section of ``astrality.conf``:

Restart the astrality process in order to see the change of the wallpaper theme.

Pull requests containing new themes are very welcome!

Inspirations for themes
-----------------------
Themes have been made by the help of several posts on the `/r/unixporn <https://reddit.com/r/unixporn>`_ subreddit. Here are some of them:

* Default: Still on the lookout for where I got this theme originally
* Tower: Reddit user `/u/saors <https://reddit.com/u/soars>`_: `/r/unixporn post 1 <https://www.reddit.com/r/Rainmeter/comments/49phkc/firewatch_chrono_first_theme_includes_parallax/?st=jcktppsn&sh=792fe302>`_.
* Tower: Reddit user `/u/TheFawxyOne <https://reddit.com/u/soars>`_: `/r/unixporn post 2 <https://www.reddit.com/r/Rainmeter/comments/49fpwz/ocupdate_firewatch_parallax_theme_v150_read/?st=jcktryl8&sh=4022418b>`_.

In addition, the astrality logo is a modified version of a logo designed by `miscellaneous <https://www.shareicon.net/author/miscellaneous>`_ from Flaticon.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Astrality
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file modified docs/astrality_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e8ce8b0

Please sign in to comment.