small thunar and greetd changes and some refactoring
This commit is contained in:
11
scripts/bin/calcurse-toggle.sh
Executable file
11
scripts/bin/calcurse-toggle.sh
Executable 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
2
scripts/bin/calsync.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
hyprctl dispatch exec calcurse-caldav
|
||||
52
scripts/bin/extract.sh
Executable file
52
scripts/bin/extract.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# yanked from NotAShelf
|
||||
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
8
scripts/bin/mako-toggle.sh
Executable 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
10
scripts/bin/mako.sh
Executable 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
|
||||
9
scripts/bin/pavucontrol-toggle.sh
Executable file
9
scripts/bin/pavucontrol-toggle.sh
Executable 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
6
scripts/bin/rangerscript.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
if pgrep -f floatranger; then
|
||||
pkill -f floatranger
|
||||
else
|
||||
hyprctl dispatch exec 'foot --title floatranger ranger'
|
||||
fi
|
||||
41
scripts/bin/tuirun-debug.sh
Executable file
41
scripts/bin/tuirun-debug.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
# Log file location
|
||||
LOGFILE="/home/$USER/.cache/tuirun/tuirun-toggle.log"
|
||||
# Redirect all output and errors to the log file
|
||||
exec >>"$LOGFILE" 2>&1
|
||||
# Enable command tracing
|
||||
set -x
|
||||
|
||||
echo "Script started at $(date)"
|
||||
|
||||
# Log the environment variables
|
||||
echo "Environment variables:"
|
||||
env
|
||||
|
||||
# Define TERMINAL if not set
|
||||
TERMINAL="${TERMINAL:-foot}"
|
||||
echo "TERMINAL is set to: $TERMINAL"
|
||||
|
||||
# Ensure USER is set
|
||||
USER="${USER:-$(whoami)}"
|
||||
echo "USER is set to: $USER"
|
||||
|
||||
# Path to the tuirun executable
|
||||
TUIRUN_PATH="/etc/profiles/per-user/$USER/bin/tuirun"
|
||||
echo "TUIRUN_PATH is set to: $TUIRUN_PATH"
|
||||
|
||||
# Use absolute paths for commands
|
||||
PGREP="/run/current-system/sw/bin/pgrep"
|
||||
PKILL="/run/current-system/sw/bin/pkill"
|
||||
HYPRCTL="/etc/profiles/per-user/$USER/bin/hyprctl"
|
||||
|
||||
echo "Checking if tuirun is already running..."
|
||||
|
||||
if "$PGREP" -f "$TERMINAL --title tuirun" >/dev/null; then
|
||||
echo "Found existing tuirun process. Terminating..."
|
||||
"$PKILL" -f "$TERMINAL --title tuirun"
|
||||
else
|
||||
echo "No existing tuirun process. Starting a new one..."
|
||||
"$HYPRCTL" dispatch exec "$TERMINAL --title tuirun -e $TUIRUN_PATH"
|
||||
fi
|
||||
|
||||
echo "Script finished at $(date)"
|
||||
36
scripts/bin/tuirun-toggle.sh
Executable file
36
scripts/bin/tuirun-toggle.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
# Define TERMINAL if not set
|
||||
TERMINAL="${TERMINAL:-foot}"
|
||||
|
||||
# Path to the tuirun executable
|
||||
TUIRUN_PATH="/etc/profiles/per-user/$USER/bin/tuirun"
|
||||
|
||||
# Use absolute paths for commands
|
||||
PGREP="/run/current-system/sw/bin/pgrep"
|
||||
PKILL="/run/current-system/sw/bin/pkill"
|
||||
HYPRCTL="/etc/profiles/per-user/$USER/bin/hyprctl"
|
||||
|
||||
# Determine OPTIONS based on TERMINAL
|
||||
if [ "$TERMINAL" = "foot" ]; then
|
||||
OPTIONS="--override=main.pad=0x0"
|
||||
elif [ "$TERMINAL" = "alacritty" ]; then
|
||||
OPTIONS="--option window.padding.x=0 --option window.padding.y=0"
|
||||
else
|
||||
OPTIONS=""
|
||||
fi
|
||||
|
||||
# Matching pattern for the process
|
||||
MATCH_PATTERN="$TERMINAL --title tuirun"
|
||||
|
||||
if "$PGREP" -f "$MATCH_PATTERN" >/dev/null; then
|
||||
"$PKILL" -f "$MATCH_PATTERN"
|
||||
else
|
||||
# Construct the command
|
||||
CMD="$TERMINAL --title tuirun"
|
||||
if [ -n "$OPTIONS" ]; then
|
||||
CMD="$CMD $OPTIONS"
|
||||
fi
|
||||
CMD="$CMD -e $TUIRUN_PATH"
|
||||
|
||||
# Launch the terminal with OPTIONS
|
||||
"$HYPRCTL" dispatch exec "$CMD"
|
||||
fi
|
||||
114
scripts/bin/volume-control.sh
Executable file
114
scripts/bin/volume-control.sh
Executable 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
|
||||
Reference in New Issue
Block a user