merger of bin

This commit is contained in:
Luke Smith 2019-11-23 16:16:30 -05:00
parent 85d353d796
commit a5e66ac4f4
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
14 changed files with 160 additions and 96 deletions

19
.config/gtk-2.0/gtkrc-2.0 Normal file
View file

@ -0,0 +1,19 @@
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
include "/home/luke/.gtkrc-2.0.mine"
gtk-theme-name="Arc-Gruvbox"
gtk-icon-theme-name="Adwaita"
gtk-font-name="Sans 10"
gtk-cursor-theme-name="Adwaita"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"
gtk-xft-rgba="rgb"

View file

@ -0,0 +1,16 @@
[Settings]
gtk-theme-name=Arc-Gruvbox
gtk-icon-theme-name=Adwaita
gtk-font-name=Sans 10
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-cursor-theme-name=Adwaita

View file

@ -0,0 +1,11 @@
# Important Note
These cronjobs have components that require information about your current display to display notifications correctly.
When you add them as cronjobs, I recommend you precede the command with commands as those below:
```
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
```
This ensures that notifications will display, xdotool commands will function and environmental varialbes will work as well.

18
.local/bin/cron/checkup Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env sh
# Syncs repositories and downloads updates, meant to be run as a cronjob.
ping -q -c 1 1.1.1.1 > /dev/null || exit
notify-send "📦 Repository Sync" "Checking for package updates..."
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
Check your internet connection, if pacman is already running, or run update manually to see errors."
pkill -RTMIN+8 i3blocks
if pacman -Qu | grep -v "\[ignored\]"
then
notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update."
else
notify-send "📦 Repository Sync" "Sync complete. No new packages for update."
fi

8
.local/bin/cron/cronbat Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env sh
# Notify me with notify-send if my battery is below 25%.
# You can set this to run via cron.
[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit
[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] &&
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus &&
notify-send -u critical "Battery critically low."

5
.local/bin/cron/crontog Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
# Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.consaved until restored.
([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")

16
.local/bin/cron/newsup Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env sh
# Set as a cron job to check for new RSS entries for newsboat.
# If newsboat is open, sends it an "R" key to refresh.
ping -q -c 1 1.1.1.1 > /dev/null || exit
/usr/bin/notify-send "📰 Updating RSS feeds..."
pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
echo 🔃 > /tmp/newsupdate
pkill -RTMIN+6 i3blocks
/usr/bin/newsboat -x reload
rm -f /tmp/newsupdate
pkill -RTMIN+6 i3blocks
/usr/bin/notify-send "📰 RSS feed update complete."

View file

@ -1,96 +0,0 @@
#!/usr/bin/env sh
# This script sets the statusbar with the xsetroot command at the end. Have it
# started by ~/.xinitrc or ~/.xprofile.
# Handle SIGTRAP signals sent by refbar to update the status bar immediately.
trap 'update' 5
# Set the deliminter character.
delim="|"
# testweather checks to see if the most recent forecast is up to date. If it
# isn't, it downloads a new weather forecast, then signals to update the
# statusbar. Gets weather report from wttr.in.
testweather() { \
[ "$(stat -c %y "$HOME/.local/share/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
ping -q -c 1 1.1.1.1 >/dev/null &&
curl -s "wttr.in/$location" > "$HOME/.local/share/weatherreport" &&
notify-send "🌞 Weather" "New weather forecast for today." &&
refbar
}
# Here is the (big) function that outputs the appearance of the statusbar. It
# can really be broken down into many submodules which I've commented and
# explained.
status() { \
# Get current mpd track filename or artist - title if possible.
mpc -f "[[%artist% - ]%title%]|[%file%]" 2>/dev/null | grep -v "volume:" | head -n 1 && echo "$delim"
# If the weather report is current, show daily precipitation chance,
# low and high. Don't even bother to understand this one unless you
# have all day. Takes the weather report format from wttr.in and makes
# it look like how I want it for the status bar.
[ "$(stat -c %y "$HOME/.local/share/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] &&
sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/ /g" | tr -d '\n' &&
sed '13q;d' "$HOME/.local/share/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ",$1 "°","",$2 "°"}' &&
echo "$delim"
# Get the volume of ALSA's master volume output. Show an icon if or
# not muted.
amixer get Master | grep -o "[0-9]*%\|\[on\]\|\[off\]" | sed "s/\[on\]//;s/\[off\]//"
echo "$delim"
# Wifi quality percentage and  icon if ethernet is connected.
grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70) "%" }'
sed "s/down//;s/up//" /sys/class/net/e*/operstate
# Show unread mail if mutt-wizard is installed.
command -v mw >/dev/null 2>&1 &&
echo "$delim" &&
du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | wc -l | sed 's/^/:/'
echo "$delim"
# Will show all batteries with approximate icon for remaining power.
for x in /sys/class/power_supply/BAT?/capacity;
do
case "$(cat $x)" in
100|9[0-9]) echo "" ;;
8[0-9]|7[0-9]) echo "" ;;
6[0-9]|5[0-9]) echo "" ;;
4[0-9]|3[0-9]) echo "" ;;
*) echo "" ;;
esac
done && echo "$delim"
# Date and time.
date '+%Y %b %d (%a) %I:%M%p'
}
update() { \
# So all that big status function was just a command that quicking gets
# what we want to be the statusbar. This xsetroot command is what sets
# it. Note that the tr command replaces newlines with spaces. This is
# to prevent some weird issues that cause significant slowing of
# everything in dwm. Note entirely sure of the cause, but again, the tr
# command easily avoids it.
xsetroot -name "$(status | tr '\n' ' ')" &
wait
# Check to see if new weather report is needed.
testweather &
wait
}
while :; do
update
# Sleep for a minute after changing the status bar before updating it
# again. We run sleep in the background and use wait until it finishes,
# because traps can interrupt wait immediately, but they can't do that
# with sleep.
sleep 1m &
wait
done

19
.local/bin/i3cmds/ddspawn Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env 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

2
.local/bin/i3cmds/dropdowncalc Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
ifinstalled bc && echo "Welcome to the Calculator." && bc -lq

14
.local/bin/i3cmds/hover Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env 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
View file

@ -0,0 +1,27 @@
#!/usr/bin/env 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

4
.local/bin/i3cmds/tmuxdd Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env 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

View file

@ -8,6 +8,7 @@ pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRK
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
ranger (file manager) https://www.youtube.com/watch?v=L6Vu7WPkoJo
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