Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/xdg-utils/scripts/xdg-terminal.in

Issue 151098: Patch from mdm@google.com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/bin/sh
2 #---------------------------------------------
3 # xdg-terminal
4 #
5 # Utility script to open the registered terminal emulator
6 #
7 # Refer to the usage() function below for usage.
8 #
9 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
10 #
11 # LICENSE:
12 #
13 #---------------------------------------------
14
15 manualpage()
16 {
17 cat << _MANUALPAGE
18 _MANUALPAGE
19 }
20
21 usage()
22 {
23 cat << _USAGE
24 _USAGE
25 }
26
27 #@xdg-utils-common@
28
29 terminal_kde()
30 {
31 terminal=`kreadconfig --file kdeglobals --group General --key TerminalApplic ation --default konsole`
32
33 terminal_exec=`which $terminal >/dev/null 2>/dev/null`
34
35 if [ -x "$terminal_exec" ]; then
36 if [ x"$1" == x"" ]; then
37 $terminal_exec
38 else
39 $terminal_exec -e "$1"
40 fi
41
42 if [ $? -eq 0 ]; then
43 exit_success
44 else
45 exit_failure_operation_failed
46 fi
47 else
48 exit_failure_operation_impossible "configured terminal program '$termina l' not found or not executable"
49 fi
50 }
51
52 terminal_gnome()
53 {
54 term_exec_key="/desktop/gnome/applications/terminal/exec"
55 term_exec_arg_key="/desktop/gnome/applications/terminal/exec_arg"
56
57 term_exec=`gconftool-2 --get ${term_exec_key}`
58 term_exec_arg=`gconftool-2 --get ${term_exec_arg_key}`
59
60 terminal_exec=`which $term_exec 2>/dev/null`
61
62 if [ -x "$terminal_exec" ]; then
63 if [ x"$1" == x"" ]; then
64 $terminal_exec
65 else
66 if [ x"$term_exec_arg" == x"" ]; then
67 $terminal_exec "$1"
68 else
69 $terminal_exec "$term_exec_arg" "$1"
70 fi
71 fi
72
73 if [ $? -eq 0 ]; then
74 exit_success
75 else
76 exit_failure_operation_failed
77 fi
78 else
79 exit_failure_operation_impossible "configured terminal program '$term_ex ec' not found or not executable"
80 fi
81 }
82
83 terminal_xfce()
84 {
85 if [ x"$1" == x"" ]; then
86 exo-open --launch TerminalEmulator
87 else
88 exo-open --launch TerminalEmulator "$1"
89 fi
90
91 if [ $? -eq 0 ]; then
92 exit_success
93 else
94 exit_failure_operation_failed
95 fi
96 }
97
98 terminal_generic()
99 {
100 # if $TERM is not set, try xterm
101 if [ x"$TERM" == x"" ]; then
102 TERM=xterm
103 fi
104
105 terminal_exec=`which $TERM >/dev/null 2>/dev/null`
106
107 if [ -x "$terminal_exec" ]; then
108 if [ $? -eq 0 ]; then
109 exit_success
110 else
111 exit_failure_operation_failed
112 fi
113 else
114 exit_failure_operation_impossible "configured terminal program '$TERM' n ot found or not executable"
115 fi
116 }
117
118 #[ x"$1" != x"" ] || exit_failure_syntax
119
120 command=
121 while [ $# -gt 0 ] ; do
122 parm="$1"
123 shift
124
125 case "$parm" in
126 -*)
127 exit_failure_syntax "unexpected option '$parm'"
128 ;;
129
130 *)
131 if [ -n "$command" ] ; then
132 exit_failure_syntax "unexpected argument '$parm'"
133 fi
134 command="$parm"
135 ;;
136 esac
137 done
138
139 detectDE
140
141 if [ x"$DE" = x"" ]; then
142 # if TERM variable is not set, try xterm
143 if [ x"$TERM" = x"" ]; then
144 TERM=xterm
145 fi
146 DE=generic
147 fi
148
149 case "$DE" in
150 kde)
151 terminal_kde "$command"
152 ;;
153
154 gnome)
155 terminal_gnome "$command"
156 ;;
157
158 xfce)
159 terminal_xfce "$command"
160 ;;
161
162 generic)
163 terminal_generic "$command"
164 ;;
165
166 *)
167 exit_failure_operation_impossible "no terminal emulator available"
168 ;;
169 esac
OLDNEW
« no previous file with comments | « third_party/xdg-utils/scripts/xdg-terminal ('k') | third_party/xdg-utils/scripts/xdg-utils-common.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698