Skip to content

Instantly share code, notes, and snippets.

@ablakely
Last active June 22, 2022 00:29
Show Gist options
  • Select an option

  • Save ablakely/42a2a3d529fc0e319f1597a87f18ce3a to your computer and use it in GitHub Desktop.

Select an option

Save ablakely/42a2a3d529fc0e319f1597a87f18ce3a to your computer and use it in GitHub Desktop.

Revisions

  1. ablakely revised this gist Jun 22, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hexfetch.pl
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@

    sub do_neofetch {
    my $osColor = "\x030";
    my $neofetchBin = "bash neofetch";
    my $neofetchBin = "neofetch";

    if ($^O =~ /msys/ || $^O =~ /MSWin32/) {
    $neofetchBin = "sh neofetch --shell_version off";
  2. ablakely revised this gist Jun 22, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hexfetch.pl
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@ sub do_neofetch {


    $neofetch[0] =~ s/^(.*)\@//g;
    $neofetch[0] = "\x02".$osColor."Hostname\003"."\x02".": ".$neofetch[0];
    $neofetch[0] = "\x02".$osColor."Hostname\003"."\x02".": ".$neofetch[0];

    my $nf = join(" ", @neofetch);
    HexChat::command("say $nf");
  3. ablakely created this gist Jun 22, 2022.
    49 changes: 49 additions & 0 deletions hexfetch.pl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    # Hexfetch - Hexchat Neofetch script
    #
    # Written by Aaron Blakely <[email protected]>
    # Date: 6/22/22

    use warnings;

    HexChat::register("Hexfetch", "0.0.1", "Neofetch parser for neofetch sysinfo", "Neofetch parser for neofetch sysinfo");
    HexChat::hook_command("neofetch", "do_neofetch");

    sub do_neofetch {
    my $osColor = "\x030";
    my $neofetchBin = "bash neofetch";

    if ($^O =~ /msys/ || $^O =~ /MSWin32/) {
    $neofetchBin = "sh neofetch --shell_version off";
    }

    my @neofetch = `$neofetchBin --off --title_fqdn on --cpu_temp F --distro_shorthand tiny --color_blocks off --memory_percent on --underline off|sed 's/\x1B\[[0-9;\?]*[a-zA-Z]//g'`;

    for (my $i = 0; $i < $#neofetch; $i++) {
    chomp $neofetch[$i];
    $neofetch[$i] =~ s/\N{U+00C2}//g;


    if ($neofetch[$i] =~ /(.*)\: (.*)/) {
    my $t = $1;

    if ($t eq "OS") {
    if ($2 =~ /Debian/ || $2 =~ /Raspbian/ || $2 =~ /Red Hat Enterprise Linux/) { $osColor = "\x034"; }
    elsif ($2 =~ /Arch/ || $2 =~ /Elementary/ || $2 =~ /Windows/) { $osColor = "\x0311"; }
    elsif ($2 =~ /Ubuntu/) { $osColor = "\x037"; }
    elsif ($2 =~ /Linux Mint/ || $2 =~ /Manjaro/) { $osColor = "\x039"; }
    elsif ($2 =~ /Gentoo/) { $osColor = "\x036"; }
    elsif ($2 =~ /Fedora/) { $osColor = "\x0312"; }
    elsif ($2 =~ /Pop\!_OS/) { $osColor = "\x0310"; }
    }

    $neofetch[$i] =~ s/$t/\002$osColor$t\003\002/;
    }
    }


    $neofetch[0] =~ s/^(.*)\@//g;
    $neofetch[0] = "\x02".$osColor."Hostname\003"."\x02".": ".$neofetch[0];

    my $nf = join(" ", @neofetch);
    HexChat::command("say $nf");
    }