mirror of
https://github.com/tumillanino/miasma-os.git
synced 2026-04-11 07:15:31 +00:00
moved etc into usr folder
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
# Tests that the default options are set correctly
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option @catppuccin_status_application | grep -q "@thm_" &&
|
||||
echo "@catppuccin_status_application did not expand all colors"
|
||||
|
||||
print_option @catppuccin_status_application | sed -E 's/(bash|fish|zsh)/<application>/'
|
||||
@@ -0,0 +1 @@
|
||||
@catppuccin_status_application #[fg=#eba0ac]#[fg=#11111b,bg=#eba0ac] #[fg=#cdd6f4,bg=#313244]#{E:@catppuccin_application_text}#[fg=#313244]
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
# Tests that the default options are set correctly
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option @catppuccin_status_battery
|
||||
@@ -0,0 +1 @@
|
||||
@catppuccin_status_battery #[fg=#b4befe]#[fg=#11111b,bg=#b4befe]#{l:#{battery_icon}} #[fg=#cdd6f4,bg=#313244]#{E:@catppuccin_battery_text}#[fg=#313244]
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
# Tests that the default options are set correctly
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option E:@catppuccin_status_cpu
|
||||
@@ -0,0 +1 @@
|
||||
E:@catppuccin_status_cpu #[fg=#f9e2af]#[fg=#11111b,bg=#f9e2af] #[fg=#{cpu_fg_color},bg=#{cpu_bg_color}] #{cpu_percentage}#[fg=#{cpu_bg_color}]
|
||||
13
files/system/usr/etc/skel/.tmux/plugins/tmux/tests/default_options.sh
Executable file
13
files/system/usr/etc/skel/.tmux/plugins/tmux/tests/default_options.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
# Tests that the default options are set correctly
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option @catppuccin_flavor
|
||||
print_option @catppuccin_menu_selected_style
|
||||
print_option @catppuccin_pane_active_border_style
|
||||
@@ -0,0 +1,3 @@
|
||||
@catppuccin_flavor mocha
|
||||
@catppuccin_menu_selected_style fg=#{@thm_fg},bold,bg=#{@thm_overlay_0}
|
||||
@catppuccin_pane_active_border_style ##{?pane_in_mode,fg=#{@thm_lavender},##{?pane_synchronized,fg=#{@thm_mauve},fg=#{@thm_lavender}}}
|
||||
153
files/system/usr/etc/skel/.tmux/plugins/tmux/tests/harness.sh
Executable file
153
files/system/usr/etc/skel/.tmux/plugins/tmux/tests/harness.sh
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Euo pipefail
|
||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||
|
||||
usage() {
|
||||
trap - EXIT
|
||||
cat <<EOF
|
||||
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
|
||||
|
||||
Checks that running the given script, specified with -t, matches the output
|
||||
specified in the file with -e.
|
||||
|
||||
Available options:
|
||||
|
||||
-h, --help Print this help and exit
|
||||
-t, --test The script to run to generate the test output
|
||||
-e, --expected File that contains the expected output of the test
|
||||
-v, --verbose Enable verbose messaging
|
||||
--no-color Do not use color in the output
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
DIFFCOLORS="never" NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
|
||||
setup_colors() {
|
||||
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
|
||||
DIFFCOLORS="always" NOFORMAT='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
|
||||
else
|
||||
# shellcheck disable=SC2034
|
||||
DIFFCOLORS="never" NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
|
||||
fi
|
||||
}
|
||||
|
||||
VERBOSE=false
|
||||
|
||||
msg() {
|
||||
echo >&2 -e "${1-}"
|
||||
}
|
||||
|
||||
msg_verbose() {
|
||||
if [ "$VERBOSE" = true ]; then
|
||||
msg "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
SOCKET_NAME="${SOCKET_NAME:-test}"
|
||||
SESSION_NAME="test-session"
|
||||
|
||||
tmux() {
|
||||
command tmux -L "$SOCKET_NAME" -f /dev/null "$@"
|
||||
}
|
||||
|
||||
start_tmux_server() {
|
||||
msg_verbose "${CYAN}Starting tmux server on socket ${SOCKET_NAME}${NOFORMAT}"
|
||||
tmux new -s "$SESSION_NAME" -d "$(which bash)"
|
||||
}
|
||||
|
||||
kill_tmux_server() {
|
||||
msg_verbose "${CYAN}Stopping tmux server${NOFORMAT}"
|
||||
tmux kill-session "$SESSION_NAME" 2>/dev/null
|
||||
tmux kill-server 2>/dev/null
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
trap - SIGINT SIGTERM ERR EXIT
|
||||
|
||||
# If the session is still running then stop it.
|
||||
tmux has-session -t "$SESSION_NAME" 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
kill_tmux_server
|
||||
fi
|
||||
}
|
||||
|
||||
die() {
|
||||
local msg=$1
|
||||
local code=${2-1} # default exit status 1
|
||||
msg "$msg"
|
||||
|
||||
cleanup
|
||||
|
||||
exit "$code"
|
||||
}
|
||||
|
||||
parse_params() {
|
||||
# default values of variables set from params
|
||||
test_script=''
|
||||
expected_output=''
|
||||
|
||||
while :; do
|
||||
case "${1-}" in
|
||||
-h | --help) usage ;;
|
||||
--no-color) NO_COLOR=1 ;;
|
||||
-t | --test)
|
||||
test_script="${2-}"
|
||||
shift
|
||||
;;
|
||||
-e | --expected)
|
||||
expected_output="${2-}"
|
||||
shift
|
||||
;;
|
||||
-v | --verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
-?*) die "Unknown option: $1" ;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
args=("$@")
|
||||
|
||||
# check required params and arguments
|
||||
[[ -z "${test_script-}" ]] && die "Missing required parameter: -t|--test"
|
||||
[[ -z "${expected_output-}" ]] && die "Missing required parameter: -e|--expected"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
parse_params "$@"
|
||||
setup_colors
|
||||
|
||||
run_test() {
|
||||
msg_verbose "Running test ${test_script} and checking the output against ${expected_output}"
|
||||
|
||||
start_tmux_server
|
||||
|
||||
local script_name
|
||||
script_name=$(basename "${test_script}")
|
||||
|
||||
local output
|
||||
# shellcheck disable=SC1090
|
||||
output=$(source "${test_script}")
|
||||
test_exit_code="$?"
|
||||
|
||||
if test $test_exit_code -ne 0; then
|
||||
die "\n${RED}Test ${script_name} exited with code $test_exit_code ${NOFORMAT}"
|
||||
fi
|
||||
|
||||
echo -e "${output}" | diff -abB --color=${DIFFCOLORS} "${expected_output}" -
|
||||
|
||||
if test $? -eq 0; then
|
||||
msg "${GREEN}Test ${script_name} passed${NOFORMAT}"
|
||||
else
|
||||
die "\n${RED}Test ${script_name} failed${NOFORMAT}"
|
||||
fi
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
run_test
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Returns the value of given tmux option.
|
||||
# First argument is the option name, e.g. @catppuccin_flavor.
|
||||
#
|
||||
# Usage: `get_option @catppuccin_flavor`
|
||||
# Would return: `mocha`
|
||||
#
|
||||
# The option is given as a format string.
|
||||
get_option() {
|
||||
local option
|
||||
option=$1
|
||||
|
||||
tmux display-message -p "#{${option}}"
|
||||
}
|
||||
|
||||
# Prints the given tmux option to stdout.
|
||||
# First argument is the option name, e.g. @catppuccin_flavor.
|
||||
#
|
||||
# Usage: `print_option @catppuccin_flavor`
|
||||
# Would print: `@catppuccin_flavor mocha`
|
||||
#
|
||||
# The option is given as a format string.
|
||||
print_option() {
|
||||
local option
|
||||
option=$1
|
||||
|
||||
printf "\n%s " "${option}"
|
||||
get_option "$option"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
# Tests that the default options are set correctly
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option E:@catppuccin_status_load
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
E:@catppuccin_status_load #[fg=#89b4fa]#[fg=#11111b,bg=#89b4fa] #[fg=#cdd6f4,bg=#313244]#(uptime | awk '{split(substr($0, index($0, "load")), a, ":"); print a[2]}')#[fg=#313244]
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
tmux set -g @catppuccin_pane_status_enabled "yes"
|
||||
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option pane-border-format
|
||||
|
||||
# Switch the number position to the right
|
||||
tmux set -g @catppuccin_pane_number_position "right"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
print_option pane-border-format
|
||||
|
||||
tmux set -g @catppuccin_pane_number_position "left" # reset
|
||||
|
||||
# Fill option "all"
|
||||
tmux set -g @catppuccin_pane_default_fill "all"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
print_option pane-border-format
|
||||
|
||||
tmux set -g @catppuccin_pane_default_fill "number" # reset
|
||||
|
||||
# Fill option "none"
|
||||
tmux set -g @catppuccin_pane_default_fill "none"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
print_option pane-border-format
|
||||
@@ -0,0 +1,4 @@
|
||||
pane-border-format #[fg=#a6e3a1,bg=default]█#[fg=#313244,bg=#a6e3a1]#{pane_index}#[fg=#a6e3a1,bg=#313244]█ #[fg=#a6e3a1,bg=#313244]#{b:pane_current_path}#[fg=#313244,bg=default]█
|
||||
pane-border-format #[fg=#313244,bg=default]█#[fg=#a6e3a1,bg=#313244]#{b:pane_current_path} #[fg=#a6e3a1,bg=#313244]█#[fg=#313244,bg=#a6e3a1]#{pane_index}#[fg=#a6e3a1,bg=default]█
|
||||
pane-border-format #[fg=#a6e3a1,bg=default]█#[fg=#313244,bg=#a6e3a1]#{pane_index}#[fg=#a6e3a1,bg=#313244]█ #[fg=#313244,bg=#a6e3a1]#{b:pane_current_path}#[fg=#a6e3a1,bg=default]█
|
||||
pane-border-format #[fg=#313244,bg=default]█#[fg=#cdd6f4,bg=#313244]#{pane_index}#[fg=#cdd6f4,bg=#313244]█ #[fg=#cdd6f4,bg=#313244]#{b:pane_current_path}#[fg=#313244,bg=default]█
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Unsets (removes) any styling options that will contaminate
|
||||
# subsequent test runs.
|
||||
function reset() {
|
||||
tmux set -gu @catppuccin_window_current_left_separator
|
||||
tmux set -gu @catppuccin_window_current_middle_separator
|
||||
tmux set -gu @catppuccin_window_current_right_separator
|
||||
tmux set -gu @catppuccin_window_status_style
|
||||
}
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
# shellcheck disable=SC1091
|
||||
source "${script_dir}/helpers.sh"
|
||||
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option window-status-format
|
||||
print_option window-status-current-format
|
||||
|
||||
# Test the rounded style
|
||||
reset
|
||||
tmux set -g @catppuccin_window_status_style "rounded"
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option window-status-format
|
||||
print_option window-status-current-format
|
||||
|
||||
# Test the basic style with the number on the right
|
||||
reset
|
||||
tmux set -g @catppuccin_window_number_position "right"
|
||||
tmux source "${script_dir}/../catppuccin_options_tmux.conf"
|
||||
tmux source "${script_dir}/../catppuccin_tmux.conf"
|
||||
|
||||
print_option window-status-format
|
||||
print_option window-status-current-format
|
||||
@@ -0,0 +1,6 @@
|
||||
window-status-format #[fg=#11111b,bg=#{@thm_overlay_2}] #I #[fg=#cdd6f4,bg=#{@thm_surface_0}] #T
|
||||
window-status-current-format #[fg=#11111b,bg=#{@thm_mauve}] #I #[fg=#cdd6f4,bg=#{@thm_surface_1}] #T
|
||||
window-status-format #[fg=#11111b,bg=#{@thm_overlay_2}]#[fg=#181825,reverse]#[none]#I #[fg=#cdd6f4,bg=#{@thm_surface_0}] #T#[fg=#181825,reverse]#[none]
|
||||
window-status-current-format #[fg=#11111b,bg=#{@thm_mauve}]#[fg=#181825,reverse]#[none]#I #[fg=#cdd6f4,bg=#{@thm_surface_1}] #T#[fg=#181825,reverse]#[none]
|
||||
window-status-format #[fg=#cdd6f4,bg=#{@thm_surface_0}] #[fg=#cdd6f4,bg=#{@thm_surface_0}] #T #[fg=#11111b,bg=#{@thm_overlay_2}] #I
|
||||
window-status-current-format #[fg=#cdd6f4,bg=#{@thm_surface_1}] #[fg=#cdd6f4,bg=#{@thm_surface_1}] #T #[fg=#11111b,bg=#{@thm_mauve}] #I
|
||||
Reference in New Issue
Block a user