Migrated to ansible

This commit is contained in:
2024-04-02 00:59:42 +02:00
parent c53268e307
commit 0ccf6427f2
136 changed files with 5157 additions and 1407 deletions

View File

@@ -0,0 +1,36 @@
#!/bin/bash
rofi_conf="~/.config/rofi/main.rasi"
# Rofi action
case $1 in
d) mode="drun" ;;
w) mode="window" ;;
f) mode="filebrowser" ;;
e) mode="emoji"
action=(-a copy)
;;
c) mode="calc"
action=(-calc-command "wl-copy {result}")
children="\"message\", "
;;
h) echo -e "$0 [action]"
echo "d : drun mode"
echo "w : window mode"
echo "f : filebrowser mode"
exit 0 ;;
*) mode="drun" ;;
esac
# Get font
font=`gsettings get org.gnome.desktop.interface font-name`
fnt_override="configuration {font: \"${font//\'}\";}"
# Get icon theme
icon_override=`gsettings get org.gnome.desktop.interface icon-theme | sed "s/'//g"`
icon_override="configuration {icon-theme: \"${icon_override}\";}"
# Children
children_ovr="mainbox {children: [\"inputbar\", $children \"listbox\"];}"
# Launch rofi
rofi -show $mode ${action[0]} "${action[1]}" -theme-str "$children_ovr" -theme-str "$fnt_override" -theme-str "$icon_override" -config "$rofi_conf"

View File

@@ -0,0 +1,53 @@
#!/bin/bash
#set -e # Exit immediately if a command exits with a non-zero status. (deprecated) -> [CMD] || exit 1
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
echo "Usage:
$0 <dir containing images> [interval(seconds)]"
exit 1
fi
## Check running
running=$(ps -ef | grep "$0" | grep -v grep | wc -l)
if [ ${running} -gt 2 ]; then
echo "Script already running! Killing others (TODO)..."
exit 1
# CRASHES EVERYTHING \/ !!!!!!!!!!
script_pids=$(ps aux | grep -E "$script_name" | grep -v "grep" | awk -v pid="$current_pid" '$2 != pid {print $2}')
# Loop through the PIDs and kill the processes
for pid in $script_pids; do
echo "Killing process $pid"
kill "$pid"
done
fi
## Start swww
swww init &> /dev/null
## Settings for swww
export SWWW_TRANSITION_FPS=60
export SWWW_TRANSITION_STEP=2
INTERVAL=300
if [ ! -z $2 ]; then
INTERVAL=$2
fi
## Main loop
while true; do
find "$1" \
| while read -r img; do
echo "$((RANDOM % 1000)):$img"
done \
| sort -n | cut -d':' -f2- \
| while read -r img; do
img=${img/\~/$HOME}
if [ -d $img ]; then
continue
fi
swww img "$img" --transition-type wipe --resize=fit
ln -sf "$img" ~/.config/background
sleep $INTERVAL
done
done

View File

@@ -0,0 +1,24 @@
#!/bin/bash
roconf="~/.config/rofi/clipboard.rasi"
# Read font
font=`gsettings get org.gnome.desktop.interface font-name`
fnt_override="configuration {font: \"${font//\'}\";}"
# Clipboard action
case $1 in
c) cliphist list | rofi -dmenu -theme-str "entry { placeholder: \"Copy...\";}" -theme-str "$fnt_override" -config $roconf | cliphist decode | wl-copy
;;
d) cliphist list | rofi -dmenu -theme-str "entry { placeholder: \"Delete...\";}" -theme-str "$fnt_override" -config $roconf | cliphist delete
;;
w) if [ `echo -e "Yes\nNo" | rofi -dmenu -theme-str "entry { placeholder: \"Clear Clipboard History?\";}" -theme-str "$fnt_override" -config $roconf` == "Yes" ] ; then
cliphist wipe
fi
;;
*) echo -e "$0 [action]"
echo "c : cliphist list and copy selected"
echo "d : cliphist list and delete selected"
echo "w : cliphist wipe database"
exit 1
;;
esac

View File

@@ -0,0 +1,5 @@
#!/bin/bash
HYPRCMDS=$(hyprctl -j clients | jq -j '.[] | "dispatch closewindow address:\(.address); "')
hyprctl --batch "$HYPRCMDS" >> /tmp/hypr/cexit.log 2>&1

View File

@@ -0,0 +1,21 @@
#!/bin/bash
isplayingvideo(){
if pactl list | grep -q RUNNING; then
exit 1
else
exit 0
fi
}
if ! [ -z $1 ]; then
isplayingvideo
fi
timeout_lock=900
timeout_DPMS=1080
swayidle -w \
timeout ${timeout_lock} "$0 isplayinfvideo || ~/.config/hypr/scripts/lock.sh" \
#timeout ${timeout_DPMS} 'hyprctl dispatch dpms off'
#resume 'hyprctl dispatch dpms on' # Crashes all apps -> Hyprland config set misc/mouse_move_enables_dpms=true

View File

@@ -0,0 +1,10 @@
#!/bin/bash
dnd=$(swaync-client -D)
swaync-client -dn
swaylock -C ~/.config/swaylock/swaylock.conf
if [ "$dnd" == "false" ]; then
swaync-client -df
fi

View File

@@ -0,0 +1,6 @@
#!/bin/bash
HYPRCMDS=$(hyprctl -j clients | jq -j '.[] | "dispatch closewindow address:\(.address); "')
hyprctl --batch "$HYPRCMDS" >> /tmp/hypr/cexit.log 2>&1
hyprctl dispatch exit >> /tmp/hypr/cexit.log 2>&1

View File

@@ -0,0 +1,13 @@
#!/bin/bash
program_name="ags"
check_program_running() {
pgrep -x "$program_name" > /dev/null
}
while ! check_program_running; do
sleep 1
done
sleep 1