Ajout de scripts
This commit is contained in:
parent
fbc6525efe
commit
c9305a5776
5 changed files with 180 additions and 0 deletions
16
.i3blocks/beep
Executable file
16
.i3blocks/beep
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -n "$button" ]]
|
||||
then
|
||||
$HOME/.local/bin/toggle-beep
|
||||
fi
|
||||
|
||||
echo -n "beep "
|
||||
|
||||
if [[ -e /dev/input/by-path/platform-pcspkr-event-spkr ]]
|
||||
then
|
||||
echo "<span foreground=\"#99CC99\">█</span>"
|
||||
else
|
||||
echo "<span foreground=\"#515151\">█</span>"
|
||||
fi
|
||||
|
23
.i3blocks/bepo
Executable file
23
.i3blocks/bepo
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
runtime="${XDG_RUNTIME_DIR}/i3blocks"
|
||||
[[ ! -d "$runtime" ]] && mkdir -p "$runtime"
|
||||
|
||||
if [[ -n "$button" ]]
|
||||
then
|
||||
if [[ -f "$runtime/oss" ]]
|
||||
then
|
||||
setxkbmap fr bepo
|
||||
rm "$runtime/oss"
|
||||
else
|
||||
setxkbmap fr oss
|
||||
touch "$runtime/oss"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f "$runtime/oss" ]]
|
||||
then
|
||||
echo "oss "
|
||||
else
|
||||
echo "bepo"
|
||||
fi
|
136
.i3blocks/mpd.new
Executable file
136
.i3blocks/mpd.new
Executable file
|
@ -0,0 +1,136 @@
|
|||
#!/bin/bash
|
||||
|
||||
LONG=25
|
||||
SHORT=10
|
||||
|
||||
human_time() {
|
||||
local seconds="$1"
|
||||
if [[ "$seconds" -lt 0 ]]
|
||||
then
|
||||
echo "--:--"
|
||||
return
|
||||
fi
|
||||
local minutes=$(( $seconds / 60 ))
|
||||
seconds=$(( $seconds % 60 ))
|
||||
if [[ "$minutes" -ge 90 ]]
|
||||
then
|
||||
printf "%5s\n" "${minutes}m"
|
||||
else
|
||||
printf "%02d:%02d\n" "$minutes" "$seconds"
|
||||
fi
|
||||
return
|
||||
}
|
||||
|
||||
if ! systemctl --user is-active mpd &>/dev/null
|
||||
then
|
||||
origstatus='off'
|
||||
else
|
||||
origstatus="$(mpc status | sed -n '2p' | grep -Eo '^\[.*\]' | tr -d '[]')"
|
||||
[[ -z "$origstatus" ]] && origstatus='stop'
|
||||
fi
|
||||
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) mpc -q prev ;;
|
||||
2) mpc -q toggle ;;
|
||||
3) mpc -q next ;;
|
||||
4) mpc -q volume +2 ;;
|
||||
5) mpc -q volume -2 ;;
|
||||
esac
|
||||
|
||||
status="<span foreground=\"#6699CC\">"
|
||||
case $origstatus in
|
||||
stop ) status="<span foreground=\"#F2777A\">" ;;
|
||||
paused ) status="<span foreground=\"#FFCC66\">" ;;
|
||||
playing ) status="<span foreground=\"#99CC99\">" ;;
|
||||
off ) status="<span foreground=\"#515151\">" ;;
|
||||
esac
|
||||
|
||||
if [[ "$origstatus" != "stop" ]] && [[ "$origstatus" != "off" ]]
|
||||
then
|
||||
if [[ ! -f /dev/shm/mpd ]]
|
||||
then
|
||||
mpc -f '[[%artist%§]%title%|[%file%]' current > /dev/shm/mpd
|
||||
fi
|
||||
|
||||
song=$(</dev/shm/mpd)
|
||||
|
||||
if [[ "${#song}" -gt $LONG ]]
|
||||
then
|
||||
scrolling=long
|
||||
elif [[ "${#song}" -gt $SHORT ]]
|
||||
then
|
||||
scrolling=short
|
||||
else
|
||||
scrolling=none
|
||||
fi
|
||||
|
||||
if [[ "$scrolling" != "none" ]]
|
||||
then
|
||||
scroll="$(</dev/shm/mpd-scroll)"
|
||||
|
||||
if [[ -z "${scroll// /}" ]]
|
||||
then
|
||||
printf "%-${LONG}s" "$(</dev/shm/mpd)" > /dev/shm/mpd-scroll
|
||||
song="$(</dev/shm/mpd-scroll)"
|
||||
else
|
||||
song="$(</dev/shm/mpd-scroll)"
|
||||
printf "%-${LONG}s" "${song:1}" > /dev/shm/mpd-scroll
|
||||
fi
|
||||
fi
|
||||
|
||||
time="$(echo -e 'status\nclose' | nc -U $MPD_HOST | grep time \
|
||||
| cut -d' ' -f2)"
|
||||
|
||||
time_elapsed=$(human_time "${time%:*}")
|
||||
time_total=$(human_time "${time#*:}")
|
||||
time_left=$(human_time "$(( ${time#*:} - ${time%:*} ))")
|
||||
|
||||
longtime="[$time_elapsed $time_left ${time_total/00:00/--:--}]"
|
||||
shorttime="$time_elapsed $time_left"
|
||||
|
||||
case $scrolling in
|
||||
long)
|
||||
longsong="${song} "
|
||||
shortsong="${song} "
|
||||
;;
|
||||
short)
|
||||
longsong="$(</dev/shm/mpd) "
|
||||
shortsong="${song} "
|
||||
;;
|
||||
none)
|
||||
longsong="$(</dev/shm/mpd) "
|
||||
shortsong="$longsong"
|
||||
;;
|
||||
esac
|
||||
|
||||
longsong="${longsong:0:$LONG}"
|
||||
shortsong="${shortsong:0:$SHORT}"
|
||||
longsong="${longsong//&/&}"
|
||||
shortsong="${shortsong//&/&}"
|
||||
|
||||
if [[ "$longsong" =~ § ]]
|
||||
then
|
||||
longsong="<u>${longsong/§/</u> }"
|
||||
elif [[ "$song" =~ § ]]
|
||||
then
|
||||
longsong="<u>${longsong}</u>"
|
||||
fi
|
||||
if [[ "$shortsong" =~ § ]]
|
||||
then
|
||||
shortsong="<u>${shortsong/§/</u> }"
|
||||
elif [[ "$song" =~ § ]]
|
||||
then
|
||||
shortsong="<u>${shortsong}</u>"
|
||||
fi
|
||||
|
||||
echo "${longsong} $status$longtime</span>"
|
||||
echo "${shortsong} $status$shorttime</span>"
|
||||
else
|
||||
[[ -f /dev/shm/mpd ]] && rm /dev/shm/mpd
|
||||
[[ -f /dev/shm/mpd-scroll ]] && rm /dev/shm/mpd-scroll
|
||||
printf "%${LONG}s $status[--:-- --:-- --:--]</span>\n" " "
|
||||
printf "%${SHORT}s $status--:-- --:--</span>\n" " "
|
||||
fi
|
||||
|
||||
|
5
.local/bin/mcaselector
Executable file
5
.local/bin/mcaselector
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
/usr/lib/jvm/java-14-openjdk/bin/java --module-path /usr/lib/jvm/java-14-openjdk/lib/javafx.base.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.controls.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.fxml.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.graphics.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.media.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.swing.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx.web.jar:/usr/lib/jvm/java-14-openjdk/lib/javafx-swt.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.base.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.controls.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.fxml.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.graphics.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.media.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.swing.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx.web.jar:/usr/lib/jvm/java-14-openjfx/lib/javafx-swt.jar --add-modules ALL-MODULE-PATH -jar $(dirname $0)/mcaselector-1.12.jar
|
||||
|
||||
rm -rf $(dirname $0)/cache
|
BIN
.local/bin/mcaselector-1.12.jar
Normal file
BIN
.local/bin/mcaselector-1.12.jar
Normal file
Binary file not shown.
Loading…
Reference in a new issue