diff --git a/README.md b/README.md index 8efcf42..caa1d01 100755 --- a/README.md +++ b/README.md @@ -8,4 +8,8 @@ One uses JQ the other awk,grep and sed. They basically achieve the same thing th # Where did the name come from? -Well, one day I was watching a youtube video about a new type of scam that was discovered by the youtuber Pleasent Green. Which dealt with becoming a reseller / middle man for a fictiious herb called lactozora. I basically just stole the name. \ No newline at end of file +Well, one day I was watching a youtube video about a new type of scam that was discovered by the youtuber Pleasent Green. Which dealt with becoming a reseller / middle man for a fictiious herb called lactozora. I basically just stole the name. + +# Push test + +Ignore this block its for testing a new git setup diff --git a/config.json b/config.json old mode 100644 new mode 100755 diff --git a/modules/gui.bash b/modules/gui.bash old mode 100644 new mode 100755 diff --git a/modules/keydb.bash b/modules/keydb.bash index dac0886..86f97e0 100755 --- a/modules/keydb.bash +++ b/modules/keydb.bash @@ -65,6 +65,6 @@ check_redis_cli # Code goes here -redis_save "bashini" "new" -redis_get "bashini" +#redis_save "bashini" "new" +#redis_get "bashini" diff --git a/modules/zellij.bash b/modules/zellij.bash old mode 100644 new mode 100755 index 431614e..d629c29 --- a/modules/zellij.bash +++ b/modules/zellij.bash @@ -1,20 +1,71 @@ #!/bin/bash -config="main" # default config +# Default configuration +config="main" export ZELLIJ_CONFIG="$config" # Function to check if zellij is installed is_zellij_installed() { - if ! command -v zellij &> /dev/null - then + if ! command -v zellij &> /dev/null; then echo "This module needs zellij to be installed." - exit + exit 1 fi } -is_zellij_installed +# Function to check if a session is running +is_session_running() { + if pgrep -x "zellij" > /dev/null; then + return 0 + else + return 1 + fi +} -# check if a session is already running -if pgrep -x "zellij" > /dev/null -then - zellij attach "$config" +# Function to list all zellij sessions +list_sessions() { + zellij list-sessions +} + +# Function to create a new session +create_session() { + local session_name="${1:-$config}" + zellij -s "$session_name" +} + +# Function to attach to a session +attach_session() { + local session_name="${1:-$config}" + zellij attach "$session_name" +} + +# Function to kill a session +kill_session() { + local session_name="${1:-$config}" + zellij kill-session "$session_name" +} + +# Function to load a layout +load_layout() { + local layout_name="$1" + if [ -z "$layout_name" ]; then + echo "Please specify a layout name." + return 1 + fi + zellij --layout "$layout_name" +} + +# Main function to handle session management +zellij_main() { + is_zellij_installed + + if is_session_running; then + attach_session + else + create_session + fi +} + +# Execute main function if script is run directly +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + zellij_main +fi