mirror of
https://github.imc.re/void-land/hyprland-void-dots
synced 2025-06-04 02:03:43 +02:00
refactor: stow shell file
This commit is contained in:
parent
0ef1c24c04
commit
afa1d96c2e
13 changed files with 27 additions and 16 deletions
43
stow.sh
43
stow.sh
|
@ -1,7 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
configs_dir="$(pwd)/configs"
|
configs_dir="$(pwd)/configs"
|
||||||
shortcuts_dir="$(pwd)/configs/shortcuts"
|
dotfiles_dir="$configs_dir/dotfiles"
|
||||||
|
shell_dir="$configs_dir/shell"
|
||||||
|
shortcuts_dir="$configs_dir/shortcuts"
|
||||||
|
hyprland_dir="$configs_dir/hyprland"
|
||||||
|
|
||||||
display_help() {
|
display_help() {
|
||||||
echo "Usage: [-s | -u] [-h]"
|
echo "Usage: [-s | -u] [-h]"
|
||||||
|
@ -50,14 +53,14 @@ unstow_shortcuts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
stow_dotfiles() {
|
stow_dotfiles() {
|
||||||
create_symlinks $configs_dir/dotfiles ~/.config
|
create_symlinks $dotfiles_dir ~/.config
|
||||||
create_symlinks $configs_dir/sh ~/
|
create_symlinks $shell_dir ~/
|
||||||
|
|
||||||
echo "Dotfiles stowed successfully!"
|
echo "Dotfiles stowed successfully!"
|
||||||
}
|
}
|
||||||
|
|
||||||
unstow_dotfiles() {
|
unstow_dotfiles() {
|
||||||
for folder in $configs_dir/dotfiles/*; do
|
for folder in $dotfiles_dir/*; do
|
||||||
local folder_name=$(basename $folder)
|
local folder_name=$(basename $folder)
|
||||||
local target_folder=~/.config/$folder_name
|
local target_folder=~/.config/$folder_name
|
||||||
|
|
||||||
|
@ -69,7 +72,7 @@ unstow_dotfiles() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for config in $configs_dir/sh/.*; do
|
for config in $shell_dir/.*; do
|
||||||
if [ -f $config ]; then
|
if [ -f $config ]; then
|
||||||
local file_name=$(basename $config)
|
local file_name=$(basename $config)
|
||||||
local target_file=~/$file_name
|
local target_file=~/$file_name
|
||||||
|
@ -96,13 +99,13 @@ unstow_dotfiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
stow_hyprland() {
|
stow_hyprland() {
|
||||||
create_symlinks $configs_dir/hyprland ~/.config
|
create_symlinks $hyprland_dir ~/.config
|
||||||
|
|
||||||
echo "Hyprland stowed successfully!"
|
echo "Hyprland stowed successfully!"
|
||||||
}
|
}
|
||||||
|
|
||||||
unstow_hyprland() {
|
unstow_hyprland() {
|
||||||
for config in $configs_dir/hyprland/*; do
|
for config in $hyprland_dir/*; do
|
||||||
config_name=$(basename $config)
|
config_name=$(basename $config)
|
||||||
target_config=~/.config/$config_name
|
target_config=~/.config/$config_name
|
||||||
|
|
||||||
|
@ -115,20 +118,28 @@ unstow_hyprland() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stow() {
|
||||||
|
create_target_dir
|
||||||
|
stow_dotfiles
|
||||||
|
stow_shortcuts
|
||||||
|
stow_hyprland
|
||||||
|
}
|
||||||
|
|
||||||
|
unstow() {
|
||||||
|
unstow_dotfiles
|
||||||
|
unstow_shortcuts
|
||||||
|
unstow_hyprland
|
||||||
|
|
||||||
|
echo "All configs ustowed successfully !"
|
||||||
|
}
|
||||||
|
|
||||||
while getopts ":suh" opt; do
|
while getopts ":suh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
s)
|
s)
|
||||||
create_target_dir
|
stow
|
||||||
stow_dotfiles
|
|
||||||
stow_shortcuts
|
|
||||||
stow_hyprland
|
|
||||||
;;
|
;;
|
||||||
u)
|
u)
|
||||||
unstow_dotfiles
|
unstow
|
||||||
unstow_shortcuts
|
|
||||||
unstow_hyprland
|
|
||||||
|
|
||||||
echo "All configs stowed successfully !"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
display_help
|
display_help
|
||||||
|
|
Loading…
Add table
Reference in a new issue