diff --git a/src/terminal/terminaldisplay.cc b/src/terminal/terminaldisplay.cc index e7595c248..ebc2ae89e 100644 --- a/src/terminal/terminaldisplay.cc +++ b/src/terminal/terminaldisplay.cc @@ -121,6 +121,28 @@ std::string Display::new_frame( bool initialized, const Framebuffer &last, const } frame.append( '\007' ); } + /* has notification changed? */ + if (f.get_notification() != frame.last_frame.get_notification()) { + frame.append( "\033]" ); + const title_type ¬ification( f.get_notification() ); + for ( title_type::const_iterator i = notification.begin(); + i != notification.end(); + i++ ) { + frame.append( *i ); + } + frame.append( '\007' ); + } + /* has sendfile changed? */ + if (f.get_sendfile() != frame.last_frame.get_sendfile()) { + frame.append( "\033]1337;" ); + const title_type &sendfile( f.get_sendfile() ); + for ( title_type::const_iterator i = sendfile.begin(); + i != sendfile.end(); + i++ ) { + frame.append( *i ); + } + frame.append( '\007' ); + } /* has reverse video state changed? */ if ( (!initialized) diff --git a/src/terminal/terminalframebuffer.cc b/src/terminal/terminalframebuffer.cc index 2751f3b7d..705b95ae8 100644 --- a/src/terminal/terminalframebuffer.cc +++ b/src/terminal/terminalframebuffer.cc @@ -78,7 +78,7 @@ DrawState::DrawState( int s_width, int s_height ) } Framebuffer::Framebuffer( int s_width, int s_height ) - : rows(), icon_name(), window_title(), clipboard(), bell_count( 0 ), title_initialized( false ), ds( s_width, s_height ) + : rows(), icon_name(), window_title(), clipboard(), notification(), sendfile(), bell_count( 0 ), title_initialized( false ), ds( s_width, s_height ) { assert( s_height > 0 ); assert( s_width > 0 ); @@ -89,7 +89,7 @@ Framebuffer::Framebuffer( int s_width, int s_height ) Framebuffer::Framebuffer( const Framebuffer &other ) : rows( other.rows ), icon_name( other.icon_name ), window_title( other.window_title ), - clipboard( other.clipboard ), bell_count( other.bell_count ), + clipboard( other.clipboard ), notification(other.notification), sendfile(other.sendfile), bell_count( other.bell_count ), title_initialized( other.title_initialized ), ds( other.ds ) { } @@ -101,6 +101,8 @@ Framebuffer & Framebuffer::operator=( const Framebuffer &other ) icon_name = other.icon_name; window_title = other.window_title; clipboard = other.clipboard; + notification = other.notification; + sendfile = other.sendfile; bell_count = other.bell_count; title_initialized = other.title_initialized; ds = other.ds; @@ -384,6 +386,8 @@ void Framebuffer::reset( void ) rows = rows_type( height, newrow() ); window_title.clear(); clipboard.clear(); + notification.clear(); + sendfile.clear(); /* do not reset bell_count */ } diff --git a/src/terminal/terminalframebuffer.h b/src/terminal/terminalframebuffer.h index de9386977..09df6a007 100644 --- a/src/terminal/terminalframebuffer.h +++ b/src/terminal/terminalframebuffer.h @@ -380,6 +380,8 @@ namespace Terminal { title_type icon_name; title_type window_title; title_type clipboard; + title_type notification; + title_type sendfile; unsigned int bell_count; bool title_initialized; /* true if the window title has been set via an OSC */ @@ -453,9 +455,13 @@ namespace Terminal { void set_icon_name( const title_type &s ) { icon_name = s; } void set_window_title( const title_type &s ) { window_title = s; } void set_clipboard( const title_type &s ) { clipboard = s; } + void set_notification( const title_type &s ) { notification = s; } + void set_sendfile( const title_type &s ) { sendfile = s; } const title_type & get_icon_name( void ) const { return icon_name; } const title_type & get_window_title( void ) const { return window_title; } const title_type & get_clipboard( void ) const { return clipboard; } + const title_type & get_notification( void ) const { return notification; } + const title_type & get_sendfile( void ) const { return sendfile; } void prefix_window_title( const title_type &s ); @@ -469,7 +475,7 @@ namespace Terminal { bool operator==( const Framebuffer &x ) const { - return ( rows == x.rows ) && ( window_title == x.window_title ) && ( clipboard == x.clipboard ) && ( bell_count == x.bell_count ) && ( ds == x.ds ); + return ( rows == x.rows ) && ( window_title == x.window_title ) && ( clipboard == x.clipboard ) && ( bell_count == x.bell_count ) && ( ds == x.ds ) && ( notification == x.notification ) && (sendfile == x.sendfile); } }; } diff --git a/src/terminal/terminalfunctions.cc b/src/terminal/terminalfunctions.cc index ca141dd35..52bf4a508 100644 --- a/src/terminal/terminalfunctions.cc +++ b/src/terminal/terminalfunctions.cc @@ -598,6 +598,23 @@ void Dispatcher::OSC_dispatch( const Parser::OSC_End *act __attribute((unused)), Terminal::Framebuffer::title_type clipboard( OSC_string.begin() + 5, OSC_string.end() ); fb->set_clipboard( clipboard ); + } else if ( OSC_string.size() >= 2 && OSC_string[ 0 ] == L'9' && + OSC_string[ 1 ] == L';') { + Terminal::Framebuffer::title_type notification( + OSC_string.begin(), OSC_string.end() ); + fb->set_notification( notification ); + } else if ( OSC_string.size() >= 4 && OSC_string[ 0 ] == L'7' && + OSC_string[ 1 ] == L'7' && OSC_string[ 2 ] == L'7' && + OSC_string[ 3 ] == L';') { + Terminal::Framebuffer::title_type notification( + OSC_string.begin(), OSC_string.end() ); + fb->set_notification( notification ); + } else if ( OSC_string.size() >= 5 && OSC_string[ 0 ] == L'1' && + OSC_string[ 1 ] == L'3' && OSC_string[ 2 ] == L'3' && + OSC_string[ 3 ] == L'7' && OSC_string[ 4 ] == L';') { + Terminal::Framebuffer::title_type sendfile( + OSC_string.begin() + 5, OSC_string.end() ); + fb->set_sendfile( sendfile ); /* handle osc terminal title sequence */ } else if ( OSC_string.size() >= 1 ) { long cmd_num = -1;