From 47b3758dfa2830a03878e50144d727560aa0a3d1 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Wed, 30 Jan 2019 12:31:17 +0200 Subject: [PATCH] separate folders better --- files/foldermenu.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/files/foldermenu.py b/files/foldermenu.py index e061f11..5bf1351 100755 --- a/files/foldermenu.py +++ b/files/foldermenu.py @@ -176,14 +176,17 @@ class entry_collection: continue row = row.strip().split(':',1) if len(row) == 1: - row = [ "$" + row[0].strip(), row[0] ] + row = [ row[0].strip(), row[0] ] else: row = [ row[0].strip(), row[1] ] + launcher = "menu" + if row[1][-1] == '/' and os.path.isdir(row[1]): + launcher = "dir" self.entries.append( launch_item( command = row[1], description = row[0], - launcher = "menu" + launcher = launcher ) ) @@ -407,12 +410,15 @@ class entry_collection: bg = False idx = self.menu_keys.index(key) + chdir = False if self.dir_mode: command_str = self.dirs[idx].command + chdir = True else: command_str = self.entries[idx].command + chdir = self.entries[idx].launcher == "dir" - if self.dir_mode or command_str[-1] == '/': + if chdir: if os.path.isdir(command_str): os.chdir(command_str) self.selected = -1