Changeset 23ad51b105f191c931f4cf908dfe28c07e4f3876

Show
Ignore:
Timestamp:
03/12/09 11:30:32 (3 years ago)
Author:
Lincoln de Sousa <lincoln@…>
Children:
6bc67508d7815dd6e33663252591bb7a553da606
Parents:
6764d9cf7f48f1dd5cf0754cf8785031aa135323
git-author:
Aleksandar Krsteski <alekrsteski@…> (03/03/09 23:58:58)
git-committer:
Lincoln de Sousa <lincoln@…> (03/12/09 11:30:32)
Message:

Use user shell by default.

Guake should use user shell defined for the user in /etc/passwd by
default. Also add an option to select user shell in preferences so the
user can return to user shell option after selection another shell.
Implementation uses the user shell by passing None to vte command
argument. Also fallback to user shell if default_shell option defines
invalid path.

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • data/guake.schemas

    r6e52bd6 r23ad51b  
    77            <owner>guake</owner> 
    88            <type>string</type> 
    9             <default>/bin/bash</default> 
     9            <default></default> 
    1010            <locale name="C"> 
    1111                <short>Path to the default shell.</short> 
    12                 <long>Path to the default shell. If an invalid shell is placed 
    13                 here, guake will fallback to bash.</long> 
     12                <long>Path to the default shell. Set to empty to 
     13                use default user shell. If invalid path is set 
     14                here, guake will fallback to user shell.</long> 
    1415            </locale> 
    1516        </schema> 
  • src/guake.py

    r6764d9c r23ad51b  
    903903        method of a vte terminal. 
    904904        """ 
    905         argv = None 
    906         shell = self.client.get_string(KEY('/general/default_shell')) or 'sh' 
     905        # use dictionary to pass named params to work around command 
     906        # parameter in fork_command not accepting None as argument. 
     907        # When we pass None as command, vte starts the default user shell. 
     908        params = {} 
     909 
     910        shell = self.client.get_string(KEY('/general/default_shell')) 
     911        if shell and os.path.exists(shell): 
     912            params['command'] = shell 
     913 
    907914        login_shell = self.client.get_bool(KEY('/general/use_login_shell')) 
    908915        if login_shell: 
    909             argv = ['-'] 
    910  
    911         directory = self.get_current_dir() 
    912         return shell, argv, None, directory, login_shell, False, False 
     916            params['argv'] = ['-'] 
     917 
     918        params['directory'] = self.get_current_dir() 
     919        params['loglastlog'] = login_shell 
     920 
     921        return params 
    913922 
    914923    def add_tab(self, *args): 
     
    924933        self.term_list.append(box.terminal) 
    925934 
    926         pid = box.terminal.fork_command(*self.get_fork_params()) 
     935        pid = box.terminal.fork_command(**self.get_fork_params()) 
    927936        self.pid_list.append(pid) 
    928937 
  • src/prefs.py

    r6e52bd6 r23ad51b  
    3939SHELLS_FILE = '/etc/shells' 
    4040 
     41# string to show in prefereces dialog for user shell option 
     42USER_SHELL_VALUE = _('<user shell>') 
     43 
    4144# translating our types to vte types 
    4245ERASE_BINDINGS = {'ASCII DEL': 'ascii-delete', 
     
    99102            return 
    100103        shell = combo.get_model().get_value(citer, 0) 
    101         self.client.set_string(KEY('/general/default_shell'), shell) 
     104        # we unset the value (restore to default) when user chooses to use 
     105        # user shell as guake shell interpreter. 
     106        if shell == USER_SHELL_VALUE: 
     107            self.client.unset(KEY('/general/default_shell')) 
     108        else: 
     109            self.client.set_string(KEY('/general/default_shell'), shell) 
    102110 
    103111    def on_use_login_shell_toggled(self, chk): 
     
    359367        # default_shell 
    360368        combo = self.get_widget('default_shell') 
     369        # get the value for defualt shell. If unset, set to USER_SHELL_VALUE. 
     370        value = self.client.get_string(KEY('/general/default_shell')) or \ 
     371                USER_SHELL_VALUE 
    361372        for i in combo.get_model(): 
    362             if i[0] == self.client.get_string(KEY('/general/default_shell')): 
     373            if i[0] == value: 
    363374                combo.set_active_iter(i.iter) 
    364375 
     
    450461        """ 
    451462        cb = self.get_widget('default_shell') 
     463        # append user shell as first option 
     464        cb.append_text(USER_SHELL_VALUE) 
    452465        if os.path.exists(SHELLS_FILE): 
    453466            lines = open(SHELLS_FILE).readlines()