mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-10-09 19:11:15 +02:00
bulkadding .local files
This commit is contained in:
26
.local/bin/i3cmds/cabl
Executable file
26
.local/bin/i3cmds/cabl
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Dependencies are xclip and xorg-xprop.
|
||||
# qrencode required for qrcode generation.
|
||||
# groff/zathura required for man pages.
|
||||
prim="$(xclip -o)"; [ -z "$prim" ] && exit
|
||||
|
||||
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)"
|
||||
[ -f "$prim" ] && xdg-open "$prim" && exit
|
||||
[ -d "$prim" ] && "$TERMINAL" "$prim" && exit
|
||||
|
||||
websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;}
|
||||
wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;}
|
||||
wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;}
|
||||
maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;}
|
||||
ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;}
|
||||
|
||||
echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;}
|
||||
echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;}
|
||||
command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;}
|
||||
man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;}
|
||||
|
||||
func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb \"$(echo "$prim" | cut -c -30)\" to?" -i -l 15)"
|
||||
|
||||
[ -z "$func" ] || "$func" "$prim"
|
2
.local/bin/i3cmds/camtoggle
Executable file
2
.local/bin/i3cmds/camtoggle
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/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
|
19
.local/bin/i3cmds/ddspawn
Executable file
19
.local/bin/i3cmds/ddspawn
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Toggle floating dropdown terminal in i3, or start if non-existing.
|
||||
# $1 is the script run in the terminal.
|
||||
# All other args are terminal settings.
|
||||
# Terminal names are in dropdown_* to allow easily setting i3 settings.
|
||||
|
||||
[ -z "$1" ] && exit
|
||||
|
||||
script=$1
|
||||
shift
|
||||
if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
|
||||
then
|
||||
echo "Window detected."
|
||||
i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
|
||||
else
|
||||
echo "Window not detected... spawning."
|
||||
i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script"
|
||||
fi
|
73
.local/bin/i3cmds/displayselect
Executable file
73
.local/bin/i3cmds/displayselect
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/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
|
59
.local/bin/i3cmds/dmenumount
Executable file
59
.local/bin/i3cmds/dmenumount
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/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 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" ] && (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" 2>/dev/null && 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" "$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
|
105
.local/bin/i3cmds/dmenurecord
Executable file
105
.local/bin/i3cmds/dmenurecord
Executable file
@@ -0,0 +1,105 @@
|
||||
#!/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 $DISPLAY \
|
||||
-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 $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\\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
|
41
.local/bin/i3cmds/dmenuumount
Executable file
41
.local/bin/i3cmds/dmenuumount
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/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
|
22
.local/bin/i3cmds/dmenuunicode
Executable file
22
.local/bin/i3cmds/dmenuunicode
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/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
|
||||
|
||||
if [ -e ~/.config/fontawesome ]; then
|
||||
chosen=$(grep -v "#" -h ~/.config/emoji ~/.config/fontawesome | dmenu -i -l 20 -fn Monospace-18)
|
||||
else
|
||||
chosen=$(grep -v "#" ~/.config/emoji | dmenu -i -l 20 -fn Monospace-18)
|
||||
fi
|
||||
|
||||
[ "$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." &
|
2
.local/bin/i3cmds/dropdowncalc
Executable file
2
.local/bin/i3cmds/dropdowncalc
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
ifinstalled bc && echo "Welcome to the Calculator." && bc -lq
|
20
.local/bin/i3cmds/ducksearch
Executable file
20
.local/bin/i3cmds/ducksearch
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Gives a dmenu prompt to search DuckDuckGo.
|
||||
# Without input, will open DuckDuckGo.com.
|
||||
# URLs will be directly handed to the browser.
|
||||
# Anything else, it search it.
|
||||
browser=${BROWSER:-firefox}
|
||||
|
||||
pgrep -x dmenu && exit
|
||||
|
||||
choice=$(echo "🦆" | dmenu -i -p "Search DuckDuckGo:") || exit 1
|
||||
|
||||
if [ "$choice" = "🦆" ]; then
|
||||
$browser "https://duckduckgo.com"
|
||||
else
|
||||
if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
|
||||
$browser "$choice"
|
||||
else
|
||||
$browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1"
|
||||
fi
|
||||
fi
|
14
.local/bin/i3cmds/hover
Executable file
14
.local/bin/i3cmds/hover
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/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
|
27
.local/bin/i3cmds/i3resize
Executable file
27
.local/bin/i3cmds/i3resize
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# This script was made by `goferito` on Github.
|
||||
# Some cleanup by Luke.
|
||||
|
||||
[ -z "$1" ] && echo "No direction provided" && exit 1
|
||||
distanceStr="2 px or 2 ppt"
|
||||
|
||||
moveChoice() {
|
||||
i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \
|
||||
i3-msg resize "$3" "$4" "$distanceStr"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
moveChoice grow up shrink down
|
||||
;;
|
||||
down)
|
||||
moveChoice shrink up grow down
|
||||
;;
|
||||
left)
|
||||
moveChoice shrink right grow left
|
||||
;;
|
||||
right)
|
||||
moveChoice grow right shrink left
|
||||
;;
|
||||
esac
|
||||
|
7
.local/bin/i3cmds/killrecording
Executable file
7
.local/bin/i3cmds/killrecording
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
kill -9 "$(cat ~/.recordingpid)"
|
||||
|
||||
# Update i3bar.
|
||||
echo "" > ~/.recordingicon
|
||||
pkill -RTMIN+9 i3blocks
|
9
.local/bin/i3cmds/maimpick
Executable file
9
.local/bin/i3cmds/maimpick
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/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
|
7
.local/bin/i3cmds/prompt
Executable file
7
.local/bin/i3cmds/prompt
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/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
|
5
.local/bin/i3cmds/samedir
Executable file
5
.local/bin/i3cmds/samedir
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/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"
|
10
.local/bin/i3cmds/showclip
Executable file
10
.local/bin/i3cmds/showclip
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/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"
|
10
.local/bin/i3cmds/td-toggle
Executable file
10
.local/bin/i3cmds/td-toggle
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/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
|
4
.local/bin/i3cmds/tmuxdd
Executable file
4
.local/bin/i3cmds/tmuxdd
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
# This is the script that i3 runs to either start tmux in
|
||||
# the dropdown terminal or log into a previous session.
|
||||
tmux a || tmux
|
4
.local/bin/i3cmds/toggletouchpad
Executable file
4
.local/bin/i3cmds/toggletouchpad
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/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."
|
6
.local/bin/i3cmds/torwrap
Executable file
6
.local/bin/i3cmds/torwrap
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/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
|
18
.local/bin/i3cmds/tutorialvids
Executable file
18
.local/bin/i3cmds/tutorialvids
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/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
|
2
.local/bin/i3cmds/winresize
Executable file
2
.local/bin/i3cmds/winresize
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
echo "📐" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)"
|
Reference in New Issue
Block a user