gedit-themes icon indicating copy to clipboard operation
gedit-themes copied to clipboard

Mass theme import?

Open K0K0SHA opened this issue 1 year ago • 5 comments

How come I currently have to import themes 1 by 1? bug recreation: First run installer EDIT: on Mint. Now open gedit and go to preferences then font and color, then hit plus sign to add a theme. Select all themes in the directory you installed to. Notice only the first gets imported.

fix ideas: I'll clone this repo and add working installer for Linux which places the themes in the proper directory

K0K0SHA avatar Jul 04 '23 07:07 K0K0SHA

going to ask GPT where gedit stores and references themes

K0K0SHA avatar Jul 04 '23 07:07 K0K0SHA

cloned repo under my account and added readme.md

K0K0SHA avatar Jul 04 '23 08:07 K0K0SHA

install.sh is dumb in several ways. Here is the source code:

#!/bin/sh
set -v
mkdir -p $HOME/.gnome2/gedit/styles
cp ./*.xml $HOME/.gnome2/gedit/styles/.

It's dumb because not every distro uses gnome. Ubuntu usually uses GNOME, but Mint does not. Other distros may not. Thus creating an install.sh for gnome2 is intolerant, non-robust, and incompatible. I'm going to move the themes to the config directory in gedit default location ~/.local/share/gedit/styles

K0K0SHA avatar Jul 04 '23 08:07 K0K0SHA

removed install scriptt

K0K0SHA avatar Jul 04 '23 09:07 K0K0SHA

replacing the content of the install with the following allows mass theme importation:


#!/bin/bash
##################################################################################
# v0.1
# created by K0K0$H@
# Github repo: https://github.com/K0K0SHA/gedit-themes/
# repo cloned from: https://github.com/mig/gedit-themes/
# this install.sh works with both repos above
# be sure to check readme

styles_dir="$HOME/.local/share/gedit/styles"

if [ ! -d "$styles_dir" ]; then
  echo "The directory $styles_dir does not exist."
  echo "Check gedit config file, as you may need to edit it"
  # TODO attempt gedit config edit if user wants
  exit 1
fi

# ensure there is at least one theme in current directory 

shopt -s nullglob

xml_files=(*.xml)

if [ ${#xml_files[@]} -eq 0 ]; then
  echo "No XML files found in the current directory."
  echo "Ensure you are in the correct directory with style xml files."
  exit 1
fi

# functional one liner (most important line of code)
cp ./*.xml $styles_dir

echo "Themes copied to $styles_dir"
echo "Contents of $styles_dir (user-installed themes):"
ls $styles_dir

K0K0SHA avatar Jul 04 '23 09:07 K0K0SHA