diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-04-15 10:46:09 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-04-15 10:46:09 +0200 |
commit | e88acdea18983b4e405098accef9ad0b21e73a4a (patch) | |
tree | 44ab6d3201ba5b09f07f9921c5d50bb67de3bf62 | |
parent | fbcbd9d52113eeac7e9a05120396a3a18f73e2d4 (diff) | |
download | scripts-e88acdea18983b4e405098accef9ad0b21e73a4a.tar.gz scripts-e88acdea18983b4e405098accef9ad0b21e73a4a.zip |
Minor upgrades.
-rwxr-xr-x | brightness.sh | 20 | ||||
-rwxr-xr-x | cmusPlay.sh | 2 | ||||
-rwxr-xr-x | dmenuDic.sh | 2 | ||||
-rwxr-xr-x | emoji.sh | 6 | ||||
-rwxr-xr-x | rm.sh | 8 | ||||
-rwxr-xr-x | shufEmoji.sh | 7 | ||||
-rwxr-xr-x | syncthing.sh | 5 | ||||
-rwxr-xr-x | vol.sh | 6 |
8 files changed, 35 insertions, 21 deletions
diff --git a/brightness.sh b/brightness.sh index a1c6648..cf2480f 100755 --- a/brightness.sh +++ b/brightness.sh @@ -9,20 +9,18 @@ maxbrightness_file="/sys/class/backlight/intel_backlight/max_brightness" # sudo ~/scripts/brightFirst.sh # fi -brightness=$(< "$brightness_file") -maxbrightness=$(< "$maxbrightness_file") -let target=$1+$brightness -sudo chmod 666 /sys/class/backlight/intel_backlight/brightness -if [ $target -gt $maxbrightness ] +brightness="$(cat "$brightness_file")" +maxbrightness="$(cat "$maxbrightness_file")" +target=$(($1+brightness)) +if [ $target -gt "$maxbrightness" ] then - sudo echo "$maxbrightness" >"$brightness_file" -elif [ 0 -gt $target ] + echo "$maxbrightness" | sudo tee "$brightness_file" +elif [ 0 -gt "$target" ] then - sudo echo "0" >"$brightness_file" + echo "0" | sudo tee "$brightness_file" else - sudo echo "$target" >"$brightness_file" + echo "$target" | sudo tee "$brightness_file" fi -sudo chmod 644 /sys/class/backlight/intel_backlight/brightness -dunstify -r $(dunstifyIDs.sh "brightness") -t 500 "$(~/scripts/i3blocks/i3brightness.sh)" +dunstify -r "$(dunstifyIDs.sh "brightness")" -t 500 "$(~/scripts/i3blocks/i3brightness.sh)" pkill -SIGRTMIN+11 i3blocks diff --git a/cmusPlay.sh b/cmusPlay.sh index 2996651..64f5b2c 100755 --- a/cmusPlay.sh +++ b/cmusPlay.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if ! pgrep -x cmus ; then urxvt -title floating -sh 20 -geometry "185x15+30-28" -cd ~/music -e cmus diff --git a/dmenuDic.sh b/dmenuDic.sh index cbfce71..586d0c5 100755 --- a/dmenuDic.sh +++ b/dmenuDic.sh @@ -2,7 +2,7 @@ # Selects a word from the system's dictionary with the help of dmenu and copies it to clipboard. -word="$(cat /usr/share/dict/cracklib-small | dmenu -i -l 10 -p "Choose a word:")" +word="$(dmenu -i -l 10 -p "Choose a word:" < /usr/share/dict/cracklib-small)" [ "$word" ] || exit 0 echo "$word" | xsel -bi dunstify -t 2000 "Written [$word] into clipboard." @@ -3,7 +3,7 @@ # Feeds an emoji list into dmenu and allows to select one into clipboard file="$XDG_CONFIG_HOME/emoji" -selected="$(cat "$file" | dmenu -i -l 20 -p "Choose an emoji:" | cut -d' ' -f1)" -[ -z "$selected" ] && dunstify "No emoji selected." && exit 0 +selected="$(dmenu -i -l 20 -p "Choose an emoji:" < "$file" | cut -d' ' -f1 | tr -d '\n')" +[ -z "$selected" ] && dunstify -t 2000 "No emoji selected." && exit 0 echo "$selected" | xsel -ib -dunstify "Copied $(xsel -ob)" +dunstify -t 2000 "Copied $(xsel -ob)" @@ -0,0 +1,8 @@ +#!/bin/sh + +# Moves an element to a litter folder instead of permanently removing it + +folder="$HOME/litter/" +[ -d "$folder" ] || mkdir "$folder" +mv "$1" "$folder" +pkill -SIGRTMIN+14 i3blocks diff --git a/shufEmoji.sh b/shufEmoji.sh new file mode 100755 index 0000000..04dbc07 --- /dev/null +++ b/shufEmoji.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Echoes some random emojis + +file="$XDG_CONFIG_HOME/emoji" +count=$1 +cut -d' ' -f1 < "$file" | shuf -n "$count" | tr -d '\n' diff --git a/syncthing.sh b/syncthing.sh index a0b0924..f593af9 100755 --- a/syncthing.sh +++ b/syncthing.sh @@ -1,2 +1,3 @@ -#!/bin/bash -~/syncthing/syncthing-linux-amd64-v0.14.51/syncthing +#!/bin/sh + +i3-msg "workspace 5" && urxvt -e ~/syncthing/syncthing-linux-amd64-v1.1.1/syncthing @@ -1,10 +1,10 @@ #!/bin/sh sink="$(pactl list sinks | grep "^Sink " | cut -d'#' -f2)" -if [ $1 = "mute" ]; then +if [ "$1" = "mute" ]; then pactl set-sink-mute "$sink" toggle else - pactl set-sink-volume "$sink" $1% + pactl set-sink-volume "$sink" "$1%" fi -dunstify -r $(dunstifyIDs.sh "vol") -t 500 "$(~/scripts/i3blocks/i3vol.sh)" +dunstify -r "$(dunstifyIDs.sh "vol")" -t 500 "$(~/scripts/i3blocks/i3vol.sh)" pkill -SIGRTMIN+10 i3blocks |