From d60d417579503fda6b03c6dfd52ea2995e5a1ea3 Mon Sep 17 00:00:00 2001 From: kake26 Date: Mon, 27 Jan 2025 00:12:03 -0600 Subject: [PATCH] save point --- README.md | 0 config.json | 3 +++ modules/config.ini | 0 modules/config.json | 0 modules/gui.bash | 7 +++++++ modules/keydb.bash | 0 modules/ntfy.bash | 12 +++++++++++- modules/zellij.bash | 20 ++++++++++++++++++++ script.bash | 7 +++++++ 9 files changed, 48 insertions(+), 1 deletion(-) mode change 100644 => 100755 README.md create mode 100644 config.json mode change 100644 => 100755 modules/config.ini mode change 100644 => 100755 modules/config.json create mode 100644 modules/gui.bash mode change 100644 => 100755 modules/keydb.bash mode change 100644 => 100755 modules/ntfy.bash create mode 100644 modules/zellij.bash diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/config.json b/config.json new file mode 100644 index 0000000..a89bb28 --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "bashini": "new" +} diff --git a/modules/config.ini b/modules/config.ini old mode 100644 new mode 100755 diff --git a/modules/config.json b/modules/config.json old mode 100644 new mode 100755 diff --git a/modules/gui.bash b/modules/gui.bash new file mode 100644 index 0000000..7fb4941 --- /dev/null +++ b/modules/gui.bash @@ -0,0 +1,7 @@ +#!/bin/bash + +# Function to show a notification using zenity +show_notification() { + local message="$1" + zenity --info --text="$message" --title="Notification" +} diff --git a/modules/keydb.bash b/modules/keydb.bash old mode 100644 new mode 100755 diff --git a/modules/ntfy.bash b/modules/ntfy.bash old mode 100644 new mode 100755 index 23fa1af..559b9e6 --- a/modules/ntfy.bash +++ b/modules/ntfy.bash @@ -10,5 +10,15 @@ then exit fi -ntfyserver="http://192.168.168:83" + + +# Function to send a message to a NTFY server +send_ntfy_message() { + local message="$1" + local topic="$2" + ntfyserver="192.168.1.112:83" + local url="http://${ntfyserver}/${topic:-default}" + + curl -X POST -d "$message" "$url" +} diff --git a/modules/zellij.bash b/modules/zellij.bash new file mode 100644 index 0000000..431614e --- /dev/null +++ b/modules/zellij.bash @@ -0,0 +1,20 @@ +#!/bin/bash + +config="main" # default config +export ZELLIJ_CONFIG="$config" + +# Function to check if zellij is installed +is_zellij_installed() { + if ! command -v zellij &> /dev/null + then + echo "This module needs zellij to be installed." + exit + fi +} + +is_zellij_installed + +# check if a session is already running +if pgrep -x "zellij" > /dev/null +then + zellij attach "$config" diff --git a/script.bash b/script.bash index 669b690..e12d563 100755 --- a/script.bash +++ b/script.bash @@ -19,6 +19,13 @@ cleanup() { } source ./modules/config_json.bash # can be json or ini, I preffer json +source ./modules/gui.bash +source ./modules/ntfy.bash +#source ./modules/keydb.bash # Keydb / Redis interaction functions, works for both + +show_notification "Hello World!" + +send_ntfy_message "Hello World!" "kuma" \ No newline at end of file