From bd71ae832af625219bbdc67a4396221aeb62e4fb Mon Sep 17 00:00:00 2001 From: tuxwarrior Date: Sun, 12 May 2024 14:14:13 -0500 Subject: [PATCH] - hyprland & qtile --- dots/archinstall/t470p/options.sh | 5 +- dots/environment/environment | 4 +- dots/xorg/.xinitrc | 8 +- .../dots}/hypridle/hypridle.conf | 0 .../dots}/hyprland/hyprland.conf | 0 .../dots}/hyprlock/hyprlock.conf | 0 .../dots}/hyprpaper/hyprpaper.conf | 0 {dots => obsolete/dots}/qtile/config.py | 0 {dots => obsolete/dots}/waybar/config.jsonc | 0 {dots => obsolete/dots}/waybar/style.css | 0 obsolete/scripts/99_deploy.wHyprland.sh | 263 ++++++++++++++++++ scripts/99_deploy.sh | 43 +-- 12 files changed, 270 insertions(+), 53 deletions(-) rename {dots => obsolete/dots}/hypridle/hypridle.conf (100%) rename {dots => obsolete/dots}/hyprland/hyprland.conf (100%) rename {dots => obsolete/dots}/hyprlock/hyprlock.conf (100%) rename {dots => obsolete/dots}/hyprpaper/hyprpaper.conf (100%) rename {dots => obsolete/dots}/qtile/config.py (100%) rename {dots => obsolete/dots}/waybar/config.jsonc (100%) rename {dots => obsolete/dots}/waybar/style.css (100%) create mode 100644 obsolete/scripts/99_deploy.wHyprland.sh diff --git a/dots/archinstall/t470p/options.sh b/dots/archinstall/t470p/options.sh index 8194760..6db8fdb 100644 --- a/dots/archinstall/t470p/options.sh +++ b/dots/archinstall/t470p/options.sh @@ -10,7 +10,4 @@ CLONE_TARGET_DIR=/tmp # directory to clone dots repository to USER=poq # system user -# window manager / compositor -HYPRLAND=false -I3WM=true -QTILE=false +I3WM=true # {true, false} installs i3 packages diff --git a/dots/environment/environment b/dots/environment/environment index 2ec9ebb..01b1ce4 100644 --- a/dots/environment/environment +++ b/dots/environment/environment @@ -13,8 +13,6 @@ NEXTCLOUD_tuxwarrior=/media/drive2/nass/lo/nextcloud DOWNLOADS=/home/poq/syncDir/0_downloads # mounted downloads dir, same for all hosts -XWM=i3 # {i3, qtile} +XWM=i3 # {i3, qtile} window manager to start in .xinitrc GTK_THEME=Adapta-Nokto - -HYPRSHOT_DIR=/home/poq/syncDir/0_downloads # only in use for hyprland diff --git a/dots/xorg/.xinitrc b/dots/xorg/.xinitrc index 9eebbb4..9b71aaa 100644 --- a/dots/xorg/.xinitrc +++ b/dots/xorg/.xinitrc @@ -26,10 +26,10 @@ fi # start some nice programs if [ -d /etc/X11/xinit/xinitrc.d ] ; then - for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do - [ -x "$f" ] && . "$f" - done - unset f + for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do + [ -x "$f" ] && . "$f" + done + unset f fi if [ ${XWM} == "i3" ] ; then diff --git a/dots/hypridle/hypridle.conf b/obsolete/dots/hypridle/hypridle.conf similarity index 100% rename from dots/hypridle/hypridle.conf rename to obsolete/dots/hypridle/hypridle.conf diff --git a/dots/hyprland/hyprland.conf b/obsolete/dots/hyprland/hyprland.conf similarity index 100% rename from dots/hyprland/hyprland.conf rename to obsolete/dots/hyprland/hyprland.conf diff --git a/dots/hyprlock/hyprlock.conf b/obsolete/dots/hyprlock/hyprlock.conf similarity index 100% rename from dots/hyprlock/hyprlock.conf rename to obsolete/dots/hyprlock/hyprlock.conf diff --git a/dots/hyprpaper/hyprpaper.conf b/obsolete/dots/hyprpaper/hyprpaper.conf similarity index 100% rename from dots/hyprpaper/hyprpaper.conf rename to obsolete/dots/hyprpaper/hyprpaper.conf diff --git a/dots/qtile/config.py b/obsolete/dots/qtile/config.py similarity index 100% rename from dots/qtile/config.py rename to obsolete/dots/qtile/config.py diff --git a/dots/waybar/config.jsonc b/obsolete/dots/waybar/config.jsonc similarity index 100% rename from dots/waybar/config.jsonc rename to obsolete/dots/waybar/config.jsonc diff --git a/dots/waybar/style.css b/obsolete/dots/waybar/style.css similarity index 100% rename from dots/waybar/style.css rename to obsolete/dots/waybar/style.css diff --git a/obsolete/scripts/99_deploy.wHyprland.sh b/obsolete/scripts/99_deploy.wHyprland.sh new file mode 100644 index 0000000..01fc66c --- /dev/null +++ b/obsolete/scripts/99_deploy.wHyprland.sh @@ -0,0 +1,263 @@ +#!/usr/bin/env bash + +# klevstul + +echo "<< 99_deploy.sh >>" + +if [ "$EUID" -ne 0 ] + then echo "error: run as 'root'" + exit +fi + +this_file_name=`basename "$0"` +if [ $# -lt 1 ]; then + echo "usage: '$this_file_name {all}'" + exit 1 +fi +operation=$1 + +options_url=https://git.mz.fo/fro/lnx-arch/raw/branch/master/dots/archinstall/${HOSTNAME}/options.sh +options_trg=/tmp/options.sh +rm -rf ${options_trg} +rm -rf ${options_trg}.tmp +wget -q ${options_url} -O ${options_trg} +source ${options_trg} +if [ -z "${OPTIONS_LOADED}" ]; then + echo "error: unable to load options" + exit 1 +fi + +user=${USER} +clone_trg=${CLONE_TARGET_DIR} + +# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + +# helper functions +download_repo() { + + _targz_url=$1 + + # make clone target directory, if it doesn't exist + mkdir -p ${clone_trg} + + # instead of doing a git clone (like `git clone ${clone_url} ${clone_trg}`), + # where i would have emptied the target dir each time, i download the + # source as a tar.gz. + wget --show-progress ${_targz_url} -O ${clone_trg}/tmp.tar.gz + tar -xzf ${clone_trg}/tmp.tar.gz -C ${clone_trg} + rm ${clone_trg}/tmp.tar.gz + +} + +create_dir() { + _directory=$1 + + mkdir -p ${_directory} + chown ${user}:${user} ${_directory} +} + +deploy_file() { + _src_path=$1 + _trg_path=$2 + _no_chown=$3 + + file_name=$(basename ${_trg_path}) + echo "" + echo "${file_name}:" + + cp -f ${_src_path} ${_trg_path} + + # only chown if _no_chown variable is empty + if [ -z "${_no_chown}" ]; then + # if the target path ends with a slash, we have a directory + if [[ "$_trg_path" == */ ]] + then + echo "(ignore potential \"chown: cannot access\" error, which will occur if there are no dot-files in the directory)" + chown ${user}:${user} ${_trg_path}* + # https://serverfault.com/questions/156437/how-to-chown-a-directory-recursively-including-hidden-files-or-directories + chown ${user}:${user} ${_trg_path}.[^.]* + else + chown ${user}:${user} ${_trg_path} + fi + fi + + suffix=".sh" + if [[ ${file_name} == *$suffix ]] ; then + chmod 755 ${_trg_path}/*.sh + elif [[ ${file_name} == "bin" ]] ; then + chmod 755 ${_trg_path}/* + fi + + ls -al ${_trg_path} +} + +# locate profile folder +firefox_profile_dir() { + ffdir=/home/${user}/.mozilla/firefox/ + + if ! [ -d "$ffdir" ] + then + echo "error: firefox main directory not found: '${ffdir}'" + else + pattern=".default-release" + old_dir=`pwd` + cd ${ffdir} + for _dir in *"${pattern}"*; do + [ -d "${_dir}" ] && dir="${_dir}" && break + done + cd ${old_dir} + + if [ -z "$dir" ] + then + echo "error: firefox profile directory not found" + else + ffprofiledir=${ffdir}${dir} + echo "${ffprofiledir}" + fi + fi +} + +# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + +# dots (dot files) +if [ ${operation} == "dots" ] ; then + + # declarations + targz_dots_url=https://git.mz.fo/fro/lnx-arch/archive/master.tar.gz + dots_trg=${clone_trg}/lnx-arch/dots + + echo "***** ${operation} *****" + rm -rf ${clone_trg}/lnx-arch + download_repo ${targz_dots_url} + tree ${clone_trg}/lnx-arch + + # ---------- + # system + # ---------- + + # bashrc + file_name=.bashrc + file_path=/home/${user} + deploy_file "${dots_trg}/bash/${file_name}" "${file_path}/${file_name}" + + # bin (executable binaries, scripts) + file_path=/usr/local/bin + deploy_file "${dots_trg}/bin/*" "${file_path}/" + + # environment + file_name=environment + file_path=/etc + deploy_file "${dots_trg}/environment/${file_name}" "${file_path}/${file_name}" no_chown + + # ---------- + # programs + # ---------- + + # firefox + file_name=policies.json + file_path=/usr/lib/firefox/distribution + deploy_file "${dots_trg}/firefox/${file_name}" "${file_path}/${file_name}" no_chown + + ffpd=$(firefox_profile_dir) + if [[ ${ffpd} == error* ]] ; then + echo ${ffpd} + else + file_name=user.js + file_path=${ffpd} + deploy_file "${dots_trg}/firefox/${file_name}" "${file_path}/${file_name}" + + file_name=userChrome.css + file_path=${ffpd}/chrome + mkdir -p ${file_path} + deploy_file "${dots_trg}/firefox/${file_name}" "${file_path}/${file_name}" + fi + + # hyprland + if [ ${HYPRLAND} == "true" ] ; then + + # hypridle + file_name=hypridle.conf + file_path=/home/${user}/.config/hypr + deploy_file ${dots_trg}/hypridle/${file_name} ${file_path}/${file_name} + + # hyprland + file_name=hyprland.conf + file_path=/home/${user}/.config/hypr + deploy_file ${dots_trg}/hyprland/${file_name} ${file_path}/${file_name} + + # hyprlock + file_name=hyprlock.conf + file_path=/home/${user}/.config/hypr + deploy_file ${dots_trg}/hyprlock/${file_name} ${file_path}/${file_name} + + # hyprpaper + file_name=hyprpaper.conf + file_path=/home/${user}/.config/hypr + deploy_file ${dots_trg}/hyprpaper/${file_name} ${file_path}/${file_name} + + # waybar + file_path=/home/${user}/.config/waybar + mkdir -p ${file_path} + deploy_file "${dots_trg}/waybar/*" "${file_path}/" + + fi + + # qtile + if [ ${QTILE} == "true" ] ; then + + # qtile + file_name=config.py + file_path=/home/${user}/.config/qtile + mkdir -p ${file_path} + deploy_file "${dots_trg}/qtile/${file_name}" "${file_path}/" + + fi + + # i3wm + if [ ${I3WM} == "true" ] ; then + + # i3 + file_name=config + file_path=/home/${user}/.config/i3 + mkdir -p ${file_path} + deploy_file "${dots_trg}/i3wm/${file_name}" "${file_path}/" + + fi + + if [ ${I3WM} == "true" ] || [ ${QTILE} == "true" ] ; then + + # xorg + file_path=/home/${user} + deploy_file "${dots_trg}/xorg/.*" "${file_path}/" + + fi + +fi + +# dots+ (wallpapers, fonts ++) +if [ ${operation} == "dots+" ] ; then + + # declarations + targz_dotsplus_url=https://gitlab.com/pqq/dotsplus/-/archive/main/dotsplus-main.tar.gz + dotsplus_trg=${clone_trg}/dotsplus-main + + echo "***** ${operation} *****" + rm -rf ${dotsplus_trg} + download_repo ${targz_dotsplus_url} + tree ${clone_trg} + + # ---------- + # fonts + # ---------- + file_path=/home/${user}/.local/share/fonts + mkdir -p ${file_path} + deploy_file "${dotsplus_trg}/fonts/install/*" "${file_path}/" + + # ---------- + # wallpapers + # ---------- + file_path=/home/${user}/.local/share/wp + mkdir -p ${file_path} + deploy_file "${dotsplus_trg}/wallpapers/install/*" "${file_path}/" + +fi diff --git a/scripts/99_deploy.sh b/scripts/99_deploy.sh index 01fc66c..8fd411f 100644 --- a/scripts/99_deploy.sh +++ b/scripts/99_deploy.sh @@ -91,7 +91,7 @@ deploy_file() { ls -al ${_trg_path} } -# locate profile folder +# locate firefox's profile directory firefox_profile_dir() { ffdir=/home/${user}/.mozilla/firefox/ @@ -172,47 +172,6 @@ if [ ${operation} == "dots" ] ; then deploy_file "${dots_trg}/firefox/${file_name}" "${file_path}/${file_name}" fi - # hyprland - if [ ${HYPRLAND} == "true" ] ; then - - # hypridle - file_name=hypridle.conf - file_path=/home/${user}/.config/hypr - deploy_file ${dots_trg}/hypridle/${file_name} ${file_path}/${file_name} - - # hyprland - file_name=hyprland.conf - file_path=/home/${user}/.config/hypr - deploy_file ${dots_trg}/hyprland/${file_name} ${file_path}/${file_name} - - # hyprlock - file_name=hyprlock.conf - file_path=/home/${user}/.config/hypr - deploy_file ${dots_trg}/hyprlock/${file_name} ${file_path}/${file_name} - - # hyprpaper - file_name=hyprpaper.conf - file_path=/home/${user}/.config/hypr - deploy_file ${dots_trg}/hyprpaper/${file_name} ${file_path}/${file_name} - - # waybar - file_path=/home/${user}/.config/waybar - mkdir -p ${file_path} - deploy_file "${dots_trg}/waybar/*" "${file_path}/" - - fi - - # qtile - if [ ${QTILE} == "true" ] ; then - - # qtile - file_name=config.py - file_path=/home/${user}/.config/qtile - mkdir -p ${file_path} - deploy_file "${dots_trg}/qtile/${file_name}" "${file_path}/" - - fi - # i3wm if [ ${I3WM} == "true" ] ; then