added more setup scrippts and missing util file
This commit is contained in:
parent
8210ac9565
commit
ad38207904
5 changed files with 209 additions and 109 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,8 +1,10 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"alacritty",
|
||||
"betterdiscordctl",
|
||||
"btop",
|
||||
"davinci",
|
||||
"dconf",
|
||||
"deno",
|
||||
"developomp",
|
||||
"flatpak",
|
||||
|
|
|
@ -38,70 +38,6 @@ setup_cpu_undervolting() {
|
|||
sudo systemctl enable intel-undervolt
|
||||
}
|
||||
|
||||
setup_discord() {
|
||||
# assumes that plugins are located in ~/.config/BetterDiscord/plugins
|
||||
|
||||
# betterdiscordctl-git: BetterDiscord installer
|
||||
|
||||
package_install \
|
||||
discord \
|
||||
betterdiscordctl-git
|
||||
|
||||
install ./home/pomp/.config/autostart/discord.desktop ~/.config/autostart/
|
||||
|
||||
BD_PLUGINS=(
|
||||
134 # https://betterdiscord.app/plugin/Avatar%20Hover
|
||||
60 # https://betterdiscord.app/plugin/BadgesEverywhere
|
||||
119 # https://betterdiscord.app/plugin/BetterCodeblocks
|
||||
62 # https://betterdiscord.app/plugin/BetterNsfwTag
|
||||
63 # https://betterdiscord.app/plugin/BetterSearchPage
|
||||
228 # https://betterdiscord.app/plugin/CallTimeCounter
|
||||
64 # https://betterdiscord.app/plugin/CharCounter
|
||||
67 # https://betterdiscord.app/plugin/CompleteTimestamps
|
||||
176 # https://betterdiscord.app/plugin/Copier
|
||||
68 # https://betterdiscord.app/plugin/CopyRawMessage
|
||||
69 # https://betterdiscord.app/plugin/CreationDate
|
||||
186 # https://betterdiscord.app/plugin/DoNotTrack
|
||||
132 # https://betterdiscord.app/plugin/EmoteReplacer
|
||||
245 # https://betterdiscord.app/plugin/FreeEmojis
|
||||
81 # https://betterdiscord.app/plugin/GoogleTranslateOption
|
||||
284 # https://betterdiscord.app/plugin/GrammarCorrect
|
||||
220 # https://betterdiscord.app/plugin/GuildProfile
|
||||
83 # https://betterdiscord.app/plugin/ImageUtilities
|
||||
295 # https://betterdiscord.app/plugin/InvisibleTyping
|
||||
84 # https://betterdiscord.app/plugin/JoinedAtDate
|
||||
85 # https://betterdiscord.app/plugin/LastMessageDate
|
||||
287 # https://betterdiscord.app/plugin/Link-Profile-Picture
|
||||
11 # https://betterdiscord.app/plugin/MemberCount
|
||||
29 # https://betterdiscord.app/plugin/PermissionsViewer
|
||||
158 # https://betterdiscord.app/plugin/PlatformIndicators
|
||||
93 # https://betterdiscord.app/plugin/QuickMention
|
||||
94 # https://betterdiscord.app/plugin/ReadAllNotificationsButton
|
||||
179 # https://betterdiscord.app/plugin/RedditMentions
|
||||
97 # https://betterdiscord.app/plugin/RevealAllSpoilersOption
|
||||
98 # https://betterdiscord.app/plugin/SendLargeMessages
|
||||
159 # https://betterdiscord.app/plugin/ShowAllActivities
|
||||
291 # https://betterdiscord.app/plugin/ShowConnections
|
||||
103 # https://betterdiscord.app/plugin/ShowHiddenChannels
|
||||
104 # https://betterdiscord.app/plugin/SpellCheck
|
||||
162 # https://betterdiscord.app/plugin/StaffTag
|
||||
8 # https://betterdiscord.app/plugin/SuppressReplyMentions
|
||||
253 # https://betterdiscord.app/plugin/Typing%20Users%20Avatars
|
||||
196 # https://betterdiscord.app/plugin/TypingIndicator
|
||||
293 # https://betterdiscord.app/plugin/UserDetails
|
||||
)
|
||||
|
||||
log "installing betterdiscord plugins"
|
||||
|
||||
for id in "${BD_PLUGINS[@]}"; do
|
||||
BD_PLUGIN_URL="https://betterdiscord.app/Download?id=$id"
|
||||
log "installing $BD_PLUGIN_URL"
|
||||
wget --content-disposition --no-clobber -P ~/.config/BetterDiscord/plugins "$BD_PLUGIN_URL"
|
||||
done
|
||||
|
||||
POST_INSTALL+=("discord: run betterdiscordctl install")
|
||||
}
|
||||
|
||||
setup_docker() {
|
||||
package_install docker
|
||||
|
||||
|
@ -308,51 +244,6 @@ setup_gnome_apps() {
|
|||
sushi
|
||||
}
|
||||
|
||||
setup_gnome_extensions() {
|
||||
log "installing gnome extensions"
|
||||
|
||||
# chrome-gnome-shell GNOME shell integration for Chrome
|
||||
# gnome-shell-extension-installer Installation of gnome extensions from command line
|
||||
# gnome-shell-extension-pop-shell-git for window tiling
|
||||
package_install \
|
||||
chrome-gnome-shell \
|
||||
gnome-shell-extension-installer \
|
||||
gnome-shell-extension-pop-shell-git
|
||||
|
||||
load_dconf "extension-pop-shell.conf"
|
||||
|
||||
extensions=(
|
||||
36,"extension-lockkeys.conf" # lock-keys
|
||||
906,"extension-sound-output-device-chooser.conf" # sound-output-device-chooser
|
||||
1460,"extension-vitals.conf" # vitals
|
||||
2741,"" # remove-alttab-delay-v2
|
||||
2890,"extension-trayIconsReloaded.conf" # tray-icons-reloaded
|
||||
3193,"extension-blur-my-shell.conf" # blur-my-shell
|
||||
4000,"extension-barbar.conf" # babar
|
||||
4158,"" # gnome-40-ui-improvements
|
||||
)
|
||||
|
||||
for i in "${extensions[@]}"; do
|
||||
IFS=","
|
||||
set -- $i
|
||||
|
||||
# $1: extension id
|
||||
# $2: extension dconf
|
||||
|
||||
log "installing: https://extensions.gnome.org/extension/$1"
|
||||
gnome-shell-extension-installer $1 --yes --update
|
||||
|
||||
if [ ! -z $2 ]; then
|
||||
load_dconf $2
|
||||
fi
|
||||
done
|
||||
|
||||
# enable extensions
|
||||
load_dconf "extensions.conf"
|
||||
|
||||
gnome-shell-extension-installer --restart-shell
|
||||
}
|
||||
|
||||
setup_grub() {
|
||||
sudo sed -i '/GRUB_TIMEOUT=/c\GRUB_TIMEOUT=1' /etc/default/grub
|
||||
sudo sed -i '/GRUB_TIMEOUT_STYLE=/c\GRUB_TIMEOUT_STYLE=hidden' /etc/default/grub
|
||||
|
|
71
src/setup/discord.py
Normal file
71
src/setup/discord.py
Normal file
|
@ -0,0 +1,71 @@
|
|||
from ..util import flatpak_install, pamac_install, smart_copy
|
||||
from ..constants import tmp_dir
|
||||
from .. import log
|
||||
from os import system
|
||||
|
||||
name = "Discord"
|
||||
|
||||
PLUGINS = (
|
||||
134, # https://betterdiscord.app/plugin/Avatar%20Hover
|
||||
60, # https://betterdiscord.app/plugin/BadgesEverywhere
|
||||
119, # https://betterdiscord.app/plugin/BetterCodeblocks
|
||||
62, # https://betterdiscord.app/plugin/BetterNsfwTag
|
||||
63, # https://betterdiscord.app/plugin/BetterSearchPage
|
||||
228, # https://betterdiscord.app/plugin/CallTimeCounter
|
||||
64, # https://betterdiscord.app/plugin/CharCounter
|
||||
67, # https://betterdiscord.app/plugin/CompleteTimestamps
|
||||
176, # https://betterdiscord.app/plugin/Copier
|
||||
68, # https://betterdiscord.app/plugin/CopyRawMessage
|
||||
69, # https://betterdiscord.app/plugin/CreationDate
|
||||
186, # https://betterdiscord.app/plugin/DoNotTrack
|
||||
132, # https://betterdiscord.app/plugin/EmoteReplacer
|
||||
245, # https://betterdiscord.app/plugin/FreeEmojis
|
||||
81, # https://betterdiscord.app/plugin/GoogleTranslateOption
|
||||
284, # https://betterdiscord.app/plugin/GrammarCorrect
|
||||
220, # https://betterdiscord.app/plugin/GuildProfile
|
||||
83, # https://betterdiscord.app/plugin/ImageUtilities
|
||||
295, # https://betterdiscord.app/plugin/InvisibleTyping
|
||||
84, # https://betterdiscord.app/plugin/JoinedAtDate
|
||||
85, # https://betterdiscord.app/plugin/LastMessageDate
|
||||
287, # https://betterdiscord.app/plugin/Link-Profile-Picture
|
||||
11, # https://betterdiscord.app/plugin/MemberCount
|
||||
29, # https://betterdiscord.app/plugin/PermissionsViewer
|
||||
158, # https://betterdiscord.app/plugin/PlatformIndicators
|
||||
93, # https://betterdiscord.app/plugin/QuickMention
|
||||
94, # https://betterdiscord.app/plugin/ReadAllNotificationsButton
|
||||
179, # https://betterdiscord.app/plugin/RedditMentions
|
||||
97, # https://betterdiscord.app/plugin/RevealAllSpoilersOption
|
||||
98, # https://betterdiscord.app/plugin/SendLargeMessages
|
||||
159, # https://betterdiscord.app/plugin/ShowAllActivities
|
||||
291, # https://betterdiscord.app/plugin/ShowConnections
|
||||
103, # https://betterdiscord.app/plugin/ShowHiddenChannels
|
||||
104, # https://betterdiscord.app/plugin/SpellCheck
|
||||
162, # https://betterdiscord.app/plugin/StaffTag
|
||||
8, # https://betterdiscord.app/plugin/SuppressReplyMentions
|
||||
253, # https://betterdiscord.app/plugin/Typing%20Users%20Avatars
|
||||
196, # https://betterdiscord.app/plugin/TypingIndicator
|
||||
293, # https://betterdiscord.app/plugin/UserDetails
|
||||
)
|
||||
|
||||
|
||||
def setup():
|
||||
"""Discord and better discord"""
|
||||
|
||||
flatpak_install("com.discordapp.Discord")
|
||||
pamac_install("betterdiscordctl-git")
|
||||
|
||||
smart_copy(
|
||||
f"{tmp_dir}/home/pomp/.config/autostart/discord.desktop",
|
||||
"~/.config/autostart/discord.desktop",
|
||||
)
|
||||
|
||||
for id in PLUGINS:
|
||||
url = f"https://betterdiscord.app/Download?id={id}"
|
||||
log.log(f"installing {url}")
|
||||
|
||||
# assumes that plugins is located in "~/.var/app/com.discordapp.Discord/config/BetterDiscord/plugins" because I'm using flatpak
|
||||
system(
|
||||
f'wget --content-disposition --no-clobber -P ~/.var/app/com.discordapp.Discord/config/BetterDiscord/plugins "{url}"'
|
||||
)
|
||||
|
||||
system("betterdiscordctl -i flatpak install")
|
43
src/setup/gnome_extensions.py
Normal file
43
src/setup/gnome_extensions.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
from ..util import pamac_install, load_dconf
|
||||
from .. import log
|
||||
|
||||
name = "Gnome extensions"
|
||||
|
||||
EXTENSIONS = (
|
||||
(36, "extension-lockkeys.conf"), # lock-keys
|
||||
(906, "extension-sound-output-device-chooser.conf"), # sound-output-device-chooser
|
||||
(1460, "extension-vitals.conf"), # vitals
|
||||
(2741, ""), # remove-alttab-delay-v2
|
||||
(2890, "extension-trayIconsReloaded.conf"), # tray-icons-reloaded
|
||||
(3193, "extension-blur-my-shell.conf"), # blur-my-shell
|
||||
(4000, "extension-barbar.conf"), # babar
|
||||
(4158, ""), # gnome-40-ui-improvements
|
||||
)
|
||||
|
||||
|
||||
def setup():
|
||||
"""
|
||||
Extensions for the GNOME Desktop environment
|
||||
|
||||
Intentionally left out chrome-gnome-shell because I won't be using browsers to install GNOME extensions.
|
||||
|
||||
gnome-shell-extension-installer: gnome extension installer CLI
|
||||
gnome-shell-extension-pop-shell-git: window tiling extension
|
||||
"""
|
||||
|
||||
pamac_install(
|
||||
["gnome-shell-extension-installer", "gnome-shell-extension-pop-shell-git"]
|
||||
)
|
||||
|
||||
load_dconf("extension-pop-shell.conf")
|
||||
|
||||
for (extension, dconf_file) in EXTENSIONS:
|
||||
log.log("installing: https://extensions.gnome.org/extension/$1")
|
||||
system(f"gnome-shell-extension-installer {extension} --yes --update")
|
||||
|
||||
if dconf_file: # if dconf_file is not empty
|
||||
load_dconf(dconf_file)
|
||||
|
||||
# enable extensions
|
||||
load_dconf("extensions.conf")
|
||||
system("gnome-shell-extension-installer --restart-shell")
|
93
src/util.py
Normal file
93
src/util.py
Normal file
|
@ -0,0 +1,93 @@
|
|||
from os import system, makedirs
|
||||
from shutil import copy
|
||||
from .constants import tmp_dir
|
||||
|
||||
# todo: remove all uses of AUR (use pacman instead of pamac)
|
||||
def pamac_install(packages: str | list[str]) -> None:
|
||||
"""
|
||||
Download package from the arch repository and AUR.
|
||||
|
||||
arguments:
|
||||
packages: space-separated list of packages.
|
||||
"""
|
||||
|
||||
if type(packages) == str:
|
||||
system(f"pamac install --no-confirm {packages}")
|
||||
elif type(packages) == list[str]:
|
||||
packages = packages.join(" ")
|
||||
system(f"pamac install --no-confirm {packages}")
|
||||
|
||||
|
||||
def flatpak_install(packages: str) -> None:
|
||||
"""
|
||||
Download packages from flathub.
|
||||
|
||||
arguments:
|
||||
packages: space-separated list of packages.
|
||||
"""
|
||||
|
||||
system(f"flatpak install -y {packages}")
|
||||
|
||||
|
||||
def smart_mkdir(path: str):
|
||||
"""
|
||||
Recursively create directories if it doesn't exist already.
|
||||
"""
|
||||
try:
|
||||
makedirs(path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def smart_copy(src: str, dst: str):
|
||||
"""
|
||||
Copies src to dst.
|
||||
Errors if parent directory/directories of dst does not exist.
|
||||
|
||||
arguments:
|
||||
src: A path-like object or string pointing to a file.
|
||||
dst: A path-like object or string pointing to a file or a directory.
|
||||
"""
|
||||
|
||||
copy(src, dst)
|
||||
|
||||
|
||||
def load_dconf(file_name: str):
|
||||
"""Loads dconf configuration"""
|
||||
|
||||
system(f'dconf load / < "{tmp_dir}/dconf/{file_name}"')
|
||||
|
||||
|
||||
"""
|
||||
def setup_essentials():
|
||||
setup_fstab
|
||||
sudo pacman -S --needed base-devel wget
|
||||
dconf
|
||||
|
||||
# install pamac if it does not exist
|
||||
if ! command -v pamac &>/dev/null; then
|
||||
log "pamac was not installed already. Installing now..."
|
||||
setup_pamac
|
||||
fi
|
||||
|
||||
# install dialog if it's not installed already
|
||||
if ! command -v dialog &>/dev/null; then
|
||||
log "dialog was not installed already. Installing now..."
|
||||
package_install dialog
|
||||
fi
|
||||
|
||||
def backup():
|
||||
TIMESTAMP=$(date +%s)
|
||||
# backup dconf configuration
|
||||
dconf dump / >"$SCRIPT_DIR/dconf$TIMESTAMP.conf"
|
||||
|
||||
# make a home directory backup
|
||||
rsync -a --info=progress2 --perms /home/pomp "$DATA_PATH/backup$TIMESTAMP"
|
||||
|
||||
# create timeshift backup
|
||||
if ! command -v timeshift &>/dev/null; then
|
||||
error "failed to create timeshift backup. Timeshift command not found."
|
||||
else
|
||||
sudo timeshift --create --comments "auto created by developomp setup script ($TIMESTAMP)"
|
||||
fi
|
||||
"""
|
Loading…
Add table
Add a link
Reference in a new issue