diff --git a/channels.scm b/channels.scm index 81ae0f2..8abc494 100644 --- a/channels.scm +++ b/channels.scm @@ -63,7 +63,7 @@ "F164 709E 5FC7 B32B AEC7 9F37 1F2E 76AC E3F5 31C8")))) (channel (name 'ajattix) - (url "http://ajattix.loophole.site/hashirama/ajattix.git") + (url "https://git.ajattix.org/hashirama/ajattix.git") (branch "main") (introduction (make-channel-introduction diff --git a/config.scm b/config.scm index 1a421af..77fd1cd 100644 --- a/config.scm +++ b/config.scm @@ -15,8 +15,11 @@ (rosenthal packages binaries) (rosenthal packages emacs-xyz) (guix transformations) + (gnu packages python-xyz) (gnu packages audio) (gnu packages librewolf) + (gnu packages sync) + (gnu packages qt) (gnu packages gdb) (gnu packages graphics) (gnu packages java) @@ -31,6 +34,9 @@ (rde features bluetooth) (gnu packages gcc) (gnu packages pulseaudio) + (gnu packages enchant) + (gnu packages hunspell) + (gnu packages upnp) (gnu packages tor) (gnu packages commencement) (gnu packages guile-xyz) @@ -125,7 +131,10 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 (firmware (list linux-firmware)) (locale "en_US.utf8") - (kernel-arguments (list "modprobe.blacklist=hid-nintendo")) + (kernel-arguments (list "modprobe.blacklist=hid-nintendo" + "noatime" + + )) (timezone "America/Manaus") (keyboard-layout (keyboard-layout "us")) (host-name "lisp-machine") @@ -160,13 +169,20 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 cmus emacs-ox-hugo sbcl-coleslaw + numix-gtk-theme tor - ibus + python-psutil + python-schedule + xsel + gerbera + ibus dconf gimp blender gimp-resynthesizer wmctrl + imagemagick + zpaq libwebp libreoffice librewolf @@ -174,6 +190,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 ardour noise-repellent ;; + ;; nextcloud-client xprop fzf zstd @@ -186,6 +203,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 xrdb noisetorch mpv + qtwebengine ;; required by some applications, like anki ;;emasc-everywhere xdotool xprop @@ -216,6 +234,8 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 bluez blueman ;; ime + enchant + hunspell fcitx5 fcitx5-gtk fcitx5-qt @@ -260,15 +280,19 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 ;; font-apple-color-emoji picom feh - xmodmap + ;; ================ + ;; haskell + cabal-install ;; deps for xmonad xmonad xmobar ghc ;; ridiculous, gcc and ghc are runtime dependencies , yet people didnt put in the package description + ghc-xmonad-contrib + ;; ================== gcc gcc-toolchain xmessage - ghc-xmonad-contrib + xmodmap rofi linux-libre-headers ;;-------- @@ -284,6 +308,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 ;; Below is the list of system services. To search for available ;; services, run 'guix system search KEYWORD' in a terminal. (services + (append (list (simple-service 'my-zfs-loader kernel-module-loader-service-type '("zfs")) @@ -302,8 +327,10 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 (compression-algorithm 'xz) (priority 100))) ;; (service oci-forgejo-service-type) - (set-xorg-configuration - (xorg-configuration (keyboard-layout keyboard-layout))) + (set-xorg-configuration + (xorg-configuration + + (keyboard-layout keyboard-layout))) (udev-rules-service '8bitdo %8bitdo-udev-rules) (service nix-service-type) @@ -315,8 +342,9 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 "find /mnt/Data/mpv-screenshots/ -type f \\( -iname '*.png' -o -iname '*.jpg' \\) -exec sh -c 'cwebp -q 80 \"$0\" -o \"${0%.*}.webp\" && rm \"$0\"' {} \\;"))))) ) - - %desktop-services) + + %desktop-services) + ) (bootloader (bootloader-configuration @@ -347,16 +375,6 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3 ;; "223baecf-e5f4-453f-90c7-d33edbbae145" ;; 'ext4)) ;; (type "ext4")) - (file-system - (mount-point "/mnt/Quartz") - (device (uuid - "b0e97572-255c-4f6e-9a0a-9a89ae99f1a5" - 'ext4)) - (type "ext4")) - (file-system - (mount-point "/mnt/Sources") - (device (uuid - "c01d762b-0c91-43c0-9c80-e048c4abe939" - 'ext4)) - (type "ext4")) + + %base-file-systems))) diff --git a/home-configuration/home-configuration.scm b/home-configuration/home-configuration.scm index 3e7fac5..1287ed6 100644 --- a/home-configuration/home-configuration.scm +++ b/home-configuration/home-configuration.scm @@ -5,6 +5,8 @@ ;; See the "Replicating Guix" section in the manual. (use-modules (gnu home) + (radix packages) + (radix packages image-viewers) (gnu home services desktop) (gnu packages) (gnu services) @@ -16,6 +18,7 @@ (gnu packages ebook) (gnu home services syncthing) (gnu packages tor) + (gnu packages sync) (gnu packages package-management) (gnu packages syncthing) (guix gexp) @@ -121,6 +124,7 @@ ;;unrar qtmultimedia sylpheed + zpaq ;; xpad-module unzip zip @@ -133,6 +137,7 @@ gnupg xprop ;;nicotine+ + nextcloud-client yt-dlp higan librewolf @@ -200,10 +205,11 @@ pavucontrol-qt mpv emacs + ueberzug++ (specifications->packages (list "steam" "guile" - "ueberzug++" + ;; "ueberzug++" "fcitx5-gtk4" "fcitx5-qt" "fcitx5-gtk" @@ -212,6 +218,7 @@ "unrar" "nicotine+" "librewolf" + "zpaq" "gimp" "foliate" "tor-client" @@ -229,11 +236,13 @@ ("grep" . "grep --color=auto") ("update" . "guix pull && sudo guix system reconfigure .config/guix/config.scm") ("lf" . "~/.local/bin/lf/lfrun") - ("ps2" . "nohup flatpak run --filesystem=/mnt/Data net.pcsx2.PCSX2 > /dev/null 2>&1 &") + ("ps2" . "nohup flatpak run --filesystem=/mnt/Data net.pcsx2.PCSX2 > /dev/null 2>&1 &") + ("ocr" . "sudo /nix/var/nix/profiles/default/bin/manga_ocr") ("ll" . "ls -l") ("ls" . "ls -p --color=auto") ("run_code" . "g++ -o main main.cc -Ofast -std=c++23 -s -flto -march=native -I ~/dev/ajatt/hakurei/include/ && ./main") ("rgf" . "rg --files | rg") + ("dufh" . "/nix/var/nix/profiles/default/bin/duf -hide-fs tmpfs,ext4,devtmpfs,vfat") ("mpv" . "mpv --audio-pitch-correction=yes --vf=setpts=PTS/1") ("record" . "ffmpeg -f x11grab -r 23 -s 1366x768 -i $DISPLAY -f pulse -i nui_mic_remap -filter_complex '[1:a]volume=2.0[a]' -map 0:v -map '[a]' -c:v libx264 -pix_fmt yuv420p -preset ultrafast -crf 23 -y /tmp/output.mp4") ("isolate" . "guix shell --container --network --preserve='^DISPLAY$' \ diff --git a/misc/scripts/compatibility.sh b/misc/scripts/compatibility.sh index 2200590..19a1347 100755 --- a/misc/scripts/compatibility.sh +++ b/misc/scripts/compatibility.sh @@ -42,7 +42,7 @@ if [ ! -f "$input_file" ]; then fi # Output folder and file paths -output_folder="$HOME/Videos/converted_for_compatibility" +output_folder="/mnt/Zonai/Videos/converted_for_compatibility" output_filename="compatible-$(basename "$input_file" | sed 's/[^a-zA-Z0-9._-]/_/g')" output_file="$output_folder/$output_filename" diff --git a/misc/scripts/copy_image.sh b/misc/scripts/copy_image.sh index a79b56d..4cd37ea 100755 --- a/misc/scripts/copy_image.sh +++ b/misc/scripts/copy_image.sh @@ -1,4 +1,3 @@ - EXEC_SHELL_PATH=$(command -v bash) diff --git a/misc/scripts/epub_thumbnailer.sh b/misc/scripts/epub_thumbnailer.sh new file mode 100755 index 0000000..a42d863 --- /dev/null +++ b/misc/scripts/epub_thumbnailer.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import os +import zipfile +from PIL import Image +import sys +from io import BytesIO + +def extract_cover(epub, output_path, size): + for fileinfo in epub.filelist: + if fileinfo.filename.lower().endswith(('.jpg', '.jpeg', '.png')): + cover = epub.open(fileinfo.filename) + im = Image.open(BytesIO(cover.read())) + im.thumbnail((size, size), Image.LANCZOS) + im.save(os.path.join(output_path, os.path.basename(input_file) + '.png'), "PNG") + return True + return False + +if __name__ == '__main__': + input_file = sys.argv[1] + output_path = os.environ.get('THUMBNAIL_DIR', os.path.dirname(input_file)) + size = int(sys.argv[2]) + + epub = zipfile.ZipFile(input_file, "r") + if extract_cover(epub, output_path, size): + exit(0) + else: + print("Error extracting cover") + exit(1) + diff --git a/misc/scripts/focus.sh b/misc/scripts/focus.sh new file mode 100755 index 0000000..2bf7b82 --- /dev/null +++ b/misc/scripts/focus.sh @@ -0,0 +1,12 @@ +EXEC_SHELL_PATH=$(command -v bash) + +while true +do + PID=$(pgrep element) + if [ -n "$PID" ]; then + echo "Killing element (PID: $PID)" + kill -9 $PID + echo "element killed successfully!" + fi + sleep 1 +done diff --git a/misc/scripts/focus_real.sh b/misc/scripts/focus_real.sh new file mode 100755 index 0000000..9f4e0e2 --- /dev/null +++ b/misc/scripts/focus_real.sh @@ -0,0 +1,5 @@ +EXEC_SHELL_PATH=$(command -v bash) + +LOG_FILE="/tmp/element_exit.log" + +setsid nohup ~/.local/bin/focus.sh > "$LOG_FILE" 2>&1 & diff --git a/misc/scripts/gd-test b/misc/scripts/gd-test new file mode 100755 index 0000000..2a1fac1 --- /dev/null +++ b/misc/scripts/gd-test @@ -0,0 +1,3 @@ +export LD_LIBRARY_PATH=~/Documents/lib + +~/.local/bin/gd-tools diff --git a/misc/scripts/gd-tools b/misc/scripts/gd-tools new file mode 100755 index 0000000..5bfa888 Binary files /dev/null and b/misc/scripts/gd-tools differ diff --git a/misc/scripts/goldendict b/misc/scripts/goldendict new file mode 100755 index 0000000..78e777f --- /dev/null +++ b/misc/scripts/goldendict @@ -0,0 +1,5 @@ +export GTK_IM_MODULE=fcitx +export QT_IM_MODULE=fcitx +export XMODIFIERS=@im=fcitx + +goldendict diff --git a/misc/scripts/hakurei b/misc/scripts/hakurei new file mode 100755 index 0000000..c0eae0b Binary files /dev/null and b/misc/scripts/hakurei differ diff --git a/misc/scripts/lf/preview b/misc/scripts/lf/preview index 4b70b2e..92c7ff4 100755 --- a/misc/scripts/lf/preview +++ b/misc/scripts/lf/preview @@ -51,10 +51,16 @@ case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;; *.epub) - [ ! -f "$CACHE" ] && \ - epub-thumbnailer "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; + + [ ! -f "$CACHE" ] && \ + ~/.local/bin/epub_thumbnailer.sh "$1" "$CACHE" 1024 + if [ -f "$CACHE" ]; then + image "$CACHE" "$2" "$3" "$4" "$5" + else + print "Error extracting cover" + exit 1 + fi + ;; *.cbz|*.cbr|*.cbt) [ ! -f "$CACHE" ] && \ comicthumb "$1" "$CACHE" 1024 diff --git a/misc/scripts/lf/preview~ b/misc/scripts/lf/preview~ new file mode 100755 index 0000000..4b70b2e --- /dev/null +++ b/misc/scripts/lf/preview~ @@ -0,0 +1,83 @@ +#!/bin/sh + +image() { + if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + exit 1 + else + chafa "$1" -s "$4x" + fi +} + +batorcat() { + file="$1" + shift + if command -v bat > /dev/null 2>&1 + then + bat --color=always --style=plain --pager=never "$file" "$@" + else + cat "$file" + fi +} + +CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" + +case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in + *.tgz|*.tar.gz) tar tzf "$1" ;; + *.tar.bz2|*.tbz2) tar tjf "$1" ;; + *.tar.txz|*.txz) xz --list "$1" ;; + *.tar) tar tf "$1" ;; + *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;; + *.rar) unrar l "$1" ;; + *.md) glow -s dark "$1" ;; + *.7z) 7z l "$1" ;; + *.[1-8]) man "$1" | col -b ;; + *.o) nm "$1";; + *.torrent) transmission-show "$1" ;; + *.iso) iso-info --no-header -l "$1" ;; + *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; + *.doc) catdoc "$1" ;; + *.docx) docx2txt "$1" - ;; + *.xml|*.html) w3m -dump "$1";; + *.xls|*.xlsx) + ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv + ;; + *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) + exiftool "$1" + ;; + *.pdf) + [ ! -f "${CACHE}.jpg" ] && \ + pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; + *.epub) + [ ! -f "$CACHE" ] && \ + epub-thumbnailer "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; + *.cbz|*.cbr|*.cbt) + [ ! -f "$CACHE" ] && \ + comicthumb "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; + *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) + [ ! -f "${CACHE}.jpg" ] && \ + ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5 + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; + *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.gif|*.jfif) + image "$1" "$2" "$3" "$4" "$5" + ;; + *.svg) + [ ! -f "${CACHE}.jpg" ] && \ + convert "$1" "${CACHE}.jpg" + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; + *.ino) + batorcat --language=cpp "$1" + ;; + *) + batorcat "$1" + ;; +esac +exit 0 diff --git a/misc/scripts/loophole b/misc/scripts/loophole new file mode 100755 index 0000000..93ffd63 Binary files /dev/null and b/misc/scripts/loophole differ diff --git a/misc/scripts/mullvad.sh b/misc/scripts/mullvad.sh new file mode 100755 index 0000000..6154c70 --- /dev/null +++ b/misc/scripts/mullvad.sh @@ -0,0 +1,23 @@ +EXEC_SHELL_PATH=$(command -v bash) + +MULLVAD="/nix/var/nix/profiles/default/bin/mullvad-daemon" +LOG_FILE="/tmp/mullvad.log" + + +# Create the log directory if it doesn't exist +mkdir -p "$(dirname "$LOG_FILE")" + + +# Check if Navidrome is already running +if pgrep -x "mullvad" > /dev/null; then + echo "mullvad is already running. Exiting." +else + # Run Navidrome command, redirecting output to the log file and detaching it from the terminal + setsid nohup $MULLVAD > "$LOG_FILE" 2>&1 & + echo "mullvad started and detached from the terminal." +fi + + + + + diff --git a/misc/scripts/noisetorch b/misc/scripts/noisetorch new file mode 100755 index 0000000..91b552d Binary files /dev/null and b/misc/scripts/noisetorch differ diff --git a/misc/scripts/preview.sh b/misc/scripts/preview.sh index 5bb0ba3..747aae9 100755 --- a/misc/scripts/preview.sh +++ b/misc/scripts/preview.sh @@ -1,19 +1,46 @@ -#!/bin/sh +EXEC_SHELL_PATH=$(command -v bash) + +export THUMBNAIL_DIR="$HOME/.cache/lf/epub" + set -e +# Define cleanup function to close file descriptor and remove FIFO file cleanup() { exec 3>&- - rm "$FIFO_UEBERZUG" + rm "$FIFO_UEBERZUG" } -if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - lf "$@" -else - [ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf" - export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" - mkfifo "$FIFO_UEBERZUG" - ueberzug layer -s <"$FIFO_UEBERZUG" -p json & - exec 3>"$FIFO_UEBERZUG" - trap cleanup EXIT - lf "$@" 3>&- -fi +# Check if running over SSH and exit if true +[[ -n $SSH_CLIENT || -n $SSH_TTY ]] && exit 0 + +# Create necessary directories +[[ ! -d $HOME/.cache/lf ]] && mkdir -p "$HOME/.cache/lf" +export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" +mkfifo "$FIFO_UEBERZUG" + +# Start ueberzugpp in background +ueberzugpp layer -s <"$FIFO_UEBERZUG" -p json & +exec 3>"$FIFO_UEBERZUG" +trap cleanup EXIT + +case "$1" in + *.epub) + EPUB_FILE="$1" + THUMBNAIL_DIR="$HOME/.cache/lf/epub" + mkdir -p "$THUMBNAIL_DIR" + THUMBNAIL_PATH="${THUMBNAIL_DIR}/${EPUB_FILE%.epub}.png" + + # Check if the thumbnail exists, if not, generate it + if [[ ! -f $THUMBNAIL_PATH ]]; then + $HOME/.config/lf/epub_thumbnailer.sh "$EPUB_FILE" 256 + fi + + # Open the generated thumbnail with nsxiv + nsxiv "$THUMBNAIL_DIR" & + # just a workaround, will fix to display the file instead of the + # whole folder + ;; + *) + exit 0 + ;; +esac diff --git a/misc/scripts/run_anki.sh b/misc/scripts/run_anki.sh index a66f5c9..ec7bd6f 100755 --- a/misc/scripts/run_anki.sh +++ b/misc/scripts/run_anki.sh @@ -1,8 +1,11 @@ EXEC_SHELL_PATH=$(command -v bash) +export QT_XCB_GL_INTEGRATION=none +export QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox" +export DISABLE_QT5_COMPAT=1 # Run Anki with nohup, redirecting output to a log file -nohup flatpak run net.ankiweb.Anki > anki.log 2>&1 & +nohup /nix/var/nix/profiles/default/bin/anki-bin > anki.log 2>&1 & # Disown the process to remove it from the shell's job table disown diff --git a/misc/scripts/send_image_telegram.sh b/misc/scripts/send_image_telegram.sh new file mode 100755 index 0000000..b24ebd6 --- /dev/null +++ b/misc/scripts/send_image_telegram.sh @@ -0,0 +1,44 @@ + + +EXEC_SHELL_PATH=$(command -v bash) + +send_most_recent_image_via_telegram() { + # Specify the correct folder paths + folder_path_x="/mnt/Data/mpv-screenshots/" + folder_path_y="/mnt/Data/mpv-screenshots/screenshots/" + + # Check if both folders exist + if [ ! -d "$folder_path_x" ] || [ ! -d "$folder_path_y" ]; then + echo "Error: One or both folders do not exist." + return 1 + fi + + # Get the most recent file from FolderX + most_recent_x=$(find "$folder_path_x" -maxdepth 1 \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.bmp" -o -iname "*.tiff" \) -exec stat --format='%Y %n' {} + | sort -nr | head -n 1) + + # Get the most recent file from FolderY + most_recent_y=$(find "$folder_path_y" -maxdepth 1 \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.bmp" -o -iname "*.tiff" \) -exec stat --format='%Y %n' {} + | sort -nr | head -n 1) + + # Compare the modification times and choose the most recent file + if [ "$(echo "$most_recent_x" | cut -d' ' -f 1)" -gt "$(echo "$most_recent_y" | cut -d' ' -f 1)" ]; then + most_recent_file="$most_recent_x" + else + most_recent_file="$most_recent_y" + fi + + # Check if telegram-desktop is installed + if ! command -v telegram-desktop &> /dev/null; then + echo "Error: telegram-desktop is not installed." + return 1 + fi + + # Activate telegram-desktop window + wmctrl -x -a telegram-desktop + + # Send the most recent image file via telegram-desktop + telegram-desktop -sendpath "$(echo "$most_recent_file" | cut -d' ' -f 2-)" + echo "Sent most recent image file via telegram-desktop: $(echo "$most_recent_file" | cut -d' ' -f 2-)" +} + +# Execute the function +send_most_recent_image_via_telegram diff --git a/misc/scripts/send_video_telegram.sh b/misc/scripts/send_video_telegram.sh new file mode 100755 index 0000000..62b7e3c --- /dev/null +++ b/misc/scripts/send_video_telegram.sh @@ -0,0 +1,40 @@ + + +EXEC_SHELL_PATH=$(command -v bash) + +send_most_recent_video_via_telegram() { + # Specify the correct folder path + folder_path="$HOME/Videos" + + # Check if the folder exists + if [ ! -d "$folder_path" ]; then + echo "Error: Folder does not exist." + return 1 + fi + + # Check if the folder is empty + if [ -z "$(find "$folder_path" -maxdepth 1 \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.flv" -o -iname "*.wmv" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.webm" \) -print -quit)" ]; then + echo "Error: Folder does not contain any video files." + return 1 + fi + + # Get the most recent video file + most_recent_video=$(find "$folder_path" -maxdepth 1 \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.flv" -o -iname "*.wmv" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.webm" \) -exec stat --format='%Y %n' {} + | sort -nr | head -n 1 | cut -d ' ' -f 2-) + file_path="$most_recent_video" + + # Check if telegram-desktop is installed + if ! command -v telegram-desktop &> /dev/null; then + echo "Error: telegram-desktop is not installed." + return 1 + fi + + # Activate telegram-desktop window + wmctrl -x -a telegram-desktop + + # Send the most recent video file via telegram-desktop + telegram-desktop -sendpath "$file_path" + echo "Sent most recent video file via telegram-desktop: $file_path" +} + +# Execute the function +send_most_recent_video_via_telegram diff --git a/misc/scripts/wallpapers-lua.sh b/misc/scripts/wallpapers-lua.sh new file mode 100755 index 0000000..b8bf9fa --- /dev/null +++ b/misc/scripts/wallpapers-lua.sh @@ -0,0 +1,58 @@ +EXEC_SHELL_PATH=$(command -v bash) + +lua=$(which lua) +pid=$$ +"$lua" < doFloat , isDialog --> doFloat + , className =? "GoldenDict-ng" --> doShift "ws7" + , className =? "qBittorrent" --> doShift "ws8" + , manageSpawn ] +spawnAndShift :: WorkspaceId -> String -> X () +spawnAndShift ws app = do + spawn app + windows $ W.shift ws myTheme :: Theme myTheme = def