Skip to content

Instantly share code, notes, and snippets.

@reversesigh
Created August 5, 2022 20:52
Show Gist options
  • Save reversesigh/82c0023fa342c400958228d18bbd73ad to your computer and use it in GitHub Desktop.
Save reversesigh/82c0023fa342c400958228d18bbd73ad to your computer and use it in GitHub Desktop.
test1
#!/bin/bash
# ALTER_desktop-0.0.5-alpha - An Unofficial Desktop App for Linux-x64 wrapped with 'nativefier'
## resources/scrollbar.css injection script from https://gist.github.com/febritecno/82ec55602ccd2cbb08ef69fa4c863d46/
## Loading Vairables
echo
source resources/variables
echo
echo
echo "Detecting Operating System..."
if [[ "$OSTYPE" =~ ^darwin ]]; then
## Installs a local version of Nativefier to interact with resources/nativefier.json
echo -e "${BOLDGREEN}Installing local Nativefier module in current folder to build ALTER_desktop...${ENDCOLOR}"
npm install nativefier
echo -e "${BOLDGREEN}Running ALTER_desktop.js${ENDCOLOR}"
node resources/ALTER_desktop_macos.js
echo -e "${BOLDGREEN}Built ALTER_desktop succesfully. Removing local Nativefier module...${ENDCOLOR}"
npm uninstall nativefier
echo
echo
echo
$DV2
## Move ALTER-linux-x64 to ALTER_desktop
echo
echo -e "${BOLDGREEN}Moving ALTER_desktop-linux-x64 to ALTER_desktop${ENDCOLOR}"
$MV ALTER_desktop-linux-x64 ALTER_desktop
echo
echo
echo -e "${GREY}ALTER_desktop for macOSx64 is still in development... some elements might not work correctly.${ENDCOLOR}"
echo
fi
$DV2
echo
echo -e "${YELLOW}$MSG1${ENDCOLOR}"
echo
echo -e "${YELLOW}$MSG2${ENDCOLOR}" "${GREY}$EMAIL1${ENDCOLOR}" or "${GREY}$EMAIL2${ENDCOLOR}"
echo
echo -e "${YELLOW}$MSG3${ENDCOLOR}" "${GREY}$ALTER${ENDCOLOR}"
echo
echo -e "${GREY}$URLS${ENDCOLOR}"
echo
echo
echo -e "${BOLDRED}$DIVIDER${ENDCOLOR}"
fi
if [[ "$OSTYPE" =~ ^linux-gnu ]]; then
echo "Linux detected - continuing install"
## Creates ALTER.desktop to local applications folder, allowing it to be discoverable in your applications list
echo
if ! $IT0 >/dev/null; then
echo -e "${RED}No .desktop file detected. Creating...${ENDCOLOR}"
mkdir $HOME/.local/share/applications
else
$RM $HOME/.local/share/applications/ALTER.desktop
echo -e "${BOLDGREEN}Removed old .desktop file and created new .desktop file.${ENDCOLOR}"
fi
echo -e "${BOLDGREEN}Creating ALTER.desktop in $HOME/.local/share/applications/${ENDCOLOR}"
cat <<EOF >> ~/.local/share/applications/ALTER.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Categories=Network;Email;Chat;InstantMessaging;FileTransfer;TrayIcon
Exec=$HOME/.local/share/ALTER_desktop/ALTER_desktop
Name=ALTER
Icon=$HOME/.local/share/icons/alter.png
EOF
echo
cat $HOME/.local/share/applications/ALTER.desktop
## Copies alter.png to your root icons folder to use the ALTER logo as the ALTER_dekstop icon
$DV2
echo
echo -e "${BOLDGREEN}Creating ALTER_desktop${ENDCOLOR}"
echo -e "${BOLDGREEN}If it doesn't exsit, will create .local/share${ENDCOLOR}"
mkdir ~/.local/share
echo -e "${BOLDGREEN}If it doesn't exsit, will create .local/share/icons${ENDCOLOR}"
mkdir ~/.local/share/icons
echo -e "${BOLDGREEN}Moving alter.png to icons folder${ENDCOLOR}"
$CP resources/alter.png $HOME/.local/share/icons/alter.png
echo
$DV2
## Installs a local version of Nativefier to interact with resources/nativefier.json
echo -e "${BOLDGREEN}Installing local Nativefier module in current folder to build ALTER_desktop...${ENDCOLOR}"
npm install nativefier
echo -e "${BOLDGREEN}Running ALTER_desktop.js${ENDCOLOR}"
node resources/ALTER_desktop.js
echo -e "${BOLDGREEN}Built ALTER_desktop succesfully. Removing local Nativefier module...${ENDCOLOR}"
npm uninstall nativefier
echo
echo
echo
$DV2
## Move ALTER-linux-x64 to ALTER_desktop
echo
echo -e "${BOLDGREEN}Moving ALTER_desktop-linux-x64 to ALTER_desktop${ENDCOLOR}"
$MV ALTER_desktop-linux-x64 ALTER_desktop
echo
## Copying ALTER_desktop to $HOME/.local/ALTER_desktop
echo -e "${BOLDGREEN}Copying ALTER to $HOME/.local/share/ALTER_desktop${ENDCOLOR}"
$CP -r ALTER_desktop $HOME/.local/share/
$RM -rf ALTER_desktop
echo
## Checks to make sure installing ALTER_desktop was a success
if hash $RD1 2>/dev/null; then
echo -e "${RED}WARNING ALTER_desktop not on system${ENDCOLOR}"
echo -e "${CYAN}Please check your settings and environment${ENDCOLOR}"
exit
$DV2
else
echo
echo
echo
echo
echo -e "${GREEN}SERACHING FOR ALTER_desktop.......${ENDCOLOR}"
echo
echo -e "${GREEN}Successfully built ALTER_desktop. Nice!${ENDCOLOR}"
echo
echo
echo -e "${GREY}Locate ALTER_desktop in your applications list or run $HOME/.local/share/ALTER_desktop/ALTER_desktop${ENDCOLOR}"
echo
fi
$DV2
echo
echo -e "${YELLOW}$MSG1${ENDCOLOR}"
echo
echo -e "${YELLOW}$MSG2${ENDCOLOR}" "${GREY}$EMAIL1${ENDCOLOR}" or "${GREY}$EMAIL2${ENDCOLOR}"
echo
echo -e "${YELLOW}$MSG3${ENDCOLOR}" "${GREY}$ALTER${ENDCOLOR}"
echo
echo -e "${GREY}$URLS${ENDCOLOR}"
echo
echo
echo -e "${BOLDRED}$DIVIDER${ENDCOLOR}"
fi
if [[ "$OSTYPE" =~ ^windows ]]; then
echo "Not supported on Windows yet"
exit
fi
## Intro
echo
echo
$DV2
echo
echo -e "${RED}ALTER_desktop-0.0.6-alpha for Linux-x64${ENDCOLOR}"
echo
$DV2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment