Changeset 23ad51b105f191c931f4cf908dfe28c07e4f3876
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r6e52bd6
|
r23ad51b
|
|
| 7 | 7 | <owner>guake</owner> |
| 8 | 8 | <type>string</type> |
| 9 | | <default>/bin/bash</default> |
| | 9 | <default></default> |
| 10 | 10 | <locale name="C"> |
| 11 | 11 | <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> |
| 14 | 15 | </locale> |
| 15 | 16 | </schema> |
-
|
r6764d9c
|
r23ad51b
|
|
| 903 | 903 | method of a vte terminal. |
| 904 | 904 | """ |
| 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 | |
| 907 | 914 | login_shell = self.client.get_bool(KEY('/general/use_login_shell')) |
| 908 | 915 | 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 |
| 913 | 922 | |
| 914 | 923 | def add_tab(self, *args): |
| … |
… |
|
| 924 | 933 | self.term_list.append(box.terminal) |
| 925 | 934 | |
| 926 | | pid = box.terminal.fork_command(*self.get_fork_params()) |
| | 935 | pid = box.terminal.fork_command(**self.get_fork_params()) |
| 927 | 936 | self.pid_list.append(pid) |
| 928 | 937 | |
-
|
r6e52bd6
|
r23ad51b
|
|
| 39 | 39 | SHELLS_FILE = '/etc/shells' |
| 40 | 40 | |
| | 41 | # string to show in prefereces dialog for user shell option |
| | 42 | USER_SHELL_VALUE = _('<user shell>') |
| | 43 | |
| 41 | 44 | # translating our types to vte types |
| 42 | 45 | ERASE_BINDINGS = {'ASCII DEL': 'ascii-delete', |
| … |
… |
|
| 99 | 102 | return |
| 100 | 103 | 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) |
| 102 | 110 | |
| 103 | 111 | def on_use_login_shell_toggled(self, chk): |
| … |
… |
|
| 359 | 367 | # default_shell |
| 360 | 368 | 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 |
| 361 | 372 | for i in combo.get_model(): |
| 362 | | if i[0] == self.client.get_string(KEY('/general/default_shell')): |
| | 373 | if i[0] == value: |
| 363 | 374 | combo.set_active_iter(i.iter) |
| 364 | 375 | |
| … |
… |
|
| 450 | 461 | """ |
| 451 | 462 | cb = self.get_widget('default_shell') |
| | 463 | # append user shell as first option |
| | 464 | cb.append_text(USER_SHELL_VALUE) |
| 452 | 465 | if os.path.exists(SHELLS_FILE): |
| 453 | 466 | lines = open(SHELLS_FILE).readlines() |