@@ -32,6 +32,7 @@ pub const LINUX_TERMINALS: &[Terminal] = &[
3232 Terminal :: Kitty ,
3333 Terminal :: GnomeConsole ,
3434 Terminal :: GnomeTerminal ,
35+ Terminal :: Guake ,
3536 Terminal :: Hyper ,
3637 Terminal :: Konsole ,
3738 Terminal :: XfceTerminal ,
@@ -121,6 +122,8 @@ pub enum Terminal {
121122 CursorNightly ,
122123 /// Rio <https://github.com/raphamorim/rio>
123124 Rio ,
125+ /// Guake
126+ Guake ,
124127
125128 // Other pseudoterminal that we want to launch within
126129 /// SSH
@@ -170,6 +173,7 @@ impl fmt::Display for Terminal {
170173 Terminal :: CursorNightly => write ! ( f, "Cursor Nightly" ) ,
171174 Terminal :: Rio => write ! ( f, "Rio" ) ,
172175 Terminal :: Windsurf => write ! ( f, "Windsurf" ) ,
176+ Terminal :: Guake => write ! ( f, "Guake" ) ,
173177 }
174178 }
175179}
@@ -201,6 +205,7 @@ impl Terminal {
201205 Some ( "Tabby" ) => return Some ( Terminal :: Tabby ) ,
202206 Some ( "Nova" ) => return Some ( Terminal :: Nova ) ,
203207 Some ( "WezTerm" ) => return Some ( Terminal :: WezTerm ) ,
208+ Some ( "guake" ) => return Some ( Terminal :: Guake ) ,
204209 _ => ( ) ,
205210 } ;
206211
@@ -247,17 +252,22 @@ impl Terminal {
247252 ///
248253 /// Only the list provided in `terminals` will be searched for.
249254 pub fn try_from_cmdline ( cmdline : & str , terminals : & Vec < Terminal > ) -> Option < Self > {
250- // Special case for terminator
251- if terminals. contains ( & Terminal :: Terminator ) {
255+ // Special cases for terminals that launch as a script, e.g.
256+ // `/usr/bin/python3 /usr/bin/terminator`
257+ let second_arg_terms = & [ Terminal :: Terminator , Terminal :: Guake ] ;
258+ if second_arg_terms. iter ( ) . any ( |t| terminals. contains ( t) ) {
252259 let second_arg_name = cmdline
253260 . split ( ' ' )
254261 . skip ( 1 )
255262 . take ( 1 )
256263 . next ( )
257264 . and_then ( |cmd| cmd. split ( '/' ) . last ( ) ) ;
258265 if let Some ( second_arg_name) = second_arg_name {
259- if Terminal :: Terminator . executable_names ( ) . contains ( & second_arg_name) {
260- return Some ( Terminal :: Terminator ) ;
266+ if let Some ( term) = second_arg_terms
267+ . iter ( )
268+ . find ( |t| t. executable_names ( ) . contains ( & second_arg_name) )
269+ {
270+ return Some ( term. clone ( ) ) ;
261271 }
262272 }
263273 }
@@ -322,6 +332,7 @@ impl Terminal {
322332 Terminal :: CursorNightly => "cursor-nightly" . into ( ) ,
323333 Terminal :: Rio => "rio" . into ( ) ,
324334 Terminal :: Windsurf => "windsurf" . into ( ) ,
335+ Terminal :: Guake => "guake" . into ( ) ,
325336 }
326337 }
327338
@@ -441,6 +452,7 @@ impl Terminal {
441452 Terminal :: CursorNightly => & [ "Cursor Nightly" , "cursor-nightly" ] ,
442453 Terminal :: Rio => & [ "rio" ] ,
443454 Terminal :: Windsurf => & [ "windsurf" ] ,
455+ Terminal :: Guake => & [ "guake" ] ,
444456
445457 Terminal :: Ssh => & [ "sshd" ] ,
446458 Terminal :: Tmux => & [ "tmux" , "tmux: server" ] ,
@@ -758,5 +770,15 @@ mod tests {
758770 Some ( Terminal :: Terminator ) ,
759771 "should return terminator"
760772 ) ;
773+
774+ let ctx = make_context ( Os :: Linux , vec ! [
775+ ( Some ( "q" ) , None ) ,
776+ ( Some ( "python3" ) , Some ( "/usr/bin/python3 /usr/bin/guake" ) ) ,
777+ ] ) ;
778+ assert_eq ! (
779+ Terminal :: from_process_info( & ctx, & LINUX_TERMINALS . to_vec( ) ) ,
780+ Some ( Terminal :: Guake ) ,
781+ "should return guake"
782+ ) ;
761783 }
762784}
0 commit comments