Skip to content

Instantly share code, notes, and snippets.

@matrixik
Last active March 4, 2020 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matrixik/c62ee6553c9abbccd78b3e1e2574f665 to your computer and use it in GitHub Desktop.
Save matrixik/c62ee6553c9abbccd78b3e1e2574f665 to your computer and use it in GitHub Desktop.
Geeqie copy file to ~/Pictures with changing name when clicking F12
[Desktop Entry]
Version=1.0
Type=Application
# The name which appears in the menu:
Name=Copy to Pictures
# Replace "command" with the actual command or script:
#Exec=yes | cp -rf %F ~/Pictures
Exec=geeqie_copy.sh %F &
# %f A single file name, even if multiple files are selected. The
# system reading the desktop entry should recognize that the program in
# question cannot handle multiple file arguments, and it should should
# probably spawn and execute multiple copies of a program for each
# selected file if the program is not able to handle additional file
# arguments. If files are not on the local file system (i.e. are on HTTP
# or FTP locations), the files will be copied to the local file system
# and %f will be expanded to point at the temporary file. Used for
# programs that do not understand the URL syntax.
#
# %F A list of files. Use for apps that can open several local files
# at once. Each file is passed as a separate argument to the executable
# program.
#
# %u A single URL. Local files may either be passed as file: URLs or
# as file path.
#
# %U A list of URLs. Each URL is passed as a separate argument to
# the executable program. Local files may either be passed as file: URLs
# or as file path.
# Change the following line to point to an icon of your choosing
Icon=gtk-file
# Use the following to only show this menu entry if the command is installed
#TryExec=command
# Desktop files that are usable only in Geeqie should be marked like this:
Categories=X-Geeqie;
OnlyShowIn=X-Geeqie;
# Uncomment the following line to include in a Geeqie menu,
# other than in the default path of EditMenu/ExternalMenu
#X-Geeqie-Menu-Path=<FileMenuPath>
# e.g.
#X-Geeqie-Menu-Path=SelectMenu/SelectSection
# Valid sections are:
# FileMenu
# FileMenu/OpenSection
# FileMenu/SearchSection
# FileMenu/PrintSection
# FileMenu/FileOpsSection
# FileMenu/QuitSection
# GoMenu
# SelectMenu
# SelectMenu/SelectSection
# SelectMenu/ClipboardSection
# SelectMenu/MarksSection
# EditMenu
# EditMenu/EditSection
# EditMenu/OrientationMenu
# EditMenu/RatingMenu
# EditMenu/PropertiesSection
# EditMenu/PreferencesSection
# PluginsMenu
# ViewMenu
# ViewMenu/WindowSection
# ViewMenu/FileDirMenu
# ViewMenu/FileDirMenu/FolderSection
# ViewMenu/FileDirMenu/ListSection
# ViewMenu/DirSection
# ViewMenu/ZoomMenu
# ViewMenu/ZoomMenu/ConnectZoomMenu
# ViewMenu/SplitMenu
# ViewMenu/StereoMenu
# ViewMenu/ColorMenu
# ViewMenu/OverlayMenu
# ViewMenu/ViewSection
# ViewMenu/ToolsSection
# ViewMenu/SlideShowSection
# HelpMenu
# HelpMenu/HelpSection
# This is a filter - see symlink.desktop and geeqie-symlink for an example
# how to use this feature
#X-Geeqie-Filter=true
# It can be made verbose
#X-Geeqie-Verbose=true
X-Geeqie-Hotkey=F12
X-Geeqie-Keep-Fullscreen=true
#!/bin/bash
for file in "$@" ; do
# we get only one file for each group, typically the main one
# get the sidecars:
echo ">>><<<"
geeqie -r --get-sidecars:"$file" | while read -r sidecar ; do
# Do something with the each of the grouped files
DATE=$(exiftool -a "-ExifIFD:DateTimeOriginal" "$sidecar" | awk '/Time Original/ { print $4 }' | tr -d ':')
FILENAME="${DATE}$(basename "${sidecar}")"
# Clean name: YYYYMMDD_0123.jpg
CLEAN_FILENAME="${FILENAME//DSC}"
yes | cp -rf "$sidecar" ~/Pictures/"${CLEAN_FILENAME}"
echo "${CLEAN_FILENAME}"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment