Add dotfiles

This commit is contained in:
josh
2018-08-23 16:03:16 +03:00
parent 15d8911b9e
commit 641da4c1b4
34 changed files with 1458 additions and 0 deletions

27
.scripts/audio.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
current_volume=$(pamixer --get-volume)
case $1 in
"raise")
(( current_volume += 5 ))
[[ current_volume -gt 100 ]] && current_volume=100
pamixer --set-volume $current_volume
notify-send -t 250 "VOL: $current_volume"
pkill -RTMIN+1 i3blocks
;;
"lower")
(( current_volume -= 5 ))
[[ current_volume -lt 0 ]] && current_volume=0
pamixer --set-volume $current_volume
notify-send -t 250 "VOL: $current_volume"
pkill -RTMIN+1 i3blocks
;;
"toggle_mute")
pamixer --toggle-mute
notify-send -t 300 "MUTE: $(pamixer --get-mute)"
;;
esac

8
.scripts/daemons.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
[[ ! $(pidof compton) ]] && compton &
[[ ! $(pidof unclutter) ]] && unclutter &
[[ ! $(pidof mpd) ]] && mpd &
[[ ! $(pidof transmission-daemon) ]] && transmission-daemon &
[[ ! $(pidof dunst) ]] && dunst &

24
.scripts/mount.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives.
# If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory.
pgrep -x dmenu && exit
COLS="name,type,size,mountpoint"
drives="$(lsblk -rpo "$COLS" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
[ -z "$drives" ] && exit 1
chosen="$(echo "$drives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
[ -z "$chosen" ] && exit 1
sudo -A mount "$chosen" && exit 0
# You may want to change the line below for more suggestions for mounting.
# I.e. you can increase the depth of the search, or add directories.
# This will increase the load time briefly though.
mp="$(find /mnt /media /mount /home -type d -maxdepth 5 2>/dev/null | dmenu -i -p "Type in mount point.")"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && sudo -A mkdir -p "$mp"
fi
sudo -A mount "$chosen" "$mp" && pgrep -x dunst && notify-send "$chosen mounted to $mp."

16
.scripts/music.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
case $1 in
"toggle")
mpc toggle
;;
"prev")
mpc prev &
pkill -RTMIN+2 i3blocks
;;
"next")
mpc next &
pkill -RTMIN+2 i3blocks
;;
esac

11
.scripts/umount.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# A dmenu prompt to unmount drives.
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s) on %s\n",$1,$3,$4}')
[ -z "$drives" ] && exit
chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted."