This commit is contained in:
wt committed 2025-07-18 15:42:55 +07:00
1 parent e7d6e61720
commit 75c5b90d29
19 files changed
+91 -335

No files matched your search

-48
View File
@@ -1,48 +0,0 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
Yellow='\033[1;33m'
batteries=$(ls /sys/class/power_supply/ | grep BAT)
case "$1" in
"-c")
if [[ "$batteries" == "" ]]; then
printf "$Yellow**$Red error:$Color_off no battery found\n"
exit 1;
fi
for i in $batteries; do
batfull=$(cat /sys/class/power_supply/$i/charge_full)
batnow=$(cat /sys/class/power_supply/$i/charge_now)
batperc=$((($batnow/($batfull/100))))
if [[ "$batperc" -le "20" ]]; then
printf "$Yellow**$Color_off $i: $Red$batperc$Color_off\n"
exit 0
fi
if [[ "$batperc" -le "70" ]]; then
printf "$Yellow**$Color_off $i: $Yellow$batperc$Color_off\n"
exit 0
fi
printf "$Yellow**$Color_off $i: $Green$batperc$Color_off\n"
done
;;
"-j")
if [[ "$batteries" == "" ]]; then
echo no
exit 1;
fi
for i in $batteries; do
batfull=$(cat /sys/class/power_supply/$i/charge_full)
batnow=$(cat /sys/class/power_supply/$i/charge_now)
batperc=$((($batnow/($batfull/100))))
printf "$batperc \n"
done
;;
esac
-16
View File
@@ -1,16 +0,0 @@
#!/bin/sh
batperc=$(~/dotfiles/bin/batperc -j)
echo $batperc
if [[ "$batperc" != "no" ]]; then
while true; do
for i in $batperc; do
if [[ "$i" -le "20" ]]; then
notify-send "Battery low: $i%" -u critical
sleep 60
fi
done
done
fi
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
while true; do
BAT=$(acpi -S | cut -d' ' -f4 | sed 's/.$//')
if [ $BAT -le 9 ]; then
notify-send "Низкий заряд батареи!!!" -u critical
sleep 60s
fi
sleep 5s
done &
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
blueman-applet &
-5
View File
@@ -1,5 +0,0 @@
#!/bin/sh
xset -dpms
xset s off
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
xrandr --output eDP1 --primary --mode 1366x768 --pos 1440x0 --rotate normal --output DP1 --off --output DP2 --off --output HDMI1 --off --output HDMI2 --mode 1440x900 --pos 0x0 --rotate normal --output VIRTUAL1 --off
+35 -43
View File
@@ -1,64 +1,56 @@
#!/bin/sh
#------ cli variables -------------------------------------------------------------------------------------------------------------------------------
PATH=$1 # path for new root
SHELL=$2 # shell to use in chroot
#----------------------------------------------------------------------------------------------------------------------------------------------------
#------- Check root func ----------------------------------------------------------------------------------------------------------------------------
PATH=$1
SHELL=$2
check_root() {
if [ $(/usr/bin/id -u) -ne 0 ]; then # cheking root priveleges
if [ $(/usr/bin/id -u) -ne 0 ]; then
printf "** You must be root\n"
exit 1 # exit with exit code 1 error
exit 1
fi
}
#----------------------------------------------------------------------------------------------------------------------------------------------------
#----------- checking or create dirs ----------------------------------------------------------------------------------------------------------------
check_or_mkdir() {
[ ! -d $PATH/dev ] && mkdir -pv $PATH/dev # if directory not exists then mkdir
[ ! -d $PATH/proc ] && mkdir -pv $PATH/proc # if directory not exists then mkdir
[ ! -d $PATH/sys ] && mkdir -pv $PATH/sys # if directory not exists then mkdir
[ ! -d $PATH/run ] && mkdir -pv $PATH/run # if directory not exists then mkdir
[ ! -d $PATH/dev ] && mkdir -pv $PATH/dev
[ ! -d $PATH/proc ] && mkdir -pv $PATH/proc
[ ! -d $PATH/sys ] && mkdir -pv $PATH/sys
[ ! -d $PATH/run ] && mkdir -pv $PATH/run
}
#----------------------------------------------------------------------------------------------------------------------------------------------------
#-------- mount virtual filesystems -----------------------------------------------------------------------------------------------------------------
mount_virtual() {
/usr/bin/mount -v --bind /dev $PATH/dev # mount bind devtmpfs to /dev
/usr/bin/mount -vt devpts devpts -o gid=5,mode=0620 $PATH/dev/pts # mount devpts to /dev/pts
/usr/bin/mount -vt proc proc $PATH/proc # mount procfs to /proc
/usr/bin/mount -vt sysfs sysfs $PATH/sys # mount sysfs to /sys
/usr/bin/mount -vt tmpfs tmpfs $PATH/run # mount tmpfs to /run
if [ -h $PATH/dev/shm ]; then # check
/usr/bin/install -v -d -m 1777 $PATH$(/usr/bin/realpath /dev/shm) # install directories
/usr/bin/mount -v --bind /dev $PATH/dev
/usr/bin/mount -vt devpts devpts -o gid=5,mode=0620 $PATH/dev/pts
/usr/bin/mount -vt proc proc $PATH/proc
/usr/bin/mount -vt sysfs sysfs $PATH/sys
/usr/bin/mount -vt tmpfs tmpfs $PATH/run
if [ -h $PATH/dev/shm ]; then
/usr/bin/install -v -d -m 1777 $PATH$(/usr/bin/realpath /dev/shm)
else
/usr/bin/mount -vt tmpfs -o nosuid,nodev tmpfs $PATH/dev/shm # mount tmpfs to /dev/shm
/usr/bin/mount -vt tmpfs -o nosuid,nodev tmpfs $PATH/dev/shm
fi
/usr/bin/cp -v /etc/resolv.conf $PATH/etc/resolv.conf # copy resolv.conf file to chroot
/usr/bin/cp -v /etc/resolv.conf $PATH/etc/resolv.conf
}
#----------------------------------------------------------------------------------------------------------------------------------------------------
#------ umount virtual filesystems ------------------------------------------------------------------------------------------------------------------
umount_virtual() {
/usr/bin/mountpoint -q $PATH/dev/shm && /usr/bin/umount $PATH/dev/shm # umount /dev/shm
/usr/bin/umount $PATH/dev/pts # umount /dev/pts
/usr/bin/umount $PATH/{sys,proc,run,dev} # umount /sys,/proc,/run,/dev
/usr/bin/mountpoint -q $PATH/dev/shm && /usr/bin/umount $PATH/dev/shm
/usr/bin/umount $PATH/dev/pts
/usr/bin/umount $PATH/{sys,proc,run,dev}
}
#----------------------------------------------------------------------------------------------------------------------------------------------------
#------ get shell path func -------------------------------------------------------------------------------------------------------------------------
get_shell() {
if [[ "$SHELL" != "" ]]; then # if shell is not empty
echo $SHELL # return shell
if [[ "$SHELL" != "" ]]; then
echo $SHELL
fi
echo "/bin/sh" # if shell is empty return /bin/sh
echo "/bin/sh"
}
#----------------------------------------------------------------------------------------------------------------------------------------------------
#------- main ---------------------------------------------------------------------------------------------------------------------------------------
check_root # check root priveleges
check_or_mkdir # check directories for mount virtual filesystems in chroot
mount_virtual # mount virtual filesystems to chroot
#---- do chroot in chroot path using shell ----------------------------------------------------------------------------------------------------------
check_root
check_or_mkdir
mount_virtual
/usr/bin/chroot \
$PATH \
/usr/bin/env -i \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin \
$(get_shell)
#----------------------------------------------------------------------------------------------------------------------------------------------------
umount_virtual # umount virtual filesystems from chroot
#----------------------------------------------------------------------------------------------------------------------------------------------------
umount_virtual
-12
View File
@@ -1,12 +0,0 @@
#!/bin/sh
xrandr --output HDMI-0 --mode 1680x1050
cvt 1920 1200 60
xrandr --newmode "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
xrandr --addmode DVI-0 1920x1200_60.00
xrandr --output DVI-0 --mode 1920x1200_60.00
~/dotfiles/bin/lisascreenslayout.sh
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
xrandr --output DisplayPort-0 --off --output HDMI-0 --mode 1680x1050 --pos 0x0 --rotate normal --output DVI-0 --mode 1920x1200_60.00 --pos 1680x0 --rotate normal --output DVI-1 --off
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh
astal -q
ags run --gtk 3 &
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh
hypridle &
-5
View File
@@ -1,5 +0,0 @@
#!/bin/sh
killall lxpolkit
sleep 2
lxpolkit &
-5
View File
@@ -1,5 +0,0 @@
#!/bin/sh
killall waybar
waybar &