drop to shell in foldermenu

This commit is contained in:
ville rantanen
2019-02-11 20:25:20 +02:00
parent 9de0720383
commit 27297ebdde

View File

@@ -27,7 +27,7 @@ def setup_options():
"Menufile format for each line: 'description:command'. " +
"If the command ends in '&' it is run in the background. " +
"If the command ends in '/' it is a folder, and selecting will enter. " +
"Extra keyboard shortcuts: / Edit ")
"Extra keyboard shortcuts: / Edit, $ Shell ")
parser.add_argument("-1","--one-shot",action = 'store_true', dest = 'once', default = False,
help = "Launch only once, then exit")
parser.add_argument("-b","--no-banner", action='store_false', dest='banner', default=True,
@@ -500,6 +500,18 @@ class entry_collection:
)
self.initialize()
def shell(self):
#env = os.environ.copy()
#env["PS1"] = "fM:" + env.get("PS1","")
subprocess.call(
"bash --rcfile <(cat ~/.bashrc; echo \"PS1='folderMenu: '\$PS1\") -i",
stderr = subprocess.STDOUT,
shell = True,
executable = "/bin/bash"
)
self.initialize()
def debug_code_print(c):
print("- code: %d, str: %s -"%(
c,
@@ -569,6 +581,8 @@ def start_engines():
entries.flip_mode()
if inkey == 47: # /
entries.edit_menu()
if inkey == 36: # $
entries.shell()
if inkey == 13: # enter
inkey = ord(entries.menu_keys[entries.selected])
found, message = entries.is_key(chr(inkey))