Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Complete rework of code - Various bug-fixes - Added unit tests - CI and Coverage
- Loading branch information
Showing
116 changed files
with
2,363 additions
and
1,423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: ~/i3wm-themer | ||
docker: | ||
- image: circleci/python:3.6.4 | ||
steps: | ||
- checkout | ||
- run: sudo chown -R circleci:circleci /usr/local/bin | ||
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.6/site-packages | ||
- restore_cache: | ||
key: deps10-{{ .Branch }}-{{ checksum "Pipfile.lock" }} | ||
- run: | ||
name: Setup testing environment | ||
command: | | ||
pip install coverage --user | ||
pip install pytest --user | ||
pip install -r requirements.txt | ||
echo $HOME | ||
- save_cache: | ||
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }} | ||
paths: | ||
- ".venv" | ||
- "/usr/local/bin" | ||
- "/usr/local/lib/python3.6/site-packages" | ||
- run: | ||
name: Running tests | ||
command: | | ||
$HOME/.local/bin/coverage run -m pytest | ||
$HOME/.local/bin/coverage report --include="i3wmthemer/*" | ||
$HOME/.local/bin/coverage html | ||
- store_artifacts: | ||
path: htmlcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
src/__pycache__ | ||
src/*.pyc | ||
test-reports/ | ||
.pytest_cache/ | ||
*__pycache__ | ||
*.pyc | ||
.idea/ | ||
*.iml | ||
./*.png | ||
./*.jpg | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
|
||
[packages] | ||
PyYAML = "==5.1" | ||
|
||
[requires] | ||
python_version = "3.6" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/bin/env sh | ||
### Script written by James Shane ( github.com/jamesshane ) | ||
|
||
cd src | ||
python i3wm-themer.py --config config.yaml --load themes/$1.json | ||
python i3wm-themer.py --config config.yaml --load themes/"$1".json |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/env python3 | ||
|
||
""" | ||
i3-wm theme changing utility. | ||
Author : Stavros Grigoriou (@unix121) | ||
""" | ||
|
||
import argparse | ||
|
||
from i3wmthemer.models.configuration import ConfigurationLoader | ||
from i3wmthemer.models.theme import Theme | ||
from i3wmthemer.utils.backup import BackupUtils | ||
from i3wmthemer.utils.fileutils import FileUtils | ||
from i3wmthemer.utils.install import InstallationUtils | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description='i3wm-themer by Stavros Grigoriou (@unix121)') | ||
parser.add_argument('-c', '--config', type=str, required=True, help='Load config file') | ||
parser.add_argument('-b', '--backup', type=str, help='Backup files') | ||
parser.add_argument('-i', '--install', type=str, help='Install i3wm-themer\'s default configuration files') | ||
parser.add_argument('-l', '--load', type=str, help='Load theme from JSON file') | ||
args = parser.parse_args() | ||
|
||
# TODO :: Default | ||
if args.config is None: | ||
exit(0) | ||
|
||
# Load the configuration | ||
configLoader = ConfigurationLoader(args.config) | ||
configuration = configLoader.load() | ||
|
||
if args.backup is not None: | ||
BackupUtils.backup_config(args.backup, configuration) | ||
exit(0) | ||
|
||
if args.install is not None: | ||
InstallationUtils.install_defaults(args.install, configuration) | ||
configuration.refresh_all('') | ||
exit(0) | ||
|
||
if args.load is not None: | ||
file = FileUtils.load_theme_from_file(args.load) | ||
theme = Theme(file) | ||
theme.load(configuration) | ||
exit(0) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
from enum import Enum, unique | ||
|
||
|
||
@unique | ||
class XresourcesAttr(Enum): | ||
""" | ||
Attributes that should be parsed from the configuration file for Xresources. | ||
""" | ||
NAME = 'xresources' | ||
BACKGROUND = 'background' | ||
FOREGROUND = 'foreground' | ||
CURSOR = 'cursorcolor' | ||
COLOR0 = 'color0' | ||
COLOR1 = 'color1' | ||
COLOR2 = 'color2' | ||
COLOR3 = 'color3' | ||
COLOR4 = 'color4' | ||
COLOR5 = 'color5' | ||
COLOR6 = 'color6' | ||
COLOR7 = 'color7' | ||
COLOR8 = 'color8' | ||
COLOR9 = 'color9' | ||
COLOR10 = 'color10' | ||
COLOR11 = 'color11' | ||
COLOR12 = 'color12' | ||
COLOR13 = 'color13' | ||
COLOR14 = 'color14' | ||
COLOR15 = 'color15' | ||
ROFI_WIND = 'rofi.color-window' | ||
ROFI_NORM = 'rofi.color-normal' | ||
ROFI_ACTI = 'rofi.color-active' | ||
ROFI_URGE = 'rofi.color-urgent' | ||
|
||
|
||
@unique | ||
class I3Attr(Enum): | ||
""" | ||
Attributes that should be parsed from the configuration file for i3. | ||
""" | ||
NAME = 'i3wm' | ||
BACKGROUND = 'client.background' | ||
FOCUSED = 'client.focused' | ||
UNFOCUSED = 'client.unfocused' | ||
INACTIVE = 'client.focused_inactive' | ||
URGENT = 'client.urgent' | ||
PLACEHOLDER = 'client.placeholder' | ||
|
||
|
||
@unique | ||
class PolybarAttr(Enum): | ||
""" | ||
Attributes that should be parsed from the configuration file for Polybar. | ||
""" | ||
NAME = 'polybar' | ||
BACKGROUND = 'background' | ||
FOREGROUND = 'foreground' | ||
MOD_L = 'modules-left' | ||
MOD_C = 'modules-center' | ||
MOD_R = 'modules-right' | ||
LABEL_UN_BACK = 'label-unfocused-background' | ||
LABEL_UN_FORE = 'label-unfocused-foreground' | ||
LABEL_MOD_BACK = 'label-mode-background' | ||
LABEL_MOD_FORE = 'label-mode-foreground' | ||
LABEL_FOC_BACK = 'label-focused-background' | ||
LABEL_FOC_FORE = 'label-focused-foreground' | ||
LABEL_VIS_BACK = 'label-visible-background' | ||
LABEL_VIS_FORE = 'label-visible-foreground' | ||
FORMAT_BACK = 'format-background' | ||
FORMAT_FORE = 'format-foreground' | ||
LABEL_OPEN_FORE = 'label-open-foreground' | ||
LABEL_CLOSE_FORE = 'label-close-foreground' | ||
LABEL_SEP_FOREGROUND = 'label-separator-foreground' | ||
FORMAT_CON_FORE = 'format-connected-foreground' | ||
FORMAT_CON_BACK = 'format-connected-background' | ||
FORMAT_CON_PRE_FORE = 'format-connected-prefix-foreground' | ||
RAMP_SIG_FOREGROUND = 'ramp-signal-foreground' | ||
|
||
|
||
@unique | ||
class NitrogenAttr(Enum): | ||
""" | ||
Attributes that should be parsed from the configuration file for Nitrogen. | ||
""" | ||
NAME = 'wallpaper' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
|
||
class AbstractTheme(ABC): | ||
""" | ||
Abstract Theme. | ||
""" | ||
|
||
@abstractmethod | ||
def load(self, configuration): | ||
""" | ||
Method that must be implemented. | ||
Should load the theme in the proper file in the configuration. | ||
:param configuration: the configuration. | ||
""" | ||
raise NotImplementedError |
Oops, something went wrong.