diff --git a/CHANGELOG.md b/CHANGELOG.md index f20eb8f..5d26ba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed - `hand2` and `left_ptr` hotspots alignments fixed. -- Ignored `docs` files (**.md ,LICENCE, **.bbcode) in `build` GitHub Actions. ([3a19013](https://github.com/ful1e5/apple_cursor/commit/0df635b1cdd18840606956f2188e735321f6f8b5)) +- Ignored `docs` files (**.md ,LICENCE, **.bbcode) in `build` GitHub Actions. ([0df635b](https://github.com/ful1e5/apple_cursor/commit/0df635b1cdd18840606956f2188e735321f6f8b5)) +- Windows Configs inside `config.py` ([e7d5092](https://github.com/ful1e5/apple_cursor/commit/e7d509295b69fbe43cdc3ea3000c493dcee47824)) +- Redesign **Windows package** with `install.inf`. ([5f99e05](https://github.com/ful1e5/apple_cursor/commit/5f99e0565a5730165a498695bcbba4716108e82b)) +- Remove **unnecessary** Windows Cursors. ([5f99e05](https://github.com/ful1e5/apple_cursor/commit/5f99e0565a5730165a498695bcbba4716108e82b)) ## Added - Cursors Preview, Build Dependencies, Runtime Dependencies and other Documents @ [README.md](https://github.com/ful1e5/apple_cursor/blob/master/README.md) - CONTRIBUTING.md - CODE_OF_CONDUCT.md +- Quick Install (Windows & Linux) Documents @ [README.md](https://github.com/ful1e5/apple_cursor/blob/master/README.md) ([686bde5](https://github.com/ful1e5/apple_cursor/commit/686bde5eda5c4d913dd8c9df49aa94c20d24d9bf)) +- **install.sh** and **windows.inf**(automated installtion files) added in `scripts` directory. ## [1.0.1-beta] - 3 August 2020 @@ -24,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `hand1 hand2 move` cursors finger gap & border in center - Drop shadow & FPS(**62**) imporovments in `wait, left_ptr_watch` cursors. -- Build size fix **65x65** to **64x64**. ([b6a8529](https://github.com/ful1e5/apple_cursor/commit/1120d176636baff2aac1838ba316b4f420be7ca7)) +- Build size fix **65x65** to **64x64**. ([1120d17](https://github.com/ful1e5/apple_cursor/commit/1120d176636baff2aac1838ba316b4f420be7ca7)) - [Pling](https://www.pling.com/p/1408466/) product page Docs at `PLING.bbcode`. ## [1.0.0-alpha1] - 31 July 2020 diff --git a/README.md b/README.md index 2302e57..5a8bee5 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,28 @@ Enjoy upcoming **[macOS BigSur](https://www.apple.com/macos/big-sur-preview/)** Cursor Theme for `Windows` and `Linux` with _HiDPi Support_ 🎉. +#### Quick install + +##### via curl + +```bash +bash <(curl -s "https://raw.githubusercontent.com/ful1e5/apple_cursor/easy-install-patch/scripts/install.sh") +``` + +##### via wget + +```bash +bash <(wget -qO- "https://raw.githubusercontent.com/ful1e5/apple_cursor/easy-install-patch/scripts/install.sh") +``` + +#### Windows + +1. unzip `macOSBigSur_Windows.zip` file +2. Open `macOSBigSur_Windows/` in Explorer, and **right click** on `install.inf`. +3. Click 'Install' from the context menu, and authorise the modifications to your system. +4. Open _Control Panel > Personalisation and Appearance > Change mouse pointers_, and select **MacOSBigSur Cursors**. +5. Click '**Apply**'. + #### Cursor Sizes: 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96 #### Colors: @@ -156,15 +178,6 @@ mv macOSBigSur ~/.icons/ sudo mv macOSBigSur /usr/share/icons/ ``` -### Windows - -1. Open the `settings` app. -2. **Goto** `Devices` -> `Mouse` -> `Additional Mouse Options`. -3. **Goto** the `pointers` tab. -4. Replace each cursor in the currently applied cursor set with the corresponding cursor in the `mac OsBigSur Windows Theme` folder. -5. Click "**save as**" and type in the desired name. -6. Click "**apply**" and "**ok**". - ## Manual Install > Make sure you have installed all [Build dependencies](#build-dependencies). @@ -186,6 +199,8 @@ After build `bitmaps` and `packages` are generated at project root directory. ### Install Build Cursor +#### Linux + All builded cursor packages are available inside `packages` directory. ```bash @@ -196,6 +211,16 @@ mkdir macOSBigSur && tar -xvf macOSBigSur.tar -C macOSBigSur rm -rf ~/.icons/macOSBigSur && cp macOSBigSur ~/.icons/ ``` +#### Windows + +1. unzip `macOSBigSur_Windows.zip` file +2. Open the `settings` app. +3. **Goto** `Devices` -> `Mouse` -> `Additional Mouse Options`. +4. **Goto** the `pointers` tab. +5. Replace each cursor in the currently applied cursor set with the corresponding cursor in the `macOSBigSur Windows Theme` folder. +6. Click "**save as**" and type in the desired name. +7. Click "**apply**" and "**ok**". + # Bugs diff --git a/config.py b/config.py index 7069bdb..0cdb726 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,5 @@ import tempfile +import json # Build Config delay = 50 @@ -9,5 +10,36 @@ bitmaps_dir = "./bitmaps" temp_folder = tempfile.mkdtemp() # Cleanup Configs -x11_out = "macOSBigSur" -win_out = "macOSBigSur_Windows" +x11_out = name +win_out = name + "_Windows" + +# getting author name +with open("./package.json") as f: + data = json.loads(f.read()) + author = data["author"] + +# Windows Cursors Config +windows_cursors = { + "sb_up_arrow.cur": "alt-select.cur", + "bd_double_arrow.cur": "diagonal-resize-1.cur", + "bottom_left_corner.cur": "diagonal-resize-2.cur", + "pencil.cur": "handwriting.cur", + "dnd-ask.cur": "help-select.cur", + "right_side.cur": "horizontal-resize.cur", + "hand2.cur": "link-select.cur", + "all-scroll.cur": "move.cur", + "left_ptr.cur": "normal-select.cur", + "X_cursor.cur": "pirate.cur", + "crosshair.cur": "precision-select.cur", + "xterm.cur": "text-select.cur", + "circle.cur": "unavailable.cur", + "bottom_side.cur": "vertical-resize.cur", + "wait.ani": "busy.ani", + "left_ptr_watch.ani": "working-in-background.ani" +} + +# Windows install.inf file content +with open("./scripts/windows.inf") as f: + data = f.read() + window_install_inf = data.replace( + "", name+" Cursors").replace("", author) diff --git a/helper.py b/helper.py index 5a4dc5c..2b3b642 100644 --- a/helper.py +++ b/helper.py @@ -2,8 +2,8 @@ import shutil import json import sys -from config import name, temp_folder, bitmaps_dir, win_out, x11_out -from os import path, listdir +from config import name, temp_folder, bitmaps_dir, win_out, x11_out, window_install_inf, windows_cursors +from os import path, listdir, rename, remove package_dir = "./packages" @@ -11,6 +11,24 @@ x11_out_dir = path.join(package_dir, x11_out) win_out_dir = path.join(package_dir, win_out) +def window_bundle() -> None: + # Remove & Rename cursors + # If Key found => Rename else Remove + for cursor in listdir(win_out_dir): + old_path = path.join(win_out_dir, cursor) + + try: + new_path = path.join(win_out_dir, windows_cursors[cursor]) + rename(old_path, new_path) + except KeyError: + remove(old_path) + + # creating install.inf file + install_inf_path = path.join(win_out_dir, "install.inf") + with open(install_inf_path, "w") as file: + file.write(install_inf_path) + + def init_build() -> None: """ Print build version. @@ -40,6 +58,9 @@ def pack_it() -> None: shutil.move(path.join(temp_folder, name, "x11"), x11_out_dir) shutil.move(path.join(temp_folder, name, "win"), win_out_dir) + # create install.inf file in Windows Theme + window_bundle() + # Packaging # - .tar archive for X11 # - .zip archive for Windows diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..fecedac --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,222 @@ +#! /bin/bash + +# auto-install patch by @luizoti on Bibata Cursror => https://github.com/ful1e5/Bibata_Cursor/commit/eb84f27919e433f9b72e7ef9f6444d4a7d276ba9 +INPUT=$1 + +ROOT_UID=0 +DEST_DIR= +URL="https://github.com/ful1e5/apple_cursor/releases/download/1.0.1-beta/macOSBigSur.tar" +macOSBigSur="./macOSBigSur" +DOWNLOAD_FILE_NAME="$macOSBigSur.tar" + +cd "$( dirname "${BASH_SOURCE[0]}" )" || exitt + +# Destination directory +if [ "$UID" -eq "$ROOT_UID" ]; then + DEST_DIR="/usr/share/icons" +else + DEST_DIR="$HOME/.icons" +fi + +echo -e "\e[1m\n+---------------------------------------------+" +echo -e "| macOSBigSur Cursor Installer Script |" +echo -e "+---------------------------------------------+\n\e[0m" + + + +# -------------------- Color print Functions -------------------- +show_question() { + echo -e "\033[1;34m$@\033[0m" +} + +show_dir() { + echo -e "\033[1;32m$@\033[0m" +} + +show_error() { + echo -e "\033[1;31m$@\033[0m" +} + +end() { + echo -e "\nExiting...\n" + exit 0 +} + +# -------------------- Helpers -------------------- +continue() { + case ${INPUT} in + '-a' ) + : + ;; + '-h' ) + echo " -a - Auto-install for all users!" + ;; + * ) + show_question "\nDo you want to continue? (Y)es, (N)o : \n" + read INPUT + case $INPUT in + ( [Yy]* ) ;; + ( [Nn]* ) end;; + ( * ) show_error "\nSorry, try again."; continue;; + esac + ;; + esac +} + +replace() { + show_question "\nFound an existing installation. Replace it? (Y)es, (N)o :\n" + read INPUT + case $INPUT in + ( [Yy]* ) rm -rf "$@/macOSBigSur*" 2>/dev/null;; + ( [Nn]* ) ;; + ( * ) show_error "\tSorry, try again."; replace $@;; + esac + +} + + +# For download the package +function download { + echo -e "\nDownloading macOSBigSur Theme..." + url=$1 + filename=$2 + + if [ -x "$(which wget)" ] ; then + curl -o $2 -fL $url + elif [ -x "$(which curl)" ]; then + wget -q $url -O $2 --show-progress + else + show_error "Could not find curl or wget, please install one." >&2 + fi + + if [ $? -eq 0 ]; then + echo "Downloading Complete" + else + show_error "Downloading... FAIL" + fi +} + + +# unpack +function unpack { + echo -e "\nUnpacking Theme..." + file=$1 + dir=${file%.*} + + echo "$dir" + # creating dir and extract .tar file content to it + mkdir "$dir" && tar -xvf "$file" -C "$dir" + + # remove .tar file + rm -rf $file + + if [ $? -eq 0 ]; then + echo "Unpacking Complete" + else + show_error "Unpacking Theme... FAIL" + fi +} + +install() { + + # Cecking old version exits or not + if [ -f "$DOWNLOAD_FILE_NAME" ] || [ -f "$macOSBigSur" ]; then + echo -e "\nmacOSBigSur.tar file already exists" + show_question "\nDownload Fresh Theme OR Continue with existing file? (D)ownload File (recommended), (E)xisting File : \n " + read INPUT + case $INPUT in + ( [Dd]* ) download $URL $DOWNLOAD_FILE_NAME;; + ( [Ee]* ) ;; + ( * ) show_error "\nSorry, try again."; continue;; + esac + else + download $URL $DOWNLOAD_FILE_NAME + fi + + + # unpack file + unpack $DOWNLOAD_FILE_NAME + + # Show destination directory + echo -e "\nmacOSBigSur Cursor Theme will be installed in:\n" + show_dir "\t$DEST_DIR" + if [ "$UID" -eq "$ROOT_UID" ]; then + echo -e "\nIt will be available to all users." + else + echo -e "\nTo make them available to all users, run this script as root." + fi + + continue + + + # Check destination directory + if [ ! -d $DEST_DIR ]; then + mkdir -p $DEST_DIR + elif [[ -d $DEST_DIR/macOSBigSur ]]; then + replace $DEST_DIR + fi + + echo -e "\nInstalling macOSBigSur..." + + # Copying files + cp -rf $macOSBigSur $DEST_DIR + chmod -R 755 $DEST_DIR/macOSBigSur + + echo "Installation complete!" + echo "Do not forget you have to set macOSBigSur Cursor" +} + +remove() { + + # PREVIEW + + # Show installation directory + if [[ -d $DEST_DIR/macOSBigSur ]]; then + echo -e "\nmacOSBigSur Theme installed in:\n" + show_dir "\t$DEST_DIR" + if [ "$UID" -eq "$ROOT_UID" ]; then + echo -e "\nIt will remove for all users." + else + echo -e "\nIt will remove only for current user." + fi + + continue + + else + show_error "\nmacOSBigSur Cursor is not installed in:\n" + show_dir "\t$DEST_DIR\n" + end + fi + + echo -e "\nRemoving macOSBigSur..." + rm -rf $DEST_DIR/macOSBigSur + + echo "Removing complete" + echo "I hope to see you soon." +} + +main() { + # Cases + case ${INPUT} in + '-a' ) + install + ;; + '-h' ) + echo " -a - Auto-install for all users!" + ;; + * ) + show_question "What you want to do: (I)nstall, (R)emove : \n" + read INPUT + case $INPUT in + ( [Ii]* ) install;; + ( [Rr]* ) remove;; + ( * ) show_error "\nSorry, try again."; main;; + esac + ;; + esac + + # Remove directory + rm -rf macOSBigSur +} + +( cd /tmp/ && main ) \ No newline at end of file diff --git a/scripts/windows.inf b/scripts/windows.inf new file mode 100644 index 0000000..fad7e73 --- /dev/null +++ b/scripts/windows.inf @@ -0,0 +1,55 @@ +; By +; Right click on the file "install.inf" and select "Install". Then apply in Control Panel > Appearance and Personalization > Personalization > Change mouse pointers. + +[Version] +signature="$CHICAGO$" + +[DefaultInstall] +CopyFiles = Scheme.Cur, Scheme.Txt +AddReg = Scheme.Reg + +[DestinationDirs] +Scheme.Cur = 10,"%CUR_DIR%" +Scheme.Txt = 10,"%CUR_DIR%" + +[Scheme.Reg] +HKCU,"Control Panel\Cursors\Schemes","%SCHEME_NAME%",,"%10%\%CUR_DIR%\%pointer%,%10%\%CUR_DIR%\%help%,%10%\%CUR_DIR%\%work%,%10%\%CUR_DIR%\%busy%,%10%\%CUR_DIR%\%cross%,%10%\%CUR_DIR%\%Text%,%10%\%CUR_DIR%\%Hand%,%10%\%CUR_DIR%\%unavailiable%,%10%\%CUR_DIR%\%Vert%,%10%\%CUR_DIR%\%Horz%,%10%\%CUR_DIR%\%Dgn1%,%10%\%CUR_DIR%\%Dgn2%,%10%\%CUR_DIR%\%move%,%10%\%CUR_DIR%\%alternate%,%10%\%CUR_DIR%\%link%" + +; -- Installed files + +[Scheme.Cur] +busy.ani +working-in-background.ani +normal-select.cur +help-select.cur +link-select.cur +move.cur +diagonal-resize-2.cur +Install.inf +vertical-resize.cur +horizontal-resize.cur +diagonal-resize-1.cur +handwriting.cur +precision-select.cur +text-select.cur +unavailable.cur +alt-select.cur + +[Strings] +CUR_DIR = "Cursors\" +SCHEME_NAME = "" +pointer = "normal-select.cur" +help = "help-select.cur" +work = "working-in-background.ani" +busy = "busy.ani" +text = "text-select.cur" +unavailiable = "unavailable.cur" +vert = "vertical-resize.cur" +horz = "horizontal-resize.cur" +dgn1 = "diagonal-resize-1.cur" +dgn2 = "diagonal-resize-2.cur" +move = "move.cur" +link = "link-select.cur" +cross = "precision-select.cur" +hand = "handwriting.cur" +alternate = "alt-select.cur" \ No newline at end of file