Metadata-Version: 2.1
Name: dotbot-windows
Version: 1.1.0
Summary: Configure Windows using dotbot
Home-page: https://github.com/kurtmckee/dotbot-windows
License: MIT
Keywords: dotbot,dotbot-plugin,windows,dotfiles
Author: Kurt McKee
Author-email: contactme@kurtmckee.org
Requires-Python: >=3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: dotbot (>=1.20.1)
Project-URL: Repository, https://github.com/kurtmckee/dotbot-windows
Description-Content-Type: text/x-rst

..  dotbot-windows -- Configure Windows using dotbot.
..  Copyright 2023-2024 Kurt McKee <contactme@kurtmckee.org>
..  SPDX-License-Identifier: MIT


dotbot-windows
##############

Configure Windows using `dotbot`_.

-------------------------------------------------------------------------------


Table of contents
=================

*   `What you can do with it`_
*   `Installation`_
*   `Configuration`_
*   `Development`_


What you can do with it
=======================

The dotbot-windows plugin is able to configure Windows in the following ways:

*   Configure the desktop background color
*   Import registry files (``*.reg``) from a specified directory

Sample configuration:

..  code-block:: yaml

    windows:
      personalization:
        background-color: "#2A4661"

      registry:
        import: "my-registry-tweaks/"

      fonts:
        path: "my-standard-fonts/"


Installation
============

There are two ways to install and use the plugin:

1.  Install it as a Python package.
2.  Add it as a git submodule in your dotfiles repository.
3.  Copy ``dotbot_windows.py`` into your dotfiles directory.


Python package
--------------

If you want to install dotbot-windows as a Python package
(for example, if you're using a virtual environment),
then you can install the plugin using ``pip``:

..  code-block::

    pip install dotbot-windows

Then, when running dotbot, use the ``-p`` or ``--plugin`` option
to tell dotbot to load the plugin:

..  code-block::

    dotbot [...] --plugin dotbot_windows [...]

If you're using one of dotbot's ``install`` scripts,
you'll need to edit that file to add the ``--plugin`` option.


Git submodule
-------------

If you want to track dotbot-windows as a git submodule
(for example, if you manage your dotfiles using git)
then you can add the plugin repository as a submodule using ``git``:

..  code-block::

    git submodule add https://github.com/kurtmckee/dotbot-windows.git

This will clone the repository to a directory named ``dotbot-windows``.
Then, when running dotbot, use the ``-p`` or ``--plugin`` option
to tell dotbot to load the plugin:

..  code-block::

    dotbot [...] --plugin dotbot-windows/dotbot_windows.py [...]

Note that you may need to initialize the plugin's git submodule
when you clone your dotfiles repository or pull new changes
to another computer.
The command for this will look something like:

..  code-block::

    git submodule update --init dotbot-windows


Copy ``dotbot_windows.py``
--------------------------

If desired, you can copy ``dotbot_windows.py`` to your dotfiles directory.
You might choose to do this if you already use other plugins
and have configured dotbot to load all plugins from a plugin directory.

If you copy ``dotbot_windows.py`` to the root of your dotfiles directory
then, when running dotbot, use the ``-p`` or ``--plugin`` option
to tell dotbot to load the plugin:

..  code-block::

    dotbot [...] --plugin dotbot_windows.py [...]

If you copy ``dotbot_windows.py`` to a directory containing other plugins,
you can use dotbot's ``--plugin-dir`` option to load all plugins in the directory.
In the example below, the plugin directory is named ``dotbot-plugins``:

..  code-block::

    dotbot [...] --plugin-dir dotbot-plugins [...]


Configuration
=============

**Personalization**

You can configure the desktop background color using a hexadecimal color (like ``"#2A4661"``)
or a triplet of decimal RGB values (like ``"0 153 255"``).

Here are examples demonstrating the two formats:

..  code-block:: yaml

    windows:
        personalization:
            background-color: "#2A4661"

..  code-block:: yaml

    windows:
        personalization:
            background-color: "42 70 97"

**Registry**

You can import registry files by specifying a directory containing ``*.reg`` files.
The directory will be recursively searched for ``*.reg`` files,
and each of them will be imported.

Note that registry imports may fail if the changes require administrator privileges.

Here's a dotbot configuration file example:

..  code-block:: yaml

    windows:
        registry:
            import: "registry-export-files"


**Fonts**

Starting with Windows 10 build 17704, users can `install fonts without admin permissions`_.
The fonts can be copied into ``"%LOCALAPPDATA%/Microsoft/Windows/Fonts"``,
so this plugin replaces that directory with a symlink to a directory of your choosing.

Here's a dotbot configuration file example:

..  code-block:: yaml

    windows:
      fonts:
        path: "my-standard-fonts/"

..  note::

    This plugin will only create the symlink -- or update it -- under these circumstances:

    *   The user's Windows font directory must be an empty directory,
    *   OR the font directory must already be a symlink


Development
===========

To set up a development environment, clone the dotbot-windows plugin's git repository.
Then, follow these steps to create a virtual environment and run the unit tests locally:

..  code-block:: shell

    # Create the virtual environment
    $ python -m venv .venv

    # Activate the virtual environment (Windows-only)
    $ & .venv/Scripts/Activate.ps1

    # Update pip and setuptools, and install wheel
    (.venv) $ pip install -U pip setuptools wheel

    # Install poetry, tox, and scriv
    (.venv) $ pip install poetry tox scriv

    # Install all dependencies
    (.venv) $ poetry install

    # Run the unit tests locally
    (.venv) $ tox


..  Links
..  =====
..
..  _dotbot: https://github.com/anishathalye/dotbot
..  _install fonts without admin permissions: https://blogs.windows.com/windows-insider/2018/06/27/announcing-windows-10-insider-preview-build-17704/

