summaryrefslogtreecommitdiff
path: root/modules/10-i3/install.sh
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-08-21 18:24:35 -0400
committerGalen Guyer <galen@galenguyer.com>2022-08-21 18:24:35 -0400
commitf668e009263cdafdebae3607719ae19bfd9dc249 (patch)
treeb9379edfa40b18c237eb7d38e6a2af8e0829028a /modules/10-i3/install.sh
parent36fbe057d2235cbc12c3e7e85d88486d02be6c12 (diff)
begin configuration of new machine
Diffstat (limited to 'modules/10-i3/install.sh')
-rw-r--r--modules/10-i3/install.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/10-i3/install.sh b/modules/10-i3/install.sh
new file mode 100644
index 0000000..5f6ab71
--- /dev/null
+++ b/modules/10-i3/install.sh
@@ -0,0 +1,45 @@
+_script="$(realpath ${BASH_SOURCE[0]})"
+_scriptname="$(basename $_script)"
+_scriptdir="$(dirname $_script)"
+_modulename="$(basename $_scriptdir)"
+DOT_MODULE_NAME="i3"
+
+function preinstall() {
+ if ! [[ -x "$(command -v i3)" ]]; then
+ PACKAGES+=("i3-gaps")
+ fi
+ if ! [[ -x "$(command -v i3lock)" ]]; then
+ PACKAGES+=("i3lock" "polkit")
+ fi
+ if ! [[ -x "$(command -v dmenu)" ]]; then
+ PACKAGES+=("dmenu")
+ fi
+ if ! [[ -x "$(command -v startx)" ]]; then
+ PACKAGES+=("xorg" "xorg-xinit")
+ fi
+ if ! [[ -x "$(command -v xss-lock)" ]]; then
+ PACKAGES+=("xss-lock")
+ fi
+ if ! [[ -x "$(command -v scrot)" ]]; then
+ PACKAGES+=("scrot")
+ fi
+ if ! [[ -x "$(command -v convert)" ]]; then
+ PACKAGES+=("imagemagick")
+ fi
+}
+
+function install() {
+ # backup old file if it exists and we haven't backed it up before
+ if [[ -f "$HOME/.config/i3/config" ]] && ! [[ -f "$HOME/.config/i3/config.bak" ]] && ! [[ -f "$_scriptdir/.firstrun" ]]; then
+ log verbose "making backup"
+ cp "$HOME/.config/i3/config" "$HOME/.config/i3/config.bak"
+ touch "$_scriptdir/.firstrun"
+ fi
+
+ log info "linking i3 config"
+ mkdir -p "$HOME/.config/i3"
+ ln -f "$_scriptdir/config" "$HOME/.config/i3/config"
+
+ log info "linking xinitrc"
+ ln -f "$_scriptdir/xinitrc" "$HOME/.xinitrc"
+}