Add shortcuts for next/prev profile (Peter E Lind, LP#1314734)
This commit is contained in:
commit
6ffafe81d1
|
@ -189,7 +189,9 @@ DEFAULTS = {
|
|||
'insert_number' : '',
|
||||
'insert_padded' : '',
|
||||
'edit_window_title': '',
|
||||
'layout_launcher' : ''
|
||||
'layout_launcher' : '',
|
||||
'next_profile' : '',
|
||||
'previous_profile' : ''
|
||||
},
|
||||
'profiles': {
|
||||
'default': {
|
||||
|
|
|
@ -147,7 +147,9 @@ class PrefsEditor:
|
|||
'insert_number' : 'Insert terminal number',
|
||||
'insert_padded' : 'Insert zero padded terminal number',
|
||||
'edit_window_title': 'Edit window title',
|
||||
'layout_launcher' : 'Open layout launcher window'
|
||||
'layout_launcher' : 'Open layout launcher window',
|
||||
'next_profile' : 'Switch to next profile',
|
||||
'previous_profile' : 'Switch to previous profile'
|
||||
}
|
||||
|
||||
def __init__ (self, term):
|
||||
|
|
|
@ -196,6 +196,26 @@ class Terminal(gtk.VBox):
|
|||
"""Return our profile name"""
|
||||
return(self.config.profile)
|
||||
|
||||
def switch_to_next_profile(self):
|
||||
profilelist = self.config.list_profiles()
|
||||
list_length = len(profilelist)
|
||||
|
||||
if list_length > 1:
|
||||
if profilelist.index(self.get_profile()) + 1 == list_length:
|
||||
self.force_set_profile(False, profilelist[0])
|
||||
else:
|
||||
self.force_set_profile(False, profilelist[profilelist.index(self.get_profile()) + 1])
|
||||
|
||||
def switch_to_previous_profile(self):
|
||||
profilelist = self.config.list_profiles()
|
||||
list_length = len(profilelist)
|
||||
|
||||
if list_length > 1:
|
||||
if profilelist.index(self.get_profile()) == 0:
|
||||
self.force_set_profile(False, profilelist[list_length - 1])
|
||||
else:
|
||||
self.force_set_profile(False, profilelist[profilelist.index(self.get_profile()) - 1])
|
||||
|
||||
def get_cwd(self):
|
||||
"""Return our cwd"""
|
||||
return(self.terminator.pid_cwd(self.pid))
|
||||
|
@ -1580,6 +1600,12 @@ class Terminal(gtk.VBox):
|
|||
def key_zoom_in(self):
|
||||
self.zoom_in()
|
||||
|
||||
def key_next_profile(self):
|
||||
self.switch_to_next_profile()
|
||||
|
||||
def key_previous_profile(self):
|
||||
self.switch_to_previous_profile()
|
||||
|
||||
def key_zoom_out(self):
|
||||
self.zoom_out()
|
||||
|
||||
|
|
Loading…
Reference in New Issue