From 3604752ed7f886a334a6c0c0aef6631ba90a05a2 Mon Sep 17 00:00:00 2001 From: hesam-init Date: Sat, 24 Feb 2024 16:10:28 +0330 Subject: [PATCH] feat: stow and unstow applications shortcut function --- dots/.stow-local-ignore | 3 ++- dots/shortcuts/nekoray.desktop | 11 +++++++++++ dots/shortcuts/vscode.desktop | 13 +++++++++++++ stow.sh | 27 +++++++++++++++++++++------ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 dots/shortcuts/nekoray.desktop create mode 100644 dots/shortcuts/vscode.desktop diff --git a/dots/.stow-local-ignore b/dots/.stow-local-ignore index e0b72f6..2a4ddde 100644 --- a/dots/.stow-local-ignore +++ b/dots/.stow-local-ignore @@ -1 +1,2 @@ -zsh \ No newline at end of file +zsh +shortcuts \ No newline at end of file diff --git a/dots/shortcuts/nekoray.desktop b/dots/shortcuts/nekoray.desktop new file mode 100644 index 0000000..9f6051c --- /dev/null +++ b/dots/shortcuts/nekoray.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Nekoray +Comment=V2ray Client +GenericName=VPN +Exec=/opt/nekoray/nekoray +Icon=/opt/nekoray/nekobox.png +Type=Application +Terminal=false +Categories=Network;Internet; +MimeType= +Keywords=nekoray;VPN;V2Ray; \ No newline at end of file diff --git a/dots/shortcuts/vscode.desktop b/dots/shortcuts/vscode.desktop new file mode 100644 index 0000000..d93132a --- /dev/null +++ b/dots/shortcuts/vscode.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=Visual Studio Code +Comment=Code Editing. Refined. +GenericName=Text Editor +Exec=/opt/vscode/code --no-sandbox --unity-launch +Icon=/opt/vscode/resources/app/resources/linux/code.png +Type=Application +StartupNotify=false +StartupWMClass=Code +Categories=Utility;TextEditor;Development;IDE; +MimeType=text/plain;inode/directory;application/x-visual-studio-code-workspace; +Actions=new-empty-window; +Keywords=vscode; \ No newline at end of file diff --git a/stow.sh b/stow.sh index a944a11..fa4ea73 100755 --- a/stow.sh +++ b/stow.sh @@ -1,5 +1,9 @@ #!/bin/bash +dots_dir="dots" +hyprland_dir="hyprland" +shortcuts_target_dir="$HOME/.local/share/applications" + display_help() { echo "Usage: [-s | -u] [-h]" echo " -s Stow dotfiles" @@ -7,17 +11,27 @@ display_help() { echo " -h Display this help message" } +stow_shortcuts() { + mkdir -p $shortcuts_target_dir + stow -d $dots_dir -S shortcuts -t $shortcuts_target_dir + + echo "Shortcuts stowed successfully!" +} + stow_dotfiles() { - stow dots - stow -d dots -S zsh -t ~/ - stow hyprland + stow $dots_dir + stow -d $dots_dir -S zsh -t ~/ + stow $hyprland_dir + echo "Dotfiles stowed successfully!" } unstow_dotfiles() { - stow -D dots - stow -D -d dots -t ~/ zsh - stow -D hyprland + stow -D $dots_dir + stow -D -d $dots_dir -t ~/ zsh + stow -D -d $dots_dir -t $shortcuts_target_dir shortcuts + # stow -D $hyprland_dir + echo "Dotfiles unstowed successfully!" } @@ -25,6 +39,7 @@ while getopts ":suh" opt; do case $opt in s) stow_dotfiles + stow_shortcuts ;; u) unstow_dotfiles