Skip to content

Commit

Permalink
Add --image/-im section to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mateosss committed Mar 15, 2021
1 parent ebc9c04 commit 6a5692a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ requests.
- [Uninstall](#uninstall)
- [Fonts](#fonts)
- [Colors](#colors)
- [Images](#images)
- [Testing Without Rebooting](#testing-without-rebooting)
- [What does Matter do to my system
files?](#what-does-matter-do-to-my-system-files)
Expand Down Expand Up @@ -154,6 +155,19 @@ the syntax:
./matter.py -hl FFC107 -fg white -bg 2196f3 -ic pink
```

## Images (unfinished)

You can specify a background image with `--image/-im`, the supported image
formats/extensions are PNG, JPG, JPEG, and TGA. This feature is considered
*unfinished* because it does not yet work as well as it could *(see
[#57](https://github.com/mateosss/matter/pull/57))*

Here is an example of the syntax:

```sh
./matter.py -im ~/Pictures/some-cool-image-that-has-good-contrast-with-my-text-color.png
```

## Testing Without Rebooting

If you install the `pip` package
Expand Down
12 changes: 6 additions & 6 deletions matter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

# Logging utils


def color_string(string, fg=None):
COLORS = { # List some colors that may be needed
"red": "\033[31m",
Expand Down Expand Up @@ -323,11 +324,9 @@ def prepare_source_dir():
# Image checks
if image:
if not exists(image):
error(
f"{image} does not exist!")
if os.path.splitext(image)[1] not in ('.png', '.tga', '.jpg', '.jpeg'):
error(
f"Background image must be one of .png, .tga, .jpg or .jpeg formats.")
error(f"{image} does not exist")
if os.path.splitext(image)[1] not in (".png", ".tga", ".jpg", ".jpeg"):
error(f"Background image must be one of .png, .tga, .jpg or .jpeg formats.")
image_name = basename(image)
copyfile(image, f"{INSTALLATION_SOURCE_DIR}/{image_name}")
if background:
Expand Down Expand Up @@ -632,6 +631,7 @@ def do_set_icons():
f"{GRUB_MKCONFIG_PATH} succesfully patched, icons will now persist between grub updates."
)


def install_hookcheck():
info(f"Create hook check script")
with open(HOOKCHECK_TEMPLATE_PATH, "r", newline="") as f:
Expand Down Expand Up @@ -737,7 +737,7 @@ def parse_args():
"--image",
"-im",
type=str,
help=f"image file to use as background",
help=f"image file to use as background, supported extensions: PNG, JPG, JPEG, TGA",
)
parser.add_argument(
"--iconcolor",
Expand Down

0 comments on commit 6a5692a

Please sign in to comment.