mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 22:13:19 -07:00
reworked screen-profiles-helper to support new window creation with name
prompt; this was broken by the last commit adding custom escape sequences also, dynamically populate the escape sequence in the help text display
This commit is contained in:
parent
c751c3fe62
commit
3e0609fd8f
2 changed files with 29 additions and 12 deletions
|
@ -12,3 +12,5 @@ F5 Close this window | F9 Basic help (this)
|
|||
|
||||
Commands:
|
||||
'screen -r' - reattach | 'man screen' - complete help
|
||||
|
||||
The escape key is currently set to <ctrl-<esckey>>
|
||||
|
|
|
@ -102,6 +102,8 @@ def help(screen, size, config):
|
|||
text=f.read()
|
||||
f.close()
|
||||
|
||||
text=text.replace("<esckey>", getesckey(), 1)
|
||||
|
||||
t = Textbox(74, 19, text, scroll=1)
|
||||
bb = ButtonBar(screen, ((_("Menu"), "menu"), (_("Exit"), "exit")), compact = 1)
|
||||
|
||||
|
@ -322,6 +324,17 @@ def install(screen, size, isInstalled):
|
|||
|
||||
return 101
|
||||
|
||||
def appendtofile(p, s):
|
||||
f = open(p, 'a')
|
||||
try:
|
||||
f.write(s)
|
||||
except IOError:
|
||||
return
|
||||
finally:
|
||||
f.close()
|
||||
return
|
||||
|
||||
|
||||
def getesckey():
|
||||
path=HOME+'/.screenrc-keybindings'
|
||||
if not os.path.exists(path):
|
||||
|
@ -334,19 +347,21 @@ def getesckey():
|
|||
def setesckey(key):
|
||||
path = HOME+'/.screenrc-keybindings'
|
||||
if key != "":
|
||||
val = key[0].upper()+key[0].lower()
|
||||
if os.path.exists(path):
|
||||
u = key[0].upper()
|
||||
l = key[0].lower()
|
||||
if not os.path.exists(path):
|
||||
appendtofile(path, "escape ^"+u+l+"\nregister n ^"+l+"^c^"+l+"A\n")
|
||||
else:
|
||||
out = commands.getoutput("grep ^escape "+path)
|
||||
if out != "":
|
||||
out = commands.getoutput("sed -i -e 's/^escape \^.*/escape ^"+val+"/' "+path)
|
||||
return
|
||||
f = open(path, 'a')
|
||||
try:
|
||||
f.write("escape ^"+val+"\n")
|
||||
except IOError:
|
||||
return
|
||||
finally:
|
||||
f.close()
|
||||
if out == "":
|
||||
appendtofile(path, "escape ^"+u+l+"\n")
|
||||
else:
|
||||
out = commands.getoutput("sed -i -e 's/^escape \^.*/escape ^"+u+l+"/' "+path)
|
||||
out = commands.getoutput("grep \"^register n \" "+path)
|
||||
if out == "":
|
||||
appendtofile(path, "register n ^"+l+"^c^"+l+"A\n")
|
||||
else:
|
||||
out = commands.getoutput("sed -i -e 's/^register n .*/register n ^"+l+"^c^"+l+"A/' "+path)
|
||||
|
||||
def chgesc(screen, size):
|
||||
esc=Entry(2, text=getesckey(), returnExit=1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue