From 2f111c4013c7b4867af0f2d33c42d26c3f1fb478 Mon Sep 17 00:00:00 2001 From: Breizh Date: Sat, 20 Aug 2022 20:23:03 +0200 Subject: [PATCH] Diverses modifs --- .config/cava/config | 2 ++ .config/conky/conky_mount | 2 +- .config/htop/htoprc | 4 ++-- .config/yt-dlp/config | 5 +++-- .i3blocks/mpd | 33 ++++++++++++++++----------------- .local/bin/auto-poweroff.sh | 11 +++-------- .local/bin/mccmd | 6 +++--- 7 files changed, 30 insertions(+), 33 deletions(-) diff --git a/.config/cava/config b/.config/cava/config index 93260e0..db15bfc 100644 --- a/.config/cava/config +++ b/.config/cava/config @@ -27,6 +27,8 @@ # bar_height is only used for output in "noritake" format ; bar_height = 32 +bar_width=1 + # For SDL width and space between bars is in pixels, defaults are: ; bar_width = 20 ; bar_spacing = 5 diff --git a/.config/conky/conky_mount b/.config/conky/conky_mount index b7a0d5b..be22eba 100755 --- a/.config/conky/conky_mount +++ b/.config/conky/conky_mount @@ -2,6 +2,6 @@ for dir in /run/media/breizh/* do - [[ -d "$dir" ]] && echo -e "\${template3 $dir $(basename $dir)}\n\n" + [[ -d "$dir" ]] && echo -e "\${template3 $dir $(basename $dir)}\n" done diff --git a/.config/htop/htoprc b/.config/htop/htoprc index 57398e1..ad032e7 100644 --- a/.config/htop/htoprc +++ b/.config/htop/htoprc @@ -36,7 +36,7 @@ column_meters_0=LeftCPUs2 Blank CPU Memory Swap Blank Hostname System DateTime B column_meter_modes_0=1 2 1 1 1 2 2 2 2 2 2 2 2 2 2 column_meters_1=RightCPUs2 Blank CPU Memory Swap Blank Uptime LoadAverage Tasks Blank DiskIO NetworkIO Blank PressureStallMemoryFull PressureStallIOFull column_meter_modes_1=1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 -tree_view=0 +tree_view=1 sort_key=46 tree_sort_key=0 sort_direction=-1 @@ -46,7 +46,7 @@ all_branches_collapsed=0 screen:Main=PID USER PRIORITY NICE OOM M_VIRT M_RESIDENT M_SHARE M_SWAP IO_RATE STATE PERCENT_CPU PERCENT_MEM TIME Command .sort_key=PERCENT_CPU .tree_sort_key=PID -.tree_view=0 +.tree_view=1 .tree_view_always_by_pid=0 .sort_direction=-1 .tree_sort_direction=1 diff --git a/.config/yt-dlp/config b/.config/yt-dlp/config index ecba7c7..395a741 100644 --- a/.config/yt-dlp/config +++ b/.config/yt-dlp/config @@ -1,9 +1,9 @@ --o "%(title)s.%(ext)s" +-o "%(release_date,upload_date)s.%(title)s.%(ext)s" -P "temp:/tmp" --embed-subs --write-subs --write-auto-subs ---sub-lang fr,en +--sub-langs fr,en,-live_chat --embed-thumbnail -i -f "((bestvideo[vcodec^=av01][height<=?1440][width<=?2560]/bestvideo[vcodec=vp9][height<=?1440][width<=?2560]/bestvideo[height<=?1440][width<=?2560]/bestvideo)+(bestaudio[acodec=opus]/bestaudio[acodec=vorbis]/bestaudio))/best" @@ -11,3 +11,4 @@ --hls-use-mpegts --compat-options no-keep-subs --download-archive ".yt-dlp_archive" +--downloader axel diff --git a/.i3blocks/mpd b/.i3blocks/mpd index 9087be4..bf2fb82 100755 --- a/.i3blocks/mpd +++ b/.i3blocks/mpd @@ -3,7 +3,7 @@ # Fonction de réinitialisation en cas de perte de la connexion self-reset() { echo "[--:-- --:-- --:--]" - sleep 5 + sleep 1 exec "$0" } @@ -14,7 +14,7 @@ coproc nc -U /home/breizh/.mpd/socket IN=${COPROC[1]} OUT=${COPROC[0]} #echo "password xxx" >&"${IN}" -sed '/^OK/q' <&"$OUT" &>/dev/null +#sed '/^OK/q' <&"$OUT" &>/dev/null # Initialisation des valeurs par défaut et des fonctions declare -i SCROLL=50 I=0 @@ -43,10 +43,9 @@ human_time() { # Initialisation de l’état echo "status" >&"$IN" -while read -t 1 -u "$OUT" output +while read -t 0.1 -u "$OUT" output do - [[ "$output" == "OK" ]] && break - o[${output%%:*}]="${output##*: }" + [[ "$output" =~ : ]] && o[${output%%:*}]="${output##*: }" done # Boucle principale @@ -54,8 +53,8 @@ while [[ -n "$COPROC_PID" ]] do # Gestion du clic, fait office de délai si aucune action (une seconde). # En cas de clic, l’actualisation de l’affichage sera instantanné. - read -t 1 BLOCK_BUTTON - + read -t 0.75 BLOCK_BUTTON + case $BLOCK_BUTTON in 1|3) if [[ "${o["state"]}" == stop ]] @@ -77,25 +76,23 @@ do 1|2|3) sed '/^OK$/q' <&"$OUT" &>/dev/null ;; 4) I="I-2"; [[ "$I" -lt 0 ]] && I=0 ;; esac - + # Réinitialisation de l’état unset o output declare -A o - + # Récupération de l’état echo "status" >&"$IN" || self-reset - while read -t 1 -u "$OUT" output + while read -t 0.1 -u "$OUT" output do - [[ "$output" == "OK" ]] && break - o[${output%%:*}]="${output##*: }" + [[ "$output" =~ : ]] && o[${output%%:*}]="${output##*: }" done # Récupération des informations du morceau en cours echo "currentsong" >&"$IN" || self-reset - while read -t 1 -u "$OUT" output + while read -t 0.1 -u "$OUT" output do - [[ "$output" == "OK" ]] && break - o[${output%%:*}]="${output##*: }" + [[ "$output" =~ : ]] && o[${output%%:*}]="${output##*: }" done # Choix des couleurs selon l’état @@ -120,7 +117,7 @@ do scroll=true song=" $song " else - scroll=false + unset scroll song=" $song" fi @@ -131,7 +128,7 @@ do fi # Gestion du défilement - if "$scroll" + if [[ -n "$scroll" ]] then unset bloc1 bloc2 bloc3 bloc4 declare -- bloc1 bloc2 bloc3 bloc4 @@ -190,3 +187,5 @@ do # DEBUG printf '%s%s%s%s%s\n' "$bloc1" "$bloc2" "$bloc3" "$bloc4" " $status$time" done + + diff --git a/.local/bin/auto-poweroff.sh b/.local/bin/auto-poweroff.sh index 42fb79e..7119f8d 100755 --- a/.local/bin/auto-poweroff.sh +++ b/.local/bin/auto-poweroff.sh @@ -8,19 +8,14 @@ touch /dev/shm/mccount while true do -mcpid=$(systemctl show minecraft-server.service --property MainPID --value) -mcstatus=$(ps -q "${mcpid}" -o state --no-headers 2>/dev/null) +mcpid="$(pgrep -nu minecraft java)" +mcstatus="$(ps -q "${mcpid}" -o state --no-headers 2>/dev/null)" if [[ "$mcstatus" == "T" ]] then echo . >> /dev/shm/mccount else - players_tmp=($(mcstatus localhost query | grep players)) - players="${players_tmp[1]%%/*}" - if [[ "$players" -gt 0 ]] - then - > /dev/shm/mccount - fi + > /dev/shm/mccount fi time=$(wc -l /dev/shm/mccount | cut -d" " -f1) diff --git a/.local/bin/mccmd b/.local/bin/mccmd index 880af65..57c4585 100755 --- a/.local/bin/mccmd +++ b/.local/bin/mccmd @@ -4,9 +4,9 @@ cat | while read line do if [[ "$line" =~ ^/ ]] then - echo "$line" > /run/minecraft-server.stdin + echo "mine $line" > /run/minecraft-server.stdin else - echo "say $line" > /run/minecraft-server.stdin - echo "dynmap sendtoweb $line" > /run/minecraft-server.stdin + echo "mine say $line" > /run/minecraft-server.stdin +# echo "mine dynmap sendtoweb $line" > /run/minecraft-server.stdin fi done