This commit is contained in:
Stefan Spangenberg
2023-10-19 15:42:05 +02:00
parent 4b3a0488cc
commit 800a6b61af
98 changed files with 9212 additions and 0 deletions

3
scripts/applauncher.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
rofi -show drun

5
scripts/autolock.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pkill xautolock
xautolock -time 10 -locker "swaylock -i ~/.cache/current_wallpaper.jpg" -notify 30 -notifier "notify-send 'Screen will be locked soon.' 'Locking screen in 30 seconds'"

3
scripts/calculator.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
rofi -show calc

6
scripts/checkplatform.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# 3 = Desktop
# 10 = Laptop
cat /sys/class/dmi/id/chassis_type

6
scripts/cleanup.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
yay -Scc
su -c 'pacman -Qtdq | pacman -Rns -'
su -c 'pacman -Qqd | pacman -Rsu -'

14
scripts/cliphist.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
case $1 in
d) cliphist list | rofi -dmenu -config ~/dotfiles/rofi/config-cliphist.rasi | cliphist delete
;;
w) if [ `echo -e "Clear\nCancel" | rofi -dmenu -config ~/dotfiles/rofi/config-short.rasi` == "Clear" ] ; then
cliphist wipe
fi
;;
*) cliphist list | rofi -dmenu -config ~/dotfiles/rofi/config-cliphist.rasi | cliphist decode | wl-copy
;;
esac

4
scripts/filemanager.sh Executable file
View File

@ -0,0 +1,4 @@
#/bin/sh
nautilus

8
scripts/fontsearch.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
fc-list \
| grep -ioE ": [^:]*$1[^:]+:" \
| sed -E 's/(^: |:)//g' \
| tr , \\n \
| sort \
| uniq

25
scripts/grim.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
DIR="$HOME/Bilder/screenshots/"
NAME="screenshot_$(date +%d%m%Y_%H%M%S).png"
option2="Selected area"
option3="Fullscreen (delay 3 sec)"
options="$option2\n$option3"
choice=$(echo -e "$options" | rofi -dmenu -config ~/dotfiles/rofi/config-screenshot.rasi -i -no-show-icons -l 4 -width 30 -p "Take Screenshot")
case $choice in
$option2)
grim -g "$(slurp)" - | swappy -f -
# grim -g "$(slurp)" $(xdg-user-dir PICTURES)/screenshots/$(date +'%s_grim.png')
notify-send "Screenshot created" "Mode: Selected area"
;;
$option3)
sleep 3
grim - | swappy -f -
# grim $(xdg-user-dir PICTURES)/screenshots/$(date +'%s_grim.png')
notify-send "Screenshot created" "Mode: Fullscreen"
;;
esac

23
scripts/growthrate.py Normal file
View File

@ -0,0 +1,23 @@
# DESC: Python script to calculate the growth rate of two numbers
import rich
import pyperclip
from rich.console import Console
from rich.prompt import FloatPrompt
# Show prompts
console = Console()
num1 = FloatPrompt.ask("Old value")
num2 = FloatPrompt.ask("New value")
# Calculate the growth rate
gr = ((num2-num1)/num1)
percentage = "{:.2%}".format(gr)
# Print result to the console
console.print(percentage, style="bold")
# Copy result into the system clipboard
pyperclip.copy(percentage)
print("Result has been copied to the clipboard!")

5
scripts/installupdates.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
yay
notify-send "Update complete"

109
scripts/library.sh Executable file
View File

@ -0,0 +1,109 @@
#!/bin/bash
_isInstalledPacman() {
package="$1";
check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0; #'0' means 'true' in Bash
return; #true
fi;
echo 1; #'1' means 'false' in Bash
return; #false
}
_isInstalledYay() {
package="$1";
check="$(yay -Qs --color always "${package}" | grep "local" | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0; #'0' means 'true' in Bash
return; #true
fi;
echo 1; #'1' means 'false' in Bash
return; #false
}
_installPackagesPacman() {
toInstall=();
for pkg; do
if [[ $(_isInstalledPacman "${pkg}") == 0 ]]; then
echo "${pkg} is already installed.";
continue;
fi;
toInstall+=("${pkg}");
done;
if [[ "${toInstall[@]}" == "" ]] ; then
# echo "All pacman packages are already installed.";
return;
fi;
printf "Packages not installed:\n%s\n" "${toInstall[@]}";
sudo pacman --noconfirm -S "${toInstall[@]}";
}
_installPackagesYay() {
toInstall=();
for pkg; do
if [[ $(_isInstalledYay "${pkg}") == 0 ]]; then
echo "${pkg} is already installed.";
continue;
fi;
toInstall+=("${pkg}");
done;
if [[ "${toInstall[@]}" == "" ]] ; then
# echo "All packages are already installed.";
return;
fi;
printf "AUR ackages not installed:\n%s\n" "${toInstall[@]}";
yay --noconfirm -S "${toInstall[@]}";
}
_installSymLink() {
name="$1"
symlink="$2";
linksource="$3";
linktarget="$4";
while true; do
read -p "DO YOU WANT TO INSTALL ${name}? (Existing dotfiles will be removed!) (Yy/Nn): " yn
case $yn in
[Yy]* )
if [ -L "${symlink}" ]; then
rm ${symlink}
ln -s ${linksource} ${linktarget}
echo "Symlink ${linksource} -> ${linktarget} created."
echo ""
else
if [ -d ${symlink} ]; then
rm -rf ${symlink}/
ln -s ${linksource} ${linktarget}
echo "Symlink for directory ${linksource} -> ${linktarget} created."
echo ""
else
if [ -f ${symlink} ]; then
rm ${symlink}
ln -s ${linksource} ${linktarget}
echo "Symlink to file ${linksource} -> ${linktarget} created."
echo ""
else
ln -s ${linksource} ${linktarget}
echo "New symlink ${linksource} -> ${linktarget} created."
echo ""
fi
fi
fi
break;;
[Nn]* )
echo ""
# exit;
break;;
* ) echo "Please answer yes or no.";;
esac
done
}

11
scripts/lockscreentime.sh Executable file
View File

@ -0,0 +1,11 @@
#/bin/sh
timeswaylock=600
timeoff=660
if [ -f "/usr/bin/swayidle" ]; then
echo "swayidle is installed."
swayidle -w timeout $timeswaylock 'swaylock -f' timeout $timeoff 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on'
else
echo "swayidle not installed."
fi;

25
scripts/powermenu-hypr.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
option1=" lock"
option2=" logout"
option3=" reboot"
option4=" power off"
options="$option1\n"
options="$options$option2\n"
options="$options$option3\n$option4"
choice=$(echo -e "$options" | rofi -dmenu -i -no-show-icons -l 4 -width 30 -p "Powermenu")
case $choice in
$option1)
swaylock ;;
$option2)
# loginctl terminate-user $USER # For command line based login
hyprctl dispatch exit ;; # For display manager login
$option3)
systemctl reboot ;;
$option4)
systemctl poweroff ;;
esac

34
scripts/updates.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
# Requires pacman-contrib trizen
# Define threshholds for color indicators
threshhold_green=0
threshhold_yellow=25
threshhold_red=100
# Calculate available updates pacman and aur (with trizen)
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
css_class="green"
if [ "$updates" -gt $threshhold_yellow ]; then
css_class="yellow"
fi
if [ "$updates" -gt $threshhold_red ]; then
css_class="red"
fi
if [ "$updates" -gt $threshhold_green ]; then
printf '{"text": "%s", "alt": "%s", "tooltip": "%s Updates", "class": "%s"}' "$updates" "$updates" "$updates" "$css_class"
else
printf '{"text": "0", "alt": "0", "tooltip": "0 Updates", "class": "green"}'
fi

26
scripts/updatewal-swww.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Select random wallpaper and create color scheme
wal -q -i ~/wallpaper/
# Load current pywal color scheme
source "$HOME/.cache/wal/colors.sh"
# Copy selected wallpaper into .cache folder
cp $wallpaper ~/.cache/current_wallpaper.jpg
# get wallpaper iamge name
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# Set the new wallpaper
swww img $wallpaper \
--transition-bezier .43,1.19,1,.4 \
--transition-fps=60 \
--transition-type="random" \
--transition-duration=0.7 \
--transition-pos "$( hyprctl cursorpos )"
~/dotfiles/waybar/launch.sh
sleep 1
# Send notification
notify-send "Colors and Wallpaper updated" "with image $newwall"

5
scripts/wal.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
wal -q -i ~/wallpaper/
exit

45
scripts/wallpaper-swww.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Select wallpaper
selected=$(ls -1 ~/wallpaper | grep "jpg" | rofi -dmenu -config ~/dotfiles/rofi/config-wallpaper.rasi)
if [ "$selected" ]; then
echo "Changing theme..."
# -----------------------------------------------------
# Update wallpaper with pywal
# -----------------------------------------------------
wal -q -i ~/wallpaper/$selected
# -----------------------------------------------------
# Get new theme
# -----------------------------------------------------
source "$HOME/.cache/wal/colors.sh"
# -----------------------------------------------------
# Copy selected wallpaper into .cache folder
# -----------------------------------------------------
cp $wallpaper ~/.cache/current_wallpaper.jpg
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# -----------------------------------------------------
# Set the new wallpaper
# -----------------------------------------------------
swww img $wallpaper \
--transition-bezier .43,1.19,1,.4 \
--transition-fps=60 \
--transition-type="random" \
--transition-duration=0.7 \
--transition-pos "$( hyprctl cursorpos )"
~/dotfiles/waybar/launch.sh
sleep 1
# -----------------------------------------------------
# Send notification
# -----------------------------------------------------
notify-send "Colors and Wallpaper updated" "with image $newwall"
echo "Done."
fi