Add configuration files

This commit is contained in:
Yorick Barbanneau 2023-03-07 21:30:31 +01:00
parent 73b1ebe491
commit 0f125a7d4f
12 changed files with 658 additions and 0 deletions

78
files/bin/create_conf.sh Executable file
View file

@ -0,0 +1,78 @@
#!/usr/bin/env bash
test=""
base_dir="${HOME}/medias/videos/sambab"
conf="$*"
key_UUID="0564-A865"
#key_UUID="188E-29AA"
printf "Creation de la conférence de %s\n" "$conf"
cd ~/medias/videos/sambab || exit 1
#Get las friday date for creating folder
friday=$(date --date='last Friday' +"%Y.%m.%d")
#Add basedir, then I have my directory
folder="${base_dir}/${friday}-${conf// /_}"
#create it
mkdir "${folder}"/{rushes,audio,titles} -p || {
echo " - >Error !";
exit 1;
}
cp "${base_dir}/logo_amis.svg" "${folder}/titles" || { echo "error on SVG copy"; exit 1; }
cp "${base_dir}/template.kdenlive" "${folder}/montage.kdenlive" || { echo "error on template copy"; exit 1; }
inkscape_date=$(LANG=fr_FR.UTF-8 date --date='last Friday' +"%A %d %B %Y")
echo "Put Name on title"
sed -i "s/\[\[conf\]\]/${conf//_/ }/g" ${folder}/titles/logo_amis.svg || {
echo " ->Error !";
exit 1;
}
echo "Put date on tile"
sed -i "s/\[\[date\]\]/${inkscape_date}/g" ${folder}/titles/logo_amis.svg || {
echo " ->Error !";
exit 1;
}
echo "Importing PNG File in ${folder}/montage.kdenlive"
sed -i "s#\[\[logo\]\]#${folder}/titles/logo_amis.png#g" "${folder}"/montage.kdenlive || {
>&2 echo " ->Error !";
exit 1;
}
echo "Export SVG title"
inkscape --export-type="png" "${folder}/titles/logo_amis.svg" || {
echo " ->Error !";
exit 1;
}
echo "Mount USBkey with UUID $key_UUID"
usb_key="/dev/$(lsblk -o KNAME,UUID | grep ${key_UUID} | awk '{print $1}')"
[[ ! $usb_key = "/dev/" ]] || {
>&2 echo " -> Error getting device name, is USB key plugged? $usb_key";
exit 1;
}
disk="$(udisksctl mount -b ${usb_key} | awk '{print $4}')"
sleep 1
[[ -n $disk ]] || {
>&2 echo " -> Error mounting device $usb_key";
exit 1
}
echo "Copy files from USB key"
mv ${disk}/$(date --date='last Friday' +'%Y-%m-%d')\ *.mkv "${folder}/rushes/" || {
>&2 echo " -> Error moving video file!";
exit 1;
}
mv ${disk}/RECORD/EXREC/*.MP3 "${folder}/audio/" || {
>&2 echo " -> Error moving audio file!";
exit 1;
}
udisksctl unmount -b ${usb_key}
exit 0

11
files/bin/import-gsettings Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
# usage: import-gsettings <gsettings key>:<settings.ini key> <gsettings key>:<settings.ini key> ...
expression=""
for pair in "$@"; do
IFS=:; set -- $pair
expressions="$expressions -e 's:^$2=(.*)$:gsettings set org.gnome.desktop.interface $1 \"\1\":e'"
done
IFS=
eval exec sed --debug -E $expressions "${XDG_CONFIG_HOME:-$HOME/.config}"/gtk-3.0/settings.ini

36
files/bin/launcher.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
# terminal application launcher for sway, using fzf
# inspired by https://github.com/Biont/sway-launcher-desktop
set -o pipefail
shopt -s nullglob globstar
HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/sway-launcher-history.txt"
export FZF_DEFAULT_OPTS="--layout=reverse --no-extended --print-query --no-sort"
[ ! -f "$HIST_FILE" ] && touch {"$HIST_FILE"
# Create fifo for populate fzf in async mode
FZFPIPE=$(mktemp -u)
mkfifo "$FZFPIPE"
trap 'rm "$FZFPIPE"' EXIT INT
#retrieve history and pipe it into our fifo
readarray HIST_LINES <"$HIST_FILE"
(printf '%s' "${HIST_LINES[@]#* }" >>"$FZFPIPE") &
# Get command, if empty exit
command=$(fzf <"$FZFPIPE" | tail -n1 || exit 1)
[[ "$command" == "" ]] && exit 0
# Update history
index=$(printf '%s' "${HIST_LINES[@]}" | grep -n -Pe "^[0-9]+ ${command}$" | awk -F ':' '{print $1-1}')
if [ -n "$index" ]; then
occurences=${HIST_LINES[$index]%% *}
occurences=$((occurences + 1))
HIST_LINES[$index]="${occurences} ${command}"$'\n'
else
HIST_LINES+=("1 $command"$'\n')
fi
printf '%s' "${HIST_LINES[@]}" | sort --numeric-sort --reverse > "$HIST_FILE"
swaymsg -t command exec "$command"
exit 0

3
files/bin/netflix Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec qutebrowser -C ~/.config/qutebrowser/config.py -B ~/.local/share/qutebrowser-apps/netflix

3
files/bin/sway.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
sway