reimplement config dotfiles with templates

This commit is contained in:
SALVI Jérémie
2024-08-15 17:56:06 +02:00
parent 9ae4fdb609
commit d02841fd19
49 changed files with 2451 additions and 219 deletions

24
scripts/bookmarks Normal file
View File

@@ -0,0 +1,24 @@
### Do not remove next line
edit
### Gbm Bookmarks
https://gta.grandbesancon.fr (Etempo)
http://s-ipam-p1 (Ipam)
https://teams.microsoft.com (Teams)
### Unixyourbrain bookmarks
https://unixyourbrain.org (Heimdall)
https://accounts.unixyourbrain.org (Authelia)
https://wireguard.unixyourbrain.org (Wireguard)
https://adguard.unixyourbrain.org (Adguard)
https://traefik.unixyourbrain.org (Traefik)
https://lldap.unixyourbrain.org (Lldap)
https://portainer.unixyourbrain.org (Portainer)
https://mail.unixyourbrain.org (Roundcube)
https://passbolt.unixyourbrain.org (Passbolt)
https://wiki.unixyourbrain.org (Wikijs)
https://git.unixyourbrain.org (Gitea)
https://rutorrent.unixyourbrain.org (Rutorrent)
http://10.0.0.1:4447 (Downloads)
https://nextcloud.unixyourbrain.org (Nextcloud)
http://192.168.0.254/ (Freebox)
###
https://www.ygg.re (YggTorrent)

19
scripts/bookmarks.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
_BASENAME=$(basename "$0")
_DIRNAME=$(dirname "$0")
cd "$(dirname "$0")" || _exit 1
_URL=$(grep -Ev "^#" ./bookmarks | rofi -dmenu -i -p Bookmarks)
if [[ "$_URL" == "edit" ]]
then
urxvt -e nvim /usr/local/share/dotfiles/scripts/bookmarks
exit 0
fi
if [[ -n $_URL ]]
then
firefox "$(awk '{print $1}' <<< "$_URL")"
fi

5
scripts/calendar.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
_DAY=$(date +%e)
dunstify -I /usr/share/icons/oxygen/scalable/actions/view-calendar.svgz \
"" "$(cal | sed -e "s/$_DAY /<b><u>$_DAY<\/u><\/b> /g")"

35
scripts/disconnect.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
selected=$(printf "Lock\0icon\x1fsystem-lock-screen
Update\0icon\x1fsystem-software-update
Shutdown\0icon\x1fsystem-shutdown
Reboot\0icon\x1fsystem-reboot
Exit i3\0icon\x1fsystem-log-out
Reload i3\0icon\x1fsystem-log-out
Restart i3\0icon\x1fsystem-log-out" | rofi -dmenu -show-icons -i -theme disconnect -p System)
echo "$selected"
case $selected in
"Reload i3")
i3 reload
;;
"Restart i3")
i3 restart
;;
"Exit i3")
i3 exit
;;
"Update")
urxvt -e /usr/local/share/dotfiles/scripts/update.sh
;;
"Lock")
i3lock
;;
"Shutdown")
systemctl poweroff
;;
"Reboot")
reboot
;;
esac

103
scripts/i3wm_key_help.sh Executable file
View File

@@ -0,0 +1,103 @@
#!/bin/bash
_CR="\e[170D\e[1B"
_E1="\e[1C"
_E2="\e[2C"
_E_RIGHT="\e[70C"
_BOLD="\e[1m"
_BLACK="\e[38;5;0m"
_RED="\e[38;5;1m"
_BLUE="\e[38;5;4m"
_PURPLE="\e[38;5;5m"
_CYAN="\e[38;5;6m"
_BG_RED="\e[48;5;1m"
_RESET="\e[0m"
# _title [string:bg_color] [string:message] [bool:right]
_title() {
printf "%b%b%b%b" "$_CR" "$_E1" "$_BOLD" "$_BLACK$1"
[[ -n $3 ]] && printf "%b" "$_E_RIGHT"
for (( i=0; i<( 10 - ${#2} / 2 ); i++ ))
do
printf " "
done
printf "%s" "$2"
for (( i=0; i<( 10 - ${#2} / 2 ); i++ ))
do
printf " "
done
(( ${#2} % 2 == 0 )) && printf " "
printf "%b%b" "$_RESET" "$_CR"
}
# _shortcut [string:modifier] [string:key] [string:message] [bool:right]
_shortcut() {
_MODIFIER=${1//+/\\\e[38;5;1m+\\\e[38;5;5m}
[[ -n $4 ]] && printf "%b" "$_E_RIGHT"
printf "%b" "$_E2"
printf "%b%b%b" "$_PURPLE" "$_MODIFIER" "$_RESET"
[[ -n $1 ]] && printf "%b+%b" "$_RED" "$_RESET"
printf "%b%s%b" "$_CYAN" "$2" "$_RESET"
printf " %s" "$3"
printf "%b" "$_CR"
}
_move() {
printf "\e[%s;%b" "$1" "$2H"
}
tput civis
clear
_title "\e[48;5;063m" "i3"
_shortcut "Super" "l" "Shutdown menu"
_title "\e[48;5;035m" "Applications"
_shortcut "Super" "d" "Rofi"
_shortcut "Super" "b" "Bookmarks"
_shortcut "Super" "m" "Mpv"
_shortcut "Super" "g" "Google search"
_shortcut "Super" "c" "Calc"
_shortcut "Super+Shift" "f" "Firefox"
_shortcut "Super+Shift" "s" "Steam"
_shortcut "Super+Shift" "d" "Discord"
_shortcut "Super+Shift" "p" "Pavucontrol"
_title "\e[48;5;191m" "Window"
_shortcut "Super" "q" "Kill window"
_shortcut "Super" "o" "Move window to next screen"
_shortcut "Super" "h" "Split horizontally"
_shortcut "Super" "v" "Split vertically"
_shortcut "Super" "f" "Toggle fullscreen"
_shortcut "Super" "Space" "Toggle layout"
_shortcut "Super" "arrows" "Change window focus"
_shortcut "Super+Shift" "arrows" "Resize window"
_shortcut "Super+ctrl" "arrows" "Move focused window"
_shortcut "Super+Ctrl" "Space" "Toggle window split"
_title "\e[48;5;170m" "Workspace"
_shortcut "Super" "Numpad" "Move to workspace n"
_shortcut "Super+Ctrl" "Numpad" "Move focused window to workspace n"
_title "\e[48;5;092m" "Sound"
_shortcut "" "F4" "Decrease volume"
_shortcut "" "F5" "Increase volume"
_move 1 1
_title "\e[48;5;204m" "Urxvt" true
_shortcut "Alt" "Up" "Increase font size" true
_shortcut "Alt" "Down" "Decrease font size" true
_shortcut "Alt" "=" "Reset font size" true
_shortcut "Alt" "/" "Show font" true
_shortcut "Alt" "u" "Url matcher" true
_shortcut "Shift" "Up" "Scroll up one line" true
_shortcut "Shift" "PageUp" "Scroll one page" true
_shortcut "Shift" "Down" "Scroll down one line" true
_shortcut "Shift" "PageDown" "Scroll down one page" true
_title "\e[48;5;214m" "Tmux" true
_move 1 1
read -r -n 1 -s

View File

@@ -1,6 +0,0 @@
#!/bin/bash
cd /opt || exit 1
git clone https://aur.archlinux.org/yay.git
cd yay || exit 1
makepkg -sric --noconfirm

32
scripts/mpv.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
_BASENAME=$(basename "$0")
_DIRNAME=$(dirname "$0")
cd "$(dirname "$0")" || _exit 1
## if not $1
if [[ -z $1 ]]
then
_LINES=$(curl "http://10.0.0.1:4447" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")
else
_LINES="$(curl "http://10.0.0.1:4447/$1" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")"
fi
_RESULT=$(rofi -dmenu -i <<< "$_LINES")
# If no output
echo "$_RESULT"
if [[ -z $_RESULT ]]
then
echo "no output, exiting"
exit 0
fi
#if line end vith /
if [[ "$_RESULT" =~ .*/$ ]]; then
echo "output is a directory"
./mpv.sh "$_RESULT"
exit 0
fi
mpv "http://10.0.0.1:4447/$_RESULT"

22
scripts/search.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
_RESULT=$(printf "Google \0icon\x1fgoogle
Arch \0icon\x1fdistributor-logo-archlinux
Github \0icon\x1fgithub" | rofi -dmenu -show-icons -i -theme disconnect -p Search)
echo "$_RESULT"
_SEARCH_ENGINE="$(cut -d " " -f 1 <<< "$_RESULT")"
_QUERRY="$(cut -d " " -f 2- <<< "$_RESULT")"
case $_SEARCH_ENGINE in
"Google")
firefox "https://www.google.com/search?client=firefox-b-d&q=$_QUERRY"
;;
"Arch")
firefox "https://archlinux.org/packages/?sort=&q=$_QUERRY"
;;
"Github")
firefox "https://github.com/search?q=$_QUERRY"
;;
esac

6
scripts/update.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -e
pacman -Syu --noconfirm
read -r

14
scripts/wallpapers.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
_LINES=$(pgrep wallpapers.sh)
while read -r line
do
(("$line" != "$$")) && kill "$line"
done <<< "$_LINES"
while (( $(pgrep i3) ))
do
feh --randomize --bg-max /usr/local/share/wallpapers
sleep 10
done