mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 06:23: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:
|
Commands:
|
||||||
'screen -r' - reattach | 'man screen' - complete help
|
'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()
|
text=f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
text=text.replace("<esckey>", getesckey(), 1)
|
||||||
|
|
||||||
t = Textbox(74, 19, text, scroll=1)
|
t = Textbox(74, 19, text, scroll=1)
|
||||||
bb = ButtonBar(screen, ((_("Menu"), "menu"), (_("Exit"), "exit")), compact = 1)
|
bb = ButtonBar(screen, ((_("Menu"), "menu"), (_("Exit"), "exit")), compact = 1)
|
||||||
|
|
||||||
|
@ -322,6 +324,17 @@ def install(screen, size, isInstalled):
|
||||||
|
|
||||||
return 101
|
return 101
|
||||||
|
|
||||||
|
def appendtofile(p, s):
|
||||||
|
f = open(p, 'a')
|
||||||
|
try:
|
||||||
|
f.write(s)
|
||||||
|
except IOError:
|
||||||
|
return
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def getesckey():
|
def getesckey():
|
||||||
path=HOME+'/.screenrc-keybindings'
|
path=HOME+'/.screenrc-keybindings'
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
|
@ -334,19 +347,21 @@ def getesckey():
|
||||||
def setesckey(key):
|
def setesckey(key):
|
||||||
path = HOME+'/.screenrc-keybindings'
|
path = HOME+'/.screenrc-keybindings'
|
||||||
if key != "":
|
if key != "":
|
||||||
val = key[0].upper()+key[0].lower()
|
u = key[0].upper()
|
||||||
if os.path.exists(path):
|
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)
|
out = commands.getoutput("grep ^escape "+path)
|
||||||
if out != "":
|
if out == "":
|
||||||
out = commands.getoutput("sed -i -e 's/^escape \^.*/escape ^"+val+"/' "+path)
|
appendtofile(path, "escape ^"+u+l+"\n")
|
||||||
return
|
else:
|
||||||
f = open(path, 'a')
|
out = commands.getoutput("sed -i -e 's/^escape \^.*/escape ^"+u+l+"/' "+path)
|
||||||
try:
|
out = commands.getoutput("grep \"^register n \" "+path)
|
||||||
f.write("escape ^"+val+"\n")
|
if out == "":
|
||||||
except IOError:
|
appendtofile(path, "register n ^"+l+"^c^"+l+"A\n")
|
||||||
return
|
else:
|
||||||
finally:
|
out = commands.getoutput("sed -i -e 's/^register n .*/register n ^"+l+"^c^"+l+"A/' "+path)
|
||||||
f.close()
|
|
||||||
|
|
||||||
def chgesc(screen, size):
|
def chgesc(screen, size):
|
||||||
esc=Entry(2, text=getesckey(), returnExit=1)
|
esc=Entry(2, text=getesckey(), returnExit=1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue