* screen-profiles-helper: add support for keybinding selection, LP: #321735

* debian/install, keybindings/none: install an empty set of keybindings for
    the "none" selection
  * profiles/common: strip out the automatic loading of the common
    keybindings now that each user sets this in their local
  * profiles/generate-profiles, profiles/profile.skel: drop the grep of the         caption, put it the skeleton
This commit is contained in:
Dustin Kirkland 2009-01-29 13:12:12 +01:00
commit 1f751a45a4
7 changed files with 56 additions and 31 deletions

3
debian/changelog vendored
View file

@ -22,8 +22,9 @@ screen-profiles (1.18) UNRELEASED; urgency=low
* select-screen-profile & screen: move the environment sanitation code * select-screen-profile & screen: move the environment sanitation code
to the screen script, such that it is executed each time screen is run, to the screen script, such that it is executed each time screen is run,
rather than on screen profile selection only rather than on screen profile selection only
* screen-profiles-helper: add support for keybinding selection, LP: #321735
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 28 Jan 2009 19:00:19 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Thu, 29 Jan 2009 12:35:44 +0100
screen-profiles (1.17-0ubuntu1) jaunty; urgency=low screen-profiles (1.17-0ubuntu1) jaunty; urgency=low

1
debian/install vendored
View file

@ -16,6 +16,7 @@ profiles/fedora-dark usr/share/screen-profiles/profiles/misc
profiles/redhat-light usr/share/screen-profiles/profiles/misc profiles/redhat-light usr/share/screen-profiles/profiles/misc
profiles/redhat-dark usr/share/screen-profiles/profiles/misc profiles/redhat-dark usr/share/screen-profiles/profiles/misc
keybindings/common usr/share/screen-profiles/keybindings keybindings/common usr/share/screen-profiles/keybindings
keybindings/none usr/share/screen-profiles/keybindings
windows/common usr/share/screen-profiles/windows windows/common usr/share/screen-profiles/windows
screen usr/bin screen usr/bin
select-screen-profile usr/bin select-screen-profile usr/bin

1
keybindings/none Normal file
View file

@ -0,0 +1 @@
# This is intended to be a completely empty set of keybindings

View file

@ -47,11 +47,8 @@ caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%?"
termcapinfo xterm* ti@:te@ termcapinfo xterm* ti@:te@
defscrollback 10000 defscrollback 10000
# Default keybindings # The selected keybinding set, plus any additional user-defined/overriding
source /usr/share/screen-profiles/keybindings/common # keybindings should be placed in each user's ~/.screenrc-keybindings
# Additional, user-defined/overriding keybindings should be placed
# in each user's ~/.screenrc-keybindings
source ~/.screenrc-keybindings source ~/.screenrc-keybindings
# Default windows # Default windows

View file

@ -9,7 +9,6 @@ for i in $(ls profiles/logos); do
sed -i "s/__LOGO__/$logo/" profiles/$i-light sed -i "s/__LOGO__/$logo/" profiles/$i-light
echo "Generating profile: $i-dark" echo "Generating profile: $i-dark"
cp profiles/$i-light profiles/$i-dark cp profiles/$i-light profiles/$i-dark
grep "^caption " profiles/common >> profiles/$i-dark
sed -i "s/ Wk/ Kw/g" profiles/$i-dark sed -i "s/ Wk/ Kw/g" profiles/$i-dark
sed -i "s/kW/wK/g" profiles/$i-dark sed -i "s/kW/wK/g" profiles/$i-dark
done done

View file

@ -21,6 +21,10 @@
source /usr/share/screen-profiles/profiles/common source /usr/share/screen-profiles/profiles/common
# Window tabs, second to last line
caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%?"
# Status string, last line
hardstatus string '__LOGO__%{=b Wk} %100` %{= Wk} %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`,%107`%{= Wk} %Y-%m-%d %0c:%s' hardstatus string '__LOGO__%{=b Wk} %100` %{= Wk} %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`,%107`%{= Wk} %Y-%m-%d %0c:%s'
# NOTE: There is an arbitrary limit of being able to change colors 16 times # NOTE: There is an arbitrary limit of being able to change colors 16 times

View file

@ -68,13 +68,14 @@ def menu(screen, size, isInstalled):
installtext=_("Install screen by default at login") installtext=_("Install screen by default at login")
li = Listbox(height = 6, width = 60, returnExit = 1) li = Listbox(height = 7, width = 60, returnExit = 1)
li.append(_("Help"), 1) li.append(_("Help"), 1)
li.append(_("Change screen profile"), 2) li.append(_("Change screen profile"), 2)
li.append(_("Change escape sequence"), 3) li.append(_("Change keybinding set"), 3)
li.append(_("Create new window(s)"), 4) li.append(_("Change escape sequence"), 4)
li.append(_("Manage default windows"), 5) li.append(_("Create new window(s)"), 5)
li.append(installtext, 6) li.append(_("Manage default windows"), 6)
li.append(installtext, 7)
bb = ButtonBar(screen, ((_("Ok"), "ok"), (_("Exit"), "exit")), compact = 1) bb = ButtonBar(screen, ((_("Ok"), "ok"), (_("Exit"), "exit")), compact = 1)
g = GridForm(screen, _("Screen Profiles Menu"), 1, 2) g = GridForm(screen, _("Screen Profiles Menu"), 1, 2)
@ -170,7 +171,26 @@ def profile(screen, size):
return 0 return 0
return 100 return 100
def keybindings(screen, size):
li = Listbox(height = 6, width = 60, returnExit = 1)
for choice in commands.getoutput('ls '+SHARE+'/keybindings').splitlines():
li.append(choice, choice)
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel")), compact = 1)
g = GridForm(screen, _("Which set of keybindings would you like to use?"), 1, 2)
g.add(li, 0, 0, padding=(4,2,4,2))
g.add(bb, 0, 1, padding=(1,1,0,0))
if bb.buttonPressed(g.runOnce()) != "cancel":
switch_keybindings(li.current())
button = messagebox(screen, 60, 2, _("Message"), _("Restart screen to apply the new keybindings"), \
buttons=((_("Ok"),"ok"), (_("Exit"), "exit")) )
if button == "exit":
return 0
return 100
def switch_keybindings(set):
commands.getoutput("sed -i -e 's:^source .*$:source "+SHARE+"/keybindings/"+set+":' "+HOME+"/.screenrc-keybindings")
def newwindow(screen, size): def newwindow(screen, size):
title=Entry(8, text="bash", returnExit=1) title=Entry(8, text="bash", returnExit=1)
titlel=Label(_("Title: ")) titlel=Label(_("Title: "))
@ -190,7 +210,7 @@ def newwindow(screen, size):
for cur in cmd: for cur in cmd:
r.append(cur[0], count) r.append(cur[0], count)
count=count+1 count=count+1
cb=Checkbox(_("Add to default windows")) cb=Checkbox(_("Add to default windows"))
bb = ButtonBar(screen, ((_("Create"), "create"), (_("Cancel"), "cancel")), compact = 1) bb = ButtonBar(screen, ((_("Create"), "create"), (_("Cancel"), "cancel")), compact = 1)
@ -219,18 +239,18 @@ def newwindow(screen, size):
appendwindow(win) appendwindow(win)
return 100 return 100
def appendwindow(win): def appendwindow(win):
f=open(HOME+'/.screenrc-windows', 'a') f=open(HOME+'/.screenrc-windows', 'a')
try: try:
f.write(win+"\n") f.write(win+"\n")
except IOError: except IOError:
return None return None
finally: finally:
f.close() f.close()
def readwindows(): def readwindows():
f=open(HOME+'/.screenrc-windows', 'r') f=open(HOME+'/.screenrc-windows', 'r')
try: try:
@ -238,7 +258,7 @@ def readwindows():
for line in f.readlines(): for line in f.readlines():
if line.startswith("# "): if line.startswith("# "):
# this is a comment # this is a comment
window=[-1, line] window=[-1, line]
elif line.startswith("#"): elif line.startswith("#"):
# this is an inactive window # this is an inactive window
window=[0, line.lstrip("#")] window=[0, line.lstrip("#")]
@ -253,7 +273,7 @@ def readwindows():
finally: finally:
f.close() f.close()
def writewindows(winlist): def writewindows(winlist):
f=open(HOME+'/.screenrc-windows', 'w') f=open(HOME+'/.screenrc-windows', 'w')
try: try:
@ -270,10 +290,10 @@ def writewindows(winlist):
finally: finally:
f.close() f.close()
def defaultwindows(screen, size): def defaultwindows(screen, size):
winlist=readwindows() winlist=readwindows()
rl=Label(_("Windows:")) rl=Label(_("Windows:"))
r=CheckboxTree(10, scroll=1) r=CheckboxTree(10, scroll=1)
count=0 count=0
@ -281,25 +301,25 @@ def defaultwindows(screen, size):
if win[0] != -1: if win[0] != -1:
r.append(win[1],count,selected=win[0]) r.append(win[1],count,selected=win[0])
count=count+1 count=count+1
bb = ButtonBar(screen, ((_("Save"), "save"), (_("Cancel"), "cancel")), compact = 1) bb = ButtonBar(screen, ((_("Save"), "save"), (_("Cancel"), "cancel")), compact = 1)
g = GridForm(screen, _("Select window(s) to create by default:"), 2, 4 ) g = GridForm(screen, _("Select window(s) to create by default:"), 2, 4 )
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1)) g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1))
g.add(r, 1, 0) g.add(r, 1, 0)
g.add(bb, 1, 1, padding=(4,1,0,0)) g.add(bb, 1, 1, padding=(4,1,0,0))
if bb.buttonPressed(g.runOnce()) != "cancel": if bb.buttonPressed(g.runOnce()) != "cancel":
count=0 count=0
for win in winlist: for win in winlist:
if win[0] != -1: if win[0] != -1:
win[0] = r.getEntryValue(count)[1] win[0] = r.getEntryValue(count)[1]
count=count+1 count=count+1
writewindows(winlist) writewindows(winlist)
return 100 return 100
def install(screen, size, isInstalled): def install(screen, size, isInstalled):
if not isInstalled: if not isInstalled:
out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-install") out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-install")
@ -430,13 +450,15 @@ def main():
tag = help(screen, size, config) tag = help(screen, size, config)
elif tag == 2: elif tag == 2:
tag = profile(screen, size) tag = profile(screen, size)
elif tag == 3: elif tag == 3:
tag = keybindings(screen, size)
elif tag == 4:
tag = chgesc(screen, size) tag = chgesc(screen, size)
elif tag == 4:
tag = newwindow(screen, size)
elif tag == 5: elif tag == 5:
tag = defaultwindows(screen, size) tag = newwindow(screen, size)
elif tag == 6: elif tag == 6:
tag = defaultwindows(screen, size)
elif tag == 7:
tag = install(screen, size, isInstalled) tag = install(screen, size, isInstalled)
isInstalled=(tag == 100) isInstalled=(tag == 100)