diff options
Diffstat (limited to 'dotfiles/dwm/.local')
| -rwxr-xr-x | dotfiles/dwm/.local/bin/audioselect | 68 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/battery_monitor | 52 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/bookfind | 5 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/displayselect | 83 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenuhandler | 21 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenumount | 67 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenumountcifs | 19 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenurecord | 123 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenuumount | 44 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/exitmenu | 15 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/monitor | 50 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/prompt | 8 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/recordnow | 26 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/remaps | 11 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/samedir | 10 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/setbg | 34 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/td-toggle | 12 |
17 files changed, 0 insertions, 648 deletions
diff --git a/dotfiles/dwm/.local/bin/audioselect b/dotfiles/dwm/.local/bin/audioselect deleted file mode 100755 index 6c40d47..0000000 --- a/dotfiles/dwm/.local/bin/audioselect +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# Craig Jennings -# convenience script to switch audio devices -# need bluez and bluez-utils - -# DEVICE MAC ADDRESSES -marshall_earbuds_device="00:25:D1:1B:39:CA" -marshall_headset_device="9C:0D:AC:05:1E:C9" - -# SINKS (Audio Out) -marshall_headset_sink="bluez_output.9C_0D_AC_05_1E_C9.a2dp-sink" -marshall_earbuds_sink="bluez_output.00_25_D1_1B_39_CA.a2dp_sink" -builtin_sink="alsa_output.pci-0000_00_1f.3.analog-stereo" -jabra_510_sink="alsa_output.usb-0b0e_Jabra_SPEAK_510_USB_1C48F9C067D5020A00-00.analog-stereo" -steelseries_sink="alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.stereo-game" -emberton_sink="bluez_sink.04_21_44_89_D0_BE.a2dp_sink" - -# SOURCES (Audio In) -jabra_510_source="alsa_input.usb-0b0e_Jabra_SPEAK_510_USB_1C48F9C067D5020A00-00.mono-fallback" -builtin_source="alsa_input.pci-0000_00_1f.3.analog-stereo" -steelseries_source="alsa_input.usb-SteelSeries_SteelSeries_Arctis_7-00.mono-chat" - -CHOICES="Cancel\nToggle Mute Speaker\nToggle Mute Mic\nMarshall Headset & Jabra Mic\nMarshall Headset & Default Mic\nMarshall Earbuds & Jabra Mic\nJabra Speaker & Mic\nBuilt-In Audio" - -CHOSEN=$(echo -e "$CHOICES" | dmenu -l 10) - -case "$CHOSEN" in -"Toggle Mute Speaker") - pactl set-sink-mute 0 toggle - ;; -"Toggle Mute Mic") - pactl set-source-mute 0 toggle - ;; -"Marshall Headset & Jabra Mic") - bluetooth power on - bluetoothctl connect $marshall_headset_device - pactl set-default-sink $marshall_headset_sink - pactl set-default-source $jabra_510_source - ;; -"Marshall Headset & Default Mic") - bluetooth power on - bluetoothctl connect $marshall_headset_device - pactl set-default-sink $marshall_headset_sink - pactl set-default-source $builtin_source - ;; -"Marshall Earbuds & Jabra Mic") - bluetooth power on - bluetoothctl connect $marshall_earbuds_device - pactl set-default-sink $marshall_earbuds_sink - pactl set-default-source $jabra_510_source - ;; -"Built-In Audio") - pactl set-default-sink $builtin_audio_sink - pactl set-default-source $builtin_audio_source - ;; -"Jabra Speaker & Mic") - pactl set-default-sink $jabra_510_sink - pactl set-default-source $jabra_510_source - ;; -"Emberton & Built-In") - pactl set-default-sink $emberton_sink - pactl set-default-source $builtin_audio_source - ;; -"Steelseries Headset") - pactl set-default-sink $steelseries_sink - pactl set-default-source $steelseries_source - ;; -esac diff --git a/dotfiles/dwm/.local/bin/battery_monitor b/dotfiles/dwm/.local/bin/battery_monitor deleted file mode 100755 index dc8d5ea..0000000 --- a/dotfiles/dwm/.local/bin/battery_monitor +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# battery_monitor -# Intended to be run via .xinitrc -# - Exit automatically if no battery (desktop) -# - When below 15%, warn user of low battery -# - When below 10%, suspend within 10 seconds if not charging -# -# Craig Jennings <c@cjennings.net> - -# check if acpi is installed -if ! command -v acpi &> /dev/null; then - echo "acpi is not installed. Cannot continue. Exiting...." - exit 1 -fi - -# exit if a battery exists -if [ ! -d "/sys/class/power_supply/BAT0" ] && [ ! -d "/sys/class/power_supply/BAT1" ]; then - echo "Acpi is installed but no battery detected. Assuming this is a desktop and exiting...." - exit 1 -fi - -while true; do - # Get the current battery percentage using acpi - battery_percentage=$(acpi -b | awk -F ', ' '{print $2}' | tr -d '%') - # battery_percentage=$(acpi -b | awk -F ', ' '{print $2}' | sed 's/%//') - - # When below 10%, suspend within 10 seconds if not charging - if [ "$battery_percentage" -lt 11 ] && ! acpi -a | grep -q "on-line" ; then - # Send a notification of sleeping in 10 seconds - notify-send -u critical "Critical Battery" "Battery is at $battery_percentage%. System entering sleep in 30 seconds." - - # sleep for 10 seconds, then abort if charging - sleep 30 - - # Check if the system is charging (AC adapter connected) - if acpi -a | grep -q "on-line"; then - notify-send "Charging" "The system is now charging. No action taken." - else - notify-send -u critical "Critical Battery" "Putting the system to sleep." - sudo systemctl suspend - fi - fi - - # When below 15%, warn user - if [ "$battery_percentage" -lt 15 ] && ! acpi -a | grep -q "on-line" ; then - # Send a notification using notify-send and dunst - notify-send -u critical "Low Battery" "Battery is at $battery_percentage%. System will automatically sleep at 10%." - fi - - # Sleep for 5 minutes before checking again - sleep 300 -done diff --git a/dotfiles/dwm/.local/bin/bookfind b/dotfiles/dwm/.local/bin/bookfind deleted file mode 100755 index c5cc1bc..0000000 --- a/dotfiles/dwm/.local/bin/bookfind +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# allows user to open a calibre book using dmenu - -find ~/Library/ -type f \( -iname \*.pdf -o -iname \*.epub \) | dmenu -i -l 20 -p "Choose an ebook:" - diff --git a/dotfiles/dwm/.local/bin/displayselect b/dotfiles/dwm/.local/bin/displayselect deleted file mode 100755 index f9e8062..0000000 --- a/dotfiles/dwm/.local/bin/displayselect +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - -# A UI for detecting and selecting all displays. Probes xrandr for connected -# displays and lets user select one to use. User may also select "manual -# selection" which opens arandr. - -twoscreen() { # If multi-monitor is selected and there are two screens. - - mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?") - # Mirror displays using native resolution of external display and a scaled - # version for the internal display - if [ "$mirror" = "yes" ]; then - external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:") - internal=$(echo "$screens" | grep -v "$external") - - res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \ - tail -n 1 | awk '{print $1}') - res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ - tail -n 1 | awk '{print $1}') - - res_ext_x=$(echo "$res_external" | sed 's/x.*//') - res_ext_y=$(echo "$res_external" | sed 's/.*x//') - res_int_x=$(echo "$res_internal" | sed 's/x.*//') - res_int_y=$(echo "$res_internal" | sed 's/.*x//') - - scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l) - scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l) - - xrandr --output "$external" --auto --scale 1.0x1.0 \ - --output "$internal" --auto --same-as "$external" \ - --scale "$scale_x"x"$scale_y" - else - - primary=$(echo "$screens" | dmenu -i -p "Select primary display:") - secondary=$(echo "$screens" | grep -v "$primary") - direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") - xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 - fi - } - -morescreen() { # If multi-monitor is selected and there are more than two screens. - primary=$(echo "$screens" | dmenu -i -p "Select primary display:") - secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") - direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") - tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") - xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto - } - -multimon() { # Multi-monitor handler. - case "$(echo "$screens" | wc -l)" in - 2) twoscreen ;; - *) morescreen ;; - esac ;} - -onescreen() { # If only one output available or chosen. - xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -) - } - -postrun() { # Stuff to run to clean up. - setbg # Fix background if screen size/arangement has changed. - remaps # Re-remap keys if keyboard added (for laptop bases) - { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen - } - -# Get all possible displays -allposs=$(xrandr -q | grep "connected") - -# Get all connected screens. -screens=$(echo "$allposs" | awk '/ connected/ {print $1}') - -# If there's only one screen -[ "$(echo "$screens" | wc -l)" -lt 2 ] && - { onescreen "$screens"; postrun; notify-send "π» Only one screen detected." "Using it in its optimal settings..."; exit ;} - -# Get user choice including multi-monitor and manual selection: -chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && -case "$chosen" in - "manual selection") arandr ; exit ;; - "multi-monitor") multimon ;; - *) onescreen "$chosen" ;; -esac - -postrun diff --git a/dotfiles/dwm/.local/bin/dmenuhandler b/dotfiles/dwm/.local/bin/dmenuhandler deleted file mode 100755 index 1c48f3a..0000000 --- a/dotfiles/dwm/.local/bin/dmenuhandler +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# Feed this script a link and it will give dmenu -# some choice programs to use to open it. -feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" - -case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in - "Copy URL") echo "$feed" | xclip -selection clipboard ;; - mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;; - "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; - "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; - "queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;; - "queue yt-dlp audio") qndl "$feed" 'yt-dlp --embed-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; - "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; - PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; - sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; - vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; - setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; - browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; - lynx) lynx "$feed" >/dev/null 2>&1 ;; -esac diff --git a/dotfiles/dwm/.local/bin/dmenumount b/dotfiles/dwm/.local/bin/dmenumount deleted file mode 100755 index 3cb1f81..0000000 --- a/dotfiles/dwm/.local/bin/dmenumount +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -# Gives a dmenu prompt to mount unmounted drives and Android phones. 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. - -getmount() { \ - [ -z "$chosen" ] && exit 1 - # shellcheck disable=SC2086 - mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 - test -z "$mp" && exit 1 - if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 - [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") - fi - } - -mountusb() { \ - chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 - chosen="$(echo "$chosen" | awk '{print $1}')" - sudo -A mount "$chosen" 2>/dev/null && notify-send "π» USB mounting" "$chosen mounted." && exit 0 - alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') - getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" - partitiontype="$(lsblk -no "fstype" "$chosen")" - case "$partitiontype" in - "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; - "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; - *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; - esac - notify-send "π» USB mounting" "$chosen mounted to $mp." - } - -mountandroid() { \ - chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 - chosen="$(echo "$chosen" | cut -d : -f 1)" - getmount "$HOME -maxdepth 3 -type d" - simple-mtpfs --device "$chosen" "$mp" - echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 - simple-mtpfs --device "$chosen" "$mp" - notify-send "π€ Android Mounting" "Android device mounted to $mp." - } - -asktype() { \ - choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 - case $choice in - USB) mountusb ;; - Android) mountandroid ;; - esac - } - -anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" - -if [ -z "$usbdrives" ]; then - [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit - echo "Android device(s) detected." - mountandroid -else - if [ -z "$anddrives" ]; then - echo "USB drive(s) detected." - mountusb - else - echo "Mountable USB drive(s) and Android device(s) detected." - asktype - fi -fi diff --git a/dotfiles/dwm/.local/bin/dmenumountcifs b/dotfiles/dwm/.local/bin/dmenumountcifs deleted file mode 100755 index 46c2b57..0000000 --- a/dotfiles/dwm/.local/bin/dmenumountcifs +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# Gives a dmenu prompt to mount unmounted local NAS shares for read/write. -# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL" -# -# Browse for mDNS/DNS-SD services using the Avahi daemon... -srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1 -notify-send "Searching for network shares..." "Please wait..." -# Choose share disk... -share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1 -# Format URL... -share2mnt=//"$srvname".local/"$share" - -sharemount() { - mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share") - [ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0 - notify-send "Netshare $share already mounted"; exit 1 -} - -sharemount diff --git a/dotfiles/dwm/.local/bin/dmenurecord b/dotfiles/dwm/.local/bin/dmenurecord deleted file mode 100755 index b83a7c5..0000000 --- a/dotfiles/dwm/.local/bin/dmenurecord +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh - -# Usage: -# `$0`: Ask for recording type via dmenu -# `$0 screencast`: Record both audio and screen -# `$0 video`: Record only screen -# `$0 audio`: Record only audio -# `$0 kill`: Kill existing recording -# -# If there is already a running instance, user will be prompted to end it. - -updateicon() { \ - echo "$1" > /tmp/recordingicon - pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" - } - -killrecording() { - recpid="$(cat /tmp/recordingpid)" - # kill with SIGTERM, allowing finishing touches. - kill -15 "$recpid" - rm -f /tmp/recordingpid - updateicon "" - pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" - # even after SIGTERM, ffmpeg may still run, so SIGKILL it. - sleep 3 - kill -9 "$recpid" - exit - } - -screencast() { \ - ffmpeg -y \ - -f x11grab \ - -framerate 60 \ - -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ - -i "$DISPLAY" \ - -f alsa -i default \ - -r 30 \ - -c:v h264 -crf 0 -preset ultrafast -c:a aac \ - "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & - echo $! > /tmp/recordingpid - updateicon "βΊοΈποΈ" - } - -video() { ffmpeg \ - -f x11grab \ - -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ - -i "$DISPLAY" \ - -c:v libx264 -qp 0 -r 30 \ - "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "βΊοΈ" - } - -webcamhidef() { ffmpeg \ - -f v4l2 \ - -i /dev/video0 \ - -video_size 1920x1080 \ - "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "π₯" - } - -webcam() { ffmpeg \ - -f v4l2 \ - -i /dev/video0 \ - -video_size 640x480 \ - "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "π₯" - } - - -audio() { \ - ffmpeg \ - -f alsa -i default \ - -c:a flac \ - "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & - echo $! > /tmp/recordingpid - updateicon "ποΈ" - } - -askrecording() { \ - choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") - case "$choice" in - screencast) screencast;; - audio) audio;; - video) video;; - *selected) videoselected;; - webcam) webcam;; - "webcam (hi-def)") webcamhidef;; - esac - } - -asktoend() { \ - response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && - [ "$response" = "Yes" ] && killrecording - } - -videoselected() -{ - slop -f "%x %y %w %h" > /tmp/slop - read -r X Y W H < /tmp/slop - rm /tmp/slop - - ffmpeg \ - -f x11grab \ - -framerate 60 \ - -video_size "$W"x"$H" \ - -i :0.0+"$X,$Y" \ - -c:v libx264 -qp 0 -r 30 \ - "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "βΊοΈ" -} - -case "$1" in - screencast) screencast;; - audio) audio;; - video) video;; - *selected) videoselected;; - kill) killrecording;; - *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; -esac diff --git a/dotfiles/dwm/.local/bin/dmenuumount b/dotfiles/dwm/.local/bin/dmenuumount deleted file mode 100755 index 946d12c..0000000 --- a/dotfiles/dwm/.local/bin/dmenuumount +++ /dev/null @@ -1,44 +0,0 @@ -#!/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. - -unmountusb() { - [ -z "$drives" ] && exit - chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 - chosen="$(echo "$chosen" | awk '{print $1}')" - [ -z "$chosen" ] && exit - sudo -A umount "$chosen" && notify-send "π» USB unmounting" "$chosen unmounted." - } - -unmountandroid() { \ - chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1 - [ -z "$chosen" ] && exit - sudo -A umount -l "$chosen" && notify-send "π€ Android unmounting" "$chosen unmounted." - } - -asktype() { \ - choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1 - case "$choice" in - USB) unmountusb ;; - Android) unmountandroid ;; - esac - } - -drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}') - -if ! grep simple-mtpfs /etc/mtab; then - [ -z "$drives" ] && echo "No drives to unmount." && exit - echo "Unmountable USB drive detected." - unmountusb -else - if [ -z "$drives" ] - then - echo "Unmountable Android device detected." - unmountandroid - else - echo "Unmountable USB drive(s) and Android device(s) detected." - asktype - fi -fi diff --git a/dotfiles/dwm/.local/bin/exitmenu b/dotfiles/dwm/.local/bin/exitmenu deleted file mode 100755 index 54028a7..0000000 --- a/dotfiles/dwm/.local/bin/exitmenu +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -CHOICES="Shutdown\nReboot\nLock\nHibernate\nSuspend\nToggle Airplane Mode\nToggle Powersave Mode" -CHOSEN=$(echo -e "$CHOICES" | dmenu -i) - -case $CHOSEN in - "Shutdown") shutdown now ;; - "Reboot") reboot ;; - "Lock") xscreensaver-command --lock ;; - "Hiberbate") systemctl hibernate ;; - "Suspend") systemctl suspend ;; - "Toggle Airplane Mode") airplanemodetoggle ;; - "Toggle Powersave Mode") lowpowertoggle && notify-send "Battery Status" "$(acpi -b)" ;; -esac - diff --git a/dotfiles/dwm/.local/bin/monitor b/dotfiles/dwm/.local/bin/monitor deleted file mode 100755 index 30f04b6..0000000 --- a/dotfiles/dwm/.local/bin/monitor +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# Craig Jennings -# convenience script to switch monitors - -# this script assumes there are at most two monitors attached and we want to switch between then -CHOICES="Laptop\nLaptop-Scaled\nHome-Display\nExternal-Auto\nExternal-Scaled\nVirtualbox" - -# laptops always have a monitor connected when running the script. -LAPTOP=$(xrandr -q | grep primary | awk '$2 == "connected" {print $1}') -echo "primary monitor is $LAPTOP" - -# an external monitor will always be a connected monitor that isn't primary -EXTERNAL=$(xrandr -q | grep -v primary | awk '$2 == "connected" {print $1}') - -# start by resetting -xrandr -s 0 - -# disable if called automatically, otherwise you'll want the menu -# if there's only one monitor connected, setup laptop monitor -# if [ -z "$EXTERNAL" ]; then -# xrandr -s 0 -# xrandr --output "$LAPTOP" --auto --dpi 144 --scale 0.6 -# exit 0 -# fi - -CHOSEN=$(echo -e "$CHOICES" | dmenu -i) - -case "$CHOSEN" in -"Laptop") - xrandr --output "$LAPTOP" --auto --output "$EXTERNAL" --off - ;; -"Laptop-Scaled") - xrandr --output "$LAPTOP" --auto --dpi 144 --scale 0.6 --output "$EXTERNAL" --off - ;; -"External") - xrandr --output "$EXTERNAL" --auto --dpi 96 --mode 3440x1440 --scale 1.0 --output "$LAPTOP" --off - ;; -"External-Auto") - xrandr --output "$EXTERNAL" --auto --output "$LAPTOP" --off - ;; -"External-Scaled") - xrandr --output "$EXTERNAL" --auto --scale 0.6 --output "$LAPTOP" --off - ;; -"Virtualbox") - xrandr --output "$LAPTOP" --auto --mode 1920x1080 - ;; -esac - -# restore the wallpaper after resolution change -[ -f ~/.fehbg ] && ~/.fehbg diff --git a/dotfiles/dwm/.local/bin/prompt b/dotfiles/dwm/.local/bin/prompt deleted file mode 100755 index 666434f..0000000 --- a/dotfiles/dwm/.local/bin/prompt +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# A dmenu binary prompt script. -# Gives a dmenu prompt labeled with $1 to perform command $2. -# For example: -# `./prompt "Do you want to shutdown?" "shutdown -h now"` - -[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2 diff --git a/dotfiles/dwm/.local/bin/recordnow b/dotfiles/dwm/.local/bin/recordnow deleted file mode 100755 index 4e2d04a..0000000 --- a/dotfiles/dwm/.local/bin/recordnow +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env sh -# Craig Jennings <c@cjennings.net> - -# Start a screen recording using ffmpeg to capture the entire -# screen along with all audio and the microphone. - -# Make sure that ffmpeg is in the path and the destination directory -# exists. - -LOCATION="$HOME/videos/recordings" -NAME=$(date +'%Y-%m-%d-%H-%M-%S') -echo $NAME - -# create the directory if it doesn't exist -if [ ! -d "$LOCATION" ]; then - mkdir -p "$LOCATION" -fi - -# error out if ffmpeg isn't installed -if ! command -v ffmpeg &> /dev/null -then - echo "ERROR: ffmpeg couldn't be found. Please ensure it's installed and added to your PATH." - exit -fi - -ffmpeg -framerate 30 -f x11grab -i :0.0+ -f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo -ac 1 -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -ac 2 "$LOCATION/$NAME".mkv diff --git a/dotfiles/dwm/.local/bin/remaps b/dotfiles/dwm/.local/bin/remaps deleted file mode 100755 index c95ac84..0000000 --- a/dotfiles/dwm/.local/bin/remaps +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# This script is called on startup to remap keys. -# Decrease key repeat delay to 300ms and increase key repeat rate to 50 per second. -xset r rate 300 50 -# Map the caps lock key to super, and map the menu key to right super. -setxkbmap -option caps:super,altwin:menu_win -# When caps lock is pressed only once, treat it as escape. -killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' -# Turn off caps lock if on since there is no longer a key for it. -xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock diff --git a/dotfiles/dwm/.local/bin/samedir b/dotfiles/dwm/.local/bin/samedir deleted file mode 100755 index 371ec64..0000000 --- a/dotfiles/dwm/.local/bin/samedir +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Open a terminal window in the same directory as the currently active window. - -PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") -PID="$(pstree -lpA "$PID")" -PID="${PID##*"${SHELL##*/}"(}" -PID="${PID%%)*}" -cd "$(readlink /proc/"$PID"/cwd)" || return 1 -"$TERMINAL" diff --git a/dotfiles/dwm/.local/bin/setbg b/dotfiles/dwm/.local/bin/setbg deleted file mode 100755 index b72dc7d..0000000 --- a/dotfiles/dwm/.local/bin/setbg +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# This script does the following: -# Run by itself, set the wallpaper (at X start). -# If given a file, set that as the new wallpaper. -# If given a directory, choose random file in it. -# If wal is installed, also generates a colorscheme. - -# Location of link to wallpaper link. -bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg" - -# Configuration files of applications that have their themes changed by pywal. -dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" -zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" - -trueloc="$(readlink -f "$1")" && -case "$(file --mime-type -b "$trueloc")" in - image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;; - inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;; - *) notify-send "πΌοΈ Error" "Not a valid image or directory." ; exit 1;; -esac - -# If pywal is installed, use it. -if command -v wal >/dev/null 2>&1 ; then - wal -n -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 -# If pywal is removed, return config files to normal. -else - [ -f "$dunstconf.bak" ] && unlink "$dunstconf" && mv "$dunstconf.bak" "$dunstconf" - [ -f "$zathuraconf.bak" ] && unlink "$zathuraconf" && mv "$zathuraconf.bak" "$zathuraconf" -fi - -xwallpaper --zoom "$bgloc" -# If running, dwm hit the key to refresh the color scheme. -pidof dwm >/dev/null && xdotool key super+F5 diff --git a/dotfiles/dwm/.local/bin/td-toggle b/dotfiles/dwm/.local/bin/td-toggle deleted file mode 100755 index de1a0e6..0000000 --- a/dotfiles/dwm/.local/bin/td-toggle +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# If transmission-daemon is running, will ask to kill, else will ask to start. - -if pidof transmission-daemon >/dev/null ; -then - [ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-daemon && notify-send "transmission-daemon disabled." -else - ifinstalled transmission-cli || exit - [ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "transmission-daemon enabled." -fi -sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" |
