separate folders better

This commit is contained in:
2019-01-30 12:31:17 +02:00
parent 4e9c703ce0
commit 47b3758dfa

View File

@@ -176,14 +176,17 @@ class entry_collection:
continue continue
row = row.strip().split(':',1) row = row.strip().split(':',1)
if len(row) == 1: if len(row) == 1:
row = [ "$" + row[0].strip(), row[0] ] row = [ row[0].strip(), row[0] ]
else: else:
row = [ row[0].strip(), row[1] ] row = [ row[0].strip(), row[1] ]
launcher = "menu"
if row[1][-1] == '/' and os.path.isdir(row[1]):
launcher = "dir"
self.entries.append( self.entries.append(
launch_item( launch_item(
command = row[1], command = row[1],
description = row[0], description = row[0],
launcher = "menu" launcher = launcher
) )
) )
@@ -407,12 +410,15 @@ class entry_collection:
bg = False bg = False
idx = self.menu_keys.index(key) idx = self.menu_keys.index(key)
chdir = False
if self.dir_mode: if self.dir_mode:
command_str = self.dirs[idx].command command_str = self.dirs[idx].command
chdir = True
else: else:
command_str = self.entries[idx].command 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): if os.path.isdir(command_str):
os.chdir(command_str) os.chdir(command_str)
self.selected = -1 self.selected = -1