From d41b500117be17ba7774470332277ce64db3709d Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Wed, 30 Dec 2015 10:46:41 +0100 Subject: [PATCH] add addtheme.sh, updated instructions, make scripts run from outside of themes directory --- CONTRIBUTE.md | 9 ++++++++- addtheme.sh | 33 +++++++++++++++++++++++++++++++++ update.sh | 11 +++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100755 addtheme.sh diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 413723c..d831c38 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -15,11 +15,13 @@ Make a local checkout of this new repository. Inside the new repository create a file containing the theme settings: ```bash -rofi -dump-xresources-theme > Themes/{themename}.theme +./addtheme.sh ``` This stores the colors and separator style configuration in `{themename}.theme`. +Theme author is set to your login name. If you would like to override this, use the `--user "Some Name"` argument. + Edit this file to add more information if needed, for example if the theme should use a specific font. ## Create screenshot and stage files @@ -30,6 +32,11 @@ Run the included script: ./update.sh ``` Make sure the script finished successful. +Dependencies for the script are: + +* xdotool +* xrdb +* xvfb ## Commit and push changes diff --git a/addtheme.sh b/addtheme.sh new file mode 100755 index 0000000..d5323a1 --- /dev/null +++ b/addtheme.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +currentdir="$(pwd)" +rofi_theme_sdir="$(dirname $0)" + +main() { + cd "${rofi_theme_dir}" + theme=$(rofi -dump-xresources-theme | sed "s/User: $USER/User: $user/g") + read -p "Give your Theme a Name: " name + echo "Saving current rofi theme..." + echo "" + echo "Filename: Themes/${name}.theme" + echo "User: ${user}" + echo "" + echo "Theme saved. You can now run 'update.sh' to update this repository" + echo "${theme}" > "Themes/${name}.theme" + cd "${currentdir}" +} + +case $1 in + --user) + user="${2}" main + ;; + --help|-h) + echo "This script stores current rofi theme in Themes subfolder" + echo "" + echo "Arguments:" + echo "--user \"USER\" Uses specified Username in theme file. Otherwise uses login name" + ;; + *) + user=$USER main +esac + diff --git a/update.sh b/update.sh index 70d3a89..4ff7ef4 100755 --- a/update.sh +++ b/update.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash +currentdir="$(pwd)" +rofi_themes_dir="$(dirname $0)" + +cd "${rofi_themes_dir}" git submodule update --init @@ -24,7 +28,7 @@ do IMAGE="Screenshots/${NAME}.png" AUTHOR=$(getAuthor) echo "# ${FILE}" >> README.md - if [ -n ${AUTHOR} ]; + if [ ${AUTHOR} ]; then echo "by ${AUTHOR}" >> README.md fi @@ -47,5 +51,8 @@ do echo "" >> README.md done - git add README.md + +cd "${currentdir}" + +