Skip to content

Commit

Permalink
Add shell script to assemble the database icons
Browse files Browse the repository at this point in the history
... from a previously downloaded directory that contains the
SVG or PNG files from the icons8 collection.

Implements keepassxreboot#4071
  • Loading branch information
wolframroesler committed May 4, 2020
1 parent ef1f98f commit e181f2e
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
File renamed without changes.
130 changes: 130 additions & 0 deletions utils/makedbicons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/bin/bash
# Assemble database icons from the icons8 collection
# by Wolfram Rösler 2020-04-30

# Check parameters
if [[ $# != 1 ]];then
echo "Assemble database icons"
echo "Usage: $0 icons8-directory"
exit 1
fi

# Check source directory
SRCDIR="$1"
if [ ! -d "$SRCDIR" ];then
echo "icons8 directory doesn't exist: $SRCDIR"
exit 1
fi

# Check destination directory
DSTDIR=share/icons/database
if [ ! -d "$DSTDIR" ];then
echo "Please invoke this script from the KeePassXC source root directory."
exit 1
fi

# Copy one icon from the icons8 collection.
#
# Usage: copy I8NAME Cnn
# I8NAME is the file name (without extender and without
# the "icon8-" prefix) in the icons8 directory.
# Cnn is C plus the number of the database icon.
#
# Example: copy key C00
copy() {
# The source file is:
# (depending on how you download the icons they come
# with or without "icons8-" at the beginning and "-100"
# at the end of the file name)
SRC=$(find "$SRCDIR" -name "$1.???" -o -name "icons8-$1-100.???")
if [ ! -f "$SRC" ];then
echo "Cannot find source icon $1"
exit 1
fi

# And the destination file is:
DST=$(ls $DSTDIR/$2*)
if [ ! -f "$DST" ];then
echo "Cannot find target icon $2"
exit 1
fi

# Remove the existing destination file (may have
# an extension different from the source file
rm -f "$DST" || exit

# Copy the source file to the destination, keeping
# the source file's extension
cp $SRC ${DST%.*}.${SRC#*.} || exit
}

# Now do the actual work
copy key C00
copy globe C01
copy error C02
copy workstation C03
copy clipboard C04
copy businessman C05
copy org_unit C06
copy pencil-drawing C07
copy external C08
copy identification-documents C09
copy address_book C10
copy old_time_camera C11
copy wi-fi C12
copy keys-holder C13
copy electrical C14
copy scanner C15
copy bookmark C16
copy cd C17
copy monitor C18
copy open-envelope C19
copy settings C20
copy inspection C21
copy file C22
copy desktop C23
copy flash_on C24
copy postal C25
copy save C26
copy cloud-storage C27
copy quicktime-player C28
copy key-2 C29
copy console C30
copy print C31
copy categorize C32
copy finish-flag C33
copy support C34
copy vpn C35
copy archive-folder C36
copy percentage C37
copy windows-client C38
copy clock C39
copy search C40
copy landscape C41
copy memory_slot C42
copy empty_trash C43
copy note C44
copy delete C45
copy help C46
copy product C47
copy folder C48
copy opened_folder C49
copy data_encryption C50
copy unlock C51
copy lock C52
copy checkmark C53
copy signature C54
copy image_file C55
copy contacts C56
copy data_sheet C57
copy podium_with_speaker C58
copy hammer C59
copy home C60
copy star-filled C61
copy linux C62
copy android_os C63
copy apple-logo C64
copy wikipedia C65
copy currency_exchange C66
copy diploma_1 C67
copy iphone C68

0 comments on commit e181f2e

Please sign in to comment.