Skip to content

Commit

Permalink
Add some tags by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Jan 23, 2024
1 parent 20f2396 commit 561495b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 0 additions & 4 deletions hyperplane/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ def __init__(self) -> None:
logging_config()
FileManagerDBusServer()

# Create home
shared.home_path.mkdir(parents=True, exist_ok=True)
(shared.home_path / ".hyperplane").touch(exist_ok=True)

shared.app = self

new_window = GLib.OptionEntry()
Expand Down
8 changes: 7 additions & 1 deletion hyperplane/shared.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ sort_reversed = state_schema.get_boolean("sort-reversed")
home_path = Path(getenv("HYPHOME", str(Path.home()))).expanduser()
home = Gio.File.new_for_path(str(home_path))

tags = []
# Create home if it doesn't exist
home_path.mkdir(parents=True, exist_ok=True)

if (path := home_path / ".hyperplane").is_file():
tags = list(
tag for tag in path.read_text(encoding="utf-8").strip().split("\n") if tag
)
else:
# Default tags
tags = [_("Documents"), _("Music"), _("Pictures"), _("Videos")]
path.write_text("\n".join(tags), encoding="utf-8")

del path

Expand Down

0 comments on commit 561495b

Please sign in to comment.