add addtheme.sh, updated instructions, make scripts run from outside of themes directory

This commit is contained in:
Rasmus Steinke 2015-12-30 10:46:41 +01:00
parent e943205f93
commit d41b500117
3 changed files with 50 additions and 3 deletions

View file

@ -15,11 +15,13 @@ Make a local checkout of this new repository.
Inside the new repository create a file containing the theme settings: Inside the new repository create a file containing the theme settings:
```bash ```bash
rofi -dump-xresources-theme > Themes/{themename}.theme ./addtheme.sh
``` ```
This stores the colors and separator style configuration in `{themename}.theme`. 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. Edit this file to add more information if needed, for example if the theme should use a specific font.
## Create screenshot and stage files ## Create screenshot and stage files
@ -30,6 +32,11 @@ Run the included script:
./update.sh ./update.sh
``` ```
Make sure the script finished successful. Make sure the script finished successful.
Dependencies for the script are:
* xdotool
* xrdb
* xvfb
## Commit and push changes ## Commit and push changes

33
addtheme.sh Executable file
View file

@ -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

View file

@ -1,4 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
currentdir="$(pwd)"
rofi_themes_dir="$(dirname $0)"
cd "${rofi_themes_dir}"
git submodule update --init git submodule update --init
@ -24,7 +28,7 @@ do
IMAGE="Screenshots/${NAME}.png" IMAGE="Screenshots/${NAME}.png"
AUTHOR=$(getAuthor) AUTHOR=$(getAuthor)
echo "# ${FILE}" >> README.md echo "# ${FILE}" >> README.md
if [ -n ${AUTHOR} ]; if [ ${AUTHOR} ];
then then
echo "by ${AUTHOR}" >> README.md echo "by ${AUTHOR}" >> README.md
fi fi
@ -47,5 +51,8 @@ do
echo "" >> README.md echo "" >> README.md
done done
git add README.md git add README.md
cd "${currentdir}"