123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #!/usr/bin/env perl
- use strict;
- use warnings;
- # Stupid script to interactively walk through all wal themes, and save
- # a bunch of aliases of themes you like
- # wal --theme | grep " - " | grep -v random | sed s/^\ -\ //g
- my $wal_path = "/home/swatson/.local/bin/wal";
- my $theme_cmd = "$wal_path -n -e --theme";
- my @saved;
- my @avail_themes = split("\n", `$wal_path --theme | grep " - " | grep -v random | sed s/^\\ -\\ //g`);
- sub set_wal($) {
- my $theme = shift;
- system("$theme_cmd $theme");
- }
- sub gen_alias($) {
- my $theme = shift;
- my $alias = "alias wal-$theme='wal -n -e --theme $theme'";
- return $alias;
- }
- sub dump_saved() {
- foreach my $entry ( @saved ) {
- print "$entry\n";
- }
- }
- foreach my $theme ( @avail_themes ) {
- set_wal($theme);
- print "Theme is: $theme\n";
- print "Hit n for next, a to add to alias list, q to quit\n";
- my $input = <STDIN>;
- chomp $input;
- if ( $input =~ m/n/ ) {
- next;
- } elsif ( $input =~ m/a/ ) {
- my $alias = gen_alias($theme);
- push(@saved,$alias);
- print "Saved $theme\n";
- next;
- } elsif ( $input =~ m/q/ ) {
- dump_saved();
- exit 0;
- } else {
- next;
- }
- }
- dump_saved();
|