aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2024-02-12 08:36:45 +0100
committerjakobst1n <jakob.stendahl@outlook.com>2024-02-12 08:36:45 +0100
commit4c960080625bf23d50c3e487d79b28443a1ccf24 (patch)
tree48eb444d8364bc1e9928416a7df06d6976701ba3
parent9f79040277af620f507aa0da4c06ffc265db2dc4 (diff)
downloaddotfiles-4c960080625bf23d50c3e487d79b28443a1ccf24.tar.gz
dotfiles-4c960080625bf23d50c3e487d79b28443a1ccf24.zip
make
-rw-r--r--.gitignore1
-rw-r--r--Makefile37
-rw-r--r--Makefile.m4170
-rwxr-xr-xconfigure141
-rw-r--r--linux/sway/autostart.m412
-rw-r--r--linux/tmux.conf.m46
6 files changed, 321 insertions, 46 deletions
diff --git a/.gitignore b/.gitignore
index 8b83c4a..b06619b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -83,3 +83,4 @@ linux/qtile/config/config.py
linux/sway/config
linux/sway/autostart
linux/sway/hid
+Makefile
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 1a5cd13..0000000
--- a/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-M4 := m4
-M4_OPTS := -P
-M4_COMMON_DEPS = system.m4
-
-define M4_EXEC
- ${M4} ${M4_OPTS} $< > $@
-endef
-
-TARGETS := linux/tmux.conf \
- Common/zshrc \
- linux/qtile/config/config.py \
- linux/sway/config \
- linux/sway/autostart \
- linux/sway/hid
-
-all: $(TARGETS)
-
-linux/tmux.conf: linux/tmux.conf.m4 \
- ${M4_COMMON_DEPS}
- $(call M4_EXEC)
-
-Common/zshrc: Common/zshrc.m4 \
- ${M4_COMMON_DEPS}
- $(call M4_EXEC)
-
-linux/qtile/config/config.py: linux/qtile/config/config.py.m4 \
- linux/qtile/config/screen.m4.py \
- linux/qtile/config/group.m4.py \
- linux/qtile/config/layout.m4.py \
- linux/qtile/config/keys.m4.py \
- ${M4_COMMON_DEPS}
- $(call M4_EXEC)
-
-linux/sway/%: linux/sway/%.m4 \
- ${M4_COMMON_DEPS}
- $(call M4_EXEC)
-
diff --git a/Makefile.m4 b/Makefile.m4
new file mode 100644
index 0000000..72267d0
--- /dev/null
+++ b/Makefile.m4
@@ -0,0 +1,170 @@
+m4_include(`system.m4')m4_dnl
+M4 := m4
+M4_OPTS := -P
+M4_COMMON_DEPS = system.m4
+SRC_DIR := DOTFILES_DIR
+HOME_DIR := HOME_DIRECTORY
+
+.PHONY: install_packages update_packages
+
+define M4_EXEC
+ ${M4} ${M4_OPTS} $< > $@
+endef
+
+define create_symlink
+@if [ ! -L "$(2)" ]; then \
+ echo "Creating new symlink $(2) -> $(1)"; \
+ ln -isf $(1) $(2); \
+elif [ "$$(readlink $(2))" != "$(1)" ]; then \
+ echo "Symlink exists but points to a different source. Updating symlink $(2) -> $(1)"; \
+ ln -sf $(1) $(2); \
+fi
+endef
+
+define create_dotfile_symlink
+ $(call create_symlink,${SRC_DIR}/$(1),${HOME_DIR}/$(2))
+endef
+
+all: install_packages m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.tmux.conf') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.zshrc') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/bin') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.vimrc') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.vim') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.p10k.zsh') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/rofi') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/deadd') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/waybar') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/foot') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/alacritty') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/powerline') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/sxhkd') m4_dnl
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `$(HOME_DIR)/.config/bspwm') m4_dnl
+m4_ifdef(`INSTALL_QTILE', `$(HOME_DIR)/.config/qtile/config.py') m4_dnl
+m4_ifdef(`INSTALL_SWAY', `$(HOME_DIR)/.config/sway/config') m4_dnl
+m4_ifdef(`INSTALL_SWAY', `$(HOME_DIR)/.config/sway/hid') m4_dnl
+m4_ifdef(`INSTALL_SWAY', `$(HOME_DIR)/.config/sway/autostart') m4_dnl
+m4_ifdef(`INSTALL_NEOVIM', `$(HOME_DIR)/.config/nvim') m4_dnl
+
+
+m4_ifdef(`INSTALL_OTHER_SYMLINKS', `m4_dnl
+linux/tmux.conf: linux/tmux.conf.m4 \
+ ${M4_COMMON_DEPS}
+ $(call M4_EXEC)
+ $(call create_symlink,$(SRC_DIR)/Common/nvim,$(HOME_DIR)/.config/nvim)
+
+$(HOME_DIR)/.tmux.conf: linux/tmux.conf
+ $(call create_dotfile_symlink,linux/tmux.conf,.tmux.conf)
+
+Common/zshrc: Common/zshrc.m4 \
+ ${M4_COMMON_DEPS}
+ $(call M4_EXEC)
+
+$(HOME_DIR)/.zshrc: Common/zshrc
+ $(call create_dotfile_symlink,Common/zshrc,.zshrc)
+
+$(HOME_DIR)/bin: bin
+ $(call create_dotfile_symlink,bin,bin)
+
+$(HOME_DIR)/.vimrc: Common/vimrc
+ $(call create_dotfile_symlink,Common/vimrc,.vimrc)
+
+$(HOME_DIR)/.vim: Common/vim
+ $(call create_dotfile_symlink,Common/vim,.vim)
+
+$(HOME_DIR)/.p10k.zsh: Common/vim
+ $(call create_dotfile_symlink,Common/p10k.zsh,.p10k.zsh)
+
+$(HOME_DIR)/.config/rofi: linux/rofi
+ $(call create_dotfile_symlink,linux/rofi,.config/rofi)
+
+$(HOME_DIR)/.config/deadd: linux/deadd/
+ $(call create_dotfile_symlink,linux/deadd,.config/deadd)
+
+$(HOME_DIR)/.config/waybar: linux/waybar
+ $(call create_dotfile_symlink,linux/waybar,.config/waybar)
+
+$(HOME_DIR)/.config/foot: linux/foot
+ $(call create_dotfile_symlink,linux/foot,.config/foot)
+
+$(HOME_DIR)/.config/alacritty: linux/alacritty
+ $(call create_dotfile_symlink,linux/alacritty,.config/alacritty)
+
+$(HOME_DIR)/.config/powerline: linux/powerline_config
+ $(call create_dotfile_symlink,linux/powerline_config,.config/powerline)
+
+$(HOME_DIR)/.config/sxhkd: linux/sxhkd
+ $(call create_dotfile_symlink,linux/sxhkd,.config/sxhkd)
+
+$(HOME_DIR)/.config/bspwm: linux/bspwm
+ $(call create_dotfile_symlink,linux/bspwm,.config/bspwm)
+')
+
+m4_ifdef(`INSTALL_SWAY', `m4_dnl
+linux/sway/%: linux/sway/%.m4 \
+ ${M4_COMMON_DEPS}
+ $(call M4_EXEC)
+
+$(HOME_DIR)/.config/sway/%: linux/sway/config linux/sway/hid linux/sway/autostart
+ $(call create_symlink,${SRC_DIR}/linux/sway,$(HOME_DIR)/.config/sway)
+
+')m4_dnl
+
+m4_ifdef(`INSTALL_QTILE', `m4_dnl
+linux/qtile/config/config.py: linux/qtile/config/config.py.m4 \
+ linux/qtile/config/screen.m4.py \
+ linux/qtile/config/group.m4.py \
+ linux/qtile/config/layout.m4.py \
+ linux/qtile/config/keys.m4.py \
+ ${M4_COMMON_DEPS}
+ $(call M4_EXEC)
+
+$(HOME_DIR)/.config/qtile/config.py: linux/qtile/config/config.py
+ $(call create_symlink,$(SRC_DIR)/linux/qtile/config/,$(HOME_DIR)/.config/qtile/)
+ sudo cp linux/qtile/qtile.desktop /usr/share/xsessions/qtile.desktop
+ sudo cp linux/qtile/qtile-wayland.desktop /usr/share/wayland-sessions/qtile-wayland.desktop
+')m4_dnl
+
+m4_ifdef(`INSTALL_NEOVIM', `m4_dnl
+/usr/local/bin/nvim:
+ git clone https://github.com/neovim/neovim /tmp/neovim
+ git -C /tmp/neovim checkout tags/v0.9.5
+ (cd /tmp/neovim && sudo make install)
+
+$(HOME_DIR)/.config/nvim/: /usr/local/bin/nvim
+ $(call create_symlink,$(SRC_DIR)/Common/nvim,$(HOME_DIR)/.config/nvim)
+')m4_dnl
+
+# Genereal package manager stuff
+m4_ifelse(DISTRO, `debian', m4_dnl
+DPKG_DEPENDENCIES := m4_dnl
+m4_ifdef(`INSTALL_TOOLS', `highlight atool w3m mediainfo curl zsh vim git python3-pip zsh tmux nodejs catimg ripgrep silversearcher-ag',) m4_dnl
+m4_ifdef(`INSTALL_GREETD_TUIGREET', `greetd',) m4_dnl
+m4_ifdef(`INSTALL_TLP', `tlp',) m4_dnl
+m4_dnl
+m4_ifdef(`INSTALL_SWAY', `sway swayidle physlock alacritty blueman network-manager-gnome wob wlogout wofi brightnessctl clipman xwayland seahorse fcitx5',) m4_dnl
+m4_dnl
+m4_ifdef(`INSTALL_QTILE', `python3-cffi python3-cairocffi pango pango-devel python3-dbus-next',) m4_dnl qtile core
+m4_ifdef(`INSTALL_QTILE', `python3_xcffib xsecurelock',) m4_dnl qtile x11
+m4_ifdef(`INSTALL_QTILE', `wlroots python3-wlroots python3-pywayland python3-xkbcommon xwayland',) m4_dnl qtile wayland
+
+
+install_packages:
+ @missing_packages=""; \
+ for pkg in $(DPKG_DEPENDENCIES); do \
+ if ! dpkg -s "$$pkg" >/dev/null 2>&1; then \
+ missing_packages="$$missing_packages $$pkg"; \
+ fi; \
+ done; \
+ if [ -n "$$missing_packages" ]; then \
+ echo "Installing missing packages: $$missing_packages"; \
+ sudo apt-get update; \
+ sudo apt-get install -y $$missing_packages; \
+ fi
+
+update_packages:
+ @echo "Updating all packages..."
+ sudo apt-get update
+ sudo apt-get upgrade -y $(DPKG_DEPENDENCIES)
+)m4_dnl
+
diff --git a/configure b/configure
new file mode 100755
index 0000000..8e67254
--- /dev/null
+++ b/configure
@@ -0,0 +1,141 @@
+#!/bin/bash
+
+set -o pipefail
+M4_DEF_FILE="system.m4"
+
+HOME_DIRECTORY=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --inputbox "Home directory" \
+ 0 0 "${HOME}" \
+3>&1 1>&2 2>&3 3>&-)
+
+DEFAULT_SHELL=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --inputbox "Default shell" \
+ 0 0 "/usr/bin/zsh" \
+3>&1 1>&2 2>&3 3>&-)
+
+DEFAULT_EDITOR=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --inputbox "Default editor" \
+ 0 0 "nvim" \
+3>&1 1>&2 2>&3 3>&-)
+
+SYSID=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --inputbox "System id (magical number)" \
+ 0 0 "1" \
+3>&1 1>&2 2>&3 3>&-)
+
+SYSTEM_TYPE=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --radiolist "System type" \
+ 0 0 0 \
+ 0 "Local" on \
+ 1 "Remote" off \
+3>&1 1>&2 2>&3 3>&-)
+
+DISTRO=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --radiolist "Distro" \
+ 0 0 0 \
+ 0 "Debian" on \
+ 1 "Fedora" off \
+3>&1 1>&2 2>&3 3>&-)
+
+GIT_VALUES=$(dialog \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --form "Git settings" \
+0 50 0 \
+ "Username:" 1 1 "$GIT_USER" 1 10 255 0 \
+ "Email:" 2 1 "$GIT_EMAIL" 2 10 255 0 \
+3>&1 1>&2 2>&3 3>&-)
+GIT_VALUES=($GIT_VALUES)
+
+FEATURES="$(dialog --stdout \
+ --backtitle "Dotfile configuration" \
+ --title "Configure" \
+ --checklist "Change dotfile features:" 0 0 10 \
+ 1 "General tools (highligt, mediainfo, git, ripgrep...)" on \
+ 2 "Other dotfile symlinks (Not for specific features below)" on \
+ 3 "neovim" on \
+ 4 "ZSH and Oh-My-Zsh" off \
+ 5 "tlp" off \
+ 6 "autorandr" off \
+ 7 "greetd and tuigreet" off \
+ 8 "Powerline and P10K" off \
+ 9 "Sway" off \
+ 10 "QTile" off)"
+
+
+# Write all to file
+echo "m4_define(\`DOTFILES_DIR', \`$(pwd)')m4_dnl" > ${M4_DEF_FILE}
+echo "m4_define(\`HOME_DIRECTORY', \`${HOME_DIRECTORY}')m4_dnl" >> ${M4_DEF_FILE}
+echo "m4_define(\`DEFAULT_SHELL', \`${DEFAULT_SHELL}')m4_dnl" >> ${M4_DEF_FILE}
+echo "m4_define(\`DEFAULT_EDITOR', \`${DEFAULT_EDITOR}')m4_dnl" >> ${M4_DEF_FILE}
+echo "m4_define(\`SYSID', \`${SYSID}')m4_dnl" >> ${M4_DEF_FILE}
+
+case $SYSTEM_TYPE in
+ 0)
+ echo "m4_define(\`DOTFILES_TYPE', \`local')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 1)
+ echo "m4_define(\`DOTFILES_TYPE', \`remote')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+esac
+
+case $DISTRO in
+ 0)
+ echo "m4_define(\`DISTRO', \`debian')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 1)
+ echo "m4_define(\`DISTRO', \`fedora')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+esac
+
+echo "m4_define(\`GIT_USER', \`${GIT_VALUES[0]}')m4_dnl" >> ${M4_DEF_FILE}
+echo "m4_define(\`GIT_EMAIL', \`${GIT_VALUES[1]}')m4_dnl" >> ${M4_DEF_FILE}
+
+for choice in ${FEATURES}; do
+ case $choice in
+ 1)
+ echo "m4_define(\`INSTALL_TOOLS', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 2)
+ echo "m4_define(\`INSTALL_OTHER_SYMLINKS', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 3)
+ echo "m4_define(\`INSTALL_NEOVIM', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 4)
+ echo "m4_define(\`INSTALL_OH_MY_ZSH', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 5)
+ echo "m4_define(\`INSTALL_TLP', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 6)
+ echo "m4_define(\`INSTALL_AUTORANDR', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 7)
+ echo "m4_define(\`INSTALL_GREETD_TUIGREET', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 8)
+ echo "m4_define(\`INSTALL_POWERLINE_P10K', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 9)
+ echo "m4_define(\`INSTALL_SWAY', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ 10)
+ echo "m4_define(\`INSTALL_QTILE', \`1')m4_dnl" >> ${M4_DEF_FILE}
+ ;;
+ esac
+done
+
+m4 -P Makefile.m4 > Makefile
diff --git a/linux/sway/autostart.m4 b/linux/sway/autostart.m4
index 57094c5..68045e2 100644
--- a/linux/sway/autostart.m4
+++ b/linux/sway/autostart.m4
@@ -5,12 +5,12 @@ exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSO
# screen locking
m4_changequote({, })m4_dnl
m4_ifelse(SYSID, {1}, {m4_dnl
-exec swayidle -w \
- timeout 300 'swaymsg "output * dpms off"' \
- timeout 3600 physlock \
- resume 'swaymsg "output * dpms on"' \
- before-sleep physlock
-})m4_dnl
+#exec swayidle -w \
+# timeout 300 'swaymsg "output * dpms off"' \
+# timeout 3600 physlock \
+# resume 'swaymsg "output * dpms on"' \
+# before-sleep physlock
+#})m4_dnl
m4_changequote(`, ')m4_dnl
# notification centre
diff --git a/linux/tmux.conf.m4 b/linux/tmux.conf.m4
index d47c78e..90df21a 100644
--- a/linux/tmux.conf.m4
+++ b/linux/tmux.conf.m4
@@ -43,9 +43,9 @@ set-option -s set-clipboard off
bind P paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
-bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -sel clip -i'`
-unbind -T copy-mode-vi Enter
-bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
+#bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -sel clip -i'
+#unbind -T copy-mode-vi Enter
+#bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -ind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i''