Added current scripts

This commit is contained in:
Allen
2023-07-18 20:55:12 -05:00
parent bb8cac305b
commit 632a408c31
16 changed files with 216 additions and 0 deletions

View File

@ -0,0 +1 @@
My Linux Scripts in /usr/local/bin

8
WindowsRenameFix.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
echo read the comments in this file see a fix
# for f in ./*'('*')'*; do mv -i "$f" "${f/ (*)/}"; done
# for f in ./*/*'('*')'*; do mv -i "$f" "${f/ (*)/}"; done
# for f in ./*/*'('*')'*; do mv -i "$f" "${f/ (*)/}"; done
# etc, for the directory you're in that you want to fix.
# I know this is a garbage implementation, but not the best at bash scripting, so don't know how to recurse through each individual directory

51
autostart.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
export DISPLAY=:0
#Added some programs here since emptty had issues
polybar &
# --- Music Workspace Start ---
#Note: So alacritty specifically (I believe kitty fixed this) has a scaling issue because L/R monitor diff resolutions
#so, as a result terminal apps spawned on LMON and moved to RMON resulting in too large text font so setting to 9.5
#as this is like 97% scaled correctly in most circumstances as a botchy hack for now, just bc I like alacritty default colors
#Update: switched back to kitty using a custom theme that's better looking, alacritty with -o=font.size=9.5 was removed btw
#TERM=alacritty
TERM=kitty
THEMES=include=kitty-themes/themes
THEME=$THEMES/Hybrid.conf
SETTINGS=$THEME
$TERM --class Lyrics -o=$SETTINGS -e "lyrics" &
(sleep 1; $TERM --class Miniplayer -o=$SETTINGS -e "miniplayer") &
# --- Music Workspace End ---
easyeffects --gapplication-service &
lxsession &
/usr/bin/emacs --daemon &
xbindkeys &
xset dpms 300 &
#xss-lock -- slock &
xautolock -locker "slock" -nowlocker "slock -f" -time 5 &
picom --experimental-backends -b &
feh --bg-fill $(/public/wallpapers/mon1.cfg) --bg-fill $(/public/wallpapers/mon2.cfg) &
trayer --edge bottom --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x555E70 --height 22 &
conky -q -c /home/allen/.config/conky-0.conf &
conky -q -c /home/allen/.config/conky-1.conf &
mpDris2 &
playerctld &
copyq &
# --- Start dolphin daemon for desktop portal so you can open files with dolphin without it being open beforehand ---
dolphin --daemon &
# Try to fix gui program issues, couldn't find a working fix outside of xmonad. WMName might be working though, not sure.
#xprop -id "$WINDOWID" -f _NET_WM_NAME 8u -set _NET_WM_NAME LG3D &
#xsetroot -name LG3D &
wmname "LG3D" &
# Start lxappearance to load settings, then close it as we don't need to keep window open
lxappearance &
sleep 1
killall lxappearance

3
clipboardprint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sh -c 'sleep 0.5; xdotool type "$(xclip -o -selection clipboard)"'

40
csgoAutoAccepter.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# For monitor 1 2560x1440 btw... (1287, 1055)
center1=$(echo "1300 850")
center2=$(echo "1250 800")
# move to proper spot
xdotool mousemove $center1
echo "Program will exit on mouse move..."
sleep .5
while [ 1 ]; do
xdotool click 1 &
sleep 5
mouseLoc=$(xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1 \2/p}')
if [ "$center1" != "$mouseLoc" ] && [ "$center2" != "$mouseLoc" ]; then
echo "Mouse moved. Exiting."
exit
fi
# This is messy as hell... but it works, can refine this in the future to make less repetitive...
xdotool mousemove $center2
xdotool click 1 &
sleep 5
mouseLoc=$(xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1 \2/p}')
if [ "$center1" != "$mouseLoc" ] && [ "$center2" != "$mouseLoc" ]; then
echo "Mouse moved. Exiting."
exit
fi
xdotool mousemove $center1
done

16
lockand Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
xset dpms force off
#Locker seems to die or be not responsive sometimes (not sure why...) so will just use slock -f as an alternative
locker=xautolock
#if [[ $(ps -ef | grep $locker | grep -v grep | wc -l) != 0 ]]; then
#xautolock -locknow
#else
#echo no
slock -f &
#fi
sleep 3
systemctl $1

16
mount-phone Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
umount /mnt/mtp
echo "Make sure all gvfs, gio, kio, kde, mtp dolphin app that may interfere are closed, automate this in the future"
killall dolphin
killall gvfsd
killall gvfsd-fuse
killall kded5
aft-mtp-mount /mnt/mtp &
#echo "once, the phone is connected, can run: rsync -r -t -v --progress -s --ignore-existing '/mnt/ntfs/samsung-1tb/Users/Allen/Music/' '/mnt/mtp/SD card/Documents/Music'"
echo "Using mtp and rsync is slow as fuck, only do this for when all songs are basically already downloaded"
/usr/local/bin/music-backup-to-phone

5
music-backup-to-phone Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "The configured transfer is quite slow, to use the faster option, use adb push."
echo "Example working for Pixel 7 Pro: adb push '/mnt/ntfs/samsung-1tb/Users/Allen/Music' '/sdcard/Documents/'"
rsync -r -t -v --progress -s --ignore-existing '/mnt/ntfs/samsung-1tb/Users/Allen/Music/' '/mnt/mtp/Internal shared storage/Documents/Music'

View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "run: awk '\$0=\"/music/\"\$0' ~/.config/mpd/playlists/GOAT.m3u > ~/Downloads/GOAT.patch.m3u"
echo "Documents/Music/ can change based on the location on the SD Drive, GOAT.m3u can change based on the playlist being imported"

4
patch-playlists-mpd-to-phone Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "run: awk '\$0=\"Documents/Music/\"\$0' ~/.config/mpd/playlists/GOAT.m3u > ~/Downloads/GOAT.patch.m3u"
echo "Documents/Music/ can change based on the location on the SD Drive, GOAT.m3u can change based on the playlist being imported"

8
picom-restart Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
killall picom
#Wait 0.25 seconds so the process can close
sleep 0.25
picom --experimental-backends -b

6
reinstall-grub Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
echo "Run the following commands:"
echo
echo "0. Make sure you have the proper drive and EFI partition mounted under /efi (Ex: sudo mount /dev/sda1 /efi)"
echo "1. sudo grub-install --target=x86_64-efi --efi-directory=/efi/ --bootloader-id=GRUB"
echo "2. sudo grub-mkconfig -o /boot/grub/grub.cfg"

16
reload-ethernet.sh Executable file
View File

@ -0,0 +1,16 @@
echo "Shutting Down Ethernet Connection..."
nmcli c d "Wired connection 1"
sleep 2
echo "Shutting Down Ethernet Device..."
nmcli d d "enp0s31f6"
sleep 2
echo "Starting Up Ethernet Device..."
nmcli d u "enp0s31f6"
sleep 2
echo "Starting up Ethernet Connection..."
nmcli c u "Wired connection 1"
echo Done.

25
rocksmith.sh Executable file
View File

@ -0,0 +1,25 @@
STEAMLIBRARY=/home/allen/.local/share/Steam
PROTON=/usr/share/steam/compatibilitytools.d/proton-ge-custom/files
#echo "Note: CLDC doesn't seem to be working sadly and was only able to get this working via 'previous_version' beta"
#echo "To enable the hidden beta, type in 'JustInCaseWeNeedIt'"
#echo "Previous Version Beta must be set in Steam -> Rocksmith 2014 -> Settings -> Betas"
#echo "Also check this note: https://www.reddit.com/r/rocksmith/comments/xa49mq/important_update_coming_to_rocksmith_2014/"
#echo "Also note that if outputs/inputs are incorrect, disable all but Speakers and Audio Adapter in pavucontrol"
#echo
#echo "'cd'ing into the steam game directory solves the missing CDLC issue!"
#echo "Only remaining problem really is that you cannot purchases CLDCs from this launch method, so must start game through steam"
#echo
echo "Note: look into a way to use predefined audio devices so I don't have to disable everything in pavucontrol"
echo "View all commented out notes in this shell file"
/usr/local/bin/rocksmith_updateCDLC.sh
echo
echo "Waiting 5 seconds..."
echo
sleep 5
#Important that all last 3 variables lines ran at same time (PIPEWIRE_LATENCY + WINEPREFIX + wine executable)
cd /home/allen/.local/share/Steam/steamapps/common/Rocksmith2014
PIPEWIRE_LATENCY=256/48000 WINEPREFIX=$STEAMLIBRARY/steamapps/compatdata/221680/pfx "$PROTON/bin/wine" $STEAMLIBRARY/steamapps/common/Rocksmith2014/Rocksmith2014.exe

10
rocksmith_updateCDLC.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
echo "Running this while the game is open works, but you must exit to the title screen for the songs to appear"
echo
echo "Moving all game DLCs from Downloads to DLC Folder"
# First move to "RocksmithCLDC" to chmod
cp /home/allen/Downloads/*.psarc /home/allen/Downloads/RSCDLCBackup/
mv /home/allen/Downloads/*.psarc /home/allen/Downloads/RocksmithCDLC/
chmod -R 755 /home/allen/Downloads/RocksmithCDLC/
mv /home/allen/Downloads/RocksmithCDLC/* /home/allen/.local/share/Steam/steamapps/common/Rocksmith2014/dlc

3
update_mirrors Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
reflector --save /etc/pacman.d/mirrorlist --country "United States,Canada" --protocol https --latest 10