From da8c4b7b65235909b7c03da480689d9d871f8d59 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 24 Jan 2019 14:24:44 +0100 Subject: Created music mode and added some other little stuff. --- closeMusicMode.sh | 5 +++++ dmenuMount.sh | 8 ++++---- dmenuTerm.sh | 4 +++- dmenuUmount.sh | 16 ++++++++-------- i3blocks/i3date.sh | 2 +- i3blocks/i3internet.sh | 4 ++-- musicMode.sh | 24 ++++++++++++++++++++++++ pipesCustom.sh | 2 ++ tty-clock.sh | 2 ++ webview.sh | 10 +++++++--- 10 files changed, 58 insertions(+), 19 deletions(-) create mode 100755 closeMusicMode.sh create mode 100755 musicMode.sh create mode 100755 pipesCustom.sh create mode 100755 tty-clock.sh diff --git a/closeMusicMode.sh b/closeMusicMode.sh new file mode 100755 index 0000000..620f667 --- /dev/null +++ b/closeMusicMode.sh @@ -0,0 +1,5 @@ +#!/bin/sh +kill $(pgrep -x musicMode.sh) # End the music mode process +i3-msg "bar mode dock" # Restore the i3bar +exec feh --bg-fill ~/images/wallpapers/bg* # Restore default wallpaper +notify-send -h string:x-canonical-private-synchronous:musicMode -t 1000 "Closed music mode." diff --git a/dmenuMount.sh b/dmenuMount.sh index c94543b..a5fb0d7 100755 --- a/dmenuMount.sh +++ b/dmenuMount.sh @@ -29,10 +29,10 @@ done <<< "$(lsblk -lp | grep "part $" )" [[ "$mountable" = "" ]] && exit 1 lines=$(echo "$mountable" | wc -l) chosen=$(echo "$mountable" | dmenu -i -l $lines -p "Mount which drive?" | awk '{print $2}') -[[ "$chosen" = "" ]] && exit 1 -mount "$chosen" && pgrep -x dunst && notify-send "$chosen mounted" && exit 0 +[ "$chosen" == "" ] && exit 1 +sudo mount "$chosen" && pgrep -x dunst && notify-send "$chosen mounted" && exit 0 -# Select mount point +# Select mount point (reached if previous mount failed, e.g. device not in /etc/fstab) directories="" i=0 while read -r line @@ -42,7 +42,7 @@ do done <<< "$(find /media ~/mounts -type d -maxdepth 3 -empty 2>/dev/null)" lines=$(echo "$directories" | wc -l) mountpoint=$(echo "$directories" | dmenu -i -l $lines -p "Type in mount point." | awk '{print $2}') -[[ "$mountpoint" = "" ]] && exit 1 +[ "$mountpoint" == "" ] && exit 1 if [[ ! -d "$mountpoint" ]]; then bash ~/scripts/prompt.sh "$mountpoint does not exist. Create it?" "mkdir -p $mountpoint" fi diff --git a/dmenuTerm.sh b/dmenuTerm.sh index 6b2e471..5a90f90 100755 --- a/dmenuTerm.sh +++ b/dmenuTerm.sh @@ -1,7 +1,7 @@ #!/bin/bash # dmenu script for opening console programs and scripts directly -options="neofetch\ncmus\ncmus (float)\nnewsboat\nneomutt\nsyncthing\nbrightFirst\nresetConnection\nwifiDown\nyears\nmonths\nbg selection\nshowColors\npython\nemojis" +options="neofetch\ncmus\ncmus (float)\nnewsboat\nneomutt\nsyncthing\nbrightFirst\nresetConnection\nwifiDown\nyears\nmonths\nbg selection\nshowColors\npython\nmusicMode\nClose music mode\nemojis" chosen=$(echo -e "$options" | dmenu -i -p "~$ urxvt -e") @@ -24,5 +24,7 @@ case "$chosen" in resetConnection) urxvt -title floating -geometry 32x1 -e sudo ~/scripts/resetConnection.sh ;; wifiDown) urxvt -title floating -geometry 32x1 -e sudo ~/scripts/wifiDown.sh ;; # other + musicMode) ~/scripts/musicMode.sh ;; + "Close music mode") ~/scripts/closeMusicMode.sh ;; emojis) ~/scripts/dmenuUnicode.sh ;; esac diff --git a/dmenuUmount.sh b/dmenuUmount.sh index 99e60db..1669706 100755 --- a/dmenuUmount.sh +++ b/dmenuUmount.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/bin/sh # _ -# __| |_ __ ___ ___ _ __ _ _ +# __| |_ __ ___ ___ _ __ _ _ # / _` | '_ ` _ \ / _ \ '_ \| | | | # | (_| | | | | | | __/ | | | |_| | # \__,_|_| |_| |_|\___|_| |_|\__,_| -# _ -# _ _ _ __ ___ ___ _ _ _ __ | |_ ___ +# _ +# _ _ _ __ ___ ___ _ _ _ __ | |_ ___ # | | | | '_ ` _ \ / _ \| | | | '_ \| __/ __| # | |_| | | | | | | (_) | |_| | | | | |_\__ \ # \__,_|_| |_| |_|\___/ \__,_|_| |_|\__|___/ -# +# # Gives a dmenu prompt to umount mounted drives. # Shows mounted partitions; select one to unmount. @@ -20,9 +20,9 @@ while read -r line do i=$((i+1)) drives="$drives$i. $( echo "$line" | awk '{print $1, "(" $4 ")", "on", $7}' )"$'\n' -done <<< "$(lsblk -lp | grep "part /" | grep -v "$exclusionregex" )" -[[ "$drives" = "" ]] && exit +done <<< "$(lsblk -lp | grep "part /" | grep -v "$exclusionregex")" +[ "$drives" == "" ] && exit lines=$(echo "$drives" | wc -l) chosen=$(echo "$drives" | dmenu -i -l $lines -p "Unmount which drive?" | awk '{print $2}') -[[ "$chosen" = "" ]] && exit +[ "$chosen" == "" ] && exit umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted." diff --git a/i3blocks/i3date.sh b/i3blocks/i3date.sh index d9ea3c8..a54a135 100755 --- a/i3blocks/i3date.sh +++ b/i3blocks/i3date.sh @@ -9,4 +9,4 @@ esac #dayofyear=$(date +%j) #perc=$(echo "scale=1; ($dayofyear*100)/365" | bc) #echo $(date +"%A, %y/%m/%d ($perc%) - %T") -echo $(date +"%y/%m/%d - %H:%M") +echo $(date +"%y/%m/%d %H:%M") diff --git a/i3blocks/i3internet.sh b/i3blocks/i3internet.sh index a148928..ab26611 100755 --- a/i3blocks/i3internet.sh +++ b/i3blocks/i3internet.sh @@ -11,9 +11,9 @@ if [ $wstatus = "down" ]; then wifi="❌" else # with IP - #wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(ip addr show wlp2s0 | grep "inet " | cut -d' ' -f6)) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))" + wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(ip addr show wlp2s0 | grep "inet " | cut -d' ' -f6)) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))" # no IP - wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))" + #wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))" fi if [ $estatus = "down" ]; then en="❌" diff --git a/musicMode.sh b/musicMode.sh new file mode 100755 index 0000000..4fd7c82 --- /dev/null +++ b/musicMode.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +[ "$(pgrep -x musicMode.sh)" != "$$" ] && notify-send -t 3000 "Already running! Exiting this new instance." && exit 0 #Check if already running +[ -z "$(pgrep -x cmus)" ] && notify-send -t 3000 "cmus not running: No music mode." && exit 0 #Check that cmus is running +# Get file name +file="" +i3-msg "workspace 6" >/dev/null #Switch to music workspace +i3-msg "gaps inner current set 0; gaps outer current set 0; bar mode hide" +i3-msg "exec urxvt -title 'noborder' -sh 100 -fn xft:monospace:size=4 -e vis -c ~/.config/vis/configMusicMode" # Start music visualizer +# Loop checking current song and checking background +coverPath="/home/inigo/images/musicMode/cover.jpg" +while [ true ] +do + if [ "$file" != "$(cmus-remote -Q | grep "^file" | cut -d' ' -f2-)" ]; then + file="$(cmus-remote -Q | grep ^file | cut -d' ' -f2-)" + rm $coverPath >/dev/null + title="$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-)" + [ -z "$title" ] && title="[$(basename "$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)")]" + notify-send -h string:x-canonical-private-synchronous:musicMode -t 0 "$(~/scripts/i3blocks/i3music.sh)" + ffmpeg -i "$file" $coverPath >/dev/null + feh --no-fehbg --bg-max $coverPath >/dev/null + sleep 1 + fi +done diff --git a/pipesCustom.sh b/pipesCustom.sh new file mode 100755 index 0000000..076dcaf --- /dev/null +++ b/pipesCustom.sh @@ -0,0 +1,2 @@ +#!/bin/sh +pipes.sh -K -p 4 -R diff --git a/tty-clock.sh b/tty-clock.sh new file mode 100755 index 0000000..51baec4 --- /dev/null +++ b/tty-clock.sh @@ -0,0 +1,2 @@ +#!/bin/sh +tty-clock -xscC 4 diff --git a/webview.sh b/webview.sh index 673dee3..38f3a48 100755 --- a/webview.sh +++ b/webview.sh @@ -4,7 +4,7 @@ ext="${1##*.}" mpvFiles="mkv mp4 gif" -pqivFiles="png jpg jpeg jpe" +imageFiles="png jpg jpeg jpe" wgetFiles="mp3 pdf" # Reproduce in terminal if no X server @@ -23,8 +23,12 @@ if echo "$1" | grep youtube >/dev/null; then w3m) urxvt -e w3m "$1" & ;; esac # General checks -elif echo $pqivFiles | grep -w $ext >/dev/null; then - nohup pqiv -i -P "0,0" -T "pqivfloat" "$1" >/dev/null & +elif echo $imageFiles | grep -w $ext >/dev/null; then + chosen=$(echo -e "pqiv\nwget" | dmenu -i) + case "$chosen" in + pqiv) nohup pqiv -i "$1" >/dev/null & ;; + wget) nohup wget "$1" & ;; + esac elif echo $mpvFiles | grep -w $ext >/dev/null; then chosen=$(echo -e "mpv\nmpv (loop)\nmpv (terminal)\nqutebrowser" | dmenu -i) case "$chosen" in -- cgit v1.2.1