diff --git a/.config/nvim/pack/plugins/opt/impatient b/.config/nvim/pack/plugins/opt/impatient index c90e273..47302af 160000 --- a/.config/nvim/pack/plugins/opt/impatient +++ b/.config/nvim/pack/plugins/opt/impatient @@ -1 +1 @@ -Subproject commit c90e273f7b8c50a02f956c24ce4804a47f18162e +Subproject commit 47302af74be7b79f002773011f0d8e85679a7618 diff --git a/.config/nvim/pack/plugins/opt/lspconfig b/.config/nvim/pack/plugins/opt/lspconfig index eeda94a..6f1d124 160000 --- a/.config/nvim/pack/plugins/opt/lspconfig +++ b/.config/nvim/pack/plugins/opt/lspconfig @@ -1 +1 @@ -Subproject commit eeda94a0b5b370d837f1ba6f70c8038b3936808b +Subproject commit 6f1d124bbcf03c4c410c093143a86415f46d16a0 diff --git a/.config/nvim/pack/plugins/opt/onedark b/.config/nvim/pack/plugins/opt/onedark index d20f23c..f6e8207 160000 --- a/.config/nvim/pack/plugins/opt/onedark +++ b/.config/nvim/pack/plugins/opt/onedark @@ -1 +1 @@ -Subproject commit d20f23c0d6810c8754737428771eef40bd1056a7 +Subproject commit f6e82074761473d30a722f5d90c60282de1ac41d diff --git a/.config/nvim/pack/plugins/opt/telescope b/.config/nvim/pack/plugins/opt/telescope index f2645c1..40c31fd 160000 --- a/.config/nvim/pack/plugins/opt/telescope +++ b/.config/nvim/pack/plugins/opt/telescope @@ -1 +1 @@ -Subproject commit f2645c13205abb9ee3dbcee68416645c69b863c8 +Subproject commit 40c31fdde93bcd85aeb3447bb3e2a3208395a868 diff --git a/.config/nvim/pack/plugins/opt/treesitter b/.config/nvim/pack/plugins/opt/treesitter index 455ded2..f2778bd 160000 --- a/.config/nvim/pack/plugins/opt/treesitter +++ b/.config/nvim/pack/plugins/opt/treesitter @@ -1 +1 @@ -Subproject commit 455ded29924aeebdd584f2bb0866788ba0a49dfe +Subproject commit f2778bd1a28b74adf5b1aa51aa57da85adfa3d16 diff --git a/.config/suckless b/.config/suckless index aa631e1..b4715b5 160000 --- a/.config/suckless +++ b/.config/suckless @@ -1 +1 @@ -Subproject commit aa631e13d23ea0b0cfa72ea13411f6dbad18ecbf +Subproject commit b4715b5963c086b30679da718a47aea9aa9394a8 diff --git a/.config/zsh/custom/themes/powerlevel10k b/.config/zsh/custom/themes/powerlevel10k index 045f006..951d695 160000 --- a/.config/zsh/custom/themes/powerlevel10k +++ b/.config/zsh/custom/themes/powerlevel10k @@ -1 +1 @@ -Subproject commit 045f006c50d782a6d3acbd8a07d1595322ff7e43 +Subproject commit 951d6957895b1887567b3ea7e548f9533daa3c83 diff --git a/.config/zsh/ohmyzsh b/.config/zsh/ohmyzsh index 5d3e86e..b06663d 160000 --- a/.config/zsh/ohmyzsh +++ b/.config/zsh/ohmyzsh @@ -1 +1 @@ -Subproject commit 5d3e86e2a48adf7a308773f8f1b725d187c7c5ef +Subproject commit b06663df23b2910a6e542dc114dc7adc2cdce22f diff --git a/bin/banana b/bin/banana new file mode 100755 index 0000000..e69ee35 --- /dev/null +++ b/bin/banana @@ -0,0 +1,19 @@ +#!/bin/bash -e + +DBUS_SESSION_BUS_ADDRESS= # https://wiki.archlinux.org/title/Podman#Permission_denied:_OCI_permission_denied +CRI=(podman) + +IMG=ghcr.io/epitech/coding-style-checker +TAG=latest + +REPORTS="$(mktemp -d)" +LOGS="$REPORTS/coding-style-reports.log" + +"${CRI[@]}" run --rm \ + -v "$PWD:/mnt/delivery" \ + -v "$REPORTS:/mnt/reports" \ + "$IMG:$TAG" \ + /mnt/delivery /mnt/reports + +cat "$LOGS" +echo "$(grep -c ': MAJOR:' "$LOGS") major, $(grep -c ': MINOR:' "$LOGS") minor, $(grep -c ': INFO:' "$LOGS") info coding style error(s) reported in $LOGS" diff --git a/bin/epitest b/bin/epitest index 60b9edf..78c33f9 100755 --- a/bin/epitest +++ b/bin/epitest @@ -1,3 +1,16 @@ -#!/bin/bash +#!/bin/bash -e -sudo docker run -it --rm --user "$UID:$GID" -v "$PWD:/usr/app/" docker.io/epitechcontent/epitest-docker bash "$@" +DBUS_SESSION_BUS_ADDRESS= # https://wiki.archlinux.org/title/Podman#Permission_denied:_OCI_permission_denied +CRI=(podman) + +IMG=docker.io/epitechcontent/epitest-docker +TAG=latest + +if ! "${CRI[@]}" container start epitest > /dev/null 2>&1; then + "${CRI[@]}" run --rm -d \ + --name epitest \ + -v "$HOME:$HOME" \ + "$IMG:$TAG" sleep infinity > /dev/null +fi + +"${CRI[@]}" exec -it -w "$PWD" epitest "$@" diff --git a/bin/mouse_360 b/bin/mouse_360 index f70b062..15bd4f1 100755 --- a/bin/mouse_360 +++ b/bin/mouse_360 @@ -1,9 +1,9 @@ -#!/bin/bash -set -e +#!/bin/bash -e # counts target = 8182 ~ 25cm sleep 3 for _ in {0..1023}; do xdotool mousemove_relative 8 0 + #ydotool mousemove -x 8 -y 0 done diff --git a/bin/sbar b/bin/sbar index af64f2e..d3f922f 100755 --- a/bin/sbar +++ b/bin/sbar @@ -33,15 +33,6 @@ update_vol() { fi } -update_backlight() { - local actual_brightness - local max_brightness - - read -r actual_brightness /dev/null)" ]; do sleep 1 done update_vol -update_backlight reload_bar() { sec=0 } display() { - xsetroot -name "$crypto | $cpu | $memory | $vol | $backlight | $wlp | $bat | $time" + xsetroot -name "$crypto | $cpu | $memory | $vol | $wlp | $bat | $time" } # SIGNALING # trap ';display' 'RTMIN+n' trap 'reload_bar;display' 'RTMIN' trap 'update_vol;display' 'RTMIN+1' -trap 'update_backlight;display' 'RTMIN+2' -trap 'update_crypto;display' 'RTMIN+3' +trap 'update_crypto;display' 'RTMIN+2' # to update it from external commands ## kill -m "$(cat ~/.cache/pidofbar)" # where m = 34 + n diff --git a/bin/set-light b/bin/set-light new file mode 100755 index 0000000..2939cac --- /dev/null +++ b/bin/set-light @@ -0,0 +1,34 @@ +#!/bin/bash -e + +function get_current() { + local d="$1" + local cur; cur="$(cat "$1/brightness")" + local max; max="$(cat "$1/max_brightness")" + + echo "$((cur * 100 / max))" +} + +function set-light() { + local d="$1" + local max; max="$(cat "$d/max_brightness")" + + echo "$((CUR * max / 100))" > "$d/brightness" +} + +NOTIFY='notify-send -t 1000 -a changeVolume -u low' +NOTIFYVOL="$NOTIFY -i audio-volume-high" + +DIRS=(/sys/class/backlight/*) +CUR="$(get_current "${DIRS[0]}")" + +case "${1:0:1}" in + '') echo "$CUR"; exit ;; + '+'|'-') CUR="$((CUR + $1))" ;; + *) CUR="$1" ;; +esac + +for d in "${DIRS[@]}"; do + set-light "$d" "$CUR" +done + +$NOTIFYVOL -h string:synchronous:vol -h int:value:"$CUR" "$CUR%" diff --git a/bin/set-vol b/bin/set-vol index 49b9970..267319c 100755 --- a/bin/set-vol +++ b/bin/set-vol @@ -1,7 +1,7 @@ #!/bin/bash -e -DUNSTIFY='dunstify -t 1000 -a changeVolume -u low' -DUNSTIFYVOL="$DUNSTIFY -i audio-volume-high" +NOTIFY='notify-send -t 1000 -a changeVolume -u low' +NOTIFYVOL="$NOTIFY -i audio-volume-high" SINK='@DEFAULT_AUDIO_SINK@' WPCUR="$(wpctl get-volume "$SINK")" @@ -12,10 +12,10 @@ grep -q MUTED <<< "$WPCUR" && MUTE=1 || MUTE=0 if [ "$1" == 'm' ]; then if [ "$MUTE" = 1 ]; then wpctl set-mute "$SINK" 0 - $DUNSTIFYVOL -h string:x-dunst-stack-tag:vol -h int:value:"$CUR" "$CUR%" + $NOTIFYVOL -h string:synchronous:vol -h int:value:"$CUR" "$CUR%" else wpctl set-mute "$SINK" 1 - $DUNSTIFY -i audio-volume-muted -h string:x-dunst-stack-tag:vol "Mute" + $NOTIFY -i audio-volume-muted -h string:synchronous:vol "Mute" fi else case "${1:0:1}" in @@ -28,7 +28,7 @@ else if [ "$MUTE" = 1 ]; then wpctl set-mute "$SINK" 0 fi - $DUNSTIFYVOL -h string:x-dunst-stack-tag:vol -h int:value:"$CUR" "$CUR%" + $NOTIFYVOL -h string:synchronous:vol -h int:value:"$CUR" "$CUR%" fi # update sbar diff --git a/bin/set-wlp b/bin/set-wlp index d799826..2dff98c 100755 --- a/bin/set-wlp +++ b/bin/set-wlp @@ -1,16 +1,35 @@ #!/bin/bash -e -readarray -t NET <<< \ - "$(nmcli -f SSID,CHAN,RATE,SIGNAL,BARS,SECURITY dev wifi list \ - | awk '!seen[$1]++')" +RESCAN=0 + +NMCLI=(nmcli dev wifi) +CON=("${NMCLI[@]}" connect) + +function connect() { + if ! "${CON[@]}" "$1" 2> /dev/null; then + if [ "$RESCAN" = 1 ]; then + return + fi + RESCAN=1 + "${NMCLI[@]}" list --rescan yes > /dev/null + if ! "${CON[@]}" "$1"; then + return + fi + fi + + kill -36 "$(cat "$HOME/.cache/pidofbar")" + exit +} + if [ -n "$1" ]; then - nmcli device wifi con "$1" + connect "$1" else + readarray -t NET <<< \ + "$(nmcli -f SSID,CHAN,RATE,SIGNAL,BARS,SECURITY dev wifi list \ + | awk '!seen[$1]++')" COLUMNS=1 select net in "${NET[@]}"; do - nmcli device wifi con "$(awk '{print $1}' <<< "$net")" && break + connect "$(awk '{print $1}' <<< "$net")" && break done fi - -kill -37 "$(cat "$HOME/.cache/pidofbar")" diff --git a/bin/ttydestroyer b/bin/ttydestroyer index e2ffecb..9e5a83f 100755 --- a/bin/ttydestroyer +++ b/bin/ttydestroyer @@ -14,6 +14,6 @@ fi (set -e asciiquarium & -cmatrix -ab & +cmatrix -abo & while true; do sl; done & ) | lolcat > "$1"