Merge branch 'master' into dmenuumount

This commit is contained in:
Luke Smith
2019-02-02 13:10:43 -05:00
committed by GitHub
28 changed files with 162 additions and 198 deletions

View File

@@ -49,7 +49,7 @@ morescreen() { # If multi-monitor is selected and there are more than two screen
multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in
1) xrandr $(echo "$allposs" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
2) twoscreen ;;
*) morescreen ;;
esac ;}
@@ -65,7 +65,7 @@ chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p
case "$chosen" in
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$screens" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
esac
setbg # Fix background if screen size/arangement has changed.

View File

@@ -17,21 +17,21 @@ getmount() { \
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "$chosen mounted." && exit 0
sudo -A mount "$chosen" && notify-send -i "$PIX/usb.svg" "$chosen mounted." && exit 0
getmount "/mnt /media /mount /home -maxdepth 5 -type d"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
esac
notify-send "$chosen mounted to $mp."
notify-send -i "$PIX/usb.svg" "$chosen mounted to $mp."
}
mountandroid() { \
chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
notify-send "Android device mounted to $mp."
notify-send -i "$PIX/android.svg" "Android device mounted to $mp."
}
asktype() { \

View File

@@ -7,13 +7,13 @@ unmountusb() {
[ -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."
sudo -A umount "$chosen" && pgrep -x dunst && notify-send -i "$PIX/usb.svg" "$chosen unmounted."
}
unmountandroid() { \
chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted."
sudo -A umount -l "$chosen" && pgrep -x dunst && notify-send -i "$PIX/android.svg" "$chosen unmounted."
}
asktype() { \

View File

@@ -1,19 +1,9 @@
#!/bin/sh
rm -f /tmp/locked.png
# If `imagemagick` is not installed, use a blank screen.
[ -f /usr/bin/convert ] &&
scrot -m -z /tmp/base.png &&
pgrep -x dunst && notify-send -i ~/.scripts/pix/lock.png "Locking computer..." &&
convert /tmp/base.png -blur 0x8 /tmp/locked.png
# Pause music (mocp, mpd and send the pause key to all mpv videos):
mocp -P >/dev/null 2>&1
# Pause mpd and send the pause key to all mpv videos:
mpc pause >/dev/null 2>&1
pauseallmpv >/dev/null 2>&1
i3lock -e -f -c 000000 -i /tmp/locked.png
i3lock -e -f -c 1d2021
# In five seconds, turn off display unless key press in last 4 seconds.
sleep 5 && [ 4000 -lt "$(xssstate -i)" ] && pgrep -x i3lock && xset dpms force off

View File

@@ -1,9 +1,9 @@
#!/bin/sh
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfullscreen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
"current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;;
"full screen") maim pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
"a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;;
"current window (copy)") maim -i | xclip -selection clipboard -t image/png ;;
"current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
"full screen (copy)") maim | xclip -selection clipboard -t image/png ;;
esac

View File

@@ -1,15 +1,10 @@
#!/bin/sh
# If transmission-daemon is running, will ask to kill, else will ask to start.
[ ! -f /usr/bin/transmission-daemon ] && notify-send "Transmission daemon not installed." && exit
if pgrep -x transmission-da >/dev/null ;
if pgrep -x transmission-da >/dev/null ;
then
yn=$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")
[ "$yn" = "Yes" ] && killall transmission-da
[ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send -i "$PIX/torrent.svg" "transmission-daemon killed."
else
yn=$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")
[ "$yn" = "Yes" ] && transmission-daemon
ifinstalled transmission-cli || exit
[ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send -i "$PIX/torrent.svg" "tranmission-daemon started."
fi
sleep 3 && pkill -RTMIN+7 i3blocks

6
.scripts/i3cmds/torwrap Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
ifinstalled transmission-remote-cli transmission-cli || exit
! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send -i "$PIX/torrent.svg" "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks
$TERMINAL -e transmission-remote-cli

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Credit to Maddison Hellstrom (@b0o on Github)
qrencode -o - -s 1 \
ifinstalled feh && qrencode -o - -s 1 \
"$(xclip -out -selection clipboard)" |
feh --zoom max \
-F \