diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2019-05-19 20:05:14 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2019-05-19 20:05:14 -0400 |
| commit | c6e69e96421ebf192eb6de537324e269e7bfda78 (patch) | |
| tree | 47d34a5ff72d65be9a3e2c6aeb55a88da3a6fbd2 /.local/bin/i3cmds | |
| parent | bf8c6b1e20f42a7725d8d919830fdb274596b20f (diff) | |
| download | eibhear-c6e69e96421ebf192eb6de537324e269e7bfda78.tar.gz eibhear-c6e69e96421ebf192eb6de537324e269e7bfda78.tar.zst eibhear-c6e69e96421ebf192eb6de537324e269e7bfda78.zip | |
massive cleanup
Diffstat (limited to '.local/bin/i3cmds')
| -rwxr-xr-x | .local/bin/i3cmds/camtoggle | 2 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/displayselect | 73 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/dmenumount | 59 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/dmenurecord | 105 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/dmenuumount | 41 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/dmenuunicode | 18 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/hover | 14 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/maimpick | 9 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/prompt | 7 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/samedir | 5 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/showclip | 10 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/td-toggle | 10 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/toggletouchpad | 4 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/torwrap | 6 | ||||
| -rwxr-xr-x | .local/bin/i3cmds/tutorialvids | 18 |
15 files changed, 0 insertions, 381 deletions
diff --git a/.local/bin/i3cmds/camtoggle b/.local/bin/i3cmds/camtoggle deleted file mode 100755 index 05679c0..0000000 --- a/.local/bin/i3cmds/camtoggle +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0 diff --git a/.local/bin/i3cmds/displayselect b/.local/bin/i3cmds/displayselect deleted file mode 100755 index e526014..0000000 --- a/.local/bin/i3cmds/displayselect +++ /dev/null @@ -1,73 +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. -# I plan on adding a routine from multi-monitor setups later. - -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 - 1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; - 2) twoscreen ;; - *) morescreen ;; - esac ;} - -# Get all possible displays -allposs=$(xrandr -q | grep "connected") - -# Get all connected screens. -screens=$(echo "$allposs" | grep " connected" | awk '{print $1}') - -# 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 ;; - *) 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. -remaps # Re-remap keys if keyboard added (for laptop bases) -pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen diff --git a/.local/bin/i3cmds/dmenumount b/.local/bin/i3cmds/dmenumount deleted file mode 100755 index 9129643..0000000 --- a/.local/bin/i3cmds/dmenumount +++ /dev/null @@ -1,59 +0,0 @@ -#!/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. - -getmount() { \ - [ -z "$chosen" ] && exit 1 - mp="$(find $1 | 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" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") - fi - } - -mountusb() { \ - chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" - sudo -A mount "$chosen" && notify-send "π» USB mounting" "$chosen mounted." && exit 0 - alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$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;; - *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";; - esac - notify-send "π» USB mounting" "$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 Mounting" "Android device mounted to $mp." - } - -asktype() { \ - case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in - USB) mountusb ;; - Android) mountandroid ;; - esac - } - -anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$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/.local/bin/i3cmds/dmenurecord b/.local/bin/i3cmds/dmenurecord deleted file mode 100755 index 0047e7a..0000000 --- a/.local/bin/i3cmds/dmenurecord +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh - -# Usage: -# `record`: Ask for recording type via dmenu -# `record screencast`: Record both audio and screen -# `record video`: Record only screen -# `record audio`: Record only audio -# `record 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 i3blocks - } - -killrecording() { - recpid="$(cat /tmp/recordingpid)" - # kill with SIGTERM, allowing finishing touches. - kill -15 "$recpid" - rm -f /tmp/recordingpid - updateicon "" - pkill -RTMIN+9 i3blocks - # 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 | grep dimensions | awk '{print $2;}') \ - -i :0.0 \ - -f alsa -i default \ - -r 30 \ - -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ - "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "βΊοΈποΈ" - } - -video() { ffmpeg \ - -f x11grab \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ - -i :0.0 \ - -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\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") - case "$choice" in - screencast) screencast;; - audio) audio;; - video) video;; - webcam) webcam;; - "webcam (hi-def)") webcamhidef;; - esac - } - -asktoend() { \ - response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && - [ "$response" = "Yes" ] && killrecording - } - - -case "$1" in - screencast) screencast;; - audio) audio;; - video) video;; - kill) killrecording;; - *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; -esac diff --git a/.local/bin/i3cmds/dmenuumount b/.local/bin/i3cmds/dmenuumount deleted file mode 100755 index dee53e7..0000000 --- a/.local/bin/i3cmds/dmenuumount +++ /dev/null @@ -1,41 +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?" | 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?") - [ -z "$chosen" ] && exit - sudo -A umount -l "$chosen" && notify-send "π€ Android unmounting" "$chosen unmounted." - } - -asktype() { \ - case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in - USB) unmountusb ;; - Android) unmountandroid ;; - esac - } - -drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') - -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/.local/bin/i3cmds/dmenuunicode b/.local/bin/i3cmds/dmenuunicode deleted file mode 100755 index 4abf202..0000000 --- a/.local/bin/i3cmds/dmenuunicode +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# Give dmenu list of all unicode characters to copy. -# Shows the selected character in dunst if running. - -# Must have xclip installed to even show menu. -xclip -h >/dev/null || exit - -chosen=$(grep -v "#" ~/.config/emoji | dmenu -i -l 20 -fn Monospace-18) - -[ "$chosen" != "" ] || exit - -c=$(echo "$chosen" | sed "s/ .*//") -echo "$c" | tr -d '\n' | xclip -selection clipboard -notify-send "'$c' copied to clipboard." & - -s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}') -echo "$s" | tr -d '\n' | xclip -notify-send "'$s' copied to primary." & diff --git a/.local/bin/i3cmds/hover b/.local/bin/i3cmds/hover deleted file mode 100755 index 8d03a99..0000000 --- a/.local/bin/i3cmds/hover +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right -current=$(xdotool getwindowfocus) -newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3)) -newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3)) -xdotool windowsize "$current" $newheight $newwidth -newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}') -newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*") - -case "$1" in - left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; - right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; -esac -xdotool windowmove "$current" $horizontal $vertical diff --git a/.local/bin/i3cmds/maimpick b/.local/bin/i3cmds/maimpick deleted file mode 100755 index 07d032f..0000000 --- a/.local/bin/i3cmds/maimpick +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -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 "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;; - "full screen (copy)") maim | xclip -selection clipboard -t image/png ;; -esac diff --git a/.local/bin/i3cmds/prompt b/.local/bin/i3cmds/prompt deleted file mode 100755 index 56de2f8..0000000 --- a/.local/bin/i3cmds/prompt +++ /dev/null @@ -1,7 +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/.local/bin/i3cmds/samedir b/.local/bin/i3cmds/samedir deleted file mode 100755 index 88845fc..0000000 --- a/.local/bin/i3cmds/samedir +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) -PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') -cd "$(readlink /proc/"$PID"/cwd)" -"$TERMINAL" diff --git a/.local/bin/i3cmds/showclip b/.local/bin/i3cmds/showclip deleted file mode 100755 index d2faff8..0000000 --- a/.local/bin/i3cmds/showclip +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Display contents of selection via dunst if running. -# Separate script for i3. - -clip=$(xclip -o -selection clipboard) -prim=$(xclip -o -selection primary) - -[ -n "$clip" ] && notify-send "Clipboard:" "$clip" -[ -n "$prim" ] && notify-send "Primary:" "$prim" diff --git a/.local/bin/i3cmds/td-toggle b/.local/bin/i3cmds/td-toggle deleted file mode 100755 index dc727b9..0000000 --- a/.local/bin/i3cmds/td-toggle +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# If transmission-daemon is running, will ask to kill, else will ask to start. -if pgrep -x transmission-da >/dev/null ; -then - [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed." -else - ifinstalled transmission-cli || exit - [ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started." -fi -sleep 3 && pkill -RTMIN+7 i3blocks diff --git a/.local/bin/i3cmds/toggletouchpad b/.local/bin/i3cmds/toggletouchpad deleted file mode 100755 index 6d8c9c8..0000000 --- a/.local/bin/i3cmds/toggletouchpad +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Toggle touchpad. Requires xf86-input-synaptics. -(synclient | grep "TouchpadOff.*1" && synclient TouchpadOff=0)>/dev/null && echo "TouchPad reactivated." && exit -synclient TouchpadOff=1 && echo "TouchPad deactivated." diff --git a/.local/bin/i3cmds/torwrap b/.local/bin/i3cmds/torwrap deleted file mode 100755 index 04e7a51..0000000 --- a/.local/bin/i3cmds/torwrap +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ifinstalled transmission-remote-cli transmission-cli || exit - -! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks - -$TERMINAL -e transmission-remote-cli diff --git a/.local/bin/i3cmds/tutorialvids b/.local/bin/i3cmds/tutorialvids deleted file mode 100755 index f1357eb..0000000 --- a/.local/bin/i3cmds/tutorialvids +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -vidlist=" -status bar https://www.youtube.com/watch?v=gKumet6b-WY -sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs -st (terminal) https://www.youtube.com/watch?v=9H75enWM22k -i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI -pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs -mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A -ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U -newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w -zathura (pdf viewer) https://www.youtube.com/watch?v=V_Iz4zdyRM4 -gpg keys https://www.youtube.com/watch?v=DMGIlj7u7Eo -calcurse (calendar) https://www.youtube.com/watch?v=hvc-pHjbhdE -urlview https://www.youtube.com/watch?v=IgzpAjFgbCw -colorschemes with pywal https://www.youtube.com/watch?v=Es79N_9BblE -vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E -" -echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv |
