From 5679d664efa2e8b65df2208386fdbf108e1851d7 Mon Sep 17 00:00:00 2001 From: Jonas Hahn Date: Thu, 6 Nov 2025 01:08:18 +0100 Subject: [PATCH] auto up 01:08:17 up 6:30, 2 users, load average: 0.62, 0.57, 0.51 --- shell/computer.sh | 24 ++++++++++++++++++++++++ shell/uni_setup.sh | 45 +++++++++++++++++++++++++++++++++++++++++---- shell/up.sh | 1 + 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100755 shell/computer.sh diff --git a/shell/computer.sh b/shell/computer.sh new file mode 100755 index 0000000..e8ae3a0 --- /dev/null +++ b/shell/computer.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Detect machine by hostname +HOST=$(hostname) + +case "$HOST" in + "minoxy") + # Apps for workstation + firefox --browser & + sleep 2 + hyprctl dispatch workspace 1 + ;; + "thinix") + # Apps for laptop + #thunderbird & + #nm-connection-editor & + ;; + *) + echo "Unknown host: $HOST" + ;; +esac + +# Optional: background processes should detach from terminal +disown diff --git a/shell/uni_setup.sh b/shell/uni_setup.sh index e83ac13..fde1b02 100755 --- a/shell/uni_setup.sh +++ b/shell/uni_setup.sh @@ -1,12 +1,49 @@ #!/usr/bin/env bash +# Try to kill +killall .rnote-wrapped +killall .sioyek-wrapped +killall .zathura-wrapped + # Select a parent folder using fzf -parent_folder=$(find ~/Nextcloud/University -mindepth 1 -type d | fzf --prompt="Select parent folder: ") || exit +parent_folder=$(find ~/Nextcloud/University -mindepth 1 -type d | fzf --prompt="What to work on? Or exit work. ") || exit +folder_name=$(basename "$parent_folder") +alt_path=~/projects/university/S3/"$folder_name"/VL # Find latest modified PDF and .rnote in that folder (non-recursive) latest_pdf=$(find "$parent_folder" -maxdepth 1 -type f -name "*.pdf" -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) latest_rnote=$(find "$parent_folder" -maxdepth 1 -type f -name "*.rnote" -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) +latest_vl=$(find "$alt_path" -maxdepth 1 -type f -name "*.pdf" -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) -# Open them with default apps -[[ -n "$latest_pdf" ]] && xdg-open "$latest_pdf" > /dev/zero 2>&1 & -[[ -n "$latest_rnote" ]] && xdg-open "$latest_rnote" > /dev/zero 2>&1 & +# Open .rnote +[[ -n "$latest_rnote" ]] && xdg-open "$latest_rnote" > /dev/null 2>&1 & + +# Open PDF +[[ -n "$latest_pdf" ]] && sioyek "$latest_pdf" > /dev/null 2>&1 & + +# Open VL file in Sioyek if found +[[ -n "$latest_vl" ]] && zathura "$latest_vl" > /dev/null 2>&1 & + +# Open Firefox only if it's already running +if pidof firefox > /dev/null; then + firefox https://ecampus.uni-goettingen.de + #firefox https://wikipedia.com +else + echo "Firefox is not running, not starting a new instance." +fi + +# Workspace logic +sleep 2 +hyprctl dispatch workspace 3 +hyprctl dispatch movetoworkspace 5 +hyprctl dispatch workspace 4 +sleep 0.1 +hyprctl dispatch workspace 3 +hyprctl dispatch movetoworkspace 8 +hyprctl dispatch workspace 4 + +#sleep 0.5 +#for i in {1..10}; do +# ydotool key 29:1 13:1 13:0 29:0 # 29: ctrl 13: equal :1 down :0 up +# sleep 0.005 +#done diff --git a/shell/up.sh b/shell/up.sh index bdf4a4e..c00a728 100755 --- a/shell/up.sh +++ b/shell/up.sh @@ -5,6 +5,7 @@ REPOS=( "/home/jonas/nixos" "/home/jonas/dotfiles" "/home/jonas/.config/nvim" + "/home/jonas/.config/emacs" "/home/jonas/projects/scripts" "/home/jonas/projects/university" )