Skip to content

Commit

Permalink
Get path segments for special places automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Dec 23, 2023
1 parent 3901da9 commit d69a4f8
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions hyperplane/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,30 @@ def __update_path_bar(self) -> None:
segments = []

# Do these automatically is shceme != "file"
match parse.scheme:
case "trash":
segments.insert(
0,
(_("Trash"), "user-trash-symbolic", f"{parse.scheme}://", None),
if parse.scheme != "file":
scheme_uri = f"{parse.scheme}://"
try:
file_info = Gio.File.new_for_uri(scheme_uri).query_info(
",".join(
(
Gio.FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON,
Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
)
),
Gio.FileQueryInfoFlags.NONE,
)
case "recent":
except GLib.Error:
pass
else:
display_name = file_info.get_display_name()
symbolic = file_info.get_symbolic_icon()

segments.insert(
0,
(
_("Recent"),
"document-open-recent-symbolic",
f"{parse.scheme}://",
display_name,
symbolic.get_names()[0] if symbolic else None,
scheme_uri,
None,
),
)
Expand Down

0 comments on commit d69a4f8

Please sign in to comment.