* 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
to the screen script, such that it is executed each time screen is run,
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

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-dark usr/share/screen-profiles/profiles/misc
keybindings/common usr/share/screen-profiles/keybindings
keybindings/none usr/share/screen-profiles/keybindings
windows/common usr/share/screen-profiles/windows
screen 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@
defscrollback 10000
# Default keybindings
source /usr/share/screen-profiles/keybindings/common
# Additional, user-defined/overriding keybindings should be placed
# in each user's ~/.screenrc-keybindings
# The selected keybinding set, plus any additional user-defined/overriding
# keybindings should be placed in each user's ~/.screenrc-keybindings
source ~/.screenrc-keybindings
# Default windows

View file

@ -9,7 +9,6 @@ for i in $(ls profiles/logos); do
sed -i "s/__LOGO__/$logo/" profiles/$i-light
echo "Generating profile: $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/kW/wK/g" profiles/$i-dark
done

View file

@ -21,6 +21,10 @@
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'
# 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")
li = Listbox(height = 6, width = 60, returnExit = 1)
li = Listbox(height = 7, width = 60, returnExit = 1)
li.append(_("Help"), 1)
li.append(_("Change screen profile"), 2)
li.append(_("Change escape sequence"), 3)
li.append(_("Create new window(s)"), 4)
li.append(_("Manage default windows"), 5)
li.append(installtext, 6)
li.append(_("Change keybinding set"), 3)
li.append(_("Change escape sequence"), 4)
li.append(_("Create new window(s)"), 5)
li.append(_("Manage default windows"), 6)
li.append(installtext, 7)
bb = ButtonBar(screen, ((_("Ok"), "ok"), (_("Exit"), "exit")), compact = 1)
g = GridForm(screen, _("Screen Profiles Menu"), 1, 2)
@ -171,6 +172,25 @@ def profile(screen, size):
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):
title=Entry(8, text="bash", returnExit=1)
titlel=Label(_("Title: "))
@ -430,13 +450,15 @@ def main():
tag = help(screen, size, config)
elif tag == 2:
tag = profile(screen, size)
elif tag == 3:
elif tag == 3:
tag = keybindings(screen, size)
elif tag == 4:
tag = chgesc(screen, size)
elif tag == 4:
tag = newwindow(screen, size)
elif tag == 5:
tag = defaultwindows(screen, size)
tag = newwindow(screen, size)
elif tag == 6:
tag = defaultwindows(screen, size)
elif tag == 7:
tag = install(screen, size, isInstalled)
isInstalled=(tag == 100)