Merge master into working tree

This commit is contained in:
Alicia Sykes 2023-02-21 11:17:41 +00:00
commit b45aa7c95a
13 changed files with 390 additions and 72 deletions

51
.github/README.md vendored
View File

@ -59,7 +59,9 @@ This is important, because as a developer, we usually have multiple machines (wo
### XDG Directories
The location of most config files can be defined using the [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec), which is honored by most apps. This lets you specify where config, log, cache and data files are stored, keeping your top-level home directory free from clutter. You can do this by setting environmental variables, usually within the [`.zshenv`](https://github.com/Lissy93/dotfiles/blob/master/config/zsh.zshenv) file.
The location of config files can usually be defined using the [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec), which is honored by most apps. This lets you specify where config, log, cache and data files are stored, keeping your top-level home directory free from clutter. You can do this by setting environmental variables, usually within the [`.zshenv`](https://github.com/Lissy93/dotfiles/blob/master/config/zsh.zshenv) file.
For example, in my setup I've [set these variables](https://github.com/Lissy93/dotfiles/blob/e839ab2d77f0be0d09b4f4ba3503c8b69ad925f3/config/zsh/.zshenv#L6=L10) to:
Variable | Location
--- | ---
@ -77,17 +79,21 @@ You can also containerize your dotfiles, meaning with a single command, you can
This is awesome for a number of reasons: 1) Super minimal dependency installation on the host 2) Blazing fast, as you can pull your built image from a registry, instead of compiling everything locally 3) Cross-platform compatibility, whatever your host OS is, you can always have a familiar Linux system in the container 4) Security, you can control which host resources are accessible within each container
For this, I'm using an Alpine-based Docker container defined in the [`Dockerfile`](https://github.com/Lissy93/dotfiles/blob/master/Dockerfile), to try it out, just run `docker run lissy93/dotfiles`.
There's several methods of doing this, like having a Docker container or spinning up VMs with a predefined config (with something like [Vagrant](https://www.vagrantup.com/) or a [NixOS](https://nixos.org/)-based config).
Other options could include spinning up VMs with a predefined config, either using something like [Vagrant](https://www.vagrantup.com/) or a [NixOS](https://nixos.org/)-based config.
I went with an Alpine-based Docker container defined in the [`Dockerfile`](https://github.com/Lissy93/dotfiles/blob/master/Dockerfile). To try it out, just run `docker run lissy93/dotfiles`.
---
### Security
Something that is important to keep in mind, is security. Often you may have some personal info included in some of your dotfiles. Before storing anything on the internet, double check there's no sensitive info, SSH keys, API keys or plaintext passwords. If you're using git, then any files you wouldn't want to be commited, can just be listed in your [`.gitignore`](https://git-scm.com/docs/gitignore). If any .gitignore'd files are imported by other files, be sure to check they exist, so you don't get errors when cloning onto a fresh system.
Something that is important to keep in mind, is security. Often you may have some personal info included in some of your dotfiles. Before storing anything on the internet, double check there's no sensitive info (think SSH keys, API keys or plaintext passwords). There's several solutions for managing sensitve info.
Another solution, is to encrypt sensitive info. A great tool for this is [`pass`](https://www.passwordstore.org/) as it makes GPG-encrypting passwords very easy ([this article](https://www.outcoldman.com/en/archive/2015/09/17/keep-sensitive-data-encrypted-in-dotfiles/) outlines how), or you could also just use plain old GPG (as outlined in [this article](https://www.abdullah.today/encrypted-dotfiles/)).
The simplest is just to have a [`.gitignore`](https://git-scm.com/docs/gitignore), so no private files get committed. Be sure to make sure your setup doesn't depend on those files though, or you'll get an error while setting up a fresh system.
Another option, is to encrypt sensitive info. A great tool for this is [`pass`](https://www.passwordstore.org/) as it makes GPG-encrypting passwords very easy ([this article](https://www.outcoldman.com/en/archive/2015/09/17/keep-sensitive-data-encrypted-in-dotfiles/) outlines how), or you could also just use plain old GPG (as outlined in [this article](https://www.abdullah.today/encrypted-dotfiles/)).
I went with [git-crypt](https://github.com/AGWA/git-crypt), a GPG-based solution designed specifically for git repos. There's fallback (safe) plaintext versions, to prevent any errors if the GPG keys aren't present.
---
@ -143,7 +149,7 @@ To learn more, DistroTube made an excellent [video about bare git repos](https:/
#### Dotfile Dependencies
In terms of managing dependencies, using either [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) will let you keep dependencies in your project, while also separate from your own code and easily updatable.
In terms of managing dependencies, using either [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) will let you keep dependencies in your project, while also separate from your own code and easily updatable. But again, you could do this yourself with a simple script.
---
@ -156,7 +162,7 @@ By all means feel free to take what you want from mine. I've taken care to ensur
If you're looking for some more example dotfile repos to get you started, I can highly recommend taking a look at: [@holman/dotfiles](https://github.com/holman/dotfiles), [@nickjj/dotfiles](https://github.com/nickjj/dotfiles), [@caarlos0/dotfiles](https://github.com/caarlos0/dotfiles), [@cowboy/dotfiles](https://github.com/cowboy/dotfiles), [@drduh/config](https://github.com/drduh/config).
There's even more to check out at [webpro/awesome-dotfiles](https://github.com/webpro/awesome-dotfiles), [dotfiles.github.io](https://dotfiles.github.io/) and [r/unixporn](https://www.reddit.com/r/unixporn/).
And for some more inspiration, check out [webpro/awesome-dotfiles](https://github.com/webpro/awesome-dotfiles), [dotfiles.github.io](https://dotfiles.github.io/) and [r/unixporn](https://www.reddit.com/r/unixporn/).
---
@ -613,7 +619,7 @@ Alias | Description
The dotfile installation script can also, detect which system and environemnt you're running, and optionally prompt to update and install listed packages and applications.
Package lists are stored in [`scripts/installs/`](https://github.com/Lissy93/dotfiles/tree/master/installs) directory, with separate files for different OSs. The install script will [pick the appropriate file](https://github.com/Lissy93/dotfiles/blob/22c6a04fdb22c140448b7d15ef8187c3a424ab47/install.sh#L243-L260) based on your distro.
Package lists are stored in [`scripts/installs/`](https://github.com/Lissy93/dotfiles/tree/master/scripts/installs) directory, with separate files for different OSs. The install script will [pick the appropriate file](https://github.com/Lissy93/dotfiles/blob/22c6a04fdb22c140448b7d15ef8187c3a424ab47/install.sh#L243-L260) based on your distro.
You will be prompted before anything is installed. Be sure to remove / comment out anything you do not need before proceeding.
@ -654,6 +660,7 @@ The following section lists apps installed for each category:
- [`jq`](https://github.com/stedolan/jq) - JSON parser
- [`most`](https://www.jedsoft.org/most/) - Multi-window scroll pager _(better less)_
- [`procs`](https://github.com/dalance/procs) - Advanced process viewer _(better ps)_
- [`rip`](https://github.com/nivekuil/rip) - Safe and ergonomic deletion tool _(better rm)_
- [`ripgrep`](https://github.com/BurntSushi/ripgrep) - Searching within files _(better grep)_
- [`rsync`](https://rsync.samba.org/) - Fast, incremental file transfer
- [`scc`](https://github.com/boyter/scc) - Count lines of code _(better cloc)_
@ -678,6 +685,7 @@ The following section lists apps installed for each category:
- [`gping`](https://github.com/orf/gping) - Interactive ping tool, with graph
- [`ncdu`](https://dev.yorhel.nl/ncdu) - Disk usage analyzer and monitor _(better du)_
- [`speedtest-cli`](https://github.com/sivel/speedtest-cli) - Command line speed test utility
- [`dog`](https://github.com/ogham/dog) - DNS lookup client _(better dig)_
</details>
@ -701,6 +709,7 @@ The following section lists apps installed for each category:
- [`httpie`](https://httpie.io/) - HTTP / API testing testing client
- [`lazydocker`](https://github.com/jesseduffield/lazydocker) - Full Docker management app
- [`lazygit`](https://github.com/jesseduffield/lazygit) - Full Git managemtne app
- [`kdash`](https://github.com/kdash-rs/kdash/) - Kubernetes dashboard app
</details>
@ -1140,3 +1149,29 @@ bash <(curl -s https://raw.githubusercontent.com/Lissy93/dotfiles/master/utils/w
---
---
<!-- License + Copyright -->
<p align="center">
<i>© <a href="https://aliciasykes.com">Alicia Sykes</a> 2022</i><br>
<i>Licensed under <a href="https://gist.github.com/Lissy93/143d2ee01ccc5c052a17">MIT</a></i><br>
<a href="https://github.com/lissy93"><img src="https://i.ibb.co/4KtpYxb/octocat-clean-mini.png" /></a><br>
<sup>Thanks for visiting :)</sup>
</p>
<!-- Dinosaur -->
<!--
. - ~ ~ ~ - .
.. _ .-~ ~-.
//| \ `..~ `.
|| | } } / \ \
(\ \\ \~^..' | } \
\`.-~ o / } | / \
(__ | / | / `.
`- - ~ ~ -._| /_ - ~ ~ ^| /- _ `.
| / | / ~-. ~- _
|_____| |_____| ~ - . _ _~_-_
-->

View File

@ -9,8 +9,10 @@ Run the install.sh script to apply settings based on system type and user prefer
Important: Take care to read through files thoroughly before applying any changes
And always make a backup of your pre-existing config files before over-writing them
Full source and documentation: https://github.com/Lissy93/dotfiles
Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com>
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Source: https://github.com/Lissy93/dotfiles/tree/master/scripts ┃
┃ Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
---

View File

@ -79,7 +79,34 @@ fi
# Import P10k config for command prompt, run `p10k configure` or edit
[[ ! -f ${zsh_dir}/.p10k.zsh ]] || source ${zsh_dir}/.p10k.zsh
# If not running in nested shell, then show nice welcome message :)
# MacOS-specific services
if [ "$(uname -s)" = "Darwin" ]; then
# Add Brew to path, if it's installed
if [[ -d /opt/homebrew/bin ]]; then
export PATH=/opt/homebrew/bin:$PATH
fi
# If using iTerm, import the shell integration if availible
if [[ -f "${XDG_CONFIG_HOME}/zsh/.iterm2_shell_integration.zsh" ]]; then
source "${XDG_CONFIG_HOME}/zsh/.iterm2_shell_integration.zsh"
fi
# Append the Android SDK locations to path
if [[ -d "${HOME}/Library/Android/" ]]; then
export PATH="${HOME}/Library/Android/sdk/emulator:${PATH}"
export ANDROID_HOME="${HOME}/Library/Android/sdk"
export ANDROID_SDK_ROOT="${HOME}/Library/Android/sdk"
export ANDROID_AVD_HOME="${ANDROID_SDK_ROOT}/tools/emulator"
export NODE_BINARY="/usr/local/bin/node"
fi
fi
# Add Zoxide (for cd, quick jump) to shell
if hash zoxide 2> /dev/null; then
eval "$(zoxide init zsh)"
fi
# If not running in nested shell, then show welcome message :)
if [[ "${SHLVL}" -lt 2 ]] && [[ -z "$SKIP_WELCOME" ]]; then
welcome
fi

View File

@ -95,12 +95,14 @@ alias gj='jump-to-git-root'
function clone {
default_service='github.com' # Used if full URL isn't specified
default_username='lissy93' # Used if repo org / username isn't specified
use_ssh=true # Use SSH instead of HTTPS
user_input=$1
target=${2:-''}
# Help flag passed, show manual and exit
if [[ $user_input == --help ]] || [[ $user_input == -h ]]; then
echo -e 'This will clone a git repo';
echo -e 'Either specify repo name, user/repo, or a full URL'
echo -e 'This will clone a git repo, and cd into it.';
echo -e 'Either specify repo name, oe user/repo, or a full URL.'
echo -e 'If no target directory is specified, the repo name will be used.'
echo -e 'E.g. `$ clone lissy93/dotfiles`'
return;
# No input specified, prompt user
@ -108,7 +110,6 @@ function clone {
echo 'Enter a user/repo or full URL: ';
read user_input;
fi
echo "$target"
# Determine input type, and make clone url
if [[ $user_input == git@* || $user_input == *://* ]]
then
@ -116,10 +117,18 @@ function clone {
REPO_URL=$user_input;
elif [[ $user_input == */* ]]; then
# Username/repo was provided
REPO_URL="https://$default_service/$user_input.git";
if [ "$use_ssh" = true ] ; then
REPO_URL="git@$default_service:$user_input.git";
else
REPO_URL="https://$default_service/$user_input.git";
fi
else
# Just repo name was provided
REPO_URL="https://$default_service/$default_username/$user_input.git";
if [ "$use_ssh" = true ] ; then
REPO_URL="git@$default_service:$default_username/$user_input.git";
else
REPO_URL="https://$default_service/$default_username/$user_input.git";
fi
fi
# Clone repo
@ -127,6 +136,13 @@ function clone {
# cd into newly cloned directory
cd "$(basename "$_" .git)"
# Print results
if test "$?" -eq 0; then
echo -e "☑️ \033[1;96mCloned $REPO_URL into $(pwd), and cd'd into it.\033[0m"
else
echo -e "❌ \033[1;91mFailed to clone $REPO_URL\033[0m"
fi
}
# Sync fork against upstream repo

View File

@ -4,20 +4,27 @@ Lissy93/Dotfiles - Scripts 📜
A set of Bash scripts for automating the setup and management of various systems.
dotfiles/scripts/
├── installs/
│ ├── arch-pacman.sh Package installations using via for Arch-based systems
│ ├── Brewfile Packages to be installed via Homebrew on MacOS
│ ├── flatpak.sh Desktop apps to be installed on Linux GUI systems via Flatpak
│ ├── alpine-pkg.sh Package installations using pkg for Alpine-based systems
│ └── prerequisites.sh Cross-distro installation of prerequisite core packages
├── linux/
│ └── dconf-prefs.sh Apply preferences to (mostly GNOME apps) via dconf utility
└── macos-setup/
├── macos-apps.sh Apply preferences to user applications (Finder, Mail, Terminal, etc)
├── macos-prefs.sh Apply user MacOS preferences (spotlight, colors, behaviour, etc)
└── macos-security.sh Apply essential MacOS security settings
╭───────────────────────────┬─────────────────────────────────────────────────────────────────╮
│ File Path │ Description │
╞═══════════════════════════╪═════════════════════════════════════════════════════════════════╡
│ dotfiles/scripts/ │ │
│ ├── installs/ │ │
│ │ ├── arch-pacman.sh │ Package installations using via for Arch-based systems │
│ │ ├── Brewfile │ Packages to be installed via Homebrew on MacOS │
│ │ ├── flatpak.sh │ Desktop apps to be installed on Linux GUI systems via Flatpak │
│ │ ├── alpine-pkg.sh │ Package installations using pkg for Alpine-based systems │
│ │ ├── debian-apt.sh │ Package installs via apt-get for Ubuntu / Debain-based systems │
│ │ └── prerequisites.sh │ Cross-distro installation of prerequisite core packages │
│ ├── linux/ │ │
│ │ └── dconf-prefs.sh │ Apply preferences to (mostly GNOME apps) via dconf utility │
│ └── macos-setup/ │ │
│ ├── macos-apps.sh │ Apply preferences to user applications │
│ ├── macos-prefs.sh │ Apply user MacOS system preferences │
│ └── macos-security.sh │ Apply essential MacOS security settings │
╰───────────────────────────┴─────────────────────────────────────────────────────────────────╯
Source: https://github.com/Lissy93/dotfiles/tree/master/scripts
Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com>
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Source: https://github.com/Lissy93/dotfiles/tree/master/scripts ┃
┃ Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

View File

@ -54,10 +54,10 @@ brew 'most' # Multi-window scroll pager (better less)
brew 'procs' # Advanced process viewer (better ps)
brew 'ripgrep' # Searching within files (better grep)
brew 'rsync' # Fast incremental file transfer
brew 'scc' # Count lines of code (better cloc)
brew 'sd' # RegEx find and replace (better sed)
brew 'thefuck' # Auto-correct miss-typed commands
brew 'tldr' # Community-maintained docs (better man)
brew 'tokei' # Count lines of code (better cloc)
brew 'tree' # Directory listings as tree structure
brew 'trash-cli' # Record and restore removed files
brew 'watch' # Run commands periorically
@ -69,10 +69,10 @@ brew 'bmon' # Bandwidth utilization monitor
brew 'ctop' # Container metrics and monitoring
brew 'dog' # DNS lookup client (better dig)
brew 'bpytop' # Resource monitoring (like htop)
brew 'dua-cli' # Disk usage analyzer and monitor (better du)
brew 'glances' # Resource monitor + web and API
brew 'goaccess' # Web log analyzer and viewer
brew 'gping' # Interactive ping tool, with graph
brew 'ncdu' # Disk usage analyzer and monitor (better du)
brew 'speedtest-cli'# Command line speed test utility
# CLI Productivity Apps

View File

@ -0,0 +1,13 @@
Lissy93/Dotfiles - Scripts for Package Installs 📥
-------------------------------------------------
Each of these scripts is used to automate the installation and updates of packages, across various OSs
Specific usage instructions can be found in a comment, at the top of each file - read before running
Files can either be run directly, or can be invoked (based on system type) when you run install.sh
Be sure to check the contents of any file, and modify to your liking before executing anything
Currently only MacOS, Arch-based systems, Debian-based systems and Windows are supported
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Source: https://github.com/Lissy93/dotfiles/tree/master/scripts ┃
┃ Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

View File

@ -27,7 +27,6 @@ pacman_apps=(
'aria2' # Resuming download util (better wget)
'bat' # Output highlighting (better cat)
'broot' # Interactive directory navigation
'cloc' # Count lines of code in file / dir
'ctags' # Indexing of file info + headers
'diff-so-fancy' # Readable file compares (better diff)
'duf' # Get info on mounted disks (better df)
@ -44,6 +43,7 @@ pacman_apps=(
'thefuck' # Auto-correct miss-typed commands
'tealdeer' # Reader for command docs (better man)
'tree' # Directory listings as tree structure
'tokei' # Count lines of code (better cloc)
'trash-cli' # Record and restore removed files
'xsel' # Copy paste access to the X clipboard
'zoxide' # Auto-learning navigation (better cd)

View File

@ -34,6 +34,7 @@ flatpak_apps=(
'org.jitsi.jitsi-meet' # Encrypted video calls
'org.mozilla.Thunderbird' # Email + calendar client
'org.signal.Signal' # Private messenger, mobile
'im.pidgin.Pidgin' # Extendable XMPP chat client
'com.slack.Slack' # Work and team messaging
'com.github.eneshecan.WhatsAppForLinux' # WhatApp client
@ -44,10 +45,13 @@ flatpak_apps=(
'org.gnome.Cheese' # Webcam client
'org.libretro.RetroArch' # Retro game emulation
'org.videolan.VLC' # Media player
'com.github.johnfactotum.Foliate' # E-book reader
'tech.feliciano.pocket-casts' # Podcast client
# Creativity
'com.ultimaker.cura' # 3D slicing
'com.obsproject.Studio' # Video streaming
'com.jgraph.drawio.desktop' # UML + Diagram tool
'com.transmissionbt.Transmission' # Torrent downloader
'com.uploadedlobster.peek' # Screen recorder
'fr.handbrake.ghb' # Video transcoder
@ -60,13 +64,14 @@ flatpak_apps=(
'org.inkscape.Inkscape' # Vector editor
'org.shotcut.Shotcut' # Video editor
'org.synfig.SynfigStudio' # 2D animation
# Software development
'com.visualstudio.code' # Extendable IDE
'com.getpostman.Postman' # API development
'cc.arduino.IDE2' # IOT development
'com.axosoft.GitKraken' # GUI git client
'com.google.AndroidStudio' # Android dev IDE
'flathub org.gnome.GHex' # Hex and binary inspector
'io.podman_desktop.PodmanDesktop' # Docker / Podman UI
# Security testing
@ -76,16 +81,22 @@ flatpak_apps=(
# Settings and system utils
'com.borgbase.Vorta' # Borg backup client
'org.kde.kleopatra' # GPG key and certificate manager
'io.github.jacalz.rymdport' # Encrypted file transfers, via Wormhole
'org.bleachbit.BleachBit' # Disk cleaner and log remover
'it.mijorus.smile' # Emoji picker
# Browsers
'org.mozilla.firefox'
'com.github.Eloston.UngoogledChromium'
'com.github.micahflee.torbrowser-launcher'
# Browsers and internet
'org.mozilla.firefox' # Firefox web browser (primary)
'com.github.Eloston.UngoogledChromium' # Chomium-based borwser (secondary)
'com.github.micahflee.torbrowser-launcher' # Tor browser
'org.filezillaproject.Filezilla' # FTP client
# Office
'org.libreoffice.LibreOffice' # Office suite
'org.cvfosammmm.Setzer' # LaTeX editor
'net.xm1math.Texmaker' # LaTeX editor
'md.obsidian.Obsidian' # Markdown editor
# Personal
'ch.protonmail.protonmail-bridge' # ProtonMail bridge
'com.belmoussaoui.Authenticator' # OTP authenticator

View File

@ -1,29 +1,30 @@
#!/bin/bash
########################################################################
# Sets app preferences on Linux via dconf #
########################################################################
# Uses dconf to apply application preferences on Linux GNOME desktops #
# Creates a backup of current settings, then prompt to load new config #
# Reads source files from ./config/gnome/*.dconf ($DCONF_SOURCE_DIR) #
# Creates a backup of current settings, then loads + saves new config #
# IMPORTANT: Be sure to read files through thoughouly before executing #
########################################################################
# Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> #
########################################################################
# Color variables
PRIMARY_COLOR='\033[1;33m'
ACCENT_COLOR='\033[0;34m'
INFO_COLOR='\033[0;30m'
INFO_COLOR_U='\033[4;30m'
SUCCESS_COLOR='\033[0;32m'
PRIMARY_COLOR='\033[1;34m'
ACCENT_COLOR='\033[0;96m'
ERROR_COLOR='\033[1;31m'
WARN_1='\033[1;31m'
WARN_2='\033[0;31m'
WARN_COLOR='\033[0;33m'
SUCCESS_COLOR='\033[0;32m'
RESET='\033[0m'
ITAL='\e[3m'
UNDAL='\e[4m'
PALE='\e[2m'
BOLD='\e[1m'
UNDAL='\e[4m'
# Set config variables
PARAMS=$*
FILE_EXT='dconf'
show_help () {
echo -e "${PRIMARY_COLOR}🐧 Linux Desktop Preferences${RESET_COLOR}\n"\
@ -32,12 +33,14 @@ show_help () {
"./config/gnome and applied to the dconf database in ~/.config/dconf/[user]\n"\
"Before any changes are made, existing settings are backed up to ~/.cache/dconf-backups/\n"\
"\n The following applications will be configured:\n"\
" - Terminal\n"\
" - Calculator\n"\
" - Evolution\n"\
" - Geddit\n"\
" - gThumb\n"\
" - Todo App\n"\
"\n${BOLD}⚠ Be sure that you've read and unserstood which changes will be applied before proceeding${RESET}\n"
"\n${WARN_COLOR}⚠ Be sure that you've read and unserstood which"\
"changes will be applied before proceeding${RESET}\n"
}
# If --help flag passed in, just show the help menu
@ -53,7 +56,8 @@ if [[ ! $PARAMS == *"--yes-to-all"* ]]; then
echo -e "\n${PRIMARY_COLOR}Would you like to proceed? (y/N)${RESET}"
read -t 15 -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${ACCENT_COLOR}\nNo worries, nothing will be applied - feel free to come back another time."
echo -e "${ACCENT_COLOR}\nNo worries, nothing will be applied"\
"- feel free to come back another time."
echo -e "${PRIMARY_COLOR}Exiting...${RESET}"
exit 0
else
@ -77,7 +81,7 @@ fi
# Set locations for where to store backups, and where to read new configs from
DCONF_BACKUP_DIR="${DCONF_BACKUP_DIR:-${XDG_CACHE_HOME}/dconf-backups}"
DCONF_BACKUP_FILE=${DCONF_BACKUP_FILE:-"backup_"`date +"%Y-%m-%d_%H-%M-%S"`}
DCONF_SOURCE_DIR="$(cd "$(dirname "$0")" && pwd)/../../config/gnome"
DCONF_SOURCE_DIR="${DOTFILES_DIR:-"$(cd "$(dirname "$0")" && pwd)/../.."}/config/gnome"
# Create directory to store backups
DCONF_BACKUP_PATH="${DCONF_BACKUP_DIR}/${DCONF_BACKUP_FILE}"
@ -106,7 +110,7 @@ apply_dconf () {
fi
# Check source file exists
if [ ! -f "$DCONF_SOURCE_DIR/$dconf_name.toml" ]; then
if [ ! -f "$DCONF_SOURCE_DIR/$dconf_name.$FILE_EXT" ]; then
echo -e "${ERROR_COLOR}⚠ Error, the specified config file for"\
"'${dconf_name}' doesn't exist in ${DCONF_SOURCE_DIR}${RESET}"
return
@ -114,24 +118,24 @@ apply_dconf () {
# Make backup of existing settings
echo -e "${PRIMARY_COLOR}Applying ${dconf_name} config${RESET}"
dconf dump $dconf_key > "${DCONF_BACKUP_PATH}/${dconf_name}.toml"
dconf dump $dconf_key > "${DCONF_BACKUP_PATH}/${dconf_name}.$FILE_EXT"
# Apply new settings from file
echo -e "${ACCENT_COLOR}${dconf_name} settings succesfully applies to ${dconf_key}${RESET}"
dconf load $dconf_key < $DCONF_SOURCE_DIR/${dconf_name}.toml
echo -e "${SUCCESS_COLOR}${dconf_name} settings succesfully applies to ${dconf_key}${RESET}"
dconf load $dconf_key < $DCONF_SOURCE_DIR/${dconf_name}.$FILE_EXT
# Print instructions on reverting changes
echo -e "${ACCENT_COLOR}${ITAL}To revert, run $"\
"dconf load $dconf_key < $DCONF_BACKUP_PATH/${dconf_name}.toml${RESET}\n"
echo -e "${ACCENT_COLOR}${ITAL}${PALE}To revert, run $"\
"${UNDAL}dconf load $dconf_key < $DCONF_BACKUP_PATH/${dconf_name}.$FILE_EXT${RESET}\n"
}
# For the following dconf keys, apply settings in from the specified files
apply_dconf '/org/gnome/calculator/' 'calculator'
apply_dconf '/org/gnome/evolution/' 'evolution'
apply_dconf '/org/gnome/gedit/preferences/' 'gedit'
apply_dconf '/org/gnome/gthumb/' 'gthumb'
apply_dconf '/org/gnome/calculator/' 'calculator' # Apply calculator settings
apply_dconf '/org/gnome/evolution/' 'evolution' # Apply Evolution (mail client) settings
apply_dconf '/org/gnome/gedit/preferences/' 'gedit' # Apply Gedit (text editor) settings
apply_dconf '/org/gnome/gthumb/' 'gthumb' # Apply gthumb (image editor) settings
apply_dconf '/org/gnome/todo/' 'todo' # Apply todo list app settings
apply_dconf '/org/gnome/shell/extensions/' 'gnome-extensions'
apply_dconf '/org/gnome/todo/' 'todo'
# Run update command
echo -e "\n${PRIMARY_COLOR}Reloading dconf database${RESET}"

View File

@ -29,6 +29,9 @@
${XDG_CONFIG_HOME}/.gitignore_global: config/general/.gitignore_global
${XDG_CONFIG_HOME}/.wgetrc: config/general/.wgetrc
# Desktop Apps
${XDG_CONFIG_HOME}/alacritty.yml: config/desktop-apps/alacritty.yml
# Bash utils
${XDG_CONFIG_HOME}/utils: utils

View File

@ -5,7 +5,8 @@
######################################################################
# Series of commands for freeing up disk space on *nix based systems #
# Will ask for user permission before executing or deleting anything #
# Info about current disk usage is printed before starting #
# Info about current disk usage, and recomendations is printed prior #
# Tasks are split into 3 categories: recommended, optional, hardcore #
# #
# Includes the following tasks: #
# - Cleaning package cache for various package managers #
@ -20,3 +21,208 @@
######################################################################
# Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> #
######################################################################
# Color Variables
CYAN_B='\033[1;96m'
YELLOW_B='\033[1;93m'
RED_B='\033[1;31m'
GREEN_B='\033[1;32m'
PLAIN_B='\033[1;37m'
RESET='\033[0m'
GREEN='\033[0;32m'
PURPLE='\033[0;35m'
function fuds_check_space () {
convert_to_gb() { echo "$(($1/1048576))" ; }
storage_used="$(df --output=used / | tail -n 1)"
storage_free="$(df --output=avail / | tail -n 1)"
storage_total="$(($storage_used + $storage_free))"
math_str="${storage_used} / ${storage_total} * 100"
storage_percent="$(echo "${math_str}" | bc -l)"
echo "Disk ${storage_percent%%.*}% full"
echo "You're using $(convert_to_gb $storage_used) GB out of $(convert_to_gb $storage_total) GB."\
"($(convert_to_gb $storage_free) GB free)."
}
function fuds_clean_pacman () {
# Clean pacman cache
sudo pacman -Scc
# Remove orphaned packages
sudo pacman -Rns $(pacman -Qtdq)
}
function fuds_clean_flatpak () {
# Remove unused Flatpak packages
flatpak uninstall --unused
# Delete Flatpak package cache
sudo rm -rfv /var/tmp/flatpak-cache-*
}
function fuds_clean_apt () {
# Removes obsolete packages
sudo apt autoremove
}
function fuds_remove_dead_snaps () {
# Remove disabled snaps
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
}
function fuds_journal_configure () {
# Limit size of journal logs to 0.5 GB
journalctl --vacuum-size=500M
# Limit age of journal logs to 1 month
journalctl --vacuum-time=4weeks
}
function fuds_empty_trash () {
# Delete the current users trash
rm -rf ~/.local/share/Trash/*
}
function fuds_clear_caches () {
# Remove thumbnails for file viewers
rm -rf ~/.cache/thumbnails/*
}
function fuds_remove_duplicates () {
# Find and prompt to delete duplicated files
fdupes . -G 10 --size -S -n -t -d
}
function fuds_remove_broken () {
# Remove broken symlinks
find . -xtype l -delete
# Remove empty files
find . -type f -empty -delete
# Remove empty folders
find . -type d -empty -delete
}
function fuds_show_help () {
echo "Usage: free-up-disk-space [OPTION]"
echo "Free up disk space on *nix based systems"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo " -r, --run Run all tasks"
echo " -p, --pacman Clean pacman cache and remove orphaned packages"
echo " -f, --flatpak Remove unused Flatpak packages and delete cache"
echo " -a, --apt Remove obsolete packages"
echo " -s, --snaps Remove disabled snaps"
echo " -j, --journal Configure journal logs"
echo " -t, --trash Empty trash"
echo " -c, --caches Remove thumbnails and other caches"
echo " -d, --dups Find and delete duplicated files"
echo " -b, --broken Remove broken symlinks and empty files + folders"
echo ""
echo "Examples:"
echo " free-up-disk-space -r"
echo " free-up-disk-space -p -f -a -s -j -t -c -d -b"
}
function free_up_disk_space () {
# Check available disk space
fuds_check_space
# Prompt to clean pacman cache
echo -e "\n${CYAN_B}Would you like to clean pacman cache? (y/N)${RESET}"
read -n 1 -r ans_clean_pacman
if [[ $ans_clean_pacman =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_clean_pacman
fi
# Prompt to remove unused Flatpak packages
echo -e "\n${CYAN_B}Would you like to remove unused Flatpak packages? (y/N)${RESET}"
read -n 1 -r ans_clean_flatpak
if [[ $ans_clean_flatpak =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_clean_flatpak
fi
# Prompt to remove obsolete packages
echo -e "\n${CYAN_B}Would you like to remove obsolete packages? (y/N)${RESET}"
read -n 1 -r ans_clean_apt
if [[ $ans_clean_apt =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_clean_apt
fi
# Prompt to remove disabled snaps
echo -e "\n${CYAN_B}Would you like to remove disabled snaps? (y/N)${RESET}"
read -n 1 -r ans_remove_dead_snaps
if [[ $ans_remove_dead_snaps =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_remove_dead_snaps
fi
# Prompt to configure journal logs
echo -e "\n${CYAN_B}Would you like to configure journal logs? (y/N)${RESET}"
read -n 1 -r ans_journal_configure
if [[ $ans_journal_configure =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_journal_configure
fi
# Prompt to empty trash
echo -e "\n${CYAN_B}Would you like to empty trash? (y/N)${RESET}"
read -n 1 -r ans_empty_trash
if [[ $ans_empty_trash =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_empty_trash
fi
# Prompt to remove thumbnails and other caches
echo -e "\n${CYAN_B}Would you like to remove thumbnails and other caches? (y/N)${RESET}"
read -n 1 -r ans_clear_caches
if [[ $ans_clear_caches =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_clear_caches
fi
# Prompt to find and delete duplicated files
echo -e "\n${CYAN_B}Would you like to find and delete duplicated files? (y/N)${RESET}"
read -n 1 -r ans_remove_duplicates
if [[ $ans_remove_duplicates =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_remove_duplicates
fi
# Prompt to remove broken symlinks and empty files + folders
echo -e "\n${CYAN_B}Would you like to remove broken symlinks and empty files + folders? (y/N)${RESET}"
read -n 1 -r ans_remove_broken
if [[ $ans_remove_broken =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then
fuds_remove_broken
fi
}
# Determine if file is being run directly or sourced
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
[[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" &&
printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] ||
[[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)) && sourced=1 || sourced=0
# If script being called directly, invoke transfer or show help
if [ $sourced -eq 0 ]; then
if [[ $@ == *"--help"* ]]; then
fuds_show_help
elif [[ $@ == *"--pacman"*]]; then
fuds_clean_pacman
elif [[ $@ == *"--flatpak"*]]; then
fuds_clean_flatpak
elif [[ $@ == *"--apt"*]]; then
fuds_clean_apt
elif [[ $@ == *"--snaps"*]]; then
fuds_remove_dead_snaps
elif [[ $@ == *"--journal"*]]; then
fuds_journal_configure
elif [[ $@ == *"--trash"*]]; then
fuds_empty_trash
elif [[ $@ == *"--caches"*]]; then
fuds_clear_caches
elif [[ $@ == *"--dups"*]]; then
fuds_remove_duplicates
elif [[ $@ == *"--broken"*]]; then
fuds_remove_broken
elif [[ $@ == *"--run"*]]; then
free_up_disk_space
else
free_up_disk_space
fi
fi

View File

@ -21,14 +21,8 @@ getConfiguredClient () {
fi
}
<<<<<<< HEAD
## Allows to call the users configured client without if statements everywhere
httpGet()
{
=======
# Call appropriate http get method
httpGet() {
>>>>>>> fe6ffbba54ca34778e1f4245466e1efc3394b896
case "$configuredClient" in
curl) curl -A curl -s "$@" ;;
wget) wget -qO- "$@" ;;