Last active
June 22, 2022 00:29
-
-
Save ablakely/42a2a3d529fc0e319f1597a87f18ce3a to your computer and use it in GitHub Desktop.
Neofetch wrapper for hexchat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = "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"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment