first test

This commit is contained in:
cnst
2024-09-21 23:22:22 +02:00
parent c647cea072
commit e212239e8c
36 changed files with 624 additions and 240 deletions

11
.scripts/bin/calcurse-toggle.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
if pgrep -f "foot --title floatcal" >/dev/null; then
# If a process with "foot --title floatcal" is found, kill it
pkill -f "foot --title floatcal"
else
# Otherwise, launch it via hyprctl
if ! hyprctl dispatch exec 'foot --title floatcal calcurse'; then
echo "Failed to launch calcurse in foot terminal"
exit 1
fi
fi

2
.scripts/bin/calsync.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
hyprctl dispatch exec calcurse-caldav

52
.scripts/bin/extract.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
SAVEIFS=$IFS
IFS="$(printf '\n\t')"
function extract {
if [ $# -eq 0 ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz|.zlib|.cso>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
fi
for n in "$@"; do
if [ ! -f "$n" ]; then
echo "'$n' - file doesn't exist"
return 1
fi
case "''${n%,}" in
*.cbt | *.tar.bz2 | *.tar.gz | *.tar.xz | *.tbz2 | *.tgz | *.txz | *.tar)
tar zxvf "$n"
;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.cbr | *.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.cbz | *.epub | *.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.7z | *.apk | *.arj | *.cab | *.cb7 | *.chm | *.deb | *.iso | *.lzh | *.msi | *.pkg | *.rpm | *.udf | *.wim | *.xar | *.vhd)
7z x ./"$n"
;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*.cpio) cpio -id <./"$n" ;;
*.cba | *.ace) unace x ./"$n" ;;
*.zpaq) zpaq x ./"$n" ;;
*.arc) arc e ./"$n" ;;
*.cso) ciso 0 ./"$n" ./"$n.iso" &&
extract "$n.iso" && \rm -f "$n" ;;
*.zlib) zlib-flate -uncompress <./"$n" >./"$n.tmp" &&
mv ./"$n.tmp" ./"''${n%.*zlib}" && rm -f "$n" ;;
*.dmg)
hdiutil mount ./"$n" -mountpoint "./$n.mounted"
;;
*)
echo "extract: '$n' - unknown archive method"
return 1
;;
esac
done
}
IFS=$SAVEIFS

8
.scripts/bin/mako-toggle.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
# Toggle Mako mode between "do-not-disturb" and "default"
if makoctl mode | grep -q "default"; then
makoctl set-mode do-not-disturb
else
makoctl set-mode default
fi

10
.scripts/bin/mako.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
COUNT=$(makoctl list | grep -c "id")
ENABLED=󰂚
DISABLED=󱏧
if [ "$COUNT" != 0 ]; then DISABLED="󱅫"; fi
if [ "$(
makoctl mode | grep -q "default"
echo $?
)" -eq 0 ]; then echo $ENABLED; else echo $DISABLED; fi

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
if pgrep -f "pavucontrol" >/dev/null; then
pkill -f "pavucontrol"
else
if ! hyprctl dispatch exec pavucontrol; then
echo "Failed to launch Pavucontrol"
exit 1
fi
fi

6
.scripts/bin/rangerscript.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
if pgrep -f floatranger; then
pkill -f floatranger
else
hyprctl dispatch exec 'foot --title floatranger ranger'
fi

26
.scripts/bin/tuirun-toggle.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Path to the tuirun executable
TUIRUN_PATH="/etc/profiles/per-user/$USER/bin/tuirun"
LOGFILE="$HOME/tuirun_debug.log"
echo "Launching tuirun..." >>"$LOGFILE"
date >>"$LOGFILE"
if pgrep -f "alacritty --title tuirun" >/dev/null; then
echo "Terminating existing tuirun process" >>"$LOGFILE"
pkill -f "alacritty --title tuirun"
else
echo "Starting new tuirun process" >>"$LOGFILE"
if ! hyprctl dispatch exec "alacritty --title tuirun -e sh -c '$TUIRUN_PATH'"; then
echo "Failed to launch tuirun in foot terminal" >>"$LOGFILE"
exit 1
fi
sleep 1 # Give it a second to start
echo "Checking if tuirun process is still running..." >>"$LOGFILE"
if pgrep -f "$TUIRUN_PATH" >/dev/null; then
echo "tuirun is running" >>"$LOGFILE"
else
echo "tuirun exited prematurely" >>"$LOGFILE"
fi
fi

114
.scripts/bin/volume-control.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/usr/bin/env bash
iDIR="$HOME/.config/mako/icons"
# Get Volume
get_volume() {
pamixer --get-volume
}
# Get icons
get_icon() {
current=$(get_volume)
case $current in
0)
echo "$iDIR/vol_off.svg"
;;
[1-9] | [1-2][0-9] | 30)
echo "$iDIR/vol_mute.svg"
;;
[3-5][0-9] | 60)
echo "$iDIR/vol_down.svg"
;;
*)
echo "$iDIR/vol_up.svg"
;;
esac
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume : $(get_volume) %"
}
# Increase Volume
inc_volume() {
pamixer -i 5 && notify_user
}
# Decrease Volume
dec_volume() {
pamixer -d 5 && notify_user
}
# Toggle Mute
toggle_mute() {
if pamixer --get-mute | grep -q "false"; then
pamixer -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/vol_off.svg" "Volume Switched OFF"
else
pamixer -u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume Switched ON"
fi
}
# Toggle Mic
toggle_mic() {
if pamixer --default-source --get-mute | grep -q "false"; then
pamixer --default-source -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/mic_off.svg" "Microphone Switched OFF"
else
pamixer --default-source -u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/mic.svg" "Microphone Switched ON"
fi
}
# Get mic icons
get_mic_icon() {
echo "$iDIR/mic.svg"
}
# Notify
notify_mic_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_mic_icon)" "Mic-Level : $(pamixer --default-source --get-volume) %"
}
# Increase MIC Volume
inc_mic_volume() {
pamixer --default-source -i 5 && notify_mic_user
}
# Decrease MIC Volume
dec_mic_volume() {
pamixer --default-source -d 5 && notify_mic_user
}
# Execute accordingly
case $1 in
--get)
get_volume
;;
--inc)
inc_volume
;;
--dec)
dec_volume
;;
--toggle)
toggle_mute
;;
--toggle-mic)
toggle_mic
;;
--get-icon)
get_icon
;;
--get-mic-icon)
get_mic_icon
;;
--mic-inc)
inc_mic_volume
;;
--mic-dec)
dec_mic_volume
;;
*)
get_volume
;;
esac