diff options
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/dmbookm | 5 | ||||
-rwxr-xr-x | .local/bin/setwp | 17 |
2 files changed, 16 insertions, 6 deletions
diff --git a/.local/bin/dmbookm b/.local/bin/dmbookm index 2bfeb21..90b7c74 100755 --- a/.local/bin/dmbookm +++ b/.local/bin/dmbookm @@ -31,6 +31,9 @@ use constant LIST => { nua_zammad => 'https://support.nuabee.fr/', nua_atlas => 'https://atlas.nuabee.fr/', nua_share => 'https://share.nuabee.fr/', + nua_aether => 'https://aether.int.ysosecure.com/ui', + nua_gaia => 'https://gaia.int.ysosecure.com/', + nua_cert => 'https://orca1.int.ysosecure.com/certsrv', }; sub main @@ -50,7 +53,7 @@ sub main if (HOSTNAME eq "mars") { $prefix += '/local'; } - for (keys %{LIST()}) { + for (sort keys %{LIST()}) { $list .= $_ . "\n"; } $choice = `printf "$list" | dmenu -i -l 100 -sb '$color' -shb '$color'`; diff --git a/.local/bin/setwp b/.local/bin/setwp index 98938c5..e5fce65 100755 --- a/.local/bin/setwp +++ b/.local/bin/setwp @@ -4,6 +4,7 @@ use strict; use warnings; use File::HomeDir qw(home); use File::Copy; +use File::Find; use constant { WP_POOL => home() . '/pics/wp/' @@ -12,11 +13,13 @@ use constant FEH_PATH => 'feh'; sub get_pool_files { + my ($pool) = (@_); my @files; - opendir(DIR, WP_POOL) or die "Couldn't open directory " . WP_POOL . ": $!"; - @files = grep { !/^\./ } readdir(DIR); - closedir(DIR); + $pool = WP_POOL if not @_; + find(sub { + push @files, $File::Find::name if -f; + }, $pool); return @files; } @@ -27,7 +30,7 @@ sub choose_wp my $wp; $rand = int(rand(@files)); - $wp = WP_POOL . $files[$rand]; + $wp = $files[$rand]; return $wp; } @@ -87,8 +90,12 @@ sub main if (@ARGV != 0 && -f $ARGV[0]) { $ret = set_wp($ARGV[0]); } + elsif (@ARGV != 0 && -d $ARGV[0]) { + $wp = choose_wp(get_pool_files($ARGV[0])); + $ret = set_wp($wp); + } else { - $wp = choose_wp(get_pool_files()); + $wp = choose_wp(get_pool_files(WP_POOL)); $ret = set_wp($wp); } if (@ARGV == 0 || (@ARGV != 0 && $ARGV[0] ne "-nw")) { |