New folder structure

This commit is contained in:
2023-04-03 17:47:42 +02:00
commit a2bdf977d9
42 changed files with 2055 additions and 0 deletions

69
Applets/monitor.sh Executable file
View File

@@ -0,0 +1,69 @@
#!/bin/bash
interno=eDP
externo=HDMI-A-0
externo2=DisplayPort-0
eleccion=""
#Todo mal pero tremendo palo cambiarlo:
# ejecutar un solo randr con variables
# modificar las variables en función de la entrada
# igual renta sacar las opciones del propio xrandr usando awk y grep
if xrandr | grep "$externo connected" && xrandr | grep "$externo2 connected"; then
eleccion="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'System' -width 12 -line-padding 3 -lines 3 -theme /home/danih/Scripts/Temas/monitor.rasi <<< "Una|Dos|Tres")"
case "$eleccion" in
Dos)
xrandr --output "$interno" --off --output "$externo2" --above "$interno" --auto --output "$externo" --auto --rotate left --right-of "$externo2"
;;
Tres)
xrandr --output "$interno" --auto --output "$externo2" --above "$interno" --auto --output "$externo" --auto --right-of "$externo2"
;;
Una)
xrandr --output "$externo" --off --output "$externo2" --off --output "$interno" --auto
;;
esac
elif xrandr | grep "$externo connected"; then
eleccion="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'System' -width 12 -line-padding 3 -lines 6 -theme /home/danih/Scripts/Temas/monitor.rasi <<< "Dual Side|Dual Top|Dual Side Vertical|Interna|Externa|Duplicar")"
case "$eleccion" in
"Dual Top")
xrandr --output "$interno" --auto --mode 1920x1080 --output "$externo" --auto --above "$interno" --output "$externo2" --off
;;
"Dual Side")
xrandr --output HDMI-A-0 --primary --mode 1920x1080 --rate 120 --pos 1920x0 --rotate normal --output eDP --mode 1920x1080 --rate 60 --pos 0x600 --rotate normal --output DisplayPort-0 --off --output DisplayPort-1 --off
;;
"Dual Side Vertical")
xrandr --output HDMI-A-0 --mode 1920x1080 --pos 0x0 --rotate right --output eDP --primary --mode 1920x1080 --pos 1080x1762 --rotate normal --output DisplayPort-0 --off --output DisplayPort-1 --off
;;
Duplicar)
xrandr --output "$interno" --auto --output "$externo" --same-as "$interno" --output "$externo2" --off
;;
Externa)
xrandr --output "$interno" --auto --output "$externo" --auto --above "$interno" --output "$externo2" --off
xrandr --output "$externo" --mode 1920x1080 --rate 144 --output "$interno" --off --output "$externo2" --off
;;
Interna)
xrandr --output "$externo" --off --output "$externo2" --off --output "$interno" --auto
;;
esac
elif xrandr | grep "$externo2 connected"; then
eleccion="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'System' -width 12 -line-padding 3 -lines 4 -theme /home/danih/Scripts/Temas/monitor.rasi <<< "Dual|Interna|Externa|Duplicar")"
case "$eleccion" in
Dual)
xrandr --output "$interno" --auto --primary --output "$externo2" --above "$interno" --auto --output "$externo" --off
;;
Duplicar)
xrandr --output "$interno" --auto --output "$externo2" --same-as "$interno" --output "$externo" --off
;;
Externa)
xrandr --output "$interno" --auto --primary --output "$externo2" --above "$interno" --auto --output "$externo" --off
xrandr --output "$externo2" --output "$interno" --off --output "$externo" --off
;;
Interna)
xrandr --output "$externo" --off --output "$externo2" --off --output "$interno" --auto
;;
esac
else
xrandr --output "$externo" --off --output "$externo2" --off --output "$interno" --auto
fi
[[ "eleccion" = "" ]] && exit 1
i3 restart
#bspc wm -r

58
Applets/mountRofiUSB.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
pgrep -x rofi && exit
get_passwd() {
rofi -dmenu\
-i\
-no-fixed-num-lines\
-p "Password : "\
-theme ~/Scripts/rofi/confirm.rasi
}
get_dir(){
rofi -dmenu\
-i\
-no-fixed-num-lines\
-p "usr@dir: "\
-theme ~/Scripts/rofi/getinfo.rasi
}
class=$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'Type of drive: ' -theme ~/Scripts/rofi/drives.rasi <<< "NORMAL|ENCRYPTED|SERVER")
[[ "$class" = "" ]] && exit 1
if test $class == "SERVER"; then
dir=$(get_dir)
passw=$(get_passwd)
sshfs -p 2222 $dir /mnt/Server <<< $passw
if test $? -eq 0; then
notify-send "Mounted" "Server mounted to /mnt/Server"
exit 1
else
notify-send "Error mounting" "Couldn't mount the drive"
exit 0
fi
fi
montable=$(lsblk -lp | grep "part $" | grep -v "nvme"| grep -v "sda" | grep -v "sdb" | grep -v "sdc" | awk '{print $1, "(" $4 ")"}')
if test "$montable" == ""; then
notify-send "Error" "No discs found to mount"
exit 1
fi
eleccion=$(rofi -no-config -no-lazy-grab -sep "\n" -dmenu -i -p '¿Disco a montar?' -theme ~/Scripts/rofi/drives.rasi <<< "$montable" | awk '{print($1)}')
#eleccion=$(echo "$montable" | dmenu -i -p "¿Disco a montar?" -nb '#'$colorFondo -sf '#'$colorFondo -sb '#'$colorAzul -nf '#'$colorAzul -fn 'Envy Code R-12' | awk '{print($1)}')
[[ "$eleccion" = "" ]] && exit 1
case "$class" in
ENCRYPTED)
passwd=$(get_passwd &)
echo $passwd | sudo -A cryptsetup luksOpen $eleccion dqnid
sudo -A mount /dev/mapper/dqnid /mnt/Encrypted
if test $? -eq 0;then
notify-send "Mounted" "Disc mounted at /mnt/Encrypted"
fi
;;
NORMAL)
udisksctl mount -b "$eleccion"
;;
esac

27
Applets/redesWifi.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
#Versión megabásica que no diferencia entre redes con passphrase y password
#A parte parece que puede fallar el scan
contra() {
rofi -dmenu\
-i\
-no-fixed-num-lines\
-p "¿Contraseña? : "\
-theme ~/Scripts/Temas/confirm.rasi
}
antena="wlan0"
# Refresco primero
iwctl station $antena get-networks
redes=$(iwctl station $antena get-networks | grep '*' | awk '{print $2}')
[[ $? == 1 ]] && exit 1
eleccion=$(rofi -no-config -no-lazy-grab -sep "\n" -dmenu -i -p '¿Red a conectar?' -theme ~/Scripts/Temas/discos.rasi <<< $redes)
[[ "$eleccion" == "" ]] && exit 1
pass=$(contra &)
[[ $pass == "" ]] && exit 1
iwctl --passphrase $pass station $antena connect $eleccion
[[ $? == 1 ]] && exit 1

29
Applets/umountRofiUSB.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
pgrep -x dmenu && exit
class=$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'Type of disc?' -theme ~/Scripts/rofi/drives.rasi <<< "NORMAL|ENCRYPTED|SERVER")
[[ "$class" = "" ]] && exit 1
case "$class" in
ENCRYPTED)
sudo -A umount /mnt/Encrypted
sudo -A cryptsetup luksClose dqnid
if test $? -eq 0;then
notify-send "Unmounted" "Disc unmounted"
fi
;;
NORMAL)
montable=$(lsblk -lp | grep "part /." | grep -v "nvme" | awk '{print $1, "(" $4 ")"}')
if test "$montable" == ""; then
notify-send "Error" "No discs found to umount"
exit 1
fi
eleccion=$(rofi -no-config -no-lazy-grab -sep "\n" -dmenu -i -p 'Disc to unmount?' -theme ~/Scripts/rofi/drives.rasi <<< "$montable" | awk '{print($1)}')
[[ "$eleccion" = "" ]] && exit 1
udisksctl unmount -b "$eleccion"
;;
SERVER)
umount /mnt/Server
;;
esac