diff --git a/.bashrc b/.bashrc index 14b024a..ad371fa 100644 --- a/.bashrc +++ b/.bashrc @@ -36,6 +36,8 @@ alias dot="cd ~/dotfiles" # ----------------------------------------------------- alias Qtile='startx' +alias QtileWayland='qtile start -b wayland' +# Hyprland with Hyprland # ----------------------------------------------------- # GIT @@ -54,7 +56,6 @@ alias gcheck="git checkout" # SCRIPTS # ----------------------------------------------------- -alias wallp='~/dotfiles/scripts/updatewal.sh' alias gr='python ~/dotfiles/scripts/growthrate.py' alias ChatGPT='python ~/mychatgpt/mychatgpt.py' alias chat='python ~/mychatgpt/mychatgpt.py' @@ -111,7 +112,17 @@ eval "$(starship init bash)" cat ~/.cache/wal/sequences # ----------------------------------------------------- -# PFETCH +# PFETCH if on wm # ----------------------------------------------------- echo "" -pfetch +if [[ $(tty) == *"pts"* ]]; then + pfetch +else + if [ -f /bin/qtile ]; then + echo "Start Qtile X11 with command Qtile" + echo "Start Qtile Wayland with command QtileWayland" + fi + if [ -f /bin/hyprctl ]; then + echo "Start Hyprland with command Hyprland" + fi +fi diff --git a/.install/backup.sh b/.install/backup.sh new file mode 100755 index 0000000..55e4b0b --- /dev/null +++ b/.install/backup.sh @@ -0,0 +1,46 @@ +# ------------------------------------------------------ +# Backup existing dotfiles +# ------------------------------------------------------ + +datets=$(date '+%Y%m%d%H%M%S') +if [ -d ~/dotfiles ]; then + +cat <<"EOF" +____ _ +| __ ) __ _ ___| | ___ _ _ __ +| _ \ / _` |/ __| |/ / | | | '_ \ +| |_) | (_| | (__| <| |_| | |_) | +|____/ \__,_|\___|_|\_\\__,_| .__/ + |_| + +EOF + + echo "The script has detected an existing dotfiles folder and will try to create a backup into the folder ~/dotfiles-versions/backups/$datets" + echo "" + while true; do + read -p "Do you want to proceed? (Yy/Nn): " yn + case $yn in + [Yy]* ) + echo "-> Preparing dotfiles" + if [ ! -d ~/dotfiles-versions ]; then + mkdir ~/dotfiles-versions + fi + if [ ! -d ~/dotfiles-versions/backups ]; then + mkdir ~/dotfiles-versions/backups + fi + if [ -d ~/dotfiles ]; then + cp -r ~/dotfiles ~/dotfiles-versions/backups/$datets + echo "Backup of your current dotfiles in ~/dotfiles-versions/backups/$datets created." + fi + if [ -f ~/.bashrc ]; then + cp ~/.bashrc ~/dotfiles-versions/backups/$datets/.bashrc-old + echo "Existing .bashrc file found in homefolder. .bashrc-old created" + fi + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + echo "" +fi diff --git a/.install/bashrc.sh b/.install/bashrc.sh new file mode 100644 index 0000000..6732fac --- /dev/null +++ b/.install/bashrc.sh @@ -0,0 +1,19 @@ +# ------------------------------------------------------ +# Install .bashrc +# ------------------------------------------------------ + +echo "-> Install .bashrc" +echo "PLEASE BACKUP YOUR .bashrc file in case you want to keep your local configuration and aliases." +while true; do + read -p "Do you want to install the .bashrc file? (Yy/Nn): " yn + case $yn in + [Yy]* ) + _installSymLink .bashrc ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc + break;; + [Nn]* ) + echo "Installation skipped." + break;; + * ) echo "Please answer yes or no.";; + esac +done +echo "" diff --git a/.install/config-folder.sh b/.install/config-folder.sh new file mode 100644 index 0000000..51813fd --- /dev/null +++ b/.install/config-folder.sh @@ -0,0 +1,11 @@ +# ------------------------------------------------------ +# Create .config folder +# ------------------------------------------------------ + +if [ -d ~/.config ]; then + echo ".config folder already exists." +else + mkdir ~/.config + echo ".config folder created." +fi +echo "" diff --git a/.install/confirm-start.sh b/.install/confirm-start.sh new file mode 100644 index 0000000..6674fa4 --- /dev/null +++ b/.install/confirm-start.sh @@ -0,0 +1,34 @@ +# ------------------------------------------------------ +# Confirm Start +# ------------------------------------------------------ + +echo "IMPORTANT: Please make sure that your system and your packages are up to date." +echo "You can cancel the installation at any time with CMD + C" +echo "" + +SCRIPT=$(realpath "$0") +SCRIPTPATH=$(dirname "$SCRIPT") +if [ $SCRIPTPATH = "/home/$USER/dotfiles" ]; then + echo "IMPORTANT: You're running the installation script from the installation target directory." + echo "Please move the installation folder dotfiles e.g. to ~/Downloads/ and start the script again." + echo "Proceeding is not recommended!" + echo "" + if [ ! $mode == "dev" ]; then + exit + fi +fi + +while true; do + read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn + case $yn in + [Yy]* ) + echo "Installation started." + break;; + [Nn]* ) + echo "Installation canceled." + exit; + break;; + * ) echo "Please answer yes or no.";; + esac +done +echo "" diff --git a/.install/copy.sh b/.install/copy.sh new file mode 100644 index 0000000..20ff2c6 --- /dev/null +++ b/.install/copy.sh @@ -0,0 +1,40 @@ +# ------------------------------------------------------ +# Copy dotfiles +# ------------------------------------------------------ +cat <<"EOF" + ___ _ _ _ _ _ __ _ _ +|_ _|_ __ ___| |_ __ _| | | __| | ___ | |_ / _(_) | ___ ___ + | || '_ \/ __| __/ _` | | | / _` |/ _ \| __| |_| | |/ _ \/ __| + | || | | \__ \ || (_| | | | | (_| | (_) | |_| _| | | __/\__ \ +|___|_| |_|___/\__\__,_|_|_| \__,_|\___/ \__|_| |_|_|\___||___/ + + +EOF +echo "The script will now remove existing directories and files from ~/.config/" +echo "and copy your prepared configuration from ~/dotfiles-versions/$version to ~/dotfiles" +echo "Symbolic links will then be created from ~/dotfiles into your ~/.config/ directory." +echo "PLEASE BACKUP YOUR EXISTING CONFIGURATIONS IF NEEDED in .config" +echo "" + +while true; do + read -p "Do you want to install the dotfiles now? (Yy/Nn): " yn + case $yn in + [Yy]* ) + if [ ! $mode == "dev" ]; then + echo "Copy started" + if [ ! -d ~/dotfiles ]; then + mkdir ~/dotfiles + fi + cp -rf ~/dotfiles-versions/$version/. ~/dotfiles/ + else + echo "Skipped: DEV MODE!" + fi + break;; + [Nn]* ) + exit + break;; + * ) echo "Please answer yes or no.";; + esac +done +echo "" + diff --git a/.install/disabledm.sh b/.install/disabledm.sh new file mode 100644 index 0000000..31ed65b --- /dev/null +++ b/.install/disabledm.sh @@ -0,0 +1,54 @@ +# ------------------------------------------------------ +# Disable display manager +# ------------------------------------------------------ +disman=0 +if [ -f /etc/systemd/system/display-manager.service ]; then + +cat <<"EOF" + ___ _ _ +|_ _|_ __ ___ _ __ ___ _ __| |_ __ _ _ __ | |_ + | || '_ ` _ \| '_ \ / _ \| '__| __/ _` | '_ \| __| + | || | | | | | |_) | (_) | | | || (_| | | | | |_ +|___|_| |_| |_| .__/ \___/|_| \__\__,_|_| |_|\__| + |_| + +EOF + + echo "An active display manager has been dedected." + echo "" + if [ $profile == "Hyprland" ]; then + echo "IMPORTANT: Starting Hyprland from tty (terminal) with command Hyperland is recommended." + echo "Login with display managers could fail and could have negative side effects on some devices." + fi + if [ $profile == "Qtile" ]; then + echo "PLEASE NOTE: Qtile works with Display Managers." + echo "But if you want to use the tty based (terminal) login instead, you can disable the display manager now." + fi + if [ $profile == "All" ]; then + echo "IMPORTANT: Starting Hyprland from tty (terminal) with command Hyperland is recommended." + echo "Login with display managers could fail and could have negative side effects on some devices." + echo "PLEASE NOTE: Qtile works with Display Managers." + echo "But if you want to use the tty based (terminal) login instead, you can disable the display manager now." + fi + echo "" + while true; do + read -p "Do you want to deactive the current display manager (Yy/Nn): " yn + case $yn in + [Yy]* ) + if [ -f /etc/systemd/system/display-manager.service ]; then + sudo rm /etc/systemd/system/display-manager.service + echo "Current display manager removed." + fi + disman=1 + break;; + [Nn]* ) + echo "Disable display manager skipped." + echo "You can run ~/dotfiles/hypr/script/disablewm.sh at a later point of time if needed." + break;; + * ) echo "Please answer yes or no.";; + esac + done + echo "" +else + disman=1 +fi diff --git a/.install/done.sh b/.install/done.sh new file mode 100644 index 0000000..7184383 --- /dev/null +++ b/.install/done.sh @@ -0,0 +1,7 @@ +# ------------------------------------------------------ +# DONE +# ------------------------------------------------------ + +echo "DONE!" +echo "IMPORTANT: Please logout and reboot your system!" +echo "" diff --git a/.install/hyprland-dotfiles.sh b/.install/hyprland-dotfiles.sh new file mode 100644 index 0000000..b20e834 --- /dev/null +++ b/.install/hyprland-dotfiles.sh @@ -0,0 +1,23 @@ +# ------------------------------------------------------ +# Install dotfiles +# ------------------------------------------------------ + +if [ ! $mode == "dev" ]; then + _installSymLink alacritty ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config + _installSymLink vim ~/.config/vim ~/dotfiles/vim/ ~/.config + _installSymLink nvim ~/.config/nvim ~/dotfiles/nvim/ ~/.config + _installSymLink starship ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml + _installSymLink rofi ~/.config/rofi ~/dotfiles/rofi/ ~/.config + _installSymLink dunst ~/.config/dunst ~/dotfiles/dunst/ ~/.config + _installSymLink hypr ~/.config/hypr ~/dotfiles/hypr/ ~/.config + _installSymLink waybar ~/.config/waybar ~/dotfiles/waybar/ ~/.config + _installSymLink swaylock ~/.config/swaylock ~/dotfiles/swaylock/ ~/.config + _installSymLink wlogout ~/.config/wlogout ~/dotfiles/wlogout/ ~/.config + _installSymLink swappy ~/.config/swappy ~/dotfiles/swappy/ ~/.config + _installSymLink .gtkrc-2.0 ~/.gtkrc-2.0 ~/dotfiles/gtk/.gtkrc-2.0 ~/.gtkrc-2.0 + _installSymLink .Xresources ~/.Xresources ~/dotfiles/gtk/.Xresources ~/.Xresources + _installSymLink gtk-3.0 ~/.config/gtk-3.0 ~/dotfiles/gtk/gtk-3.0/ ~/.config/ + _installSymLink gtk-4.0 ~/.config/gtk-4.0 ~/dotfiles/gtk/gtk-4.0/ ~/.config/ +else + echo "Skipped: DEV MODE!" +fi \ No newline at end of file diff --git a/.install/hyprland-packages.sh b/.install/hyprland-packages.sh new file mode 100644 index 0000000..6bba45b --- /dev/null +++ b/.install/hyprland-packages.sh @@ -0,0 +1,55 @@ +packagesPacman=( + "pacman-contrib" + "wget" + "unzip" + "alacritty" + "rofi" + "chromium" + "dunst" + "starship" + "neovim" + "mpv" + "freerdp" + "xfce4-power-manager" + "thunar" + "mousepad" + "ttf-font-awesome" + "ttf-fira-sans" + "ttf-fira-code" + "ttf-firacode-nerd" + "figlet" + "vlc" + "exa" + "python-pip" + "python-psutil" + "python-rich" + "python-click" + "pavucontrol" + "tumbler" + "xautolock" + "blueman" + "papirus-icon-theme" + "polkit-gnome" + "hyprland" + "xdg-desktop-portal" + "xdg-desktop-portal-wlr" + "waybar" + "grim" + "slurp" + "swayidle" + "swappy" + "cliphist" + "qalculate-gtk" + "brightnessctl" +); + +packagesYay=( + "brave-bin" + "pfetch" + "bibata-cursor-theme" + "trizen" + "swww" + "swaylock-effects" + "wlogout" + "wlr-randr" +); \ No newline at end of file diff --git a/.install/hyprland.sh b/.install/hyprland.sh new file mode 100644 index 0000000..5a3ae73 --- /dev/null +++ b/.install/hyprland.sh @@ -0,0 +1,9 @@ +cat <<"EOF" + _ _ _ _ +| | | |_ _ _ __ _ __| | __ _ _ __ __| | +| |_| | | | | '_ \| '__| |/ _` | '_ \ / _` | +| _ | |_| | |_) | | | | (_| | | | | (_| | +|_| |_|\__, | .__/|_| |_|\__,_|_| |_|\__,_| + |___/|_| + +EOF diff --git a/.install/init-pywal.sh b/.install/init-pywal.sh new file mode 100644 index 0000000..6539eba --- /dev/null +++ b/.install/init-pywal.sh @@ -0,0 +1,8 @@ +# ------------------------------------------------------ +# init pywal with default wallpaper +# ------------------------------------------------------ + +_installSymLink wal ~/.config/wal ~/dotfiles/wal/ ~/.config +wal -i ~/dotfiles/wallpapers/default.jpg +echo "Pywal and templates initiated!" +echo "" diff --git a/.install/install-packages.sh b/.install/install-packages.sh new file mode 100644 index 0000000..0c4a55e --- /dev/null +++ b/.install/install-packages.sh @@ -0,0 +1,17 @@ +# ------------------------------------------------------ +# Install required packages +# ------------------------------------------------------ + +cat <<"EOF" + ___ _ _ _ _ +|_ _|_ __ ___| |_ __ _| | | _ __ __ _ ___| | ____ _ __ _ ___ ___ + | || '_ \/ __| __/ _` | | | | '_ \ / _` |/ __| |/ / _` |/ _` |/ _ \/ __| + | || | | \__ \ || (_| | | | | |_) | (_| | (__| < (_| | (_| | __/\__ \ +|___|_| |_|___/\__\__,_|_|_| | .__/ \__,_|\___|_|\_\__,_|\__, |\___||___/ + |_| |___/ + +EOF + +_installPackagesPacman "${packagesPacman[@]}"; +_installPackagesYay "${packagesYay[@]}"; +echo "" \ No newline at end of file diff --git a/.install/issue.sh b/.install/issue.sh new file mode 100644 index 0000000..65f7d70 --- /dev/null +++ b/.install/issue.sh @@ -0,0 +1,28 @@ +# ------------------------------------------------------ +# Install tty login and issue +# ------------------------------------------------------ + +if [ $disman == 1 ]; then +cat <<"EOF" + _____ _______ __ _ _ +|_ _|_ _\ \ / / | | ___ __ _(_)_ __ + | | | | \ V / | |/ _ \ / _` | | '_ \ + | | | | | | | | (_) | (_| | | | | | + |_| |_| |_| |_|\___/ \__, |_|_| |_| + |___/ + +EOF + while true; do + read -p "Do you want to install the custom tty login issue (Yy/Nn): " yn + case $yn in + [Yy]* ) + sudo cp login/issue /etc/issue + break;; + [Nn]* ) + echo "Setup tty login skipped." + break;; + * ) echo "Please answer yes or no.";; + esac + done + echo "" +fi \ No newline at end of file diff --git a/scripts/library.sh b/.install/library.sh similarity index 60% rename from scripts/library.sh rename to .install/library.sh index 38a2e28..7b3916d 100755 --- a/scripts/library.sh +++ b/.install/library.sh @@ -54,7 +54,7 @@ _installPackagesPacman() { return; fi; - printf "Packages not installed:\n%s\n" "${toInstall[@]}"; + printf "Package not installed:\n%s\n" "${toInstall[@]}"; sudo pacman --noconfirm -S "${toInstall[@]}"; } @@ -75,7 +75,7 @@ _installPackagesYay() { return; fi; - printf "AUR ackages not installed:\n%s\n" "${toInstall[@]}"; + printf "AUR packags not installed:\n%s\n" "${toInstall[@]}"; yay --noconfirm -S "${toInstall[@]}"; } @@ -89,40 +89,24 @@ _installSymLink() { linksource="$3"; linktarget="$4"; - while true; do - read -p "DO YOU WANT TO INSTALL ${name}? (Existing dotfiles will be removed!) (Yy/Nn): " yn - case $yn in - [Yy]* ) - if [ -L "${symlink}" ]; then - rm ${symlink} - ln -s ${linksource} ${linktarget} - echo "Symlink ${linksource} -> ${linktarget} created." - echo "" - else - if [ -d ${symlink} ]; then - rm -rf ${symlink}/ - ln -s ${linksource} ${linktarget} - echo "Symlink for directory ${linksource} -> ${linktarget} created." - echo "" - else - if [ -f ${symlink} ]; then - rm ${symlink} - ln -s ${linksource} ${linktarget} - echo "Symlink to file ${linksource} -> ${linktarget} created." - echo "" - else - ln -s ${linksource} ${linktarget} - echo "New symlink ${linksource} -> ${linktarget} created." - echo "" - fi - fi - fi - break;; - [Nn]* ) - echo "" - # exit; - break;; - * ) echo "Please answer yes or no.";; - esac - done + if [ -L "${symlink}" ]; then + rm ${symlink} + ln -s ${linksource} ${linktarget} + echo "Symlink ${linksource} -> ${linktarget} created." + else + if [ -d ${symlink} ]; then + rm -rf ${symlink}/ + ln -s ${linksource} ${linktarget} + echo "Symlink for directory ${linksource} -> ${linktarget} created." + else + if [ -f ${symlink} ]; then + rm ${symlink} + ln -s ${linksource} ${linktarget} + echo "Symlink to file ${linksource} -> ${linktarget} created." + else + ln -s ${linksource} ${linktarget} + echo "New symlink ${linksource} -> ${linktarget} created." + fi + fi + fi } diff --git a/.install/preparation.sh b/.install/preparation.sh new file mode 100644 index 0000000..742ce94 --- /dev/null +++ b/.install/preparation.sh @@ -0,0 +1,68 @@ +# ------------------------------------------------------ +# Prepare dotfiles +# ------------------------------------------------------ + +cat <<"EOF" + ____ _ _ +| _ \ _ __ ___ _ __ __ _ _ __ __ _| |_(_) ___ _ __ +| |_) | '__/ _ \ '_ \ / _` | '__/ _` | __| |/ _ \| '_ \ +| __/| | | __/ |_) | (_| | | | (_| | |_| | (_) | | | | +|_| |_| \___| .__/ \__,_|_| \__,_|\__|_|\___/|_| |_| + |_| + +EOF + +echo "Preparing temporary folders for the installation." +echo "" +if [ ! -d ~/dotfiles-versions ]; then + mkdir ~/dotfiles-versions + echo "~/dotfiles-versions folder created." +fi +if [ ! -d ~/dotfiles-versions/$version ]; then + mkdir ~/dotfiles-versions/$version + echo "~/dotfiles-versions/$version folder created." +else + echo "The folder ~/dotfiles-versions/$version already exists." + echo "Do you want to create a clean build of version $version and " + while true; do + read -p "and replace all files? (Yy/Nn): " yn + case $yn in + [Yy]* ) + rm -fr ~/dotfiles-versions/$version + mkdir ~/dotfiles-versions/$version + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + echo "" +fi +cp -rf . ~/dotfiles-versions/$version/ + +if [ -d ~/dotfiles-versions/$version/.git ]; then + rm -rf ~/dotfiles-versions/$version/.git +fi + +if [ -f ~/dotfiles-versions/$version/.gitignore ]; then + rm ~/dotfiles-versions/$version/.gitignore +fi + +if [ -f ~/dotfiles-versions/$version/CHANGELOG ]; then + rm ~/dotfiles-versions/$version/CHANGELOG +fi + +if [ -f ~/dotfiles-versions/$version/README.md ]; then + rm ~/dotfiles-versions/$version/README.md +fi + +if [ -f ~/dotfiles-versions/$version/install.sh ]; then + rm ~/dotfiles-versions/$version/install.sh +fi + +if [ -d ~/dotfiles-versions/$version/.install ]; then + rm -rf ~/dotfiles-versions/$version/.install +fi + +echo "dotfiles $version successfully prepared in ~/dotfiles-versions/$version/" +echo "" diff --git a/.install/profile.sh b/.install/profile.sh new file mode 100644 index 0000000..edf0961 --- /dev/null +++ b/.install/profile.sh @@ -0,0 +1,42 @@ +# ------------------------------------------------------ +# Select installation profile +# ------------------------------------------------------ +cat <<"EOF" + ____ _ _ ____ __ _ _ +| _ \ ___ ___| | _| |_ ___ _ __ | _ \ _ __ ___ / _(_) | ___ +| | | |/ _ \/ __| |/ / __/ _ \| '_ \ | |_) | '__/ _ \| |_| | |/ _ \ +| |_| | __/\__ \ <| || (_) | |_) | | __/| | | (_) | _| | | __/ +|____/ \___||___/_|\_\\__\___/| .__/ |_| |_| \___/|_| |_|_|\___| + |_| + +EOF + +echo "Please select the Desktop Profile for your installation:" +echo "1 - Hyprland" +echo "2 - Qtile" +echo "3 - All" +echo "Nn - Cancel" +echo "" +while true; do + read -p "PLEASE SELECT: " yn + case $yn in + [1]* ) + profile="Hyprland" + break;; + [2]* ) + profile="Qtile" + break;; + [3]* ) + profile="All" + break;; + [Nn]* ) + echo "Installation canceled." + exit; + break;; + * ) echo "Please answer yes or no.";; + esac +done +echo "" +echo "Installing profile $profile ..." +sleep 2 +echo "" \ No newline at end of file diff --git a/.install/pywal.sh b/.install/pywal.sh new file mode 100644 index 0000000..275205e --- /dev/null +++ b/.install/pywal.sh @@ -0,0 +1,21 @@ +# ------------------------------------------------------ +# Install pywal +# ------------------------------------------------------ + +cat <<"EOF" + ___ _ _ _ _ +|_ _|_ __ ___| |_ __ _| | | _ __ _ ___ ____ _| | + | || '_ \/ __| __/ _` | | | | '_ \| | | \ \ /\ / / _` | | + | || | | \__ \ || (_| | | | | |_) | |_| |\ V V / (_| | | +|___|_| |_|___/\__\__,_|_|_| | .__/ \__, | \_/\_/ \__,_|_| + |_| |___/ + +EOF + +if [ -f /usr/bin/wal ]; then + echo "pywal already installed." +else + yay --noconfirm -S pywal + echo "Pywal installed." +fi +echo "" \ No newline at end of file diff --git a/.install/qtile-dotfiles.sh b/.install/qtile-dotfiles.sh new file mode 100644 index 0000000..3c118a3 --- /dev/null +++ b/.install/qtile-dotfiles.sh @@ -0,0 +1,23 @@ +# ------------------------------------------------------ +# Install dotfiles +# ------------------------------------------------------ + +if [ ! $mode == "dev" ]; then + _installSymLink alacritty ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config + _installSymLink vim ~/.config/vim ~/dotfiles/vim/ ~/.config + _installSymLink nvim ~/.config/nvim ~/dotfiles/nvim/ ~/.config + _installSymLink starship ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml + _installSymLink rofi ~/.config/rofi ~/dotfiles/rofi/ ~/.config + _installSymLink dunst ~/.config/dunst ~/dotfiles/dunst/ ~/.config + _installSymLink qtile ~/.config/qtile ~/dotfiles/qtile/ ~/.config + _installSymLink polybar ~/.config/polybar ~/dotfiles/polybar/ ~/.config + _installSymLink picom ~/.config/picom ~/dotfiles/picom/ ~/.config + _installSymLink .xinitrc ~/.xinitrc ~/dotfiles/qtile/.xinitrc ~/.xinitrc + _installSymLink swaylock ~/.config/swaylock ~/dotfiles/swaylock/ ~/.config + _installSymLink swappy ~/.config/swappy ~/dotfiles/swappy/ ~/.config + _installSymLink .gtkrc-2.0 ~/.gtkrc-2.0 ~/dotfiles/gtk/.gtkrc-2.0 ~/.gtkrc-2.0 + _installSymLink .Xresources ~/.Xresources ~/dotfiles/gtk/.Xresources ~/.Xresources + _installSymLink gtk-3.0 ~/.config/gtk-3.0 ~/dotfiles/gtk/gtk-3.0/ ~/.config/ +else + echo "Skipped: DEV MODE!" +fi \ No newline at end of file diff --git a/.install/qtile-packages.sh b/.install/qtile-packages.sh new file mode 100644 index 0000000..db09d4c --- /dev/null +++ b/.install/qtile-packages.sh @@ -0,0 +1,57 @@ +packagesPacman=( + "pacman-contrib" + "wget" + "unzip" + "alacritty" + "rofi" + "chromium" + "nitrogen" + "dunst" + "starship" + "neovim" + "mpv" + "freerdp" + "xfce4-power-manager" + "thunar" + "mousepad" + "ttf-font-awesome" + "ttf-fira-sans" + "ttf-fira-code" + "ttf-firacode-nerd" + "figlet" + "vlc" + "exa" + "python-pip" + "python-psutil" + "python-rich" + "python-click" + "xdg-desktop-portal" + "xdg-desktop-portal-gtk" + "pavucontrol" + "tumbler" + "xautolock" + "blueman" + "papirus-icon-theme" + "polkit-gnome" + "qtile" + "polybar" + "picom" + "scrot" + "slock" + "grim" + "slurp" + "swappy" + "cliphist" + "qalculate-gtk" + "brightnessctl" +); + +packagesYay=( + "brave-bin" + "pfetch" + "bibata-cursor-theme" + "trizen" + "swww" + "qtile-extras" + "wlr-randr" +); \ No newline at end of file diff --git a/.install/qtile.sh b/.install/qtile.sh new file mode 100644 index 0000000..05eabd4 --- /dev/null +++ b/.install/qtile.sh @@ -0,0 +1,8 @@ +cat <<"EOF" + ___ _ _ _ + / _ \| |_(_) | ___ +| | | | __| | |/ _ \ +| |_| | |_| | | __/ + \__\_\\__|_|_|\___| + +EOF diff --git a/.install/restore.sh b/.install/restore.sh new file mode 100644 index 0000000..3cc0554 --- /dev/null +++ b/.install/restore.sh @@ -0,0 +1,112 @@ +# ------------------------------------------------------ +# Restore +# ------------------------------------------------------ + +if [ -d ~/dotfiles ]; then +cat <<"EOF" + ____ _ +| _ \ ___ ___| |_ ___ _ __ ___ +| |_) / _ \/ __| __/ _ \| '__/ _ \ +| _ < __/\__ \ || (_) | | | __/ +|_| \_\___||___/\__\___/|_| \___| + +EOF + + echo "The script will try to restore existing configurations." + echo "PLEASE NOTE: Restoring is not possible with version < 2.5 of the dotfiles." + echo "Keyboard layout can be defined manually in the next step." + echo "" + restored=0 + + if [ -f ~/dotfiles/.bashrc ]; then + while true; do + read -p "Found existing ~/dotfiles/.bashrc Restore? (Yy/Nn): " yn + case $yn in + [Yy]* ) + cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/ + echo "Restored!" + restored=1 + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + + if [ $profile == "Hyprland" ] || [ $profile == "All" ]; then + if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then + while true; do + read -p "Found existing ~/dotfiles/hypr/conf/keyboard.conf Restore? (Yy/Nn): " yn + case $yn in + [Yy]* ) + cp ~/dotfiles/hypr/conf/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Restored!" + restored=1 + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + + if [ $profile = "Hyprland" ] || [ $profile == "All" ]; then + if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then + while true; do + read -p "Found existing ~/dotfiles/hypr/conf/monitor.conf Restore? (Yy/Nn): " yn + case $yn in + [Yy]* ) + cp ~/dotfiles/hypr/conf/monitor.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Restored!" + restored=1 + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + + if [ $profile == "Hyprland" ] || [ $profile == "All" ]; then + if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then + while true; do + read -p "Found existing ~/dotfiles/hypr/conf/keybindings.conf Restore? (Yy/Nn): " yn + case $yn in + [Yy]* ) + cp ~/dotfiles/hypr/conf/keybindings.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Restored!" + restored=1 + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + + if [ $profile == "Qtile" ] || [ $profile == "All" ]; then + if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then + while true; do + read -p "Found existing ~/dotfiles/qtile/conf/keyboard.py Restore? (Yy/Nn): " yn + case $yn in + [Yy]* ) + cp ~/dotfiles/qtile/conf/keyboard.py ~/dotfiles-versions/$version/qtile/conf/ + echo "Restored!" + restored=1 + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + if [ $restored == 0 ]; then + echo "Restore not possible." + fi + echo "" +fi \ No newline at end of file diff --git a/.install/setup.sh b/.install/setup.sh new file mode 100644 index 0000000..ad31e45 --- /dev/null +++ b/.install/setup.sh @@ -0,0 +1,35 @@ +# ------------------------------------------------------ +# Setup +# ------------------------------------------------------ + +cat <<"EOF" + ____ _ +/ ___| ___| |_ _ _ _ __ +\___ \ / _ \ __| | | | '_ \ + ___) | __/ |_| |_| | |_) | +|____/ \___|\__|\__,_| .__/ + |_| + +EOF +echo "If you could restore your keyboard layout in the step before you can select Nn and skip." +while true; do + read -p "Do you want to start the setup (Yy/Nn): " yn + case $yn in + [Yy]* ) + read -p "Enter your preferred keyboard layout (us,de,...) (default:us): " keyboard + if [ -z "$keyboard" ]; then + keyboard="us" + fi + SEARCH="kb_layout = de" + REPLACE="kb_layout = $keyboard" + sed -i "s/$SEARCH/$REPLACE/g" ~/dotfiles-versions/$version/hypr/conf/keyboard.conf + + SEARCH="keyboard_layout = \"de\"" + REPLACE="keyboard_layout = \"$keyboard\"" + sed -i "s/$SEARCH/$REPLACE/g" ~/dotfiles-versions/$version/qtile/conf/keyboard.py + break;; + [Nn]* ) + break;; + * ) echo "Please answer yes or no.";; + esac +done diff --git a/.install/wallpaper.sh b/.install/wallpaper.sh new file mode 100644 index 0000000..1fe1247 --- /dev/null +++ b/.install/wallpaper.sh @@ -0,0 +1,46 @@ +# ------------------------------------------------------ +# Install wallpapers +# ------------------------------------------------------ + +cat <<"EOF" +__ __ _ _ +\ \ / /_ _| | |_ __ __ _ _ __ ___ _ __ ___ + \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__/ __| + \ V V / (_| | | | |_) | (_| | |_) | __/ | \__ \ + \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| |___/ + |_| |_| + +EOF + +echo "Do you want to download the wallpapers from repository https://gitlab.com/stephan-raabe/wallpaper/ ?" +while true; do + read -p "If not, the script will install 3 default wallpapers to ~/wallpaper/ (Yy/Nn): " yn + case $yn in + [Yy]* ) + wget -P ~/Downloads/ https://gitlab.com/stephan-raabe/wallpaper/-/archive/main/wallpaper-main.zip + unzip -o ~/Downloads/wallpaper-main.zip -d ~/Downloads/ + if [ ! -d ~/wallpaper/ ]; then + mkdir ~/wallpaper + fi + cp ~/Downloads/wallpaper-main/* ~/wallpaper/ + echo "Wallpapers installed successfully." + break;; + [Nn]* ) + if [ -d ~/wallpaper/ ]; then + echo "wallpaper folder already exists." + else + mkdir ~/wallpaper + fi + cp wallpapers/* ~/wallpaper + echo "Default wallpapers installed." + break;; + * ) echo "Please answer yes or no.";; + esac +done +echo "" + +# ------------------------------------------------------ +# Copy default wallpaper to .cache +# ------------------------------------------------------ +cp wallpapers/default.jpg ~/.cache/current_wallpaper.jpg +echo "" diff --git a/.install/yay.sh b/.install/yay.sh new file mode 100644 index 0000000..e8a2126 --- /dev/null +++ b/.install/yay.sh @@ -0,0 +1,19 @@ +# ------------------------------------------------------ +# Check if yay is installed +# ------------------------------------------------------ + +if sudo pacman -Qs yay > /dev/null ; then + echo "yay is already installed!" +else + echo "yay is not installed. Will be installed now!" + _installPackagesPacman "base-devel" + SCRIPT=$(realpath "$0") + temp_path=$(dirname "$SCRIPT") + echo $temp_path + git clone https://aur.archlinux.org/yay-git.git ~/yay-git + cd ~/yay-git + makepkg -si + cd $temp_path + echo "yay has been installed successfully." +fi +echo "" \ No newline at end of file diff --git a/1-install.sh b/1-install.sh deleted file mode 100755 index 23526c3..0000000 --- a/1-install.sh +++ /dev/null @@ -1,213 +0,0 @@ -#/bin/bash -# ___ _ _ _ -# |_ _|_ __ ___| |_ __ _| | | -# | || '_ \/ __| __/ _` | | | -# | || | | \__ \ || (_| | | | -# |___|_| |_|___/\__\__,_|_|_| -# -# by Stephan Raabe (2023) -# ----------------------------------------------------- -# Install Script for required packages -# ------------------------------------------------------ - -# ------------------------------------------------------ -# Load Library -# ------------------------------------------------------ -source $(dirname "$0")/scripts/library.sh -clear -echo " ___ _ _ _ " -echo " |_ _|_ __ ___| |_ __ _| | | " -echo " | || _ \/ __| __/ _ | | | " -echo " | || | | \__ \ || (_| | | | " -echo " |___|_| |_|___/\__\__,_|_|_| " -echo " " -echo "by Stephan Raabe (2023)" -echo "-------------------------------------" -echo "" - -# ------------------------------------------------------ -# Check if yay is installed -# ------------------------------------------------------ -if sudo pacman -Qs yay > /dev/null ; then - echo "yay is installed. You can proceed with the installation" -else - echo "yay is not installed. Will be installed now!" - _installPackagesPacman "base-devel" - git clone https://aur.archlinux.org/yay-git.git ~/yay-git - cd ~/yay-git - makepkg -si - cd ~/dotfiles/ - clear - echo "yay has been installed successfully." - echo "" - echo " ___ _ _ _ " - echo " |_ _|_ __ ___| |_ __ _| | | " - echo " | || _ \/ __| __/ _ | | | " - echo " | || | | \__ \ || (_| | | | " - echo " |___|_| |_|___/\__\__,_|_|_| " - echo " " - echo "by Stephan Raabe (2023)" - echo "-------------------------------------" - echo "" -fi - -# ------------------------------------------------------ -# Confirm Start -# ------------------------------------------------------ - -while true; do - read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn - case $yn in - [Yy]* ) - echo "Installation started." - break;; - [Nn]* ) - exit; - break;; - * ) echo "Please answer yes or no.";; - esac -done - -# ------------------------------------------------------ -# Install required packages -# ------------------------------------------------------ -echo "" -echo "-> Install main packages" - -packagesPacman=( - "pacman-contrib" - "alacritty" - "rofi" - "chromium" - "nitrogen" - "dunst" - "starship" - "neovim" - "mpv" - "freerdp" - "xfce4-power-manager" - "thunar" - "mousepad" - "ttf-font-awesome" - "ttf-fira-sans" - "ttf-fira-code" - "ttf-firacode-nerd" - "figlet" - "vlc" - "exa" - "python-pip" - "python-psutil" - "python-rich" - "python-click" - "xdg-desktop-portal-gtk" - "pavucontrol" - "tumbler" - "xautolock" - "blueman" - "sddm" - "papirus-icon-theme" -); - -packagesYay=( - "brave-bin" - "pfetch" - "bibata-cursor-theme" - "trizen" - "sddm-sugar-dark" -); - -# ------------------------------------------------------ -# Install required packages -# ------------------------------------------------------ -_installPackagesPacman "${packagesPacman[@]}"; -_installPackagesYay "${packagesYay[@]}"; - -# ------------------------------------------------------ -# Install pywal -# ------------------------------------------------------ -if [ -f /usr/bin/wal ]; then - echo "pywal already installed." -else - yay --noconfirm -S pywal -fi - -clear - -# ------------------------------------------------------ -# Install .bashrc -# ------------------------------------------------------ -echo "" -echo "-> Install .bashrc" - -_installSymLink .bashrc ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc - -# ------------------------------------------------------ -# Install sddm display manager -# ------------------------------------------------------ -echo "" -echo "-> Install sddm display manager" -while true; do - read -p "Do you want to install the custom login promt? (Yy/Nn): " yn - case $yn in - [Yy]* ) - sudo systemctl enable sddm.service - break;; - [Nn]* ) - echo "sddm installation skipped." - break;; - * ) echo "Please answer yes or no.";; - esac -done - -# ------------------------------------------------------ -# Install wallpapers -# ------------------------------------------------------ -echo "" -echo "-> Install wallapers" -while true; do - read -p "Do you want to clone the wallpapers? If not, the script will install 3 default wallpapers to ~/wallpaper/ (Yy/Nn): " yn - case $yn in - [Yy]* ) - if [ -d ~/wallpaper/ ]; then - echo "wallpaper folder already exists." - else - git clone https://gitlab.com/stephan-raabe/wallpaper.git ~/wallpaper - echo "wallpaper installed." - fi - echo "Wallpaper installed." - break;; - [Nn]* ) - if [ -d ~/wallpaper/ ]; then - echo "wallpaper folder already exists." - else - mkdir ~/wallpaper - fi - cp ~/dotfiles/wallpapers/* ~/wallpaper - echo "Default wallpapers installed." - break;; - * ) echo "Please answer yes or no.";; - esac -done - -# ------------------------------------------------------ -# Init pywal -# ------------------------------------------------------ -echo "" -echo "-> Init pywal" -wal -i ~/dotfiles/wallpapers/default.jpg -echo "pywal initiated." - -# ------------------------------------------------------ -# Copy default wallpaper to .cache -# ------------------------------------------------------ -echo "" -echo "-> Copy default wallpaper to .cache" -cp ~/dotfiles/wallpapers/default.jpg ~/.cache/current_wallpaper.jpg -echo "default wallpaper copied." - -# ------------------------------------------------------ -# DONE -# ------------------------------------------------------ -clear -echo "DONE!" -echo "NEXT: Please continue with 2-install-hyprland.sh and/or 2-install-qtile.sh" diff --git a/2-install-hyprland.sh b/2-install-hyprland.sh deleted file mode 100755 index 49fa2ca..0000000 --- a/2-install-hyprland.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# _ _ _ _ -# | | | |_ _ _ __ _ __| | __ _ _ __ __| | -# | |_| | | | | '_ \| '__| |/ _` | '_ \ / _` | -# | _ | |_| | |_) | | | | (_| | | | | (_| | -# |_| |_|\__, | .__/|_| |_|\__,_|_| |_|\__,_| -# |___/|_| -# -# by Stephan Raabe (2023) -# ----------------------------------------------------- -# Install Script for Hyprland -# ------------------------------------------------------ - -# ------------------------------------------------------ -# Confirm Start -# ------------------------------------------------------ -source $(dirname "$0")/scripts/library.sh -clear -echo " _ _ _ _ " -echo " | | | |_ _ _ __ _ __| | __ _ _ __ __| | " -echo " | |_| | | | | ,_ \| ,__| |/ _\ | ,_ \ / _, | " -echo " | _ | |_| | |_) | | | | (_| | | | | (_| | " -echo " |_| |_|\__, | .__/|_| |_|\__,_|_| |_|\__,_| " -echo " |___/|_| " -echo " " -echo "by Stephan Raabe (2023)" -echo "------------------------------------------------------" -echo "" - -while true; do - read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn - case $yn in - [Yy]* ) - echo "Installation started." - break;; - [Nn]* ) - exit; - break;; - * ) echo "Please answer yes or no.";; - esac -done -echo "" - -# ------------------------------------------------------ -# Install required packages -# ------------------------------------------------------ -echo "" -echo "-> Install main packages" -packagesPacman=( - "hyprland" - "xdg-desktop-portal-wlr" - "waybar" - "grim" - "slurp" - "swayidle" - "swappy" - "cliphist" -); - -packagesYay=( - "swww" - "swaylock-effects" - "wlogout" -); - -# ------------------------------------------------------ -# Install required packages -# ------------------------------------------------------ -_installPackagesPacman "${packagesPacman[@]}"; -_installPackagesYay "${packagesYay[@]}"; - -echo "" -echo "DONE!" -echo "NEXT: Update the keyboard layout and screen resolution in ~/dotfiles/hypr/hyprland.conf" -echo "Then proceed with with 3-dotfiles.sh" - diff --git a/2-install-qtile.sh b/2-install-qtile.sh deleted file mode 100755 index 7b51688..0000000 --- a/2-install-qtile.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# ___ _____ ___ _ _____ -# / _ \_ _|_ _| | | ____| -# | | | || | | || | | _| -# | |_| || | | || |___| |___ -# \__\_\|_| |___|_____|_____| -# -# by Stephan Raabe (2023) -# ------------------------------------------------------ -# Install Script for Qtile -# ------------------------------------------------------ - -# ------------------------------------------------------ -# Confirm Start -# ------------------------------------------------------ -source $(dirname "$0")/scripts/library.sh -clear -echo " ___ _____ ___ _ _____ " -echo " / _ \_ _|_ _| | | ____| " -echo "| | | || | | || | | _| " -echo "| |_| || | | || |___| |___ " -echo " \__\_\|_| |___|_____|_____| " -echo " " -echo "by Stephan Raabe (2023)" -echo "------------------------------------------------------" -echo "" - -while true; do - read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn - case $yn in - [Yy]* ) - echo "Installation started." - break;; - [Nn]* ) - exit; - break;; - * ) echo "Please answer yes or no.";; - esac -done -echo "" - -# ------------------------------------------------------ -# Install required packages -# ------------------------------------------------------ -echo "" -echo "-> Install main packages" - -packagesPacman=( - "qtile" - "polybar" - "picom" - "scrot" - "slock" -); - -# ------------------------------------------------------ -# Install required packages -# ------------------------------------------------------ -_installPackagesPacman "${packagesPacman[@]}"; - -echo "" -echo "DONE!" -echo "NEXT: Update the keyboard layout and screen resolution in ~/dotfiles/qtile/autostart.sh" -echo "Then proceed with 3-dotfiles.sh" diff --git a/3-dotfiles.sh b/3-dotfiles.sh deleted file mode 100755 index 9358b96..0000000 --- a/3-dotfiles.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash -# _ _ __ _ _ -# __| | ___ | |_ / _(_) | ___ ___ -# / _` |/ _ \| __| |_| | |/ _ \/ __| -# | (_| | (_) | |_| _| | | __/\__ \ -# \__,_|\___/ \__|_| |_|_|\___||___/ -# -# by Stephan Raabe (2023) -# ------------------------------------------------------ -# Install Script for dotfiles and configuration -# yay must be installed -# ------------------------------------------------------ - -# ------------------------------------------------------ -# Load Library -# ------------------------------------------------------ -source $(dirname "$0")/scripts/library.sh -clear -echo " _ _ __ _ _ " -echo " __| | ___ | |_ / _(_) | ___ ___ " -echo " / _' |/ _ \| __| |_| | |/ _ \/ __| " -echo "| (_| | (_) | |_| _| | | __/\__ \ " -echo " \__,_|\___/ \__|_| |_|_|\___||___/ " -echo " " -echo "by Stephan Raabe (2023)" -echo "-------------------------------------" -echo "" -echo "The script will ask for permission to remove existing directories and files from ~/.config/" -echo "Symbolic links will then be created from ~/dotfiles into your ~/.config/ directory." -echo "But you can decide to keep your personal versions by answering with No (Nn)." -echo "" - -# ------------------------------------------------------ -# Confirm Start -# ------------------------------------------------------ -while true; do - read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn - case $yn in - [Yy]* ) - echo "Installation started." - break;; - [Nn]* ) - exit; - break;; - * ) echo "Please answer yes or no.";; - esac -done - -# ------------------------------------------------------ -# Create .config folder -# ------------------------------------------------------ -echo "" -echo "-> Check if .config folder exists" - -if [ -d ~/.config ]; then - echo ".config folder already exists." -else - mkdir ~/.config - echo ".config folder created." -fi - -# ------------------------------------------------------ -# Create symbolic links -# ------------------------------------------------------ -# name symlink source target - -echo "" -echo "-------------------------------------" -echo "-> Install general dotfiles" -echo "-------------------------------------" -echo "" - -_installSymLink alacritty ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config -_installSymLink ranger ~/.config/ranger ~/dotfiles/ranger/ ~/.config -_installSymLink vim ~/.config/vim ~/dotfiles/vim/ ~/.config -_installSymLink nvim ~/.config/nvim ~/dotfiles/nvim/ ~/.config -_installSymLink starship ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml -_installSymLink rofi ~/.config/rofi ~/dotfiles/rofi/ ~/.config -_installSymLink dunst ~/.config/dunst ~/dotfiles/dunst/ ~/.config -_installSymLink wal ~/.config/wal ~/dotfiles/wal/ ~/.config - -wal -i wallpapers/ -echo "Pywal templates initiated!" -echo "" - -echo "-------------------------------------" -echo "-> Install GTK dotfiles" -echo "-------------------------------------" -echo "" - -_installSymLink .gtkrc-2.0 ~/.gtkrc-2.0 ~/dotfiles/gtk/.gtkrc-2.0 ~/.gtkrc-2.0 -_installSymLink gtk-3.0 ~/.config/gtk-3.0 ~/dotfiles/gtk/gtk-3.0/ ~/.config/ -_installSymLink gtk-4.0 ~/.config/gtk-4.0 ~/dotfiles/gtk/gtk-4.0/ ~/.config/ - -echo "-------------------------------------" -echo "-> Install Qtile dotfiles" -echo "-------------------------------------" -echo "" - -_installSymLink qtile ~/.config/qtile ~/dotfiles/qtile/ ~/.config -_installSymLink polybar ~/.config/polybar ~/dotfiles/polybar/ ~/.config -_installSymLink picom ~/.config/picom ~/dotfiles/picom/ ~/.config -_installSymLink .xinitrc ~/.xinitrc ~/dotfiles/qtile/.xinitrc ~/.xinitrc - -echo "-------------------------------------" -echo "-> Install Hyprland dotfiles" -echo "-------------------------------------" -echo "" - -_installSymLink hypr ~/.config/hypr ~/dotfiles/hypr/ ~/.config -_installSymLink waybar ~/.config/waybar ~/dotfiles/waybar/ ~/.config -_installSymLink swaylock ~/.config/swaylock ~/dotfiles/swaylock/ ~/.config -_installSymLink wlogout ~/.config/wlogout ~/dotfiles/wlogout/ ~/.config -_installSymLink swappy ~/.config/swappy ~/dotfiles/swappy/ ~/.config - -# ------------------------------------------------------ -# DONE -# ------------------------------------------------------ -echo "DONE!" -echo "NEXT: Please logout and reboot your system!" diff --git a/CHANGELOG b/CHANGELOG index aa2dae7..0882f26 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,33 @@ +Version 2.5 +https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.5 +-------------------------------------------------------- +Installation: +- Completely reworked script +- Can install Hyprland and/or Qtile +- Backup of existing dotfiles possible +- New optimized download of wallpapers from the repository + +General: +- Script folder cleaned up and window manager scripts moved to related wm scripts folder + +Hyprland: +- Show key bindings defined in ~/dotfiles/hypr/conf/keybindings.conf rofi menu. Opens with SUPER+CTRL+H or right click on Apps +- Added keybinding to toggle all windows to float and back to tiling (Doesn't work with web apps) +- Add brightness control for FN Brightness keys +- swww loading wallpaper from last session +- New Waybar Theme with blurred background +- Latest Waybar supports now persistent workspaces (set to 5 by default) + +Qtile: +- Add wayland support +- New Qtile status bar theme (Qtile status bar is default theme) +- Status bar can be switch on X11 with SUPER + SHIFT + S between Qtile bar and Polybar +- swww/wal loading wallpaper from last session +- Add brightness control for FN Brightness keys + +Known issues: +- GTK dark theme is not always working (e.g. on Qtile Wayland) + Version 2.4 https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.4 -------------------------------------------------------- diff --git a/README.md b/README.md index 5634872..1e5b919 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,38 @@ -# ML4W dotfiles +# ML4W dotfiles Version 2.5 -This is my configuration of Hyprland (Wayland) and Qtile (Xorg). -This package includes installation scripts to install and setup the required components. +This is my configuration of Hyprland (Wayland) and Qtile (Xorg & Wayland). +This package includes an installation script to install and setup the required components. The dotfiles are tested with Arch Linux, Manjaro Linux, EndeavourOS and Arco Linux. -## Common Packages +## General Packages - Terminal: alacritty - Editor: nvim - Prompt: starship - Icons: Font Awesome -- Menus: Rofi -- Colorscheme: pywal (dynamic) +- Launch Menus: Rofi +- Colorscheme: pywal - Browsers: chromium (brave optional) - Filemanager: Thunar - Cursor: Bibata Modern Ice - Icons: Papirus-Icon-Theme - Virtual Machine: qemu (Windows 11 with looking glass and xrdp) -## Hyprland +## Hyprland & Qtile Wayland - Status Bar: waybar - Screenshots: grim & slurp - Clipboard Manager: cliphist -- Logout: wlogout +- Logout Hyprland: wlogout +- Logout Qtile: rofi power menu - Screenlock: swaylock-effects +- Qtile Bar: Qtile status bar -## Qtile +## Qtile X11 - Compositor: picom -- Status Bar: polybar +- Status Bar: Qtile status bar + Polybar (optional) - Screenshots: scrot ## Templating @@ -39,51 +41,55 @@ Hyprland & Qtile: Included is a pywal configuration that changes the color schem Hyprland: In addition, you can switch the Waybar Template with SUPER + CTRL + T or by pressing the "..." icon in Waybar. The templates are available in ~/dotfiles/waybar/themes. You can add your own personal themes into this folder. The script will read in the folder structure. -## Screenshots & Video +Qtile X11: In addition, you can switch between the Qtile status bar and Polybar with SUPER + SHIFT + S + +## Screenshots Hyprland + +Click to watch on YouTube + +Click to watch on YouTube Watch on YouTube -Click to watch on YouTube +## Screenshots Qtile X11 -Click to watch on YouTube +Click to watch on YouTube -Click to watch on YouTube +Click to watch on YouTube -Click to watch on YouTube +Watch on YouTube + +## Screenshots Qtile Wayland + +Click to watch on YouTube + +Click to watch on YouTube Watch on YouTube You can find more screenshots here. -## Getting started +## Installation To make it easy for you to get started with my dotfiles, here's a list of recommended next steps. -PLEASE BACKUP YOUR EXISTING .config WITH YOUR DOTFILES BEFORE STARTING THE SCRIPTS. +PLEASE BACKUP YOUR EXISTING .config FOLDER WITH YOUR DOTFILES BEFORE STARTING THE SCRIPTS FOR INITIONAL INSTALLTION. + +The script will try to create a backup from an older dotfiles folder. ``` -# Make sure that you're in your home directory -cd +# 1.) Change into your Downloads folder +cd ~/Downloads -# Clone the repository from your home directory +# 2.) Clone the dotfiles repository into the Downloads folder git clone https://gitlab.com/stephan-raabe/dotfiles.git -# Or download the lastest version and unzip into ~/dotfiles folder - -# Change into the new dotfiles folder +# 3.) Change into the dotfiles folder cd dotfiles -# Install all required packages -./1-install.sh - -# Install hyprland window manager -./2-install-hyprland.sh -# OR/AND Install qtile window manager -./2-install-qtile.sh - -# Install dotfiles -./3-install-dotfiles.sh +# 4.) Start the installation +./install.sh ``` -Please note that every Arch Linux system is different and I cannot guarantee that everything works fine on your system. +Please note that every Arch Linux system is different and I cannot guarantee that everything works fine on your system. diff --git a/default.jpg b/default.jpg deleted file mode 100644 index 9e416e9..0000000 Binary files a/default.jpg and /dev/null differ diff --git a/gtk/.Xresources b/gtk/.Xresources new file mode 100644 index 0000000..6a1c856 --- /dev/null +++ b/gtk/.Xresources @@ -0,0 +1 @@ +Xcursor.theme: Bibata-Modern-Ice diff --git a/hypr/conf/.hyprland.sh b/hypr/conf/.hyprland.sh new file mode 100755 index 0000000..cc14609 --- /dev/null +++ b/hypr/conf/.hyprland.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# _ _ _ +# | |__ _ _ _ __ _ __| | __ _ _ __ __| | +# | '_ \| | | | '_ \| '__| |/ _` | '_ \ / _` | +# _| | | | |_| | |_) | | | | (_| | | | | (_| | +# (_)_| |_|\__, | .__/|_| |_|\__,_|_| |_|\__,_| +# |___/|_| +# +# ----------------------------------------------------- +# Overwrite hyprland configuration with hyprctl +# Individual scripts and settings possible +# Copy this file into your home directory +# ----------------------------------------------------- + +# ----------------------------------------------------- +# Keyboard Layout +# ----------------------------------------------------- +hyprctl keyword input:kb_layout de # to de +# hyprctl keyword input:kb_layout us # to us + +# ----------------------------------------------------- +# Monitor Setup +# See https://wiki.hyprland.org/Configuring/Monitors/ +# ----------------------------------------------------- +hyprctl keyword monitor ,2560x1440@120,auto,1 +# hyprctl keyword monitor ,preferred,auto,1 + +notify-send ".hyprland.sh exists" "hyprctl commands executed" diff --git a/hypr/conf/autostart.conf b/hypr/conf/autostart.conf index 8ada1f8..cda2d6a 100644 --- a/hypr/conf/autostart.conf +++ b/hypr/conf/autostart.conf @@ -2,13 +2,23 @@ # Autostart # ----------------------------------------------------- -exec-once = swww init -# exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP -# exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP +# Load Dunst Notification Manager exec-once = dunst -exec-once = ~/dotfiles/scripts/lockscreentime.sh -exec-once = ~/dotfiles/scripts/updatewal-swww.sh -exec-once = ~/dotfiles/gtk/gtk.sh + +# Set Cursor Theme exec-once = hyprctl setcursor Bibata-Modern-Ice 24 -exec-once = ~/dotfiles/waybar/launch.sh + +# Load GTK settings +exec-once = ~/dotfiles/gtk/gtk.sh + +# Load swayidle and define the lock screen time +exec-once = ~/dotfiles/hypr/scripts/lockscreentime.sh + +# Load cliphist history exec-once = wl-paste --watch cliphist store + +# Initialize swww +exec-once = swww query || swww init + +# Load last wallpaper and waybar with pywal colors +exec-once = ~/dotfiles/hypr/scripts/wallpaper.sh init diff --git a/hypr/conf/keybindings.conf b/hypr/conf/keybindings.conf index aa8f551..741fd76 100644 --- a/hypr/conf/keybindings.conf +++ b/hypr/conf/keybindings.conf @@ -9,6 +9,7 @@ bind = $mainMod, Q, killactive bind = $mainMod, F, fullscreen bind = $mainMod, E, exec, dolphin bind = $mainMod, T, togglefloating +bind = $mainMod SHIFT, T, exec, ~/dotfiles/hypr/scripts/toggleallfloat.sh bind = $mainMod, B, exec, chromium bind = $mainMod CTRL, B, exec, brave bind = $mainMod, J, togglesplit @@ -17,12 +18,14 @@ bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d -bind = $mainMod, PRINT, exec, ~/dotfiles/scripts/grim.sh +bind = $mainMod, PRINT, exec, ~/dotfiles/hypr/scripts/screenshot.sh bind = $mainMod CTRL, Q, exec, wlogout -bind = $mainMod SHIFT, W, exec, ~/dotfiles/scripts/updatewal-swww.sh -bind = $mainMod CTRL, W, exec, ~/dotfiles/scripts/wallpaper-swww.sh -bind = $mainMod CTRL, RETURN, exec, ~/dotfiles/scripts/applauncher.sh +bind = $mainMod SHIFT, W, exec, ~/dotfiles/hypr/scripts/wallpaper.sh +bind = $mainMod CTRL, W, exec, ~/dotfiles/hypr/scripts/wallpaper.sh select +bind = $mainMod CTRL, RETURN, exec, rofi -show drun +bind = $mainMod CTRL, H, exec, ~/dotfiles/hypr/scripts/keybindings.sh bind = $mainMod SHIFT, B, exec, ~/dotfiles/waybar/launch.sh +bind = $mainMod SHIFT, R, exec, ~/dotfiles/hypr/scripts/loadconfig.sh bind = $mainMod CTRL, F, exec, ~/dotfiles/scripts/filemanager.sh bind = $mainMod CTRL, C, exec, ~/dotfiles/scripts/cliphist.sh bind = $mainMod CTRL, T, exec, ~/dotfiles/waybar/themeswitcher.sh @@ -60,8 +63,8 @@ bind = $mainMod SHIFT, left, resizeactive, -100 0 bind = $mainMod SHIFT, up, resizeactive, 0 -100 bind = $mainMod SHIFT, down, resizeactive, 0 100 -binde = , XF86MonBrightnessUp, exec, brightnessctl set 100% -binde = , XF86MonBrightnessDown, exec, brightnessctl set 70% +binde = , XF86MonBrightnessUp, exec, brightnessctl -q s +20% +binde = , XF86MonBrightnessDown, exec, brightnessctl -q s 20%- # ----------------------------------------------------- # Passthrough SUPER KEY to Virtual Machine diff --git a/hypr/conf/keyboard.conf b/hypr/conf/keyboard.conf index 7d23688..d0c10d4 100644 --- a/hypr/conf/keyboard.conf +++ b/hypr/conf/keyboard.conf @@ -1,13 +1,9 @@ # ----------------------------------------------------- -# Keyboard layout and mouse -# ----------------------------------------------------- - +# Keyboard Layout +# ----------------------------------------------------- input { - kb_layout = $keyboardlayout - kb_variant = - kb_model = - kb_options = - kb_rules = + kb_layout = de + # kb_layout = us follow_mouse = 1 touchpad { natural_scroll = false diff --git a/hypr/conf/monitor.conf b/hypr/conf/monitor.conf new file mode 100644 index 0000000..176e42b --- /dev/null +++ b/hypr/conf/monitor.conf @@ -0,0 +1,8 @@ +# ----------------------------------------------------- +# Monitor Setup +# See https://wiki.hyprland.org/Configuring/Monitors/ +# ----------------------------------------------------- + +monitor=,preferred,auto,1 +# monitor=,1920x1080,auto,1 +# monitor=,2560x1440@120,auto,1 \ No newline at end of file diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index e968032..64aeecf 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -9,18 +9,10 @@ # ----------------------------------------------------- # ----------------------------------------------------- -# Keyboard Layout +# Keyboard & Monitor # ----------------------------------------------------- -# $keyboardlayout=de -$keyboardlayout=us - -# ----------------------------------------------------- -# Monitor Setup -# See https://wiki.hyprland.org/Configuring/Monitors/ -# ----------------------------------------------------- -monitor=,preferred,auto,1 -# monitor=,2560x1440@120,auto,1 -# monitor=,1920x1080,auto,1 +source = ~/dotfiles/hypr/conf/keyboard.conf +source = ~/dotfiles/hypr/conf/monitor.conf # ----------------------------------------------------- # Autostart & Environment @@ -36,7 +28,6 @@ source = ~/.cache/wal/colors-hyprland.conf # ----------------------------------------------------- # Load configuration files # ----------------------------------------------------- -source = ~/dotfiles/hypr/conf/keyboard.conf source = ~/dotfiles/hypr/conf/window.conf source = ~/dotfiles/hypr/conf/decoration.conf source = ~/dotfiles/hypr/conf/layouts.conf diff --git a/hypr/scripts/disabledm.sh b/hypr/scripts/disabledm.sh new file mode 100755 index 0000000..44eb9cb --- /dev/null +++ b/hypr/scripts/disabledm.sh @@ -0,0 +1,23 @@ +#!/bin/bash +clear +echo "Hyprland recommends the start with the tty login." +echo "You can deactivate the current display manager (if exists)." +echo "" +echo "-> Do you really want to deactivate the display manager?" +while true; do + read -p "Do you want to enable the sddm display manager and setup theme? (Yy/Nn): " yn + case $yn in + [Yy]* ) + if [ -f /etc/systemd/system/display-manager.service ]; then + sudo rm /etc/systemd/system/display-manager.service + echo "Current display manager removed." + else + echo "No active display manager found." + fi + break;; + [Nn]* ) + exit + break;; + * ) echo "Please answer yes or no.";; + esac +done \ No newline at end of file diff --git a/hypr/scripts/keybindings.sh b/hypr/scripts/keybindings.sh new file mode 100755 index 0000000..4b3e438 --- /dev/null +++ b/hypr/scripts/keybindings.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# _ _ _ _ _ +# | | _____ _ _| |__ (_)_ __ __| (_)_ __ __ _ ___ +# | |/ / _ \ | | | '_ \| | '_ \ / _` | | '_ \ / _` / __| +# | < __/ |_| | |_) | | | | | (_| | | | | | (_| \__ \ +# |_|\_\___|\__, |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___/ +# |___/ |___/ +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +# ----------------------------------------------------- +# Define keybindings.conf location +# ----------------------------------------------------- +config_file=~/dotfiles/hypr/conf/keybindings.conf + +# ----------------------------------------------------- +# Parse keybindings +# ----------------------------------------------------- +keybinds=$(grep -oP '(?<=bind = ).*' $config_file) +keybinds=$(echo "$keybinds" | sed 's/$mainMod/SUPER/g'| sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g') + +# ----------------------------------------------------- +# Show keybindings in rofi +# ----------------------------------------------------- +rofi -dmenu -p "Keybinds" -config ~/dotfiles/rofi/config-compact.rasi <<< "$keybinds" \ No newline at end of file diff --git a/hypr/scripts/loadconfig.sh b/hypr/scripts/loadconfig.sh new file mode 100755 index 0000000..471602c --- /dev/null +++ b/hypr/scripts/loadconfig.sh @@ -0,0 +1,5 @@ +#!/bin/bash +if [ -f ~/.hyprland.sh ]; then + sleep 1 + ~/.hyprland.sh +fi \ No newline at end of file diff --git a/scripts/lockscreentime.sh b/hypr/scripts/lockscreentime.sh old mode 100755 new mode 100644 similarity index 100% rename from scripts/lockscreentime.sh rename to hypr/scripts/lockscreentime.sh diff --git a/scripts/grim.sh b/hypr/scripts/screenshot.sh similarity index 80% rename from scripts/grim.sh rename to hypr/scripts/screenshot.sh index 9337f7b..3231d6c 100755 --- a/scripts/grim.sh +++ b/hypr/scripts/screenshot.sh @@ -17,18 +17,16 @@ option3="Fullscreen (delay 3 sec)" options="$option2\n$option3" -choice=$(echo -e "$options" | rofi -dmenu -config ~/dotfiles/rofi/config-screenshot.rasi -i -no-show-icons -l 4 -width 30 -p "Take Screenshot") +choice=$(echo -e "$options" | rofi -dmenu -config ~/dotfiles/rofi/config-screenshot.rasi -i -no-show-icons -l 2 -width 30 -p "Take Screenshot") case $choice in $option2) grim -g "$(slurp)" - | swappy -f - - # grim -g "$(slurp)" $(xdg-user-dir PICTURES)/screenshots/$(date +'%s_grim.png') notify-send "Screenshot created" "Mode: Selected area" ;; $option3) sleep 3 grim - | swappy -f - - # grim $(xdg-user-dir PICTURES)/screenshots/$(date +'%s_grim.png') notify-send "Screenshot created" "Mode: Fullscreen" ;; esac diff --git a/hypr/scripts/toggleallfloat.sh b/hypr/scripts/toggleallfloat.sh new file mode 100755 index 0000000..fb6737c --- /dev/null +++ b/hypr/scripts/toggleallfloat.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# _ _ _ __ _ _ +# / \ | | |/ _| | ___ __ _| |_ +# / _ \ | | | |_| |/ _ \ / _` | __| +# / ___ \| | | _| | (_) | (_| | |_ +# /_/ \_\_|_|_| |_|\___/ \__,_|\__| +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +hyprctl dispatch workspaceopt allfloat diff --git a/scripts/updatewal-swww.sh b/hypr/scripts/wallpaper.sh similarity index 50% rename from scripts/updatewal-swww.sh rename to hypr/scripts/wallpaper.sh index f7b814a..e115bc1 100755 --- a/scripts/updatewal-swww.sh +++ b/hypr/scripts/wallpaper.sh @@ -1,23 +1,47 @@ #!/bin/bash -# _____ _ ______ ____ ____ __ -# |_ _| |__ ___ _ __ ___ ___ / ___\ \ / /\ \ / /\ \ / / -# | | | '_ \ / _ \ '_ ` _ \ / _ \ \___ \\ \ /\ / / \ \ /\ / / \ \ /\ / / -# | | | | | | __/ | | | | | __/ ___) |\ V V / \ V V / \ V V / -# |_| |_| |_|\___|_| |_| |_|\___| |____/ \_/\_/ \_/\_/ \_/\_/ -# +# _ _ +# __ ____ _| | |_ __ __ _ _ __ ___ _ __ +# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__| +# \ V V / (_| | | | |_) | (_| | |_) | __/ | +# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| +# |_| |_| # # by Stephan Raabe (2023) # ----------------------------------------------------- -# ----------------------------------------------------- -# Select random wallpaper and create color scheme -# ----------------------------------------------------- -wal -q -i ~/wallpaper/ +case $1 in + + # Load wallpaper from .cache of last session + "init") + if [ -f ~/.cache/current_wallpaper.jpg ]; then + wal -q -i ~/.cache/current_wallpaper.jpg + else + wal -q -i ~/wallpaper/ + fi + ;; + + # Select wallpaper with rofi + "select") + selected=$(ls -1 ~/wallpaper | grep "jpg" | rofi -dmenu -config ~/dotfiles/rofi/config-wallpaper.rasi) + if [ ! "$selected" ]; then + echo "No wallpaper selected" + exit + fi + wal -q -i ~/wallpaper/$selected + ;; + + # Randomly select wallpaper + *) + wal -q -i ~/wallpaper/ + ;; + +esac # ----------------------------------------------------- # Load current pywal color scheme # ----------------------------------------------------- source "$HOME/.cache/wal/colors.sh" +echo "Wallpaper: $wallpaper" # ----------------------------------------------------- # Copy selected wallpaper into .cache folder @@ -30,21 +54,28 @@ cp $wallpaper ~/.cache/current_wallpaper.jpg newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g") # ----------------------------------------------------- -# Set the new wallpaper +# Reload waybar with new colors +# ----------------------------------------------------- +~/dotfiles/waybar/launch.sh + # ----------------------------------------------------- +# Set the new wallpaper +# ----------------------------------------------------- +transition_type="wipe" +# transition_type="outer" +# transition_type="random" + swww img $wallpaper \ --transition-bezier .43,1.19,1,.4 \ --transition-fps=60 \ - --transition-type="random" \ + --transition-type=$transition_type \ --transition-duration=0.7 \ --transition-pos "$( hyprctl cursorpos )" -~/dotfiles/waybar/launch.sh -sleep 1 - # ----------------------------------------------------- # Send notification # ----------------------------------------------------- +sleep 1 notify-send "Colors and Wallpaper updated" "with image $newwall" echo "DONE!" diff --git a/hypr/starthypr.sh b/hypr/starthypr.sh deleted file mode 100644 index 2485c38..0000000 --- a/hypr/starthypr.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -export WLR_NO_HARDWARE_CURSORS=1 -export WLR_RENDERER_ALLOW_SOFTWARE=1 -exec Hyprland diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..851a22d --- /dev/null +++ b/install.sh @@ -0,0 +1,76 @@ +#!/bin/bash +clear + +# Set installation mode +mode="live" +if [ ! -z $1 ]; then + mode="dev" + echo "IMPORTANT: DEV MODE ACTIVATED. " + echo "Existing dotfiles folder will not be modified." + echo "Symbolic links will not be created." +fi + +cat <<"EOF" + _ _ __ _ _ + __| | ___ | |_ / _(_) | ___ ___ + / _` |/ _ \| __| |_| | |/ _ \/ __| +| (_| | (_) | |_| _| | | __/\__ \ + \__,_|\___/ \__|_| |_|_|\___||___/ + +EOF +version="2.5" +echo "Version: $version" +echo "by Stephan Raabe 2023" +echo "" +echo "This script will guide you through the installation process of my dotfiles." +echo "" +source .install/library.sh +source .install/confirm-start.sh +source .install/backup.sh +source .install/preparation.sh +source .install/profile.sh +if [ $profile == "Hyprland" ]; then + source .install/hyprland.sh +fi +if [ $profile == "Qtile" ]; then + source .install/qtile.sh +fi +source .install/yay.sh +if [ $profile == "Hyprland" ]; then + source .install/hyprland-packages.sh + source .install/install-packages.sh +fi +if [ $profile == "Qtile" ]; then + source .install/qtile-packages.sh + source .install/install-packages.sh +fi +if [ $profile == "All" ]; then + source .install/hyprland-packages.sh + source .install/install-packages.sh + source .install/qtile-packages.sh + source .install/install-packages.sh +fi +source .install/pywal.sh +source .install/wallpaper.sh +source .install/disabledm.sh +source .install/issue.sh +source .install/restore.sh +source .install/setup.sh +source .install/copy.sh +source .install/config-folder.sh +source .install/init-pywal.sh +if [ $profile == "Hyprland" ]; then + source .install/hyprland-dotfiles.sh +fi +if [ $profile == "Qtile" ]; then + source .install/qtile-dotfiles.sh +fi +if [ $profile == "All" ]; then + source .install/hyprland-dotfiles.sh + source .install/qtile-dotfiles.sh +fi + +echo "IMPORTANT: Please check the keyboard layout and screen resolution after the rebbot of your system." +echo "" + +source .install/done.sh diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index 3a41e36..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,124 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running `nixos-help`). - -{ config, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # networking.hostName = "nixos"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminus16"; - # keyMap = "de"; - useXkbConfig = true; # use xkbOptions in tty. - }; - - # Enable the X11 windowing system. - # services.xserver.enable = true; - - users.users.raabe = { - isNormalUser = true; - home = "/home/raabe"; - description = "Stephan Raabe"; - extraGroups = [ "wheel" ]; - }; - - - # Configure keymap in X11 - services.xserver.layout = "de"; - # services.xserver.xkbOptions = "eurosign:e,caps:escape"; - services.xserver.enable = true; - services.xserver.windowManager.qtile.enable = true; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # sound.enable = true; - # hardware.pulseaudio.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.alice = { - # isNormalUser = true; - # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - # packages = with pkgs; [ - # firefox - # tree - # ]; - # }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim - wget - qtile - alacritty - chromium - git - picom - rofi - nitrogen - xfce.mousepad - ]; - - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - programs.thunar.enable = true; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - -} - diff --git a/polybar/config.ini b/polybar/config.ini index 2fa077f..536e0ac 100644 --- a/polybar/config.ini +++ b/polybar/config.ini @@ -41,30 +41,6 @@ enable-ipc = true tray-position = right tray-detached = false -[bar/mypolybar] -width = 100% -height = 20pt -radius = 0 -background = ${colors.background} -foreground = ${colors.foreground} -border-size = 0pt -border-color = #00000000 -padding-left = 2 -padding-right = 1 -module-margin = 2 -separator = "" -separator-foreground = ${colors.disabled} -font-0 = "Fira Sans SemiBold:size=11;2" -font-1 = "Font Awesome 6 Free Solid:pixelsize=11;2" -modules-left = appmenu browser chatgpt xwindow -modules-center = xworkspaces -modules-right = battery xkeyboard mysystem filesystem pulseaudio memory cpu date exit -cursor-click = pointer -cursor-scroll = ns-resize -enable-ipc = true -tray-position = right -tray-detached = false - [module/youtubesubs] type = custom/script exec = "python ~/private/youtube.py" @@ -96,7 +72,7 @@ click-left = "chromium" type = custom/text content-foreground = ${colors.primary} content = "" -click-left = "~/dotfiles/scripts/applauncher.sh" +click-left = "rofi -show drun" [module/scrcpy] type = custom/text @@ -126,7 +102,7 @@ click-left = "xfreerdp -grab-keyboard /v:192.168.122.42 /size:100% /cert-ignore type = custom/text content-foreground = ${colors.primary} content = " " -click-left = "~/dotfiles/scripts/powermenu.sh" +click-left = "~/dotfiles/qtile/scripts/powermenu.sh" [module/xworkspaces] type = internal/xworkspaces diff --git a/polybar/launch.sh b/polybar/launch.sh index 88ae66f..188b630 100755 --- a/polybar/launch.sh +++ b/polybar/launch.sh @@ -12,14 +12,12 @@ # ----------------------------------------------------- # Quit running polybar instances # ----------------------------------------------------- -polybar-msg cmd quit +killall polybar + +# polybar-msg cmd quit + # ----------------------------------------------------- # Loading the configuration based on the username # ----------------------------------------------------- -if [[ $USER = "raabe" ]] -then - polybar -r mypolybar -else - polybar -r mybar -fi +polybar -r mybar diff --git a/qtile/autostart_wayland.sh b/qtile/autostart_wayland.sh new file mode 100755 index 0000000..a587947 --- /dev/null +++ b/qtile/autostart_wayland.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# ___ _____ ___ _ _____ ____ _ _ +# / _ \_ _|_ _| | | ____| / ___|| |_ __ _ _ __| |_ +# | | | || | | || | | _| \___ \| __/ _` | '__| __| +# | |_| || | | || |___| |___ ___) | || (_| | | | |_ +# \__\_\|_| |___|_____|_____| |____/ \__\__,_|_| \__| +# +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +# My screen resolution +# xrandr --rate 120 + +# For Virtual Machine +# xrandr --output Virtual-1 --mode 1920x1080 + +# Set keyboard mapping in config.py + +# Load power manager +xfce4-power-manager & + +# Load notification service +dunst & + +# Load cliphist history +wl-paste --watch cliphist store & + +# Launch GTK +~/dotfiles/gtk/gtk.sh + +swww init + +# Setup Wallpaper and update colors +~/dotfiles/qtile/scripts/wayland/wallpaper.sh init & \ No newline at end of file diff --git a/qtile/autostart.sh b/qtile/autostart_x11.sh similarity index 84% rename from qtile/autostart.sh rename to qtile/autostart_x11.sh index 65a13f8..d96c412 100755 --- a/qtile/autostart.sh +++ b/qtile/autostart_x11.sh @@ -15,9 +15,7 @@ # For Virtual Machine # xrandr --output Virtual-1 --mode 1920x1080 -# Set keyboard mapping -# setxkbmap de -setxkbmap en +# Set keyboard layout in config.py # Load picom picom & @@ -29,7 +27,9 @@ xfce4-power-manager & dunst & # Launch polybar -~/dotfiles/polybar/launch.sh & +~/dotfiles/qtile/scripts/x11/loadbar.sh + +sleep 1 # Setup Wallpaper and update colors -~/dotfiles/scripts/updatewal.sh & \ No newline at end of file +~/dotfiles/qtile/scripts/x11/wallpaper.sh init diff --git a/qtile/conf/keyboard.py b/qtile/conf/keyboard.py new file mode 100644 index 0000000..d454a1e --- /dev/null +++ b/qtile/conf/keyboard.py @@ -0,0 +1,3 @@ +# Setup global keyboard layout here + +keyboard_layout = "de" diff --git a/qtile/config.py b/qtile/config.py index c63c92c..5add732 100644 --- a/qtile/config.py +++ b/qtile/config.py @@ -24,25 +24,63 @@ from libqtile.widget import Spacer, Backlight from libqtile.widget.image import Image from libqtile.dgroups import simple_key_binder from pathlib import Path +from libqtile.log_utils import logger +from libqtile.backend.wayland import InputConfig + +from qtile_extras import widget +from qtile_extras.widget.decorations import RectDecoration +from qtile_extras.widget.decorations import PowerLineDecoration +from conf.keyboard import * + +# -------------------------------------------------------- +# Your configuration +# -------------------------------------------------------- + +# Keyboard layout in conf/keyboard.py + +# Show wlan status bar widget (set to False if wired network) +# show_wlan = True +show_wlan = False + +# Show bluetooth status bar widget +# show_bluetooth = True +show_bluetooth = False + +# -------------------------------------------------------- +# General Variables +# -------------------------------------------------------- # Get home path home = str(Path.home()) +# Get Core name: x11 or wayland +core_name = qtile.core.name +logger.warning("Using config.py with " + core_name) + # -------------------------------------------------------- # Define Status Bar # -------------------------------------------------------- -wm_bar = "polybar" -# wm_bar = "qtile" +if core_name == "x11": + try: + wm_bar = Path(home + "/.cache/.qtile_bar_x11.sh").read_text().replace("\n", "") + except: + wm_bar = "qtile" +elif qtile.core.name == "wayland": + wm_bar = "qtile" + +logger.warning("Status bar: " + wm_bar) # -------------------------------------------------------- # Check for Desktop/Laptop # -------------------------------------------------------- + # 3 = Desktop platform = int(os.popen("cat /sys/class/dmi/id/chassis_type").read()) # -------------------------------------------------------- # Set default apps # -------------------------------------------------------- + terminal = "alacritty" browser = "chromium" # browser = "brave" @@ -50,66 +88,122 @@ browser = "chromium" # -------------------------------------------------------- # Keybindings # -------------------------------------------------------- + mod = "mod4" # SUPER KEY -keys = [ +if core_name == "x11": + logger.warning("Using keys with x11") + keys = [ - # Focus - Key([mod], "Left", lazy.layout.left(), desc="Move focus to left"), - Key([mod], "Right", lazy.layout.right(), desc="Move focus to right"), - Key([mod], "Down", lazy.layout.down(), desc="Move focus down"), - Key([mod], "Up", lazy.layout.up(), desc="Move focus up"), - Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window around"), + # Focus + Key([mod], "Left", lazy.layout.left(), desc="Move focus to left"), + Key([mod], "Right", lazy.layout.right(), desc="Move focus to right"), + Key([mod], "Down", lazy.layout.down(), desc="Move focus down"), + Key([mod], "Up", lazy.layout.up(), desc="Move focus up"), + Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window around"), + + # Move + Key([mod, "shift"], "Left", lazy.layout.shuffle_left(), desc="Move window to the left"), + Key([mod, "shift"], "Right", lazy.layout.shuffle_right(), desc="Move window to the right"), + Key([mod, "shift"], "Down", lazy.layout.shuffle_down(), desc="Move window down"), + Key([mod, "shift"], "Up", lazy.layout.shuffle_up(), desc="Move window up"), + + # Swap + Key([mod, "shift"], "h", lazy.layout.swap_left()), + Key([mod, "shift"], "l", lazy.layout.swap_right()), + + Key([mod], "Print", lazy.spawn(home + "/dotfiles/qtile/scripts/x11/screenshot.sh")), + + # Size + Key([mod, "control"], "Down", lazy.layout.shrink(), desc="Grow window to the left"), + Key([mod, "control"], "Up", lazy.layout.grow(), desc="Grow window to the right"), + Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), + + # Floating + Key([mod], "t", lazy.window.toggle_floating(), desc='Toggle floating'), + + # Split + Key([mod, "shift"], "Return", lazy.layout.toggle_split(), desc="Toggle between split and unsplit sides of stack"), + + # Toggle Layouts + Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), + + # Fullscreen + Key([mod], "f", lazy.window.toggle_fullscreen()), + + #System + Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), + Key([mod, "shift"], "r", lazy.reload_config(), desc="Reload the config"), + Key([mod, "control"], "q", lazy.spawn(home + "/dotfiles/qtile/scripts/powermenu.sh"), desc="Open Powermenu"), + Key([mod, "shift"], "s", lazy.spawn(home + "/dotfiles/qtile/scripts/x11/barswitcher.sh"), desc="Switch Status Bar"), - # Move - Key([mod, "shift"], "Left", lazy.layout.shuffle_left(), desc="Move window to the left"), - Key([mod, "shift"], "Right", lazy.layout.shuffle_right(), desc="Move window to the right"), - Key([mod, "shift"], "Down", lazy.layout.shuffle_down(), desc="Move window down"), - Key([mod, "shift"], "Up", lazy.layout.shuffle_up(), desc="Move window up"), + # Apps + Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), + Key([mod, "control"], "Return", lazy.spawn("rofi -show drun"), desc="Launch Rofi"), + Key([mod], "b", lazy.spawn(browser), desc="Launch Browser"), + Key([mod, "control"], "b", lazy.spawn(home + "/dotfiles/scripts/bravebookmarks.sh"), desc="Rofi Brave Bookmarks"), + Key([mod, "shift"], "w", lazy.spawn(home + "/dotfiles/qtile/scripts/x11/wallpaper.sh"), desc="Update Theme and Wallpaper"), + Key([mod, "control"], "w", lazy.spawn(home + "/dotfiles/qtile/scripts/x11/wallpaper.sh select"), desc="Select Theme and Wallpaper"), - # Swap - Key([mod, "shift"], "h", lazy.layout.swap_left()), - Key([mod, "shift"], "l", lazy.layout.swap_right()), + Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl -q s +20%")), + Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl -q s 20%-")) + ] +elif qtile.core.name == "wayland": + logger.warning("Using keys with wayland") - Key([mod], "Print", lazy.spawn(home + "/dotfiles/scripts/scrot.sh")), + keys = [ - # Size - # Key([mod], "h", lazy.layout.shrink(), lazy.layout.decrease_nmaster(), desc='Shrink window (MonadTall)'), - # Key([mod], "l", lazy.layout.grow(), lazy.layout.increase_nmaster(), desc='Expand window (MonadTall)'), - Key([mod, "control"], "Down", lazy.layout.shrink(), desc="Grow window to the left"), - Key([mod, "control"], "Up", lazy.layout.grow(), desc="Grow window to the right"), - # Key([mod, "control"], "Down", lazy.layout.grow_down(), desc="Grow window down"), - # Key([mod, "control"], "Up", lazy.layout.grow_up(), desc="Grow window up"), - Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), + # Focus + Key([mod], "Left", lazy.layout.left(), desc="Move focus to left"), + Key([mod], "Right", lazy.layout.right(), desc="Move focus to right"), + Key([mod], "Down", lazy.layout.down(), desc="Move focus down"), + Key([mod], "Up", lazy.layout.up(), desc="Move focus up"), + Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window around"), + + # Move + Key([mod, "shift"], "Left", lazy.layout.shuffle_left(), desc="Move window to the left"), + Key([mod, "shift"], "Right", lazy.layout.shuffle_right(), desc="Move window to the right"), + Key([mod, "shift"], "Down", lazy.layout.shuffle_down(), desc="Move window down"), + Key([mod, "shift"], "Up", lazy.layout.shuffle_up(), desc="Move window up"), - # Floating - Key([mod], "t", lazy.window.toggle_floating(), desc='Toggle floating'), - - # Split - Key([mod, "shift"], "Return", lazy.layout.toggle_split(), desc="Toggle between split and unsplit sides of stack"), + # Swap + Key([mod, "shift"], "h", lazy.layout.swap_left()), + Key([mod, "shift"], "l", lazy.layout.swap_right()), - # Toggle Layouts - Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), + Key([mod], "Print", lazy.spawn(home + "/dotfiles/qtile/scripts/wayland/screenshot.sh")), - # Fullscreen - Key([mod], "f", lazy.window.toggle_fullscreen()), + # Size + Key([mod, "control"], "Down", lazy.layout.shrink(), desc="Grow window to the left"), + Key([mod, "control"], "Up", lazy.layout.grow(), desc="Grow window to the right"), + Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), - #System - Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), - Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), - Key([mod, "control"], "q", lazy.spawn(home + "/dotfiles/scripts/powermenu.sh"), desc="Open Powermenu"), - - # Apps - Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), - Key([mod, "control"], "Return", lazy.spawn(home + "/dotfiles/scripts/applauncher.sh"), desc="Launch Rofi"), - Key([mod], "b", lazy.spawn(browser), desc="Launch Browser"), - Key([mod, "control"], "b", lazy.spawn(home + "/dotfiles/scripts/bravebookmarks.sh"), desc="Rofi Brave Bookmarks"), - Key([mod], "v", lazy.spawn(home + "/dotfiles/scripts/looking-glass.sh"), desc="Start Looking Glass Client"), - Key([mod, "shift"], "w", lazy.spawn(home + "/dotfiles/scripts/updatewal.sh"), desc="Update Theme and Wallpaper"), - Key([mod, "control"], "w", lazy.spawn(home + "/dotfiles/scripts/wallpaper.sh"), desc="Select Theme and Wallpaper"), - Key([mod, "control"], "t", lazy.spawn(home + "/dotfiles/scripts/templates.sh"), desc="Select Tempate and copy to clipboard"), -# Key([], 'F10', lazy.spawn("brave --app=https://chat.openai.com"), desc="Open ChatGPT") -] + # Floating + Key([mod], "t", lazy.window.toggle_floating(), desc='Toggle floating'), + + # Split + Key([mod, "shift"], "Return", lazy.layout.toggle_split(), desc="Toggle between split and unsplit sides of stack"), + + # Toggle Layouts + Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), + + # Fullscreen + Key([mod], "f", lazy.window.toggle_fullscreen()), + + #System + Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), + Key([mod, "shift"], "r", lazy.reload_config(), desc="Reload the config"), + Key([mod, "control"], "q", lazy.spawn(home + "/dotfiles/qtile/scripts/powermenu.sh"), desc="Open Powermenu"), + + # Apps + Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), + Key([mod, "control"], "Return", lazy.spawn("rofi -show drun"), desc="Launch Rofi"), + Key([mod], "b", lazy.spawn(browser), desc="Launch Browser"), + Key([mod, "shift"], "w", lazy.spawn(home + "/dotfiles/qtile/scripts/wayland/wallpaper.sh"), desc="Update Theme and Wallpaper"), + Key([mod, "control"], "w", lazy.spawn(home + "/dotfiles/qtile/scripts/wayland/wallpaper.sh select"), desc="Select Theme and Wallpaper"), + + Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl -q s +20%")), + Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl -q s 20%-")) + ] # -------------------------------------------------------- # Groups @@ -149,16 +243,22 @@ keys.extend([ colors = os.path.expanduser('~/.cache/wal/colors.json') colordict = json.load(open(colors)) -ColorZ=(colordict['colors']['color0']) -ColorA=(colordict['colors']['color1']) -ColorB=(colordict['colors']['color2']) -ColorC=(colordict['colors']['color3']) -ColorD=(colordict['colors']['color4']) -ColorE=(colordict['colors']['color5']) -ColorF=(colordict['colors']['color6']) -ColorG=(colordict['colors']['color7']) -ColorH=(colordict['colors']['color8']) -ColorI=(colordict['colors']['color9']) +Color0=(colordict['colors']['color0']) +Color1=(colordict['colors']['color1']) +Color2=(colordict['colors']['color2']) +Color3=(colordict['colors']['color3']) +Color4=(colordict['colors']['color4']) +Color5=(colordict['colors']['color5']) +Color6=(colordict['colors']['color6']) +Color7=(colordict['colors']['color7']) +Color8=(colordict['colors']['color8']) +Color9=(colordict['colors']['color9']) +Color10=(colordict['colors']['color10']) +Color11=(colordict['colors']['color11']) +Color12=(colordict['colors']['color12']) +Color13=(colordict['colors']['color13']) +Color14=(colordict['colors']['color14']) +Color15=(colordict['colors']['color15']) # -------------------------------------------------------- # Setup Layout Theme @@ -167,7 +267,7 @@ ColorI=(colordict['colors']['color9']) layout_theme = { "border_width": 3, "margin": 15, - "border_focus": ColorC, + "border_focus": Color2, "border_normal": "FFFFFF", "single_border_width": 3 } @@ -177,19 +277,10 @@ layout_theme = { # -------------------------------------------------------- layouts = [ - # layout.Columns(), layout.Max(**layout_theme), - # Try more layouts by unleashing below layouts. - # layout.Stack(num_stacks=2), - # layout.Bsp(), - # layout.Matrix(), layout.MonadTall(**layout_theme), layout.MonadWide(**layout_theme), layout.RatioTile(**layout_theme), - # layout.Tile(), - # layout.TreeTab(), - # layout.VerticalTile(), - # layout.Zoomy(), layout.Floating() ] @@ -204,12 +295,50 @@ widget_defaults = dict( ) extension_defaults = widget_defaults.copy() +# -------------------------------------------------------- +# Decorations +# https://qtile-extras.readthedocs.io/en/stable/manual/how_to/decorations.html +# -------------------------------------------------------- + +decor_left = { + "decorations": [ + PowerLineDecoration( + path="arrow_left" + # path="rounded_left" + # path="forward_slash" + # path="back_slash" + ) + ], +} + +decor_right = { + "decorations": [ + PowerLineDecoration( + path="arrow_right" + # path="rounded_right" + # path="forward_slash" + # path="back_slash" + ) + ], +} + # -------------------------------------------------------- # Widgets # -------------------------------------------------------- widget_list = [ + widget.TextBox( + **decor_left, + background=Color1+".4", + text='Apps', + foreground='ffffff', + desc='', + padding=10, + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("rofi -show drun")}, + ), widget.GroupBox( + **decor_left, + background="#ffffff.7", highlight_method='block', highlight='ffffff', block_border='ffffff', @@ -221,82 +350,129 @@ widget_list = [ active='ffffff' ), widget.TextBox( - text='  ', - foreground=ColorC, - ), - widget.WindowName(), - widget.Systray(), - widget.TextBox( - text='', + **decor_left, + background="#ffffff.4", + text=" ", + foreground="000000.6", fontsize=18, - foreground='ffffff', - desc='Notes', - mouse_callbacks={"Button1": lambda: qtile.cmd_spawn(terminal + ' -e vim ' + home + '/notes.txt')}, + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("chromium")}, ), widget.TextBox( - text='|', - foreground=ColorC, + **decor_left, + background="#ffffff.4", + text=" ", + foreground="000000.6", + fontsize=18, + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("thunar")} ), - widget.Volume( - fmt='Vol: {}', + + widget.WindowName( + **decor_left, + max_chars=50, + background=Color2+".4", + width=400, + padding=10 + ), + widget.Spacer(), + widget.Spacer( + length=30 ), widget.TextBox( - text='|', - foreground=ColorC, - ), + **decor_right, + background="#000000.3" + ), widget.Memory( + **decor_right, + background=Color10+".4", + padding=10, measure_mem='G', format="{MemUsed:.0f}{mm} ({MemTotal:.0f}{mm})" ), + widget.Volume( + **decor_right, + background=Color12+".4", + padding=10, + fmt='Vol: {}', + ), widget.DF( + **decor_right, + padding=10, + background=Color8+".4", visible_on_warn=False, format="{p} {uf}{m} ({r:.0f}%)" ), - widget.TextBox( - text='|', - foreground=ColorC, + widget.Bluetooth( + **decor_right, + background=Color2+".4", + padding=10, + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("blueman-manager")}, ), - widget.Battery(), - widget.TextBox( - text='|', - foreground=ColorC, + widget.Wlan( + **decor_right, + background=Color2+".4", + padding=10, + format='{essid} {percent:2.0%}', + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("alacritty -e nmtui")}, ), widget.Clock( - format="%Y-%m-%d %a %I:%M %p", + **decor_right, + background=Color4+".4", + padding=10, + format="%Y-%m-%d / %I:%M %p", ), widget.TextBox( - text='|', - foreground=ColorC, - ), - widget.QuickExit( - default_text=" ", + **decor_right, + background=Color2+".4", + padding=5, + text="", fontsize=20, - countdown_start=3, - countdown_format="{}" + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn(home + "/dotfiles/scripts/cliphist.sh")}, + ), + widget.TextBox( + **decor_right, + background=Color2+".4", + padding=5, + text=" ", + fontsize=20, + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn(home + "/dotfiles/qtile/scripts/powermenu.sh")}, ), ] -if (platform == 3): - del widget_list[10:12] +# Hide Modules if not on laptop +if (show_wlan == False): + del widget_list[12:13] + +if (show_bluetooth == False): + del widget_list[11:12] + +if (core_name == "x11"): + del widget_list[12:13] # -------------------------------------------------------- # Screens # -------------------------------------------------------- -if (wm_bar == "polybar"): - screens = [Screen(top=bar.Gap(size=28))] -else: +if (wm_bar == "qtile"): + logger.warning("Loading qtile bar") screens = [ Screen( top=bar.Bar( - widget_list, - 24, + widget_list, + 30, + padding=20, opacity=0.7, - border_width=[3, 0, 3, 0], - margin=[0,0,0,0] + border_width=[0, 0, 0, 0], + margin=[0,0,0,0], + background="#000000.3" ), ), ] +else: + screens = [Screen(top=bar.Gap(size=28))] + if (core_name == "x11"): + screens = [Screen(top=bar.Gap(size=28))] + else: + screens = [Screen(top=bar.Gap(size=0))] # -------------------------------------------------------- # Drag floating layouts @@ -314,7 +490,7 @@ mouse = [ floating_layout = layout.Floating( border_width=3, - border_focus=ColorC, + border_focus=Color2, border_normal="FFFFFF", float_rules=[ # Run the utility of `xprop` to see the wm class and name of an X client. @@ -362,6 +538,15 @@ wl_input_rules = None wmname = "QTILE" +# -------------------------------------------------------- +# Set wayland properties +# -------------------------------------------------------- + +# Keyboard layout +wl_input_rules = { + "type:keyboard": InputConfig(kb_layout=keyboard_layout), +} + # -------------------------------------------------------- # Hooks # -------------------------------------------------------- @@ -369,6 +554,12 @@ wmname = "QTILE" # HOOK startup @hook.subscribe.startup_once def autostart(): - home = os.path.expanduser('~/.config/qtile/autostart.sh') + if qtile.core.name == "x11": + autostartscript = "~/.config/qtile/autostart_x11.sh" + subprocess.Popen(['setxkbmap',keyboard_layout]) + elif qtile.core.name == "wayland": + autostartscript = "~/.config/qtile/autostart_wayland.sh" + + home = os.path.expanduser(autostartscript) subprocess.Popen([home]) diff --git a/nixos/.gitkeep b/qtile/reload.sh similarity index 100% rename from nixos/.gitkeep rename to qtile/reload.sh diff --git a/scripts/powermenu.sh b/qtile/scripts/powermenu.sh similarity index 84% rename from scripts/powermenu.sh rename to qtile/scripts/powermenu.sh index 35d6311..9177ea2 100755 --- a/scripts/powermenu.sh +++ b/qtile/scripts/powermenu.sh @@ -8,6 +8,13 @@ # # by Stephan Raabe (2023) # ----------------------------------------------------- +echo $XDG_SESSION_TYPE +if [ $XDG_SESSION_TYPE == "wayland" ]; then + lockapp=swaylock +else + lockapp=slock +fi +echo "Using $lockapp to lock the screen." option1=" lock" option2=" logout" @@ -22,7 +29,7 @@ choice=$(echo -e "$options" | rofi -dmenu -config ~/dotfiles/rofi/config-power.r case $choice in $option1) - slock ;; + $lockapp ;; $option2) qtile cmd-obj -o cmd -f shutdown ;; $option3) diff --git a/qtile/scripts/wayland/screenshot.sh b/qtile/scripts/wayland/screenshot.sh new file mode 100755 index 0000000..3231d6c --- /dev/null +++ b/qtile/scripts/wayland/screenshot.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# ____ _ _ +# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_ +# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __| +# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_ +# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__| +# +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +DIR="$HOME/Pictures/screenshots/" +NAME="screenshot_$(date +%d%m%Y_%H%M%S).png" + +option2="Selected area" +option3="Fullscreen (delay 3 sec)" + +options="$option2\n$option3" + +choice=$(echo -e "$options" | rofi -dmenu -config ~/dotfiles/rofi/config-screenshot.rasi -i -no-show-icons -l 2 -width 30 -p "Take Screenshot") + +case $choice in + $option2) + grim -g "$(slurp)" - | swappy -f - + notify-send "Screenshot created" "Mode: Selected area" + ;; + $option3) + sleep 3 + grim - | swappy -f - + notify-send "Screenshot created" "Mode: Fullscreen" + ;; +esac diff --git a/qtile/scripts/wayland/wallpaper.sh b/qtile/scripts/wayland/wallpaper.sh new file mode 100755 index 0000000..23783ad --- /dev/null +++ b/qtile/scripts/wayland/wallpaper.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# _ _ +# __ ____ _| | |_ __ __ _ _ __ ___ _ __ +# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__| +# \ V V / (_| | | | |_) | (_| | |_) | __/ | +# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| +# |_| |_| +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +case $1 in + + # Load wallpaper from .cache of last session + "init") + if [ -f ~/.cache/current_wallpaper.jpg ]; then + wal -q -i ~/.cache/current_wallpaper.jpg + else + wal -q -i ~/wallpaper/ + fi + ;; + + # Select wallpaper with rofi + "select") + selected=$(ls -1 ~/wallpaper | grep "jpg" | rofi -dmenu -config ~/dotfiles/rofi/config-wallpaper.rasi) + if [ ! "$selected" ]; then + echo "No wallpaper selected" + exit + fi + wal -q -i ~/wallpaper/$selected + ;; + + # Randomly select wallpaper + *) + wal -q -i ~/wallpaper/ + ;; + +esac + +# ----------------------------------------------------- +# Load current pywal color scheme +# ----------------------------------------------------- +source "$HOME/.cache/wal/colors.sh" +echo "Wallpaper: $wallpaper" + +# ----------------------------------------------------- +# Copy selected wallpaper into .cache folder +# ----------------------------------------------------- +cp $wallpaper ~/.cache/current_wallpaper.jpg + +# ----------------------------------------------------- +# get wallpaper iamge name +# ----------------------------------------------------- +newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g") + +# ----------------------------------------------------- +# Set the new wallpaper +# ----------------------------------------------------- +swww init + +transition_type="wipe" +# transition_type="outer" +# transition_type="random" + +swww img $wallpaper \ + --transition-bezier .43,1.19,1,.4 \ + --transition-fps=60 \ + --transition-type=$transition_type \ + --transition-duration=0.7 \ + +qtile cmd-obj -o cmd -f reload_config + +# ----------------------------------------------------- +# Send notification +# ----------------------------------------------------- +notify-send "Colors and Wallpaper updated" "with image $newwall" + +echo "DONE!" diff --git a/qtile/scripts/x11/barswitcher.sh b/qtile/scripts/x11/barswitcher.sh new file mode 100755 index 0000000..bad0f00 --- /dev/null +++ b/qtile/scripts/x11/barswitcher.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# _ _ _ _ +# | |__ __ _ _ __ _____ _(_) |_ ___| |__ ___ _ __ +# | '_ \ / _` | '__/ __\ \ /\ / / | __/ __| '_ \ / _ \ '__| +# | |_) | (_| | | \__ \\ V V /| | || (__| | | | __/ | +# |_.__/ \__,_|_| |___/ \_/\_/ |_|\__\___|_| |_|\___|_| +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +# ----------------------------------------------------- +# Load status bar information +# ----------------------------------------------------- +bar=$(cat ~/.cache/.qtile_bar_x11.sh) + +# ----------------------------------------------------- +# Switch status bar information +# ----------------------------------------------------- +if [ $bar == "qtile" ]; then + echo "Change to Polybar" + echo "polybar" > ~/.cache/.qtile_bar_x11.sh + notify-send "Status Bar is changing..." "to Polybar" +else + echo "Change to Qtile Bar" + echo "qtile" > ~/.cache/.qtile_bar_x11.sh + notify-send "Status Bar is changing..." "to Qtile Status Bar" +fi + +# ----------------------------------------------------- +# Load status bar +# ----------------------------------------------------- +~/dotfiles/qtile/scripts/x11/loadbar.sh \ No newline at end of file diff --git a/qtile/scripts/x11/loadbar.sh b/qtile/scripts/x11/loadbar.sh new file mode 100755 index 0000000..ff8cbea --- /dev/null +++ b/qtile/scripts/x11/loadbar.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# _ _ _ +# | | ___ __ _ __| | |__ __ _ _ __ +# | |/ _ \ / _` |/ _` | '_ \ / _` | '__| +# | | (_) | (_| | (_| | |_) | (_| | | +# |_|\___/ \__,_|\__,_|_.__/ \__,_|_| +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +# ----------------------------------------------------- +# Check if information about the bar exists in .cache +# If not create it +# ----------------------------------------------------- +if [ ! -f ~/.cache/.qtile_bar_x11.sh ]; then + touch ~/.cache/.qtile_bar_x11.sh + echo "qtile" > ~/.cache/.qtile_bar_x11.sh + echo ".qtile_bar_x11.sh created" +fi + +# ----------------------------------------------------- +# Load status bar information +# ----------------------------------------------------- +bar=$(cat ~/.cache/.qtile_bar_x11.sh) + +# ----------------------------------------------------- +# Load status bar based on loaded information +# ----------------------------------------------------- +if [ $bar == "qtile" ]; then + killall polybar + sleep 0.2 + qtile cmd-obj -o cmd -f reload_config +else + killall polybar + sleep 0.2 + qtile cmd-obj -o cmd -f reload_config + sleep 0.2 + source "$HOME/.cache/wal/colors.sh" + ~/dotfiles/polybar/launch.sh & + sleep 0.2 + qtile cmd-obj -o cmd -f reload_config +fi + diff --git a/scripts/scrot.sh b/qtile/scripts/x11/screenshot.sh similarity index 95% rename from scripts/scrot.sh rename to qtile/scripts/x11/screenshot.sh index f160bc0..37f7e6a 100755 --- a/scripts/scrot.sh +++ b/qtile/scripts/x11/screenshot.sh @@ -18,7 +18,7 @@ option3="Fullscreen (delay 3 sec)" options="$option2\n$option3\n$option1" -choice=$(echo -e "$options" | rofi -i -dmenu -config ~/dotfiles/rofi/config-screenshot.rasi -width 30 -p "Take Screenshot") +choice=$(echo -e "$options" | rofi -i -dmenu -config ~/dotfiles/rofi/config-screenshot.rasi -width 30 -l 3 -p "Take Screenshot") case $choice in $option1) diff --git a/scripts/updatewal.sh b/qtile/scripts/x11/wallpaper.sh similarity index 67% rename from scripts/updatewal.sh rename to qtile/scripts/x11/wallpaper.sh index 2f79c4d..32c9f7c 100755 --- a/scripts/updatewal.sh +++ b/qtile/scripts/x11/wallpaper.sh @@ -9,17 +9,33 @@ # by Stephan Raabe (2023) # ----------------------------------------------------- -echo "Changing theme..." +case $1 in -# ----------------------------------------------------- -# Update Wallpaper with pywal -# ----------------------------------------------------- -wal -q -i ~/wallpaper/ + # Load wallpaper from .cache of last session + "init") + if [ -f ~/.cache/current_wallpaper.jpg ]; then + wal -q -i ~/.cache/current_wallpaper.jpg + else + wal -q -i ~/wallpaper/ + fi + ;; -# ----------------------------------------------------- -# Wait for 1 sec -# ----------------------------------------------------- -sleep 1 + # Select wallpaper with rofi + "select") + selected=$(ls -1 ~/wallpaper | grep "jpg" | rofi -dmenu -config ~/dotfiles/rofi/config-wallpaper.rasi) + if [ ! "$selected" ]; then + echo "No wallpaper selected" + exit + fi + wal -q -i ~/wallpaper/$selected + ;; + + # Randomly select wallpaper + *) + wal -q -i ~/wallpaper/ + ;; + +esac # ----------------------------------------------------- # Reload qtile to color bar @@ -30,6 +46,7 @@ qtile cmd-obj -o cmd -f reload_config # Get new theme # ----------------------------------------------------- source "$HOME/.cache/wal/colors.sh" +echo "Wallpaper: $wallpaper" newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g") # ----------------------------------------------------- @@ -43,5 +60,4 @@ sleep 1 # Send notification # ----------------------------------------------------- notify-send "Colors and Wallpaper updated" "with image $newwall" - echo "Done." diff --git a/ranger/commands.py b/ranger/commands.py deleted file mode 100644 index 97b7909..0000000 --- a/ranger/commands.py +++ /dev/null @@ -1,62 +0,0 @@ -# This is a sample commands.py. You can add your own commands here. -# -# Please refer to commands_full.py for all the default commands and a complete -# documentation. Do NOT add them all here, or you may end up with defunct -# commands when upgrading ranger. - -# A simple command for demonstration purposes follows. -# ----------------------------------------------------------------------------- - -from __future__ import (absolute_import, division, print_function) - -# You can import any python module as needed. -import os - -# You always need to import ranger.api.commands here to get the Command class: -from ranger.api.commands import Command - - -# Any class that is a subclass of "Command" will be integrated into ranger as a -# command. Try typing ":my_edit" in ranger! -class my_edit(Command): - # The so-called doc-string of the class will be visible in the built-in - # help that is accessible by typing "?c" inside ranger. - """:my_edit - - A sample command for demonstration purposes that opens a file in an editor. - """ - - # The execute method is called when you run this command in ranger. - def execute(self): - # self.arg(1) is the first (space-separated) argument to the function. - # This way you can write ":my_edit somefilename". - if self.arg(1): - # self.rest(1) contains self.arg(1) and everything that follows - target_filename = self.rest(1) - else: - # self.fm is a ranger.core.filemanager.FileManager object and gives - # you access to internals of ranger. - # self.fm.thisfile is a ranger.container.file.File object and is a - # reference to the currently selected file. - target_filename = self.fm.thisfile.path - - # This is a generic function to print text in ranger. - self.fm.notify("Let's edit the file " + target_filename + "!") - - # Using bad=True in fm.notify allows you to print error messages: - if not os.path.exists(target_filename): - self.fm.notify("The given file does not exist!", bad=True) - return - - # This executes a function from ranger.core.acitons, a module with a - # variety of subroutines that can help you construct commands. - # Check out the source, or run "pydoc ranger.core.actions" for a list. - self.fm.edit_file(target_filename) - - # The tab method is called when you press tab, and should return a list of - # suggestions that the user will tab through. - # tabnum is 1 for and -1 for by default - def tab(self, tabnum): - # This is a generic tab-completion function that iterates through the - # content of the current directory. - return self._tab_directory_content() diff --git a/ranger/commands_full.py b/ranger/commands_full.py deleted file mode 100644 index 5defa67..0000000 --- a/ranger/commands_full.py +++ /dev/null @@ -1,1993 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of ranger, the console file manager. -# This configuration file is licensed under the same terms as ranger. -# =================================================================== -# -# NOTE: If you copied this file to /etc/ranger/commands_full.py or -# ~/.config/ranger/commands_full.py, then it will NOT be loaded by ranger, -# and only serve as a reference. -# -# =================================================================== -# This file contains ranger's commands. -# It's all in python; lines beginning with # are comments. -# -# Note that additional commands are automatically generated from the methods -# of the class ranger.core.actions.Actions. -# -# You can customize commands in the files /etc/ranger/commands.py (system-wide) -# and ~/.config/ranger/commands.py (per user). -# They have the same syntax as this file. In fact, you can just copy this -# file to ~/.config/ranger/commands_full.py with -# `ranger --copy-config=commands_full' and make your modifications, don't -# forget to rename it to commands.py. You can also use -# `ranger --copy-config=commands' to copy a short sample commands.py that -# has everything you need to get started. -# But make sure you update your configs when you update ranger. -# -# =================================================================== -# Every class defined here which is a subclass of `Command' will be used as a -# command in ranger. Several methods are defined to interface with ranger: -# execute(): called when the command is executed. -# cancel(): called when closing the console. -# tab(tabnum): called when is pressed. -# quick(): called after each keypress. -# -# tab() argument tabnum is 1 for and -1 for by default -# -# The return values for tab() can be either: -# None: There is no tab completion -# A string: Change the console to this string -# A list/tuple/generator: cycle through every item in it -# -# The return value for quick() can be: -# False: Nothing happens -# True: Execute the command afterwards -# -# The return value for execute() and cancel() doesn't matter. -# -# =================================================================== -# Commands have certain attributes and methods that facilitate parsing of -# the arguments: -# -# self.line: The whole line that was written in the console. -# self.args: A list of all (space-separated) arguments to the command. -# self.quantifier: If this command was mapped to the key "X" and -# the user pressed 6X, self.quantifier will be 6. -# self.arg(n): The n-th argument, or an empty string if it doesn't exist. -# self.rest(n): The n-th argument plus everything that followed. For example, -# if the command was "search foo bar a b c", rest(2) will be "bar a b c" -# self.start(n): Anything before the n-th argument. For example, if the -# command was "search foo bar a b c", start(2) will be "search foo" -# -# =================================================================== -# And this is a little reference for common ranger functions and objects: -# -# self.fm: A reference to the "fm" object which contains most information -# about ranger. -# self.fm.notify(string): Print the given string on the screen. -# self.fm.notify(string, bad=True): Print the given string in RED. -# self.fm.reload_cwd(): Reload the current working directory. -# self.fm.thisdir: The current working directory. (A File object.) -# self.fm.thisfile: The current file. (A File object too.) -# self.fm.thistab.get_selection(): A list of all selected files. -# self.fm.execute_console(string): Execute the string as a ranger command. -# self.fm.open_console(string): Open the console with the given string -# already typed in for you. -# self.fm.move(direction): Moves the cursor in the given direction, which -# can be something like down=3, up=5, right=1, left=1, to=6, ... -# -# File objects (for example self.fm.thisfile) have these useful attributes and -# methods: -# -# tfile.path: The path to the file. -# tfile.basename: The base name only. -# tfile.load_content(): Force a loading of the directories content (which -# obviously works with directories only) -# tfile.is_directory: True/False depending on whether it's a directory. -# -# For advanced commands it is unavoidable to dive a bit into the source code -# of ranger. -# =================================================================== - -from __future__ import (absolute_import, division, print_function) - -from collections import deque -import os -import re - -from ranger.api.commands import Command - - -class alias(Command): - """:alias - - Copies the oldcommand as newcommand. - """ - - context = 'browser' - resolve_macros = False - - def execute(self): - if not self.arg(1) or not self.arg(2): - self.fm.notify('Syntax: alias ', bad=True) - return - - self.fm.commands.alias(self.arg(1), self.rest(2)) - - -class echo(Command): - """:echo - - Display the text in the statusbar. - """ - - def execute(self): - self.fm.notify(self.rest(1)) - - -class cd(Command): - """:cd [-r] - - The cd command changes the directory. - If the path is a file, selects that file. - The command 'cd -' is equivalent to typing ``. - Using the option "-r" will get you to the real path. - """ - - def execute(self): - if self.arg(1) == '-r': - self.shift() - destination = os.path.realpath(self.rest(1)) - if os.path.isfile(destination): - self.fm.select_file(destination) - return - else: - destination = self.rest(1) - - if not destination: - destination = '~' - - if destination == '-': - self.fm.enter_bookmark('`') - else: - self.fm.cd(destination) - - def _tab_args(self): - # dest must be rest because path could contain spaces - if self.arg(1) == '-r': - start = self.start(2) - dest = self.rest(2) - else: - start = self.start(1) - dest = self.rest(1) - - if dest: - head, tail = os.path.split(os.path.expanduser(dest)) - if head: - dest_exp = os.path.join(os.path.normpath(head), tail) - else: - dest_exp = tail - else: - dest_exp = '' - return (start, dest_exp, os.path.join(self.fm.thisdir.path, dest_exp), - dest.endswith(os.path.sep)) - - @staticmethod - def _tab_paths(dest, dest_abs, ends_with_sep): - if not dest: - try: - return next(os.walk(dest_abs))[1], dest_abs - except (OSError, StopIteration): - return [], '' - - if ends_with_sep: - try: - return [os.path.join(dest, path) for path in next(os.walk(dest_abs))[1]], '' - except (OSError, StopIteration): - return [], '' - - return None, None - - def _tab_match(self, path_user, path_file): - if self.fm.settings.cd_tab_case == 'insensitive': - path_user = path_user.lower() - path_file = path_file.lower() - elif self.fm.settings.cd_tab_case == 'smart' and path_user.islower(): - path_file = path_file.lower() - return path_file.startswith(path_user) - - def _tab_normal(self, dest, dest_abs): - dest_dir = os.path.dirname(dest) - dest_base = os.path.basename(dest) - - try: - dirnames = next(os.walk(os.path.dirname(dest_abs)))[1] - except (OSError, StopIteration): - return [], '' - - return [os.path.join(dest_dir, d) for d in dirnames if self._tab_match(dest_base, d)], '' - - def _tab_fuzzy_match(self, basepath, tokens): - """ Find directories matching tokens recursively """ - if not tokens: - tokens = [''] - paths = [basepath] - while True: - token = tokens.pop() - matches = [] - for path in paths: - try: - directories = next(os.walk(path))[1] - except (OSError, StopIteration): - continue - matches += [os.path.join(path, d) for d in directories - if self._tab_match(token, d)] - if not tokens or not matches: - return matches - paths = matches - - return None - - def _tab_fuzzy(self, dest, dest_abs): - tokens = [] - basepath = dest_abs - while True: - basepath_old = basepath - basepath, token = os.path.split(basepath) - if basepath == basepath_old: - break - if os.path.isdir(basepath_old) and not token.startswith('.'): - basepath = basepath_old - break - tokens.append(token) - - paths = self._tab_fuzzy_match(basepath, tokens) - if not os.path.isabs(dest): - paths_rel = self.fm.thisdir.path - paths = [os.path.relpath(os.path.join(basepath, path), paths_rel) - for path in paths] - else: - paths_rel = '' - return paths, paths_rel - - def tab(self, tabnum): - from os.path import sep - - start, dest, dest_abs, ends_with_sep = self._tab_args() - - paths, paths_rel = self._tab_paths(dest, dest_abs, ends_with_sep) - if paths is None: - if self.fm.settings.cd_tab_fuzzy: - paths, paths_rel = self._tab_fuzzy(dest, dest_abs) - else: - paths, paths_rel = self._tab_normal(dest, dest_abs) - - paths.sort() - - if self.fm.settings.cd_bookmarks: - paths[0:0] = [ - os.path.relpath(v.path, paths_rel) if paths_rel else v.path - for v in self.fm.bookmarks.dct.values() for path in paths - if v.path.startswith(os.path.join(paths_rel, path) + sep) - ] - - if not paths: - return None - if len(paths) == 1: - return start + paths[0] + sep - return [start + dirname + sep for dirname in paths] - - -class chain(Command): - """:chain ; ; ... - - Calls multiple commands at once, separated by semicolons. - """ - resolve_macros = False - - def execute(self): - if not self.rest(1).strip(): - self.fm.notify('Syntax: chain ; ; ...', bad=True) - return - for command in [s.strip() for s in self.rest(1).split(";")]: - self.fm.execute_console(command) - - -class shell(Command): - escape_macros_for_shell = True - - def execute(self): - if self.arg(1) and self.arg(1)[0] == '-': - flags = self.arg(1)[1:] - command = self.rest(2) - else: - flags = '' - command = self.rest(1) - - if command: - self.fm.execute_command(command, flags=flags) - - def tab(self, tabnum): - from ranger.ext.get_executables import get_executables - if self.arg(1) and self.arg(1)[0] == '-': - command = self.rest(2) - else: - command = self.rest(1) - start = self.line[0:len(self.line) - len(command)] - - try: - position_of_last_space = command.rindex(" ") - except ValueError: - return (start + program + ' ' for program - in get_executables() if program.startswith(command)) - if position_of_last_space == len(command) - 1: - selection = self.fm.thistab.get_selection() - if len(selection) == 1: - return self.line + selection[0].shell_escaped_basename + ' ' - return self.line + '%s ' - - before_word, start_of_word = self.line.rsplit(' ', 1) - return (before_word + ' ' + file.shell_escaped_basename - for file in self.fm.thisdir.files or [] - if file.shell_escaped_basename.startswith(start_of_word)) - - -class open_with(Command): - - def execute(self): - app, flags, mode = self._get_app_flags_mode(self.rest(1)) - self.fm.execute_file( - files=[f for f in self.fm.thistab.get_selection()], - app=app, - flags=flags, - mode=mode) - - def tab(self, tabnum): - return self._tab_through_executables() - - def _get_app_flags_mode(self, string): # pylint: disable=too-many-branches,too-many-statements - """Extracts the application, flags and mode from a string. - - examples: - "mplayer f 1" => ("mplayer", "f", 1) - "atool 4" => ("atool", "", 4) - "p" => ("", "p", 0) - "" => None - """ - - app = '' - flags = '' - mode = 0 - split = string.split() - - if len(split) == 1: - part = split[0] - if self._is_app(part): - app = part - elif self._is_flags(part): - flags = part - elif self._is_mode(part): - mode = part - - elif len(split) == 2: - part0 = split[0] - part1 = split[1] - - if self._is_app(part0): - app = part0 - if self._is_flags(part1): - flags = part1 - elif self._is_mode(part1): - mode = part1 - elif self._is_flags(part0): - flags = part0 - if self._is_mode(part1): - mode = part1 - elif self._is_mode(part0): - mode = part0 - if self._is_flags(part1): - flags = part1 - - elif len(split) >= 3: - part0 = split[0] - part1 = split[1] - part2 = split[2] - - if self._is_app(part0): - app = part0 - if self._is_flags(part1): - flags = part1 - if self._is_mode(part2): - mode = part2 - elif self._is_mode(part1): - mode = part1 - if self._is_flags(part2): - flags = part2 - elif self._is_flags(part0): - flags = part0 - if self._is_mode(part1): - mode = part1 - elif self._is_mode(part0): - mode = part0 - if self._is_flags(part1): - flags = part1 - - return app, flags, int(mode) - - def _is_app(self, arg): - return not self._is_flags(arg) and not arg.isdigit() - - @staticmethod - def _is_flags(arg): - from ranger.core.runner import ALLOWED_FLAGS - return all(x in ALLOWED_FLAGS for x in arg) - - @staticmethod - def _is_mode(arg): - return all(x in '0123456789' for x in arg) - - -class set_(Command): - """:set