mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-26 06:22:50 -05:00
Refactor pre-commit hooks to use prek (#976)
* ci: change to prek for pre-commit * refactor: fix shellcheck warnings for the scripts * chore: unify whitespace formatting * nix: add prek to dev shell
This commit is contained in:
@@ -1,66 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CONFIG_DIR="$1"
|
||||
IS_LIGHT="$2"
|
||||
SHELL_DIR="$3"
|
||||
|
||||
if [ -z "$CONFIG_DIR" ] || [ -z "$IS_LIGHT" ] || [ -z "$SHELL_DIR" ]; then
|
||||
echo "Usage: $0 <config_dir> <is_light> <shell_dir>" >&2
|
||||
if [ -z "$CONFIG_DIR" ]; then
|
||||
echo "Usage: $0 <config_dir>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apply_gtk3_colors() {
|
||||
local config_dir="$1"
|
||||
local is_light="$2"
|
||||
local shell_dir="$3"
|
||||
|
||||
|
||||
local gtk3_dir="$config_dir/gtk-3.0"
|
||||
local dank_colors="$gtk3_dir/dank-colors.css"
|
||||
local gtk_css="$gtk3_dir/gtk.css"
|
||||
|
||||
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Error: dank-colors.css not found at $dank_colors" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -L "$gtk_css" ]; then
|
||||
rm "$gtk_css"
|
||||
elif [ -f "$gtk_css" ]; then
|
||||
mv "$gtk_css" "$gtk_css.backup.$(date +%s)"
|
||||
echo "Backed up existing gtk.css"
|
||||
fi
|
||||
|
||||
|
||||
ln -s "dank-colors.css" "$gtk_css"
|
||||
echo "Created symlink: $gtk_css -> dank-colors.css"
|
||||
}
|
||||
|
||||
apply_gtk4_colors() {
|
||||
local config_dir="$1"
|
||||
|
||||
|
||||
local gtk4_dir="$config_dir/gtk-4.0"
|
||||
local dank_colors="$gtk4_dir/dank-colors.css"
|
||||
local gtk_css="$gtk4_dir/gtk.css"
|
||||
local gtk4_import="@import url(\"dank-colors.css\");"
|
||||
|
||||
|
||||
if [ ! -f "$dank_colors" ]; then
|
||||
echo "Error: GTK4 dank-colors.css not found at $dank_colors" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "$gtk_css" ]; then
|
||||
sed -i '/^@import url.*dank-colors\.css.*);$/d' "$gtk_css"
|
||||
sed -i "1i\\$gtk4_import" "$gtk_css"
|
||||
else
|
||||
echo "$gtk4_import" > "$gtk_css"
|
||||
echo "$gtk4_import" >"$gtk_css"
|
||||
fi
|
||||
echo "Updated GTK4 CSS import"
|
||||
}
|
||||
|
||||
mkdir -p "$CONFIG_DIR/gtk-3.0" "$CONFIG_DIR/gtk-4.0"
|
||||
|
||||
apply_gtk3_colors "$CONFIG_DIR" "$IS_LIGHT" "$SHELL_DIR"
|
||||
apply_gtk3_colors "$CONFIG_DIR"
|
||||
apply_gtk4_colors "$CONFIG_DIR"
|
||||
|
||||
echo "GTK colors applied successfully"
|
||||
echo "GTK colors applied successfully"
|
||||
|
||||
@@ -9,17 +9,18 @@ fi
|
||||
|
||||
apply_qt_colors() {
|
||||
local config_dir="$1"
|
||||
local color_scheme_path="$(dirname "$config_dir")/.local/share/color-schemes/DankMatugen.colors"
|
||||
|
||||
local color_scheme_path
|
||||
color_scheme_path="$(dirname "$config_dir")/.local/share/color-schemes/DankMatugen.colors"
|
||||
|
||||
if [ ! -f "$color_scheme_path" ]; then
|
||||
echo "Error: Qt color scheme not found at $color_scheme_path" >&2
|
||||
echo "Run matugen first to generate theme files" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
update_qt_config() {
|
||||
local config_file="$1"
|
||||
|
||||
|
||||
if [ -f "$config_file" ]; then
|
||||
if grep -q '^\[Appearance\]' "$config_file"; then
|
||||
if grep -q '^custom_palette=' "$config_file"; then
|
||||
@@ -27,40 +28,42 @@ apply_qt_colors() {
|
||||
else
|
||||
sed -i '/^\[Appearance\]/a custom_palette=true' "$config_file"
|
||||
fi
|
||||
|
||||
|
||||
if grep -q '^color_scheme_path=' "$config_file"; then
|
||||
sed -i "s|^color_scheme_path=.*|color_scheme_path=$color_scheme_path|" "$config_file"
|
||||
else
|
||||
sed -i "/^\\[Appearance\\]/a color_scheme_path=$color_scheme_path" "$config_file"
|
||||
fi
|
||||
else
|
||||
echo "" >> "$config_file"
|
||||
echo "[Appearance]" >> "$config_file"
|
||||
echo "custom_palette=true" >> "$config_file"
|
||||
echo "color_scheme_path=$color_scheme_path" >> "$config_file"
|
||||
{
|
||||
echo ""
|
||||
echo "[Appearance]"
|
||||
echo "custom_palette=true"
|
||||
echo "color_scheme_path=$color_scheme_path"
|
||||
} >>"$config_file"
|
||||
fi
|
||||
else
|
||||
printf '[Appearance]\\ncustom_palette=true\\ncolor_scheme_path=%s\\n' "$color_scheme_path" > "$config_file"
|
||||
printf '[Appearance]\\ncustom_palette=true\\ncolor_scheme_path=%s\\n' "$color_scheme_path" >"$config_file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
qt5_applied=false
|
||||
qt6_applied=false
|
||||
|
||||
|
||||
if command -v qt5ct >/dev/null 2>&1; then
|
||||
mkdir -p "$config_dir/qt5ct"
|
||||
update_qt_config "$config_dir/qt5ct/qt5ct.conf"
|
||||
echo "Applied Qt5ct configuration"
|
||||
qt5_applied=true
|
||||
fi
|
||||
|
||||
|
||||
if command -v qt6ct >/dev/null 2>&1; then
|
||||
mkdir -p "$config_dir/qt6ct"
|
||||
update_qt_config "$config_dir/qt6ct/qt6ct.conf"
|
||||
echo "Applied Qt6ct configuration"
|
||||
qt6_applied=true
|
||||
fi
|
||||
|
||||
|
||||
if [ "$qt5_applied" = false ] && [ "$qt6_applied" = false ]; then
|
||||
echo "Warning: Neither qt5ct nor qt6ct found" >&2
|
||||
echo "Install qt5ct or qt6ct for Qt application theming" >&2
|
||||
@@ -70,4 +73,4 @@ apply_qt_colors() {
|
||||
|
||||
apply_qt_colors "$CONFIG_DIR"
|
||||
|
||||
echo "Qt colors applied successfully"
|
||||
echo "Qt colors applied successfully"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Notification Spam Test Script - Sends 100 rapid notifications from fake apps
|
||||
|
||||
@@ -151,7 +151,7 @@ echo "Starting notification spam..."
|
||||
echo "------------------------------"
|
||||
|
||||
# Send notifications rapidly
|
||||
for i in $(seq 1 $TOTAL); do
|
||||
for _ in $(seq 1 $TOTAL); do
|
||||
# Pick random app, title, message, and urgency
|
||||
APP=${APPS[$RANDOM % ${#APPS[@]}]}
|
||||
APP_NAME=${APP%%:*}
|
||||
@@ -159,32 +159,32 @@ for i in $(seq 1 $TOTAL); do
|
||||
TITLE=${TITLES[$RANDOM % ${#TITLES[@]}]}
|
||||
MESSAGE=${MESSAGES[$RANDOM % ${#MESSAGES[@]}]}
|
||||
URG=${URGENCY[$RANDOM % ${#URGENCY[@]}]}
|
||||
|
||||
|
||||
# Add some variety with random numbers and timestamps
|
||||
RAND_NUM=$((RANDOM % 1000))
|
||||
TIMESTAMP=$(date +"%H:%M:%S")
|
||||
|
||||
|
||||
# Randomly add extra details to some messages
|
||||
if [ $((RANDOM % 3)) -eq 0 ]; then
|
||||
MESSAGE="[$TIMESTAMP] $MESSAGE (#$RAND_NUM)"
|
||||
fi
|
||||
|
||||
|
||||
# Send notification with very short delay
|
||||
notify-send \
|
||||
-h string:desktop-entry:$APP_NAME \
|
||||
-i $APP_ICON \
|
||||
-u $URG \
|
||||
-h "string:desktop-entry:$APP_NAME" \
|
||||
-i "$APP_ICON" \
|
||||
-u "$URG" \
|
||||
"$APP_NAME: $TITLE" \
|
||||
"$MESSAGE" &
|
||||
|
||||
|
||||
# Increment counter
|
||||
COUNT=$((COUNT + 1))
|
||||
|
||||
|
||||
# Show progress every 10 notifications
|
||||
if [ $((COUNT % 10)) -eq 0 ]; then
|
||||
echo " Sent $COUNT/$TOTAL notifications..."
|
||||
fi
|
||||
|
||||
|
||||
# Tiny delay to prevent complete system freeze
|
||||
# Adjust this value: smaller = faster spam, larger = slower spam
|
||||
sleep 0.01
|
||||
@@ -200,8 +200,8 @@ echo "Statistics:"
|
||||
echo " Total notifications sent: $TOTAL"
|
||||
echo " Apps simulated: ${#APPS[@]}"
|
||||
echo " Message variations: ${#MESSAGES[@]}"
|
||||
echo " Time taken: ~$(($TOTAL / 100)) seconds"
|
||||
echo " Time taken: ~$((TOTAL / 100)) seconds"
|
||||
echo ""
|
||||
echo "Check your notification center - it should be FULL!"
|
||||
echo "Tip: You may want to clear all notifications after this test"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
@@ -8,12 +8,10 @@ echo "============================================================="
|
||||
|
||||
# Check what icons are available
|
||||
echo "Checking available icons..."
|
||||
if [ -d "~/.local/share/icons/Papirus" ]; then
|
||||
if [ -d "$HOME/.local/share/icons/Papirus" ]; then
|
||||
echo "✓ Icon theme found"
|
||||
ICON_BASE="~/.local/share/icons/Papirus"
|
||||
else
|
||||
echo "! Using fallback icons"
|
||||
ICON_BASE=""
|
||||
fi
|
||||
|
||||
# Test 1: Basic notifications with markdown
|
||||
|
||||
Reference in New Issue
Block a user