Antsy

 view release on metacpan or  search on metacpan

examples/fg_bg_colors.pl  view on Meta::CPAN

#!perl

use v5.32;
use experimental qw(signatures);
use lib qw(lib);

use Antsy;

my $fg_rgb = Antsy::iterm_fg_color();

say "@$fg_rgb";

my $bg_rgb = Antsy::iterm_bg_color();

say "@$bg_rgb";

examples/query.pl  view on Meta::CPAN

#!perl

use v5.32;
use experimental qw(signatures);
require Term::ReadKey;
chomp( my $tty = `tty` );
say "TTY is $tty";

open my $terminal, '+<', $tty;
my $old = select( $terminal );
$|++;
select( $old );
$|++;

#query( "\x1b]4;-2;?\x1b\\" );


examples/query.pl  view on Meta::CPAN

	my $key;
	while( defined ($key = Term::ReadKey::ReadKey(0)) ) {
		$response .= $key;
		last if ord( $key ) == 7;
	}
	Term::ReadKey::ReadMode('restore');
	$response;
	}

my $response = query( "\x1b]4;-1;?\x1b\\" );
	say "<" .
		($response =~ s/(.)/ sprintf "%02X ", ord($1) /ger)
		. ">";

	say "<" .
		($response =~ s/\x1b/(ESC)/gr =~ s/\007/(BELL)/gr )
		. ">";

my $OSC = qr/ ( \007 | \x1b \\ ) /xn;

my( $r, $g, $b ) = $response =~ m|rgb:(.+?)/(.+?)/(.+?)$OSC|;
say "R: $r G: $g B: $b";

lib/Antsy.pm  view on Meta::CPAN

		return;
		}

	OSC() . join( ';', @args, '' ) . $command . ST();
	}

sub _iterm_query ( $command, @args ) {
	my $terminal = do {
		state $rc = require Term::ReadKey;
		chomp( my $tty = `/usr/bin/tty` );
		# say "Term: ", $tty;
		open my $terminal, '+<', $tty;
		my $old = select( $terminal );
		$|++;
		select( $old );
		$terminal;
		};

	print { $terminal } _iterm_seq( $command, @args );;
	Term::ReadKey::ReadMode('raw');
	my $response;

lib/Antsy.pm  view on Meta::CPAN

	state $allowed = do {
		my %hash = map { $_, 1 } qw( fireworks no once yes );
		\%hash;
		};
	unless( exists $allowed->{$value} ) {
		carp "iterm_attention argument can be one of <@{[ join ',', sort keys %$allowed ]}>, but you specified <$value>";
		return;
		}

	my $r = _osc_1337( "RequestAttention=$value" );
	say _encode_seq( $r );
	$r;
	}
sub iterm_bounce_dock_icon      { iterm_attention( 'yes' )  }
sub iterm_bounce_dock_icon_once { iterm_attention( 'once' ) }
sub iterm_unbounce_dock_icon    { iterm_attention( 'no' )   }
sub iterm_fireworks             { iterm_attention( 'fireworks' )  }

=item * background_image_file

OSC 1337 ; SetBackgroundImageFile=[base64] ST



( run in 1.858 second using v1.01-cache-2.11-cpan-140bd7fdf52 )