aboutsummaryrefslogtreecommitdiff
path: root/bin/.local
diff options
context:
space:
mode:
authorDaniel <[email protected]>2024-07-24 18:02:34 -0400
committerDaniel <[email protected]>2024-07-24 18:02:34 -0400
commitc7cafeb8a86f6bc655cca38bb1f630c8b99047e2 (patch)
tree6dc81eb64fd536cf39fe10eb07231a501c7c826b /bin/.local
parentc5bddbd209db8458a80523a68535745a465e08b3 (diff)
image tagging/sorting scripts
Diffstat (limited to 'bin/.local')
-rwxr-xr-xbin/.local/bin/scripts/load-theme-wallpaper41
-rwxr-xr-xbin/.local/bin/scripts/perl/image-tag26
-rwxr-xr-xbin/.local/bin/scripts/perl/image-tag-view26
3 files changed, 93 insertions, 0 deletions
diff --git a/bin/.local/bin/scripts/load-theme-wallpaper b/bin/.local/bin/scripts/load-theme-wallpaper
new file mode 100755
index 0000000..c31fbfb
--- /dev/null
+++ b/bin/.local/bin/scripts/load-theme-wallpaper
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# Clean wallpaper cache file
+sed -i '/feh/d' $HOME/.cache/wallpaper
+
+search_string=$(echo -e "vivendi\noperandi\noperandi-tinted\nelea-light\nelea-dark\nnight\nautumn" | dmenu -p 'Select theme for search: ')
+
+selected_wallpaper=$(find ~/Pictures/wall_test -type f -name "*[[]${search_string}*[]]*" -exec nsxiv -t -o {} +)
+
+# Options for display modes
+OPTIONS="Tiled\nZoom Filled\nCentered\nMax"
+
+# Prompt user to select a display mode
+selected_mode=$(echo -e "$OPTIONS" | dmenu -p "Select Display Mode:")
+
+# Command to set wallpaper based on selected mode
+case "$selected_mode" in
+ "Tiled")
+ feh --bg-tile "$selected_wallpaper"
+ echo "feh --bg-tile '$selected_wallpaper'" >> ~/.cache/wallpaper
+ ;;
+ "Zoom Filled")
+ feh --bg-fill "$selected_wallpaper"
+ echo "feh --bg-fill '$selected_wallpaper'" >> ~/.cache/wallpaper
+ ;;
+ "Centered")
+ feh --bg-center "$selected_wallpaper"
+ echo "feh --bg-center '$selected_wallpaper'" >> ~/.cache/wallpaper
+ ;;
+ "Max")
+ feh --bg-max "$selected_wallpaper"
+ echo "feh --bg-max '$selected_wallpaper'" >> ~/.cache/wallpaper
+ ;;
+ *)
+ echo "Invalid option selected."
+ exit 1
+ ;;
+esac
+
+echo "Wallpaper set successfully."
+
diff --git a/bin/.local/bin/scripts/perl/image-tag b/bin/.local/bin/scripts/perl/image-tag
new file mode 100755
index 0000000..ffd0e83
--- /dev/null
+++ b/bin/.local/bin/scripts/perl/image-tag
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use File::Basename;
+
+my $wallpaper_dir = "$ENV{HOME}/Pictures/wall_test/Anime";
+opendir(my $dh, $wallpaper_dir) or die "Can't open $wallpaper_dir: $!";
+
+# all images in $wallpaper_dir
+my @images = grep { /\.(png|jp?g)$/i && !/[\[\]]/ } readdir ($dh);
+
+foreach my $image (@images) {
+ # get individual image path
+ my $image_path = "$wallpaper_dir/$image";
+
+ system("nsxiv", "$image_path");;
+
+ my $tags = `echo | dmenu -p "Enter tag(s)"`;
+ chomp($tags);
+
+ if ($tags) {
+ my ($name, $dir, $ext) = fileparse($image_path, qr/\.[^.]*/);
+ my $new_path = "$dir$name [$tags]$ext";
+ rename($image_path, $new_path) or warn "Could not tag image: $!";
+ }
+}
diff --git a/bin/.local/bin/scripts/perl/image-tag-view b/bin/.local/bin/scripts/perl/image-tag-view
new file mode 100755
index 0000000..c4e5afb
--- /dev/null
+++ b/bin/.local/bin/scripts/perl/image-tag-view
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use File::Find;
+use File::HomeDir;
+
+# Define the directory to search
+my $dir = File::HomeDir->my_home() . '/Pictures/wall_test/';
+
+# Array to store matching file paths
+my @files;
+
+# Find files with specific characters in their names
+find(sub {
+ if (-f $_ && /[\[\]\(\)]/) {
+ push @files, $File::Find::name;
+ }
+}, $dir);
+
+# Display files as thumbnails using nsxiv
+if (@files) {
+ my $file_list = join(' ', map { qq("$_") } @files);
+ system("nsxiv -t $file_list");
+} else {
+ print "No files matching the criteria were found.\n";
+}