Add a command to open files with xdg-open.
- Vigil isn't a file manager but it is handy to let the highlighted file be opened since its already selected by the user.
This commit is contained in:
parent
ac7ca5a46a
commit
549f9ad5c8
2 changed files with 11 additions and 3 deletions
|
|
@ -57,4 +57,4 @@
|
||||||
│ │
|
│ │
|
||||||
│ │
|
│ │
|
||||||
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
|
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
(B[m[38;2;255;255;255m[48;2;76;76;76m (B[m[38;2;76;255;76m[48;2;76;76;76mh(B[m[38;2;255;255;255m[48;2;76;76;76melp (B[m[38;2;76;255;76m[48;2;76;76;76mq(B[m[38;2;255;255;255m[48;2;76;76;76muit (B[m[38;2;76;255;76m[48;2;76;76;76mtab(B[m[38;2;255;255;255m[48;2;76;76;76m:focus (B[m[38;2;76;255;76m[48;2;76;76;76mt(B[m[38;2;255;255;255m[48;2;76;76;76murn (B[m[38;2;76;255;76m[48;2;76;76;76ml(B[m[38;2;255;255;255m[48;2;76;76;76mog (B[m[38;2;76;255;76m[48;2;76;76;76me(B[m[38;2;255;255;255m[48;2;76;76;76mdit (B[m[38;2;76;255;76m[48;2;76;76;76mn(B[m[38;2;255;255;255m[48;2;76;76;76mext (B[m[38;2;76;255;76m[48;2;76;76;76mp(B[m[38;2;255;255;255m[48;2;76;76;76mause (B[m[38;2;76;255;76m[48;2;76;76;76mo(B[m[38;2;255;255;255m[48;2;76;76;76mrder (B[m[38;2;76;255;76m[48;2;76;76;76mr(B[m[38;2;255;255;255m[48;2;76;76;76mefresh (B[m[38;2;76;255;76m[48;2;76;76;76mf(B[m[38;2;255;255;255m[48;2;76;76;76mullscreen (B[m[38;2;76;171;208m[48;2;76;76;76mrunning(B[m[38;2;255;255;255m[48;2;76;76;76m order:directory (B[m
|
(B[m[38;2;255;255;255m[48;2;76;76;76m (B[m[38;2;76;255;76m[48;2;76;76;76mh(B[m[38;2;255;255;255m[48;2;76;76;76melp (B[m[38;2;76;255;76m[48;2;76;76;76mq(B[m[38;2;255;255;255m[48;2;76;76;76muit (B[m[38;2;76;255;76m[48;2;76;76;76mtab(B[m[38;2;255;255;255m[48;2;76;76;76m:focus (B[m[38;2;76;255;76m[48;2;76;76;76mt(B[m[38;2;255;255;255m[48;2;76;76;76murn (B[m[38;2;76;255;76m[48;2;76;76;76ml(B[m[38;2;255;255;255m[48;2;76;76;76mog (B[m[38;2;76;255;76m[48;2;76;76;76me(B[m[38;2;255;255;255m[48;2;76;76;76mdit (B[m[38;2;76;255;76m[48;2;76;76;76mn(B[m[38;2;255;255;255m[48;2;76;76;76mext (B[m[38;2;76;255;76m[48;2;76;76;76mp(B[m[38;2;255;255;255m[48;2;76;76;76mause (B[m[38;2;76;255;76m[48;2;76;76;76mo(B[m[38;2;255;255;255m[48;2;76;76;76mrder (B[m[38;2;76;255;76m[48;2;76;76;76mr(B[m[38;2;255;255;255m[48;2;76;76;76mefresh (B[m[38;2;76;255;76m[48;2;76;76;76mf(B[m[38;2;255;255;255m[48;2;76;76;76mullscreen (B[m[38;2;76;255;76m[48;2;76;76;76mx(B[m[38;2;255;255;255m[48;2;76;76;76mdg (B[m[38;2;76;171;208m[48;2;76;76;76mrunning(B[m[38;2;255;255;255m[48;2;76;76;76m order:directory (B[m
|
||||||
|
|
@ -811,6 +811,14 @@ class Screen:
|
||||||
def toggle_fullscreen(self):
|
def toggle_fullscreen(self):
|
||||||
self._is_fullscreen = not self._is_fullscreen
|
self._is_fullscreen = not self._is_fullscreen
|
||||||
|
|
||||||
|
def xdg_open(self):
|
||||||
|
path = self._summary.get_selection().path
|
||||||
|
path_colored = tools.path_colored(path)
|
||||||
|
self._log.log_message([in_green("Opening "), path_colored,
|
||||||
|
in_green("...")])
|
||||||
|
subprocess.Popen(["xdg-open", path], stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
def _select_entry_at_position(self, x, y, view_width, view_height):
|
def _select_entry_at_position(self, x, y, view_width, view_height):
|
||||||
border_width = 1
|
border_width = 1
|
||||||
if x < border_width or y < border_width or x > view_width or \
|
if x < border_width or y < border_width or x > view_width or \
|
||||||
|
|
@ -888,7 +896,7 @@ class Screen:
|
||||||
|
|
||||||
_STATUS_BAR = highlight_chars(
|
_STATUS_BAR = highlight_chars(
|
||||||
" *help *quit *t*a*b:focus *turn *log *edit *next *pause *order"
|
" *help *quit *t*a*b:focus *turn *log *edit *next *pause *order"
|
||||||
" *refresh *fullscreen", Log._GREEN_STYLE)
|
" *refresh *fullscreen *xdg-open", Log._GREEN_STYLE)
|
||||||
|
|
||||||
@functools.lru_cache(maxsize=2)
|
@functools.lru_cache(maxsize=2)
|
||||||
def _get_status_bar_appearance(self, width, is_directory_sort, is_paused,
|
def _get_status_bar_appearance(self, width, is_directory_sort, is_paused,
|
||||||
|
|
@ -939,7 +947,7 @@ class Screen:
|
||||||
({"N"}, move_to_next_issue_of_tool), ({"e"}, edit_file),
|
({"N"}, move_to_next_issue_of_tool), ({"e"}, edit_file),
|
||||||
({"q"}, quit_), ({"p"}, toggle_pause), ({"r"}, refresh),
|
({"q"}, quit_), ({"p"}, toggle_pause), ({"r"}, refresh),
|
||||||
({"R"}, refresh_tool), ({"tab"}, toggle_focus),
|
({"R"}, refresh_tool), ({"tab"}, toggle_focus),
|
||||||
({"f"}, toggle_fullscreen)]
|
({"f"}, toggle_fullscreen), ("x", xdg_open)]
|
||||||
|
|
||||||
|
|
||||||
def add_watch_manager_to_mainloop(root_path, mainloop, on_filesystem_change,
|
def add_watch_manager_to_mainloop(root_path, mainloop, on_filesystem_change,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue