aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJa.KooLit <jimmielovejay@gmail.com>2024-02-14 05:22:34 +0900
committerGitHub <noreply@github.com>2024-02-14 05:22:34 +0900
commita160ceeab550d8fdefc0b19f6b3a0dd6c2784db8 (patch)
treebf2ebecab995012b984c931e2ec22d947897b4b3
parent610a46e8fe3c5c0d0b292977b6015d9f858e5e98 (diff)
parente34165295e0856f9f14fffb4e323fb1f2e2220c9 (diff)
Merge pull request #158 from JaKooLit/development
Development to Main
-rwxr-xr-xconfig/hypr/UserScripts/Sounds.sh65
-rw-r--r--config/hypr/configs/Keybinds.conf2
-rwxr-xr-xconfig/hypr/scripts/PywalSwww.sh34
-rwxr-xr-xconfig/hypr/scripts/ScreenShot.sh16
-rwxr-xr-xconfig/hypr/scripts/Volume.sh2
-rwxr-xr-xconfig/hypr/scripts/WaybarCava.sh2
6 files changed, 100 insertions, 21 deletions
diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh
new file mode 100755
index 00000000..0d2bfff7
--- /dev/null
+++ b/config/hypr/UserScripts/Sounds.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+## /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
+# This script is used to play system sounds.
+
+theme="freedesktop" # Set the theme for the system sounds.
+mute=false # Set to true to mute the system sounds.
+
+# Mute individual sounds here.
+muteScreenshots=false
+muteVolume=false
+
+# Exit if the system sounds are muted.
+if [[ "$mute" = true ]]; then
+ exit 0
+fi
+
+# Choose the sound to play.
+if [[ "$1" == "--screenshot" ]]; then
+ if [[ "$muteScreenshots" = true ]]; then
+ exit 0
+ fi
+ soundoption="screen-capture.*"
+elif [[ "$1" == "--volume" ]]; then
+ if [[ "$muteVolume" = true ]]; then
+ exit 0
+ fi
+ soundoption="audio-volume-change.*"
+else
+ echo -e "Available sounds: --screenshot, --volume"
+ exit 0
+fi
+
+# Set the directory defaults for system sounds.
+userDIR="$HOME/.local/share/sounds"
+systemDIR="/usr/share/sounds"
+defaultTheme="freedesktop"
+
+# Prefer the user's theme, but use the system's if it doesn't exist.
+sDIR="$systemDIR/$defaultTheme"
+if [ -d "$userDIR/$theme" ]; then
+ sDIR="$userDIR/$theme"
+elif [ -d "$systemDIR/$theme" ]; then
+ sDIR="$systemDIR/$theme"
+fi
+
+# Get the theme that it inherits.
+iTheme=$(cat "$sDIR/index.theme" | grep -i "inherits" | cut -d "=" -f 2)
+iDIR="$sDIR/../$iTheme"
+
+# Find the sound file and play it.
+sound_file=$(find $sDIR/stereo -name "$soundoption" -print -quit)
+if ! test -f "$sound_file"; then
+ sound_file=$(find $iDIR/stereo -name "$soundoption" -print -quit)
+ if ! test -f "$sound_file"; then
+ sound_file=$(find $userDIR/$defaultTheme/stereo -name "$soundoption" -print -quit)
+ if ! test -f "$sound_file"; then
+ sound_file=$(find $systemDIR/$defaultTheme/stereo -name "$soundoption" -print -quit)
+ if ! test -f "$sound_file"; then
+ echo "Error: Sound file not found."
+ exit 1
+ fi
+ fi
+ fi
+fi
+pw-play "$sound_file"
diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf
index 1da7e9f7..3ecc4a37 100644
--- a/config/hypr/configs/Keybinds.conf
+++ b/config/hypr/configs/Keybinds.conf
@@ -78,7 +78,7 @@ bind = $mainMod ALT, Print, exec, $scriptsDir/ScreenShot.sh --in10 #screenshot i
bind = ALT, Print, exec, $scriptsDir/ScreenShot.sh --active #screenshot in 10 secs
# screenshot with swappy (another screenshot tool)
-bind = $mainMod SHIFT, S, exec, grim -g "$(slurp)" - | swappy -f -
+bind = $mainMod SHIFT, S, exec, $scriptsDir/ScreenShot.sh --swappy
# Resize windows
binde = $mainMod SHIFT, left, resizeactive,-50 0
diff --git a/config/hypr/scripts/PywalSwww.sh b/config/hypr/scripts/PywalSwww.sh
index 0cbadaf4..4ed7448f 100755
--- a/config/hypr/scripts/PywalSwww.sh
+++ b/config/hypr/scripts/PywalSwww.sh
@@ -11,30 +11,28 @@ monitor_outputs=($(ls "$cache_dir"))
# Initialize a flag to determine if the ln command was executed
ln_success=false
-# Loop through monitor outputs
-for output in "${monitor_outputs[@]}"; do
- # Construct the full path to the cache file
- cache_file="$cache_dir$output"
-
- # Check if the cache file exists for the current monitor output
- if [ -f "$cache_file" ]; then
- # Get the wallpaper path from the cache file
- wallpaper_path=$(cat "$cache_file")
-
- # Copy the wallpaper to the location Rofi can access
- if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then
- ln_success=true # Set the flag to true upon successful execution
- fi
-
- break # Exit the loop after processing the first found monitor output
+# Get first valid monitor
+current_monitor=$(hyprctl -j monitors | jq -r '.[0].name')
+echo $current_monitor
+# Construct the full path to the cache file
+cache_file="$cache_dir$current_monitor"
+echo $cache_file
+# Check if the cache file exists for the current monitor output
+if [ -f "$cache_file" ]; then
+ # Get the wallpaper path from the cache file
+ wallpaper_path=$(cat "$cache_file")
+ echo $wallpaper_path
+ # Copy the wallpaper to the location Rofi can access
+ if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then
+ ln_success=true # Set the flag to true upon successful execution
fi
-done
+fi
# Check the flag before executing further commands
if [ "$ln_success" = true ]; then
# execute pywal
# wal -i "$wallpaper_path"
-
+ echo 'about to execute wal'
# execute pywal skipping tty and terminal changes
wal -i "$wallpaper_path" -s -t &
fi
diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh
index ddf4398b..fa1b40ad 100755
--- a/config/hypr/scripts/ScreenShot.sh
+++ b/config/hypr/scripts/ScreenShot.sh
@@ -3,6 +3,7 @@
# Screenshots scripts
iDIR="$HOME/.config/swaync/icons"
+sDIR="$HOME/.config/hypr/UserScripts"
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png"
time=$(date "+%d-%b_%H-%M-%S")
@@ -18,13 +19,17 @@ notify_view() {
if [[ "$1" == "active" ]]; then
if [[ -e "${active_window_path}" ]]; then
${notify_cmd_shot} "Screenshot of '${active_window_class}' Saved."
+ "${sDIR}/Sounds.sh" --screenshot
else
${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved"
fi
+ elif [[ "$1" == "swappy" ]]; then
+ ${notify_cmd_shot} "Screenshot Captured."
else
local check_file="$dir/$file"
if [[ -e "$check_file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
+ "${sDIR}/Sounds.sh" --screenshot
else
${notify_cmd_shot} "Screenshot NOT Saved."
fi
@@ -84,6 +89,13 @@ shotactive() {
notify_view "active"
}
+shotswappy() {
+ tmpfile=$(mktemp)
+ grim -g "$(slurp)" - >"$tmpfile" && "${sDIR}/Sounds.sh" --screenshot && notify_view "swappy"
+ swappy -f - <"$tmpfile"
+ rm "$tmpfile"
+}
+
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
@@ -101,8 +113,10 @@ elif [[ "$1" == "--area" ]]; then
shotarea
elif [[ "$1" == "--active" ]]; then
shotactive
+elif [[ "$1" == "--swappy" ]]; then
+ shotswappy
else
- echo -e "Available Options : --now --in5 --in10 --win --area --active"
+ echo -e "Available Options : --now --in5 --in10 --win --area --active --swappy"
fi
exit 0
diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh
index 1c18211f..8c5af5de 100755
--- a/config/hypr/scripts/Volume.sh
+++ b/config/hypr/scripts/Volume.sh
@@ -3,6 +3,7 @@
# Scripts for volume controls for audio and mic
iDIR="$HOME/.config/swaync/icons"
+sDIR="$HOME/.config/hypr/UserScripts"
# Get Volume
get_volume() {
@@ -34,6 +35,7 @@ notify_user() {
notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted"
else
notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: $(get_volume)"
+ "$sDIR/Sounds.sh" --volume
fi
}
diff --git a/config/hypr/scripts/WaybarCava.sh b/config/hypr/scripts/WaybarCava.sh
index 62e3558e..bf9e7435 100755
--- a/config/hypr/scripts/WaybarCava.sh
+++ b/config/hypr/scripts/WaybarCava.sh
@@ -1,4 +1,4 @@
-# #! /bin/bash
+#!/bin/bash
## /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
# Not my own work. This was added through Github PR. Credit to original author
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage