init: copy from Hacmini

This commit is contained in:
wyj
2024-09-14 10:42:47 -04:00
commit 1df22c6512
384 changed files with 18925 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
clear
sleep 0.5
figlet "Diagnosis"
echo
echo "This script will check that essential packages and "
echo "execution commands are available on your system."
echo
_commandExists() {
package="$1";
if ! type $package > /dev/null 2>&1; then
echo ":: ERROR: $package doesn't exists. Please install it with yay -S $2"
else
echo ":: OK: $package found."
fi
}
_folderExists() {
folder="$1";
if [ ! -d $folder ]; then
echo ":: ERROR: $folder doesn't exists."
else
echo ":: OK: $folder found."
fi
}
_commandExists "rofi" "rofi-wayland"
_commandExists "dunst" "dunst"
_commandExists "wal" "python-pywal"
_commandExists "gum" "gum"
_commandExists "magick" "imagemagick"
_commandExists "figlet" "figlet"
echo
echo "Press return to exit"
read
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# _ _ _
# | | ___ __ _ __| | |__ __ _ _ __
# | |/ _ \ / _` |/ _` | '_ \ / _` | '__|
# | | (_) | (_| | (_| | |_) | (_| | |
# |_|\___/ \__,_|\__,_|_.__/ \__,_|_|
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
echo "Loading Qtile status bar..."
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# ____
# | _ \ _____ _____ _ __ _ __ ___ ___ _ __ _ _
# | |_) / _ \ \ /\ / / _ \ '__| '_ ` _ \ / _ \ '_ \| | | |
# | __/ (_) \ V V / __/ | | | | | | | __/ | | | |_| |
# |_| \___/ \_/\_/ \___|_| |_| |_| |_|\___|_| |_|\__,_|
#
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
echo $XDG_SESSION_TYPE
lockapp=slock
echo "Using $lockapp to lock the screen."
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 -replace -config ~/dotfiles/rofi/config-power.rasi -i -no-show-icons -l 4 -width 30 -p "Powermenu")
case $choice in
$option1)
$lockapp ;;
$option2)
qtile cmd-obj -o cmd -f shutdown ;;
$option3)
systemctl reboot ;;
$option4)
systemctl poweroff ;;
esac
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# ____ _ _
# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_
# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __|
# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_
# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__|
#
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
DIR="$HOME/Pictures/screenshots/"
NAME="screenshot_$(date +%d%m%Y_%H%M%S).png"
option1="Selected window (delay 3 sec)"
option2="Selected area"
option3="Fullscreen (delay 3 sec)"
options="$option2\n$option3\n$option1"
choice=$(echo -e "$options" | rofi -i -dmenu -replace -config ~/dotfiles/rofi/config-screenshot.rasi -width 30 -l 3 -p "Take Screenshot")
case $choice in
$option1)
scrot $DIR$NAME -d 3 -e 'xclip -selection clipboard -t image/png -i $f' -c -z -u
notify-send "Screenshot created" "Mode: Selected window"
;;
$option2)
scrot $DIR$NAME -s -e 'xclip -selection clipboard -t image/png -i $f'
notify-send "Screenshot created" "Mode: Selected area"
;;
$option3)
scrot $DIR$NAME -d 3 -e 'xclip -selection clipboard -t image/png -i $f'
notify-send "Screenshot created" "Mode: Fullscreen"
;;
esac
+97
View File
@@ -0,0 +1,97 @@
#!/bin/bash
# ____ _ _____ _
# / ___| |__ __ _ _ __ __ _ ___ |_ _| |__ ___ _ __ ___ ___
# | | | '_ \ / _` | '_ \ / _` |/ _ \ | | | '_ \ / _ \ '_ ` _ \ / _ \
# | |___| | | | (_| | | | | (_| | __/ | | | | | | __/ | | | | | __/
# \____|_| |_|\__,_|_| |_|\__, |\___| |_| |_| |_|\___|_| |_| |_|\___|
# |___/
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
# Cache file for holding the current wallpaper
wallpaper_folder="$HOME/wallpaper"
if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then
source ~/dotfiles/.settings/wallpaper-folder.sh
fi
cache_file="$HOME/.cache/current_wallpaper"
blurred="$HOME/.cache/blurred_wallpaper.png"
rasi_file="$HOME/.cache/current_wallpaper.rasi"
# Create cache file if not exists
if [ ! -f $cache_file ] ;then
touch $cache_file
echo "$wallpaper_folder/default.jpg" > "$cache_file"
fi
# Create rasi file if not exists
if [ ! -f $rasi_file ] ;then
touch $rasi_file
echo "* { current-image: url(\"$wallpaper_folder/default.jpg\", height); }" > "$rasi_file"
fi
current_wallpaper=$(cat "$cache_file")
case $1 in
# Load wallpaper from .cache of last session
"init")
if [ -f $cache_file ]; then
wal -q -i $current_wallpaper
else
wal -q -i $wallpaper_folder
fi
;;
# Select wallpaper with rofi
"select")
selected=$( find "$wallpaper_folder" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort -R | while read rfile
do
echo -en "$rfile\x00icon\x1f$wallpaper_folder/${rfile}\n"
done | rofi -dmenu -replace -l 6 -config ~/dotfiles/rofi/config-wallpaper.rasi)
if [ ! "$selected" ]; then
echo "No wallpaper selected"
exit
fi
wal -q -i $wallpaper_folder/$selected
;;
# Randomly select wallpaper
*)
wal -q -i $wallpaper_folder/
;;
esac
# -----------------------------------------------------
# Reload qtile to color bar
# -----------------------------------------------------
qtile cmd-obj -o cmd -f reload_config
# -----------------------------------------------------
# Get new theme
# -----------------------------------------------------
source "$HOME/.cache/wal/colors.sh"
echo "Wallpaper: $wallpaper"
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# -----------------------------------------------------
# Created blurred wallpaper
# -----------------------------------------------------
magick $wallpaper -resize 50% $blurred
echo ":: Resized to 50%"
magick $blurred -blur 50x30 $blurred
echo ":: Blurred"
# -----------------------------------------------------
# Write selected wallpaper into .cache files
# -----------------------------------------------------
echo "$wallpaper" > "$cache_file"
echo "* { current-image: url(\"$blurred\", height); }" > "$rasi_file"
sleep 1
# -----------------------------------------------------
# Send notification
# -----------------------------------------------------
notify-send "Colors and Wallpaper updated" "with image $newwall"
echo "Done."