diff --git a/.config/i3/config b/.config/i3/config index 0f40580..fc2c38c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -215,19 +215,32 @@ mode "$mode_system" { bindsym Escape mode "default" } -bindsym $mod+Shift+M mode "$mode_media" -set $mode_media (p)lay, (u)pdate music, (r)ecord, (m)ic record, (s)top -mode "$mode_media" { +bindsym $mod+Shift+F mode "$mode_ffmpeg" +set $mode_ffmpeg (p)lay, (r)ecord, (m)ic record, (s)top +mode "$mode_ffmpeg" { bindsym p exec mpv $(xclip -o), mode "default" bindsym r exec /home/naiji/.local/bin/media-util record, mode "default" bindsym m exec /home/naiji/.local/bin/media-util record mic, mode "default" bindsym s exec /home/naiji/.local/bin/media-util stop && notify-send -e -t 1000 -i video "ffmpeg" "done", mode "default" - bindsym u exec mpc clear && systemctl --user restart mpd.service && mpc update && mpc add / && mpc play, mode "default" # exit system mode: "Enter" or "Escape" bindsym Return mode "default" bindsym Escape mode "default" } +bindsym $mod+Shift+M mode "$mode_music" +set $mode_music (u)pdate music, (s)ingle, (r)andom, r(e)peat +mode "$mode_music" { + bindsym u exec /home/naiji/.local/bin/media-util mpc update, mode "default" + bindsym s exec /home/naiji/.local/bin/media-util mpc single && notify-send -e -t 1000 -i music "Single mode" "$(mpc status %single%)", mode "default" + bindsym r exec /home/naiji/.local/bin/media-util mpc random && notify-send -e -t 1000 -i music "Random mode" "$(mpc status %random%)", mode "default" + bindsym e exec /home/naiji/.local/bin/media-util mpc repeat && notify-send -e -t 1000 -i music "Repeat mode" "$(mpc status %repeat%)", mode "default" + + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + + bindsym $mod+Print exec --no-startup-id maim -s | xclip -selection clipboard -t image/png -i bindsym Print exec --no-startup-id maim | xclip -selection clipboard -t image/png -i diff --git a/.config/mimeapps.list b/.config/mimeapps.list index ec53362..560072e 100644 --- a/.config/mimeapps.list +++ b/.config/mimeapps.list @@ -3,9 +3,11 @@ image/png=nsxiv.desktop image/jpeg=nsxiv.desktop image/webp=nsxiv.desktop image/gif=nsxiv.desktop +audio/flac=mpv.desktop [Added Associations] image/png=nsxiv.desktop; image/webp=nsxiv.desktop; image/jpeg=nsxiv.desktop; image/gif=nsxiv.desktop; +audio/flac=mpv.desktop; diff --git a/.local/bin/media-util b/.local/bin/media-util index 0efbd47..2178e24 100755 --- a/.local/bin/media-util +++ b/.local/bin/media-util @@ -1,17 +1,5 @@ #!/bin/sh -if [ -z $(which ffmpeg) ] -then - echo "Missing ffmpeg package, please install it!" - exit 1 -fi - -if [ -z $(which shnsplit) ] -then - echo "Missing shntool package, please install it!" - exit 1 -fi - if [ ! -z $1 ] then if [ $1 == 'cut' ] @@ -46,6 +34,18 @@ then then shnsplit -f $2 $3 fi + + if [ $1 == 'mpc' ] + then + if [ $2 == 'update' ] + then + mpc clear && systemctl --user restart mpd.service && sleep 5 && mpc update && mpc add / && mpc play + else + if [ $(mpc status %$2%) == 'off' ]; then mpc $2 on; else mpc $2 off; fi + fi + fi + + else echo "cut:" echo "ffmpeg -i \$2 -ss \$3 -t \$4 -c:v copy -c:a copy \$5"