fix: Launch script from the directory in which it's contained

This commit is contained in:
Liam 2024-08-14 23:13:56 -07:00
parent 1d5b1e6676
commit d4489648b4
No known key found for this signature in database
23 changed files with 28 additions and 25 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
setupAlacritty() { setupAlacritty() {
echo "Install Alacritty if not already installed..." echo "Install Alacritty if not already installed..."

View File

@ -1,5 +1,5 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
makeDWM(){ makeDWM(){
cd $HOME && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus cd $HOME && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus
@ -24,4 +24,4 @@ setupDWM() {
checkEnv checkEnv
setupDWM setupDWM
makeDWM makeDWM

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
setupKitty() { setupKitty() {
echo "Install Kitty if not already installed..." echo "Install Kitty if not already installed..."

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
setupRofi() { setupRofi() {
echo "Install Rofi if not already installed..." echo "Install Rofi if not already installed..."

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. ./common-script.sh . ../common-script.sh
# Function to install zsh # Function to install zsh
install_zsh() { install_zsh() {
@ -48,4 +48,4 @@ EOL
checkEnv checkEnv
setup_zsh_config setup_zsh_config
install_zsh install_zsh

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
installPkg() { installPkg() {
echo "Install UFW if not already installed..." echo "Install UFW if not already installed..."

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
# Check if the home directory and linuxtoolbox folder exist, create them if they don't # Check if the home directory and linuxtoolbox folder exist, create them if they don't
LINUXTOOLBOXDIR="$HOME/linuxtoolbox" LINUXTOOLBOXDIR="$HOME/linuxtoolbox"

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
installDepend() { installDepend() {
## Check for dependencies. ## Check for dependencies.

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
# Check if the home directory and linuxtoolbox folder exist, create them if they don't # Check if the home directory and linuxtoolbox folder exist, create them if they don't
LINUXTOOLBOXDIR="$HOME/linuxtoolbox" LINUXTOOLBOXDIR="$HOME/linuxtoolbox"

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
removeSnaps() { removeSnaps() {
case $PACKAGER in case $PACKAGER in

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
. ./common-script.sh . ../common-script.sh
fastUpdate() { fastUpdate() {
case ${PACKAGER} in case ${PACKAGER} in

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to auto-detect displays and set common resolution # Function to auto-detect displays and set common resolution
auto_detect_displays() { auto_detect_displays() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to change monitor orientation # Function to change monitor orientation
change_orientation() { change_orientation() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
RESET='\033[0m' RESET='\033[0m'
BOLD='\033[1m' BOLD='\033[1m'

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to duplicate displays # Function to duplicate displays
duplicate_displays() { duplicate_displays() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
RESET='\033[0m' RESET='\033[0m'
BOLD='\033[1m' BOLD='\033[1m'

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to extend displays # Function to extend displays
extend_displays() { extend_displays() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to manage monitor arrangement # Function to manage monitor arrangement
manage_arrangement() { manage_arrangement() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to reset scaling back to 1 (native resolution) for all monitors # Function to reset scaling back to 1 (native resolution) for all monitors
reset_scaling() { reset_scaling() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to scale smaller monitors to the highest resolution of a bigger monitor # Function to scale smaller monitors to the highest resolution of a bigger monitor
scale_monitors() { scale_monitors() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
# Function to set a monitor as primary # Function to set a monitor as primary
set_primary_monitor() { set_primary_monitor() {

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
source ./utils/monitor-control/utility_functions.sh source ./utility_functions.sh
RESET='\033[0m' RESET='\033[0m'
BOLD='\033[1m' BOLD='\033[1m'

View File

@ -137,7 +137,10 @@ impl RunningCommand {
cmd.arg(prompt); cmd.arg(prompt);
} }
Command::LocalFile(file) => { Command::LocalFile(file) => {
cmd.arg(file); cmd.arg(&file);
if let Some(parent) = file.parent() {
cmd.cwd(parent);
}
} }
Command::None => panic!("Command::None was treated as a command"), Command::None => panic!("Command::None was treated as a command"),
} }