From 79860803ee98da1d272ec0703c5e380f2df67952 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Fri, 23 Jun 2023 10:10:17 -0300 Subject: [PATCH] Bunch of stuff --- Backup/.Backup_HD.sh | 16 ++++-- Backup/exclude | 15 +++++ Backup/runBackup.sh | 2 +- KDE/OXO.sh | 1 + Pacman/updateRepositories.sh | 4 +- Screen/desktop.sh | 15 +++-- Screen/new_laptop.sh | 13 ++++- Services/backup-contabo.sh | 30 +++++++--- Services/logRestartError.sh | 6 ++ browser.sh | 29 +++++----- mostUsedURLs | 30 ++++------ music/csound | 17 +++++- ntfy.sh | 60 ++++++++++++++++++++ start-dashboard | 23 +++++--- start-dev.sh | 52 ++++++++++++++--- start-firefox.sh | 43 +++++++------- start-oxo.sh | 106 ++++++++++++++++++++++++++++------- startup.sh | 13 +++-- stop-dev.sh | 1 + stop-oxo.sh | 2 + tags | 13 ++++- xrandr.sh | 2 +- 22 files changed, 373 insertions(+), 120 deletions(-) create mode 100755 Services/logRestartError.sh create mode 100755 ntfy.sh diff --git a/Backup/.Backup_HD.sh b/Backup/.Backup_HD.sh index 05c0c95..3fa55e1 100755 --- a/Backup/.Backup_HD.sh +++ b/Backup/.Backup_HD.sh @@ -16,7 +16,8 @@ function backup () { # $2 - Backup name # $3 - Files/Folders to backup prepareFolder $1 - echo -e "${blue} `date +%r` - Backing up (compressed)...${reset}" + DS=$(diskSpace $1) + echo -e "${blue} `date +%r` - Backing up (compressed)...${reset} [Free disk space: $DS ]" ionice -c 3 nice -n 19 borg create --compression auto,zstd,9 --exclude-from=./exclude "$1::$2" "$3" checkBackup $1 } @@ -54,9 +55,13 @@ function checkBackup() { function pruneBackup() { echo -e "${blue} `date +%r` - Prune old backups...${reset}" - borg prune --keep-weekly=4 --keep-monthly=12 --keep-yearly=2 $1 + borg prune --keep-weekly=4 --keep-monthly=12 --keep-yearly=1 $1 + borg compact $1 } +function diskSpace() { + df -h --output=avail "$1" | sed --silent '2p' +} cd /home/bruno/Apps/linuxShortcuts/Backup/ @@ -119,15 +124,16 @@ backupNoCompression "$HDPath/Fotos" "$YEARMONTH" "/run/media/bruno/Multimedia/Fo echo -e "${white}`date +%r` - Copying Video folder (6/7)...\e[39m" backupNoCompression "$HDPath/Videos" "$YEARMONTH" "/run/media/bruno/Multimedia/Videos" || echo "" -echo -e "${white}`date +%r` - Copying Virtual Machines folder (7/7)...\e[39m" -backup "$HDPath/VirtualMachines" "$YEARMONTH" "/run/media/bruno/Multimedia/Virtual Machines" || echo "" +#echo -e "${white}`date +%r` - Copying Virtual Machines folder (7/7)...\e[39m" +#backup "$HDPath/VirtualMachines" "$YEARMONTH" "/run/media/bruno/Multimedia/Virtual Machines" || echo "" # Show result echo -e "${green}`date +%r` - Backup finished. Please, verify your log files.\e[39m" echo "$ActiveDisk" > .lastDisk -/usr/bin/curl -d "Backup HD: Completed" ntfy.sh/bft >/dev/null 2>&1 & +# /usr/bin/curl -d "Backup HD: Completed" ntfy.sh/bft >/dev/null 2>&1 & +/home/bruno/Apps/linuxShortcuts/ntfy.sh -t "Michelle Backup Completed!" a "floppy_disk" "Close the window and remove the disk..." >/dev/null 2>&1 & kdialog --title "Backup Complete" --msgbox "Backup finished successfully" echo echo "Backup on $device is finished. Press any key to close..." diff --git a/Backup/exclude b/Backup/exclude index 8cc0588..02fa64b 100755 --- a/Backup/exclude +++ b/Backup/exclude @@ -4,24 +4,39 @@ /home/bruno/.local/share/dino/files /home/bruno/.local/share/gajim/downloads /home/bruno/.minecraft/ +/home/bruno/.mozilla/*/archives/ /home/bruno/.netbeans /home/bruno/.node-gyp /home/bruno/.npm /home/bruno/.npm-global /home/bruno/.openshot_qt +/home/bruno/.phpls/ /home/bruno/.steam/ /home/bruno/.tlauncher /home/bruno/.vagrant.d/ /home/bruno/.wine/ /home/bruno/Android/ +/home/bruno/Apps/LearnToCodeRPG-1.0-linux/ +/home/bruno/Apps/MemsourceEditor/ /home/bruno/Apps/Minecraft/Backups/ +/home/bruno/Apps/surfshark/ +/home/bruno/Apps/tor-browser_en-US/ +/home/bruno/Apps/pdshell/music/ +/home/bruno/Apps/arduino-1.8.3/ +/home/bruno/Apps/teamviewer* +/home/bruno/Apps/.joplin-bin/ +/home/bruno/Calibre Library/ /home/bruno/Emulation/ +/home/bruno/Games/ +/home/bruno/Podcasts/ /home/bruno/Videos/ /home/bruno/VirtualBox VMs/ /home/bruno/bin/ +/home/bruno/gPodder/ /home/bruno/go/ /home/bruno/node_modules /home/bruno/shared/ +/home/bruno/snap/ /run/media/bruno/Multimedia/Localização/Ccaps/Projetos/@Delivered /run/media/bruno/Multimedia/Localização/Ccaps/Projetos/MasterClass /run/media/bruno/Multimedia/Localização/Ccaps/TEMP diff --git a/Backup/runBackup.sh b/Backup/runBackup.sh index 6bac646..893dbed 100755 --- a/Backup/runBackup.sh +++ b/Backup/runBackup.sh @@ -1,3 +1,3 @@ #!/bin/sh -/bin/terminator -m -T BACKUP -x sudo systemd-inhibit bash /home/bruno/Apps/linuxShortcuts/Backup/.Backup_HD.sh & +/bin/terminator -m -T BACKUP -x "sudo systemd-inhibit bash /home/bruno/Apps/linuxShortcuts/Backup/.Backup_HD.sh" & diff --git a/KDE/OXO.sh b/KDE/OXO.sh index 2620cbe..518a7c2 100755 --- a/KDE/OXO.sh +++ b/KDE/OXO.sh @@ -3,6 +3,7 @@ # Goes back to Main if tomatoshell is not running [ $(pgrep -f 'OXO.sh' | wc -l) -gt 2 ] && exit +[ $(pgrep -f 'start-oxo.sh') ] && exit sleep 30s while [ 1 = 1 ]; do diff --git a/Pacman/updateRepositories.sh b/Pacman/updateRepositories.sh index bf20504..db97b13 100755 --- a/Pacman/updateRepositories.sh +++ b/Pacman/updateRepositories.sh @@ -14,7 +14,7 @@ set -e s -v bold "Updating..." -nice --adjustment=19 ionice -c 3 yay -Syu --sudoloop --answerclean none --answerdiff all --answerupgrade all --noremovemake --norebuild --noredownload --nobatchinstall --cleanafter +nice --adjustment=18 ionice -c 3 yay -Syu --sudoloop --answerclean none --answerdiff all --answerupgrade all --noremovemake --norebuild --noredownload --nobatchinstall --cleanafter bold "Cleaning stuff..." s -v @@ -23,4 +23,6 @@ s -v yes | (sudo -S pacman -Rns $(pacman -Qtdq) --color always 2>/dev/null) s -k + +s /home/bruno/pacnew.sh notify-send "Update script has finished!" diff --git a/Screen/desktop.sh b/Screen/desktop.sh index 37c9353..e936af0 100755 --- a/Screen/desktop.sh +++ b/Screen/desktop.sh @@ -1,6 +1,13 @@ #!/bin/sh -xrandr --output HDMI-1 --mode 1920x1080 -xrandr --output HDMI-2 --mode 1920x1080 -sleep 3 + /bin/numlockx on -/home/bruno/Apps/linuxShortcuts/start-oxo.sh organize + +#xrandr --output HDMI1 --mode 1920x1080 +#xrandr --output HDMI2 --mode 1920x1080 + +xrandr --output HDMI2 --mode 1920x1080 --pos 0x0 --rate 60.0 \ + --output HDMI1 --mode 1920x1080 --right-of HDMI2 --rate 74.97 + +sleep 3 +/home/bruno/Apps/linuxShortcuts/start-oxo.sh "organize" +echo "desktop" > /home/bruno/.layout diff --git a/Screen/new_laptop.sh b/Screen/new_laptop.sh index 3fa80d7..98ee1f9 100755 --- a/Screen/new_laptop.sh +++ b/Screen/new_laptop.sh @@ -1,11 +1,18 @@ #!/bin/sh setxkbmap -model abnt2 -layout br -variant ,abnt2 -xrandr --output HDMI-1 --mode 1280x720 #Max resolution monitor can do that fits blackout -xrandr --output HDMI-1 --mode 1366x768 #Max resolution monitor can do that fits blackout -xrandr --output HDMI-2 --mode 1366x768 +#exit 0 + +# 1280x720 = Max resolution monitor can do that fits blackout + +xrandr --output HDMI2 --mode 1366x768 --pos 0x0 --rate 59.79 \ + --output HDMI1 --mode 1280x720 --right-of HDMI2 --rate 60.00 + +#xrandr --output HDMI1 --mode 1280x720 #Max resolution monitor can do that fits blackout +#xrandr --output HDMI2 --mode 1366x768 win_list=$(wmctrl -x -l | grep -i "OXO|" | awk '{print $1}' ) for win in "${win_list[@]}" do wmctrl -r "$win" -i -b add,maximized_vert,maximized_horz done +echo "blackout" > /home/bruno/.layout diff --git a/Services/backup-contabo.sh b/Services/backup-contabo.sh index 183078f..fa88220 100755 --- a/Services/backup-contabo.sh +++ b/Services/backup-contabo.sh @@ -1,5 +1,7 @@ #! /bin/bash +set +e + if [[ `nmcli -t -f GENERAL.METERED dev show | grep "METERED:yes"` ]]; then echo Backup does not work on metered connections exit 1 @@ -11,28 +13,42 @@ if [[ -z $CONTABO_BACKUP_PATH ]]; then fi sleep 60 +OXO_PATH="/home/bruno/Backups/OXOwebsite/" + # Backup Contabo +echo "Backuping Contabo..." /bin/rsync --archive --backup --exclude "files/nextcloud*" --rsh=ssh backupContabo:/home/bruno/backups/* $CONTABO_BACKUP_PATH # Backup Gitea -/bin/rsync --archive --backup --rsh=ssh gitea:/home/brunofontes/ttt/ ~/Backups/gitea/ +echo "Backuping Gitea..." +/bin/rsync --archive --backup --rsh=ssh bkpgitea:/home/brunofontes/ttt/ /home/bruno/Backups/gitea/ # Backup OXO Files -/bin/rsync --archive --backup --rsh=ssh oxo:~/public_html ~/Backups/OXOwebsite/ -tar cfz ~/Backups/OXOwebsite/`date '+%Y-%m-%d'`_OXOwebsiteBackup.tar.gz ~/Backups/OXOwebsite/public_html/ -rm -rf ~/Backups/OXOwebsite/public_html/ +echo "Backuping OXO Files..." +/bin/rsync --archive --backup --exclude='uploads/cf7-uploads-custom/' --rsh=ssh oxo:~/public_html $OXO_PATH + +DATE=$(date '+%Y-%m-%d') + +echo "Borg(ing) OXO Files..." +ionice -c 3 nice -n 19 borg create --compression auto,zstd,9 --exclude-from="${OXO_PATH}.exclude" "${OXO_PATH}borg::${DATE}_Files" "${OXO_PATH}public_html/" + +echo "Deleting already backuped OXO Files..." +rm -rf "${OXO_PATH}public_html/" # Backup OXO DB +echo "Backuping OXO DBs..." ssh oxo ./backupDB.sh -/bin/rsync --archive --backup --compress --rsh=ssh oxo:~/db/* ~/Backups/OXOwebsite/ +/bin/rsync --archive --backup --compress --rsh=ssh oxo:~/db/* $OXO_PATH ssh oxo rm ./db/* +ionice -c 3 nice -n 19 borg create --compression auto,zstd,9 --exclude-from="${OXO_PATH}.exclude" "${OXO_PATH}borg::${DATE}_DBs" $OXO_PATH +rm -f "${OXO_PATH}*.gz" # Delete old backups +echo "Deleting old backup files..." find $CONTABO_BACKUP_PATH/db -type f -name "*.sql.gz" -mtime +15 -delete find $CONTABO_BACKUP_PATH/keys -type f -name "*.*" -mtime +15 -delete find $CONTABO_BACKUP_PATH/files -type f -name "*.*" -mtime +35 -delete find $CONTABO_BACKUP_PATH/mail -type f -name "*.*" -mtime +20 -delete find $CONTABO_BACKUP_PATH/ -type f -name "*.*" -mtime +120 -delete -find ~/Backups/OXOwebsite/ -type f -name "*.gz" -mtime +15 -delete -find ~/Backups/gitea/ -type f -name "*.zip" -mtime +15 -delete +find /home/bruno/Backups/gitea/ -type f -name "*.zip" -mtime +15 -delete diff --git a/Services/logRestartError.sh b/Services/logRestartError.sh new file mode 100755 index 0000000..f844d48 --- /dev/null +++ b/Services/logRestartError.sh @@ -0,0 +1,6 @@ +#!/bin/bash +/bin/systemctl status --full "$1" >> /home/bruno/.log_error +sleep 20 +/bin/systemctl stop "$1" +sleep 3 +/bin/systemctl start "$1" diff --git a/browser.sh b/browser.sh index a1ed2d2..3548cc2 100755 --- a/browser.sh +++ b/browser.sh @@ -1,5 +1,5 @@ -#!/bin/bash -activity=`kactivities-cli --current-activity | cut -d" " -f3` +#!/bin/zsh +activity=$(kactivities-cli --current-activity | cut -d" " -f3) if [[ $1 =~ .*youtube\.com.* ]]; then mpv "$*" >/dev/null 2>&1 & @@ -11,15 +11,16 @@ if [[ $1 =~ .*youtu\.be.* ]]; then exit fi -if [[ $1 =~ .*\&incognitottt$ ]]; then - url="${1/\&incognitottt/}" - [[ $activity == "OXO" ]] && /bin/brave --incognito "$url" >/dev/null 2>&1 & - [[ $activity == "Development" ]] && /home/bruno/Apps/firefox/firefox-bin --private-window "$url" >/dev/null 2>&1 & - [[ $activity == "Main" ]] && /bin/firefox --private-window "$url" >/dev/null 2>&1 & - [[ $activity == "Videos" ]] && /bin/firefox --private-window "$url" >/dev/null 2>&1 & -else - [[ $activity == "OXO" ]] && /bin/firefox -P OXO "$1" >/dev/null 2>&1 & - [[ $activity == "Development" ]] && /home/bruno/Apps/firefox/firefox-bin "$1" >/dev/null 2>&1 & - [[ $activity == "Main" ]] && /bin/firefox "$1" >/dev/null 2>&1 & - [[ $activity == "Videos" ]] && /bin/firefox "$1" >/dev/null 2>&1 & -fi +# if [[ $1 =~ .*\&incognitottt$ ]]; then +# url="${1/\&incognitottt/}" +# [[ $activity == "OXO" ]] && /bin/brave --incognito "$url" >/dev/null 2>&1 & +# [[ $activity == "Development" ]] && /home/bruno/Apps/firefox/firefox-bin --private-window "$url" >/dev/null 2>&1 & +# [[ $activity == "Main" ]] && /bin/firefox --private-window "$url" >/dev/null 2>&1 & +# [[ $activity == "Videos" ]] && /bin/firefox --private-window "$url" >/dev/null 2>&1 & +# exit 0 +# fi + +[[ $activity == "OXO" ]] && /bin/firefox -P OXO "$1" >/dev/null 2>&1 & +[[ $activity == "Development" ]] && /home/bruno/Apps/firefox/firefox-bin "$1" >/dev/null 2>&1 & +[[ $activity == "Main" ]] && /bin/firefox "$1" >/dev/null 2>&1 & +[[ $activity == "Videos" ]] && /bin/firefox "$1" >/dev/null 2>&1 & diff --git a/mostUsedURLs b/mostUsedURLs index d3f0594..8dfc1d9 100644 --- a/mostUsedURLs +++ b/mostUsedURLs @@ -1,24 +1,18 @@ -oxo.plunet.com -helpdesk.plunet.com -github.com -metager.org brunofontes.net -matrix.brunofontes.net +cheat.sh +cloud.memsource.com google.com -gstatic.com -gmail.com -mail.google.com docs.google.com +duckduckgo.com +ecb.europa.eu +gitea.brunofontes.net +github.com +memsource.com +oxo.egnyte.com +oxo.plunet.com sheets.google.com ticktick.com -linkedin.com -licdn.com -wikipedia.com time.is -memsource.com -cloud.memsource.com -oxo.egnyte.com -sbt.com.br -globoplay.globo.com -www.band.uol.com.br -hcaptcha.com +wallabag.brunofontes.net +www.ecb.europa.eu +xltrans.plunet.com diff --git a/music/csound b/music/csound index 01d0052..5d0d134 100755 --- a/music/csound +++ b/music/csound @@ -1,15 +1,28 @@ #!/bin/sh + +exit 0 + +## NOT RUNNING while [[ $# -gt 0 ]] do key="$1" case $key in -h|--hdmi) - pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:hdmi-stereo-extra1 && echo "HDMI profile is active" && kdialog --passivepopup "Audio output changed to HDMI" --title="Audio profile changed" 2 + pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:hdmi-stereo && echo "HDMI profile is active" && kdialog --passivepopup "Audio output changed to HDMI" --title="Audio profile changed" 2 + + #pacmd set-default-sink 0 + #pacmd set-card-profile alsa_card.usb-046d_HD_Pro_Webcam_C920_45ADDDAF-02 off # Turn off Webcam Microphone entry + #pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:hdmi-stereo+input:analog-stereo && echo "HDMI profile is active" && kdialog --passivepopup "Audio output changed to HDMI" --title="Audio profile changed" 2 shift ;; -a|--analog) - pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:analog-stereo && echo "Analog Profile is active" && kdialog --passivepopup "Audio output changed to ANALOG" --title="Audio profile changed" 2 + pacmd set-card-profile alsa_card.usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00 output:analog-stereo+input:mono-fallback && echo "Analog Profile is active" && kdialog --passivepopup "Audio output changed to ANALOG" --title="Audio profile changed" 2 + + #pacmd set-card-profile alsa_card.usb-046d_HD_Pro_Webcam_C920_45ADDDAF-02 off # Turn off Webcam Microphone entry + # pacmd set-default-sink 1 + #pacmd set-card-profile alsa_card.usb-046d_HD_Pro_Webcam_C920_45ADDDAF-02 off # Turn off Webcam Microphone entry + #pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:analog-stereo+input:analog-stereo && echo "Analog Profile is active" && kdialog --passivepopup "Audio output changed to ANALOG" --title="Audio profile changed" 2 shift ;; diff --git a/ntfy.sh b/ntfy.sh new file mode 100755 index 0000000..c05df3f --- /dev/null +++ b/ntfy.sh @@ -0,0 +1,60 @@ +#!/bin/bash -- + +TITLE="" +PRIORITY="" +TAGS="" +TOPIC="bft" +TEXT="" +HELP=' +RUN: ntfy.sh [-t "My Title"] [-p "high"] [-a "tag1,tag2"] [--topic "bft"] Here goes my message + +Params: +-t, --title, [optional] a title for the alert +-p, --priority, [optional] The priorities are: min, low, default, high or urgent +-a, --tags, [optional] one or more tags separate by comma with no spaces* + --topic [optional] the topic/channel on which the message will be sent to + +List of emojis that can be used as tags: https://brunofontes.net:9795/docs/emojis/ +' + +[[ -z $1 ]] && echo -e "$HELP" && exit 1 + + +while [[ $# -gt 0 ]] +do + case $1 in + -t|--title) + #TITLE="-H \"Title: $2\"" + TITLE="$2" + shift && shift + ;; + -p|--priority) + PRIORITY="$2" + shift && shift + ;; + -a|--tags) + TAGS="$2" + shift && shift + ;; + --topic) + TOPIC="$2" + shift && shift + ;; + -h|--help) + echo -e "$HELP" + exit 0 + ;; + *) + [[ -z $TEXT ]] && TEXT="$1" || TEXT="$TEXT $1" + shift + ;; + esac +done + +TOKEN=$(pass ntfy) +/usr/bin/curl -H "Authorization: Bearer $TOKEN" \ + -H "Title: $TITLE" \ + -H "Priority: $PRIORITY" \ + -H "Tags: $TAGS" \ + -d "$TEXT" \ + https://brunofontes.net:9795/$TOPIC diff --git a/start-dashboard b/start-dashboard index 0c01af7..3481f71 100755 --- a/start-dashboard +++ b/start-dashboard @@ -1,14 +1,14 @@ #!/bin/sh - if [[ $(tmux ls | grep 'dashboard') ]]; then - terminator -T "Dashboard" -x tmux a -t dashboard & + terminator --title "Dashboard" -x "tmux a -t dashboard" & + echo "Just attaching and exiting..." exit fi echo "Iniciando Dashboard..." sleep 2 tmux new -d -s dashboard tmux rename-window -t dashboard "Dashboard" -terminator -T "Dashboard" -x tmux a -t dashboard & +terminator -T "Dashboard" -x "tmux a -t dashboard" & sleep 10 tmux splitw -t dashboard tmux splitw -h -t dashboard:0.0 @@ -18,7 +18,7 @@ sleep 1 # 0 - Dashboard/khal tmux send -t dashboard:0.0 $'clear;watch --interval $((30 * 60)) --no-title --color screenfetch\n' -tmux send -t dashboard:0.1 $'alias clear="clear;figlet Dashboard; echo -n Khal:\ ; khal list --exclude-calendar rotina; echo;"\n' +tmux send -t dashboard:0.1 $'alias clear="/bin/clear;figlet Dashboard; bdays; khal list --notstarted now --exclude-calendar rotina; echo;"\n' tmux send -t dashboard:0.2 $'btop\n' tmux send -t dashboard:0.1 $'clear\n' tmux send -t dashboard:0.1 $'ikhal\n' @@ -30,11 +30,13 @@ tmux send -t dashboard:1.0 $'tut --user brunofontes@fosstodon.org\n' tmux rename-window -t dashboard:1 "tut - Fosstodon" tmux setw monitor-activity -t dashboard:1 -# 2 - Tut - Mastodon Social +# 2 - Tut - me@GtS tmux new-window -t dashboard sleep 1 -tmux send -t dashboard:2.0 $'tut --user brunofontes@mastodon.social\n' -tmux rename-window -t dashboard:2 "tut - MastodonSocial" +#tmux send -t dashboard:2.0 $'tut --user brunofontes@mastodon.social\n' +tmux send -t dashboard:2.0 $'tut --user me@gts.brunofontes.net\n' +#tmux rename-window -t dashboard:2 "tut - MastodonSocial" +tmux rename-window -t dashboard:2 "tut - @me@GtS.brunofontes.net" tmux setw monitor-activity -t dashboard:2 # 3 - GoMuks @@ -58,12 +60,17 @@ tmux rename-window -t dashboard:5 joplin # Weechat keeps connecting and disconnecting and I am not reading the messages # so it was just creating noise in the chat rooms -6 - Weechat +# 6 - Weechat tmux new-window -t dashboard tmux send -t dashboard:6.0 $'weechat\n' #tmux send -t dashboard:6.0 $'sleep 120; ssh contabo screen -DRS weechat\n' tmux rename-window -t dashboard:6 weechat +# 7 - Newsboat +tmux new-window -t dashboard +tmux send -t dashboard:7.0 $'newsboat\n' +tmux rename-window -t dashboard:7 Newsboat + # Back to Dashboard tmux select-window -t dashboard:0 tmux setw monitor-silence -t dashboard:0 diff --git a/start-dev.sh b/start-dev.sh index 7fdabd0..a4a2f3d 100755 --- a/start-dev.sh +++ b/start-dev.sh @@ -1,13 +1,47 @@ -#!/bin/sh +#!/bin/bash - +PARAM="$1" +LAYOUT=$(/dev/null & -sleep 4 +if [[ -z $(tmux ls | grep "DEV") ]] +then + /bin/terminator --title "DEV" -x "cd ~/development; tmux new -t \"DEV\"" & + sleep 1 + opening=1 + startedTerm=1 +fi +#if [ -z $(pgrep "qutebrowser") ] +#then +# /bin/qutebrowser &>/dev/null & +# opening=1 +#fi +#if [ $opening ] +#then +# sleep 4 +#fi TERMINATOR="0,1988,61,1760,880" QUTE="0,90,78,1715,900" -wmctrl -r "DEV" -F -b remove,maximized_vert,maximized_horz -wmctrl -r "qutebrowser" -b remove,maximized_vert,maximized_horz -sleep 1 -wmctrl -r "DEV" -F -e $TERMINATOR -wmctrl -r "qutebrowser" -e $QUTE +if [ $LAYOUT == "desktop" ] +then + wmctrl -r "DEV" -F -b remove,maximized_vert,maximized_horz + wmctrl -r "qutebrowser" -b remove,maximized_vert,maximized_horz + sleep 1 + wmctrl -r "DEV" -F -e $TERMINATOR + wmctrl -r "qutebrowser" -e $QUTE +else + wmctrl -r "DEV" -F -e $TERMINATOR + wmctrl -r "qutebrowser" -e $QUTE + sleep 1 + wmctrl -r "DEV" -F -b add,maximized_vert,maximized_horz + wmctrl -r "qutebrowser" -b add,maximized_vert,maximized_horz +fi + + +if [[ "$PARAM" ]] +then + tmux send -t DEV $'cd "'${PARAM}$'"; clear; git status; pwd\n' +else + [[ -z $startedTerm ]] && exit 0 + tmux send -t DEV $'find $HOME/development/ -maxdepth 2 -type d | gum filter --limit 1 | read myfolder; cd $myfolder; clear; starta . || git status; pwd\n' +fi diff --git a/start-firefox.sh b/start-firefox.sh index 9f6ee6c..2f35652 100755 --- a/start-firefox.sh +++ b/start-firefox.sh @@ -1,7 +1,7 @@ #!/bin/sh isFirefoxRunning=$(pgrep --exact "firefox" -a | grep -v "OXO") -if [ -z $isFirefoxRunning ] +if [[ -z $isFirefoxRunning ]] then echo "Starting Firefox..." /usr/lib/firefox/firefox >/dev/null 2>&1 & @@ -9,35 +9,36 @@ then sleep 20 fi -mainFirefox=$(wmctrl -l | grep -v "TickTick" | grep -v "OXO|" | awk '/Firefox/ { print $1 }') -TickTickFirefox=$(wmctrl -l | grep "TickTick" | grep -v "OXO|" | awk '/Firefox/ { print $1 }') +mainFirefox=$(wmctrl -l | grep -v "TickTick" | grep -v "OXO|" | awk '/Mozilla Firefox/ { print $1 }') +TickTickFirefox=$(wmctrl -l | grep "TickTick" | grep -v "OXO|" | awk '/Mozilla Firefox/ { print $1 }') echo "Main Firefox window id: $mainFirefox" echo " TickTick FF window id: $TickTickFirefox" -if [ -z $mainFirefox ] -then - notify-send "Firefox not found" - exit 1 -fi - -if [ -z $TickTickFirefox ] -then - notify-send "Firefox not found" - exit 1 -fi - -sleep 1 - # MONITOR TOP_LEFT_MONITOR="0,1935,0,570,973" TOP_RIGHT_MONITOR="0,2560,0,1280,1046" TOP_LEFT_MONITOR_BORDER="0,1935,15,570,973" TOP_RIGHT_MONITOR_BORDER="0,2540,15,1265,973" -wmctrl -i -r "$mainFirefox" -b remove,maximized_vert,maximized_horz -wmctrl -i -r "$TickTickFirefox" -b remove,maximized_vert,maximized_horz +if [[ -z $mainFirefox ]] +then + notify-send "Main Firefox not found" +else + for w in "$mainFirefox" + do + sleep 0.5 + wmctrl -i -r "$w" -b remove,maximized_vert,maximized_horz + sleep 0.5 + wmctrl -i -r "$w" -e $TOP_RIGHT_MONITOR_BORDER + done +fi sleep 1 -wmctrl -i -r "$TickTickFirefox" -e $TOP_LEFT_MONITOR_BORDER -wmctrl -i -r "$mainFirefox" -e $TOP_RIGHT_MONITOR_BORDER +if [[ -z $TickTickFirefox ]] +then + notify-send "TickTick Firefox not found" +else + wmctrl -i -r "$TickTickFirefox" -b remove,maximized_vert,maximized_horz + wmctrl -i -r "$TickTickFirefox" -e $TOP_LEFT_MONITOR_BORDER +fi diff --git a/start-oxo.sh b/start-oxo.sh index cd35f43..8af3109 100755 --- a/start-oxo.sh +++ b/start-oxo.sh @@ -1,21 +1,56 @@ #!/bin/sh -# start apps if no parameter is sent -if [ -z $1 ] +if [[ -z $1 ]] then - /bin/teams >/dev/null 2>&1 & - /usr/lib/firefox/firefox -P OXO >/dev/null 2>&1 & - /bin/terminator --title "Pomodoro" -x tmux new -t "Pomodoro" &>/dev/null & - sleep 2 - kactivities-cli --set-current-activity `kactivities-cli --list-activities | grep "Main" | cut -d' ' -f2` - sleep 120 + # Teams + # if [ -z $(xdotool search "(.*) Microsoft Teams") ] + # then + # echo "Opening Team..." + # /bin/teams >/dev/null 2>&1 & + # openingProgram=1 + # fi + + # Browser + + # if [[ -z $(pgrep --exact "brave" -a) ]] + # then + # echo "Opening Brave..." + # /usr/lib/brave-bin/brave >/dev/null 2>&1 & + # openingBrowser=1 + # fi + if [[ -z $(pgrep --exact "firefox" -a | grep "OXO") ]] + then + echo "Opening Firefox..." + /usr/lib/firefox/firefox -P OXO >/dev/null 2>&1 & + openingBrowser=1 + fi + + # Pomodoro + if [[ -z $(tmux ls | grep "Pomodoro") ]] + then + echo "Preparing Pomodoro Tool..." + /bin/terminator --title "Pomodoro" -x "tmux new -t \"Pomodoro\"" &>/dev/null & + sleep 2 + # kactivities-cli --set-current-activity $(kactivities-cli --list-activities | grep "Main" | cut -d' ' -f2) + openingProgram=1 + fi + + if [ $openingProgram ] + then + sleep 5 + fi + + if [[ $openingBrowser ]] + then + sleep 120 + fi fi # TV TOP_LEFT_TV="0,0,20,616,1016" TOP_RIGHT_TV="0,640,20,1255,1016" TOP_LEFT_TV_BORDER="0,15,35,570,330" -TOP_RIGHT_TV_BORDER="0,620,35,1265,993" +TOP_RIGHT_TV_BORDER="0,620,35,1265,990" # MONITOR TOP_LEFT_MONITOR="0,1935,0,570,973" @@ -23,26 +58,59 @@ TOP_RIGHT_MONITOR="0,2560,0,1280,1046" TOP_LEFT_MONITOR_BORDER="0,1935,15,570,973" TOP_RIGHT_MONITOR_BORDER="0,2540,15,1265,973" -mainFirefox=$(wmctrl -l | grep -v "TickTick" | grep "OXO|" | awk '/Firefox/ { print $1 }') -ticktickFirefox=$(wmctrl -l | grep "TickTick" | grep "OXO|" | awk '/Firefox/ { print $1 }') -wmctrl -i -r "$ticktickFirefox" -b remove,maximized_vert,maximized_horz -wmctrl -i -r "$mainFirefox" -b remove,maximized_vert,maximized_horz +mainFirefox=$(wmctrl -l | grep -v "TickTick" | grep -v "Plunet" | grep "OXO|" | awk '/Firefox/ { print $1 }') +ticktickFirefox=$(wmctrl -l | grep "TickTick" | grep -v "Plunet" | grep "OXO|" | awk '/Firefox/ { print $1 }') +#mainBrowser=$(wmctrl -l | grep -v "TickTick" | grep -v "OXO|Plunet BusinessManager" | awk '/Brave/ { print $1 }') +#ticktickBrowser=$(wmctrl -l | grep "TickTick" | grep -v "OXO|Plunet BusinessManager" | awk '/Brave/ { print $1 }') + +if [ $ticktickFirefox ] +then + wmctrl -i -r "$ticktickFirefox" -b remove,maximized_vert,maximized_horz +fi +if [ $mainFirefox ] +then + wmctrl -i -r "$mainFirefox" -b remove,maximized_vert,maximized_horz +fi +if [ $ticktickBrowser ] +then + wmctrl -i -r "$ticktickBrowser" -b remove,maximized_vert,maximized_horz +fi +if [ $mainBrowser ] +then + wmctrl -i -r "$mainBrowser" -b remove,maximized_vert,maximized_horz +fi wmctrl -r "Pomodoro" -F -b remove,maximized_vert,maximized_horz wmctrl -r "OXO|Plunet BusinessManager — Mozilla Firefox" -F -b remove,maximized_vert,maximized_horz sleep 1 -wmctrl -r "$ticktickFirefox" -e $TOP_LEFT_MONITOR_BORDER -wmctrl -r "$mainFirefox" -e $TOP_RIGHT_MONITOR_BORDER +if [ $ticktickFirefox ] +then + wmctrl -i -r "$ticktickFirefox" -e $TOP_LEFT_MONITOR_BORDER +fi +if [ $mainFirefox ] +then + wmctrl -i -r "$mainFirefox" -e $TOP_RIGHT_MONITOR_BORDER +fi +if [ $ticktickBrowser ] +then + wmctrl -i -r "$ticktickBrowser" -e $TOP_LEFT_MONITOR_BORDER +fi +if [ $mainBrowser ] +then + wmctrl -i -r "$mainBrowser" -e $TOP_RIGHT_MONITOR_BORDER +fi + wmctrl -r "Pomodoro" -F -e $TOP_LEFT_TV_BORDER wmctrl -r "OXO|Plunet BusinessManager — Mozilla Firefox" -F -e $TOP_RIGHT_TV_BORDER xdotool search "(.*) Microsoft Teams" windowminimize -if [ -z $1 ] +if [[ -z $1 ]] then sleep 2 - kactivities-cli --set-current-activity `kactivities-cli --list-activities | grep "OXO" | cut -d' ' -f2` - tmux send -t Pomodoro $'echo "Press enter to start\!"; read; pdshell\n' & - echo "OXO Activity prepared. You can start working" | festival --tts & + echo "OXO Activity prepared. You can start working" | festival --tts + zenity --question --text="Do you want to start working now?" || exit 0 + kactivities-cli --set-current-activity $(kactivities-cli --list-activities | grep "OXO" | cut -d' ' -f2) + tmux send -t Pomodoro $'pdshell\n' & fi diff --git a/startup.sh b/startup.sh index 60b9a29..ecfc94d 100755 --- a/startup.sh +++ b/startup.sh @@ -1,10 +1,11 @@ #!/bin/sh /usr/bin/nextcloud --background & sleep 5 -/home/bruno/Apps/linuxShortcuts/start-dashboard & -sleep 5 /home/bruno/Apps/remoteControl/start-remotecontrol.sh & -sleep 5 -/home/bruno/.local/bin/obs-virtWebcam & -sleep 5 -DISPLAY=0 firefox +sleep 60 +/home/bruno/Apps/linuxShortcuts/start-dashboard & + +exit 0 + +#sleep 5 +#/home/bruno/.local/bin/obs-virtWebcam & diff --git a/stop-dev.sh b/stop-dev.sh index fbd4a60..dc11ad9 100755 --- a/stop-dev.sh +++ b/stop-dev.sh @@ -1,4 +1,5 @@ #!/bin/bash +zenity --question --text="Should I stop DEV activity?" || exit 0 tmux kill-session -t DEV pkill qutebrowser kactivities-cli --stop-activity `kactivities-cli --list-activities | grep "Development" | cut -d' ' -f2` diff --git a/stop-oxo.sh b/stop-oxo.sh index 3c88766..ebd1c82 100755 --- a/stop-oxo.sh +++ b/stop-oxo.sh @@ -1,5 +1,7 @@ #!/bin/bash +zenity --question --text="Should I stop OXO activity?" || exit 0 tmux kill-session -t Pomodoro pkill "/usr/lib/firefox/firefox -P OXO" +pkill "brave" pkill teams kactivities-cli --stop-activity `kactivities-cli --list-activities | grep "OXO" | cut -d' ' -f2` diff --git a/tags b/tags index 456acd2..13b9c5e 100644 --- a/tags +++ b/tags @@ -8,10 +8,11 @@ !_TAG_PROGRAM_AUTHOR Universal Ctags Team // !_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ !_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 5.9.0 /p5.9.20210905.0/ +!_TAG_PROGRAM_VERSION 5.9.0 /p5.9.20220828.0/ AccuracySec Services/minecraft-hour.timer /^AccuracySec=1s$/;" k section:Timer After Services/after-wakeup.service /^After=suspend.target$/;" k section:Unit After Services/bruno-network-manager.service /^After=network-online.target$/;" k section:Unit +After Services/pihole.service /^After=docker.service network-online.target dhcpd.service$/;" k section:Unit After Services/roothints.service /^After=network.target$/;" k section:Unit After Services/testDNS.service /^After=network-online.target$/;" k section:Unit Before Services/before-sleep.service /^Before=sleep.target$/;" k section:Unit @@ -28,6 +29,7 @@ Description Services/mbsync.timer /^Description=Mailbox synchronization timer$/; Description Services/minecraft-hour.service /^Description=Minecraft Informa a Hora Certa$/;" k section:Unit Description Services/minecraft-hour.timer /^Description=Minecraft Informa a Hora Certa$/;" k section:Unit Description Services/minecraft-stop.service /^Description=Properly shutdown Minecraft before PC shutdown$/;" k section:Unit +Description Services/pihole.service /^Description=pihole$/;" k section:Unit Description Services/roothints.service /^Description=Update root hints for unbound$/;" k section:Unit Description Services/roothints.timer /^Description=Run root.hints monthly$/;" k section:Unit Description Services/run-media-bruno-Multimedia.mount /^Description=Mount Multimedia out of fstab$/;" k section:Unit @@ -48,6 +50,7 @@ ExecStart Services/logErrors@.service /^ExecStart=\/home\/bruno\/Apps\/linuxShor ExecStart Services/logErrors@.service /^ExecStart=\/usr\/bin\/curl -d "Michelle: fail to run %i" ntfy.sh\/bft$/;" k section:Service ExecStart Services/mbsync.service /^ExecStart=\/usr\/bin\/mbsync -Va$/;" k section:Service ExecStart Services/minecraft-hour.service /^ExecStart=\/bin\/sh \/home\/bruno\/Apps\/linuxShortcuts\/Services\/minecraft-hour.sh$/;" k section:Service +ExecStart Services/pihole.service /^ExecStart=\/usr\/local\/bin\/docker-compose up$/;" k section:Service ExecStart Services/roothints.service /^ExecStart=\/usr\/bin\/curl -o \/etc\/unbound\/root.hints https:\/\/www.internic.net\/domain\/nam/;" k section:Service ExecStart Services/testDNS.service /^ExecStart = \/bin\/bash \/home\/bruno\/Apps\/linuxShortcuts\/Services\/fixDNS.sh$/;" k section:Service ExecStart Services/updateRootHints.service /^ExecStart = \/bin\/bash \/home\/bruno\/Apps\/linuxShortcuts\/Services\/roothints.sh$/;" k section:Service @@ -62,6 +65,7 @@ Install Services/bruno-network-manager.service /^[Install]$/;" s Install Services/mbsync.timer /^[Install]$/;" s Install Services/minecraft-hour.timer /^[Install]$/;" s Install Services/minecraft-stop.service /^[Install]$/;" s +Install Services/pihole.service /^[Install]$/;" s Install Services/roothints.timer /^[Install]$/;" s Install Services/run-media-bruno-Multimedia.mount /^[Install]$/;" s Install Services/testDNS.service /^[Install]$/;" s @@ -78,6 +82,8 @@ OnFailure Services/after-wakeup.service /^OnFailure=logErrors@%n.service$/;" k s OnFailure Services/backup-contabo.service /^OnFailure=logErrors@%n.service$/;" k section:Unit OnFailure Services/backup-joplin.service /^OnFailure=logErrors@%n.service$/;" k section:Unit OnFailure Services/before-sleep.service /^OnFailure=logErrors@%n.service$/;" k section:Unit +OnFailure Services/bruno-network-manager.service /^OnFailure=logErrors@%n.service$/;" k section:Unit +OnFailure Services/mbsync.service /^OnFailure=logErrors@%n.service$/;" k section:Unit OnFailure Services/minecraft-hour.service /^OnFailure=logErrors@%n.service$/;" k section:Unit OnFailure Services/minecraft-stop.service /^OnFailure=logErrors@%n.service$/;" k section:Unit OnFailure Services/roothints.service /^OnFailure=logErrors@%n.service$/;" k section:Unit @@ -92,6 +98,7 @@ Persistent Services/roothints.timer /^Persistent=true$/;" k section:Timer Persistent Services/updateRootHints.timer /^Persistent=true$/;" k section:Timer RemainAfterExit Services/minecraft-stop.service /^RemainAfterExit=true$/;" k section:Service Requires Services/minecraft-hour.timer /^Requires=minecraft-hour.service$/;" k section:Unit +Requires Services/pihole.service /^Requires=docker.service multi-user.target$/;" k section:Unit SSH README.md /^## SSH$/;" s chapter:linuxShortcuts Service Services/after-wakeup.service /^[Service]$/;" s Service Services/backup-contabo.service /^[Service]$/;" s @@ -102,6 +109,7 @@ Service Services/logErrors@.service /^[Service]$/;" s Service Services/mbsync.service /^[Service]$/;" s Service Services/minecraft-hour.service /^[Service]$/;" s Service Services/minecraft-stop.service /^[Service]$/;" s +Service Services/pihole.service /^[Service]$/;" s Service Services/roothints.service /^[Service]$/;" s Service Services/testDNS.service /^[Service]$/;" s Service Services/updateRootHints.service /^[Service]$/;" s @@ -137,6 +145,7 @@ Unit Services/minecraft-hour.service /^[Unit]$/;" s Unit Services/minecraft-hour.timer /^Unit=minecraft-hour.service$/;" k section:Timer Unit Services/minecraft-hour.timer /^[Unit]$/;" s Unit Services/minecraft-stop.service /^[Unit]$/;" s +Unit Services/pihole.service /^[Unit]$/;" s Unit Services/roothints.service /^[Unit]$/;" s Unit Services/roothints.timer /^[Unit]$/;" s Unit Services/run-media-bruno-Multimedia.mount /^[Unit]$/;" s @@ -159,6 +168,7 @@ WantedBy Services/bruno-network-manager.service /^WantedBy=network-online.target WantedBy Services/mbsync.timer /^WantedBy=timers.target$/;" k section:Install WantedBy Services/minecraft-hour.timer /^WantedBy=timers.target$/;" k section:Install WantedBy Services/minecraft-stop.service /^WantedBy=multi-user.target$/;" k section:Install +WantedBy Services/pihole.service /^WantedBy=multi-user.target$/;" k section:Install WantedBy Services/roothints.timer /^WantedBy=timers.target$/;" k section:Install WantedBy Services/run-media-bruno-Multimedia.mount /^WantedBy=multi-user.target$/;" k section:Install WantedBy Services/testDNS.service /^WantedBy=multi-user.target$/;" k section:Install @@ -167,6 +177,7 @@ WantedBy Services/xpra@.service /^WantedBy=multi-user.target$/;" k section:Insta Wants Services/testDNS.service /^Wants=network-online.target$/;" k section:Unit What Services/run-media-bruno-Multimedia.mount /^What=\/dev\/disk\/by-label\/Multimedia$/;" k section:Mount Where Services/run-media-bruno-Multimedia.mount /^Where=\/run\/media\/bruno\/Multimedia$/;" k section:Mount +WorkingDirectory Services/pihole.service /^WorkingDirectory=\/home\/bruno\/Apps\/piholeDocker$/;" k section:Service apt-get README.md /^## apt-get$/;" s chapter:linuxShortcuts aur README.md /^### aur$/;" S section:linuxShortcuts""Pacman backup Backup/.Backup_HD.sh /^function backup () {$/;" f diff --git a/xrandr.sh b/xrandr.sh index 3cc2711..28b325b 100755 --- a/xrandr.sh +++ b/xrandr.sh @@ -1,3 +1,3 @@ #!/bin/sh -xrandr --output HDMI-2 --left-of HDMI-1 +xrandr --output HDMI2 --left-of HDMI1