dots

git clone git://mattcarlson.org/repos/dots.git
Log | Files | Refs

commit 3b2dc0aaafc4b6cc742c972d18c83b613de3e407
parent c9a2583edf9f93ad72afb64b850fe72373b90795
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Thu,  2 Dec 2021 16:16:17 -0500

hosts script

Diffstat:
M.config/git/config | 5+++++
M.config/sh/aliasrc | 1+
M.config/x/xresources | 32++++++++++++++++----------------
M.config/zathura/zathurarc | 54+++++++++++++++++++++++++++---------------------------
M.local/bin/backup.sh | 19+++++++++++--------
A.local/bin/hosts.sh | 22++++++++++++++++++++++
M.local/bin/menu.sh | 2--
M.local/bin/touchpad.sh | 4++--
M.local/bin/vultr.sh | 32++++++++++++++++++--------------
M.local/share/wp | 4++--
10 files changed, 104 insertions(+), 71 deletions(-)

diff --git a/.config/git/config b/.config/git/config @@ -7,3 +7,8 @@ [filter "gitignore"] clean = "sed '/#gitignore$/'d" smudge = cat +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true diff --git a/.config/sh/aliasrc b/.config/sh/aliasrc @@ -29,6 +29,7 @@ if uname -s | grep -i 'linux' >/dev/null 2>&1; then ls='ls -ahls --color=auto --group-directories-first' \ mv='mv -v' \ o='open.sh' \ + paru='paru --sudo doas' \ rmdir='rmdir -pv --ignore-fail-on-non-empty' \ vi='vim' \ vm='qemu-system-x86_64 \ diff --git a/.config/x/xresources b/.config/x/xresources @@ -1,20 +1,20 @@ ! colors -#define col0 #121018 -#define col1 #3d4780 -#define col2 #5e6189 -#define col3 #6d6f91 -#define col4 #7b86a2 -#define col5 #9499ae -#define col6 #c4c5b8 -#define col7 #cbcfdb -#define col8 #8e9099 -#define col9 #3d4780 -#define col10 #5e6189 -#define col11 #6d6f91 -#define col12 #7b86a2 -#define col13 #9499ae -#define col14 #c4c5b8 -#define col15 #cbcfdb +#define col0 #17100c +#define col1 #936521 +#define col2 #9f6f5c +#define col3 #bd904a +#define col4 #a67e81 +#define col5 #c8b3b1 +#define col6 #d5caca +#define col7 #e9e3df +#define col8 #a39e9c +#define col9 #936521 +#define col10 #9f6f5c +#define col11 #bd904a +#define col12 #a67e81 +#define col13 #c8b3b1 +#define col14 #d5caca +#define col15 #e9e3df ! font Xft.antialias : 1 diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc @@ -19,35 +19,35 @@ set recolor-keephue 'false' set recolor-reverse-video 'false' # Command line completion entries -set completion-fg '#cbcfdb' -set completion-bg '#121018' +set completion-fg '#e9e3df' +set completion-bg '#17100c' # Command line completion group elements -set completion-group-fg '#5E6189' -set completion-group-bg '#121018' +set completion-group-fg '#9F6F5C' +set completion-group-bg '#17100c' # Current command line completion element -set completion-highlight-fg '#121018' -set completion-highlight-bg '#cbcfdb' +set completion-highlight-fg '#17100c' +set completion-highlight-bg '#e9e3df' # Default foreground/background color -set default-bg rgba(18,16,24,0.95) +set default-bg rgba(23,16,12,0.95) # Input bar -set inputbar-fg '#cbcfdb' -set inputbar-bg '#121018' +set inputbar-fg '#e9e3df' +set inputbar-bg '#17100c' # Notification -set notification-fg '#cbcfdb' -set notification-bg '#121018' +set notification-fg '#e9e3df' +set notification-bg '#17100c' # Error notification -set notification-error-fg '#cbcfdb' -set notification-error-bg '#3D4780' +set notification-error-fg '#e9e3df' +set notification-error-bg '#936521' # Warning notification -set notification-warning-fg '#cbcfdb' -set notification-warning-bg '#3D4780' +set notification-warning-fg '#e9e3df' +set notification-warning-bg '#936521' # Tab - TODO # set tabbar-fg @@ -58,25 +58,25 @@ set notification-warning-bg '#3D4780' # set tabbar-focus-bg # Status bar -set statusbar-fg '#cbcfdb' -set statusbar-bg '#121018' +set statusbar-fg '#e9e3df' +set statusbar-bg '#17100c' # Highlighting parts of the document (e.g. show search results) -set highlight-color '#5E6189' -set highlight-active-color '#5E6189' +set highlight-color '#9F6F5C' +set highlight-active-color '#9F6F5C' # Represent light/dark colors in recoloring mode set recolor-lightcolor rgba(0,0,0,0) -set recolor-darkcolor '#cbcfdb' +set recolor-darkcolor '#e9e3df' # 'Loading...' text -set render-loading-fg '#cbcfdb' -set render-loading-bg '#121018' +set render-loading-fg '#e9e3df' +set render-loading-bg '#17100c' # Index mode -set index-fg '#cbcfdb' -set index-bg '#121018' +set index-fg '#e9e3df' +set index-bg '#17100c' # Selected element in index mode -set index-active-fg '#121018' -set index-active-bg '#cbcfdb' -\ No newline at end of file +set index-active-fg '#17100c' +set index-active-bg '#e9e3df' +\ No newline at end of file diff --git a/.local/bin/backup.sh b/.local/bin/backup.sh @@ -4,13 +4,16 @@ BACKUP_DIR='/mnt/backup' LOG='/var/log/backup.log' - stamp="$(date +%Y-%m-%d\ %I:%M\ %p)" -if df | grep -q "${BACKUP_DIR}"; then - [ ! -e "${LOG}" ] && touch "${LOG}" - # shellcheck disable=SC3009 - rsync -aAXHv --delete --exclude={"/*bin","/dev/","/lib*","/lost+found/","/mnt/","/opt/","/proc/","/root/","/run/","/srv/","/sys/","/tmp/","/usr/","/var/","/*.wants/"} / "${BACKUP_DIR}" - printf '%s\n' "${stamp} - System backup complete." >> "${LOG}" -else printf '%s\n' "${stamp} - ${BACKUP_DIR} is not a mount point. Not backing up system." >> "${LOG}" -fi +main() { + if df | grep -q "${BACKUP_DIR}"; then + [ ! -e "${LOG}" ] && touch "${LOG}" + # shellcheck disable=SC3009 + rsync -aAXHv --delete --exclude={"/*bin","/dev/","/lib*","/lost+found/","/mnt/","/opt/","/proc/","/root/","/run/","/srv/","/sys/","/tmp/","/usr/","/var/","/*.wants/"} / "${BACKUP_DIR}" + printf '%s\n' "${stamp} - System backup complete." >> "${LOG}" + else printf '%s\n' "${stamp} - ${BACKUP_DIR} is not a mount point. Not backing up system." >> "${LOG}" + fi +} + +main "${@}" diff --git a/.local/bin/hosts.sh b/.local/bin/hosts.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# hosts + +HOSTS_ENABLED_DIR='/etc/' +HOSTS_DISABLED_DIR="${HOME}/.local/share/" + +enable() { doas mv "${HOSTS_DISABLED_DIR}hosts" "${HOSTS_ENABLED_DIR}" && env HERBE_ID=/0 herbe 'Hosts enabled' & } + +disable() { doas mv "${HOSTS_ENABLED_DIR}hosts" "${HOSTS_DISABLED_DIR}" && env HERBE_ID=/0 herbe 'Hosts disabled' & } + +main() { + # in each of the following cases we want to sleep to prevent xcb unknown sequence number error + + # disable by moving hosts to xdg share directory + [ -f "${HOSTS_ENABLED_DIR}/hosts" ] && disable && sleep 1 && return 0 + + # enable by moving hosts to /etc/ + [ -f "${HOSTS_DISABLED_DIR}/hosts" ] && enable && sleep 1 && return 0 +} + +main "${@}" diff --git a/.local/bin/menu.sh b/.local/bin/menu.sh @@ -10,9 +10,7 @@ main() {  Text Editor "${TERMINAL}" -c "${EDITOR}" -e "${EDITOR}"  Music Player "${HOME}/.local/bin/bar/music.sh" -o  Mail Client "${HOME}/.local/bin/bar/mail.sh" -o -  RSS Feed Reader "${HOME}/.local/bin/bar/rss.sh" -o  YouTube "${TERMINAL}" -c "${YOUTUBE_CLIENT}" -e "${YOUTUBE_CLIENT}" -  Torrent Client "${TORRENT_CLIENT}"  Image Editor "${IMAGE_EDITOR}"  Tools  Terminal "${TERMINAL}" diff --git a/.local/bin/touchpad.sh b/.local/bin/touchpad.sh @@ -11,8 +11,8 @@ main() { # toggle touchpad also with xinput { - if [ "${flag}" -eq 1 ]; then xinput --disable "${tp}" && herbe 'Touchpad disabled' - else xinput --enable "${tp}" && herbe 'Touchpad enabled' + if [ "${flag}" -eq 1 ]; then xinput --disable "${tp}" && env HERBE_ID=/0 herbe 'Touchpad disabled' & + else xinput --enable "${tp}" && env HERBE_ID=/0 herbe 'Touchpad enabled' & fi } & } diff --git a/.local/bin/vultr.sh b/.local/bin/vultr.sh @@ -30,17 +30,21 @@ oldest_snapshot_id="${1}" SNAPSHOT_LIMIT=11 snapshot_count=$(printf '%s\n' "${snapshot_ids}" | wc -w) -# Delete oldest snapshot if limit if reached -if [ "${snapshot_count}" -eq "${SNAPSHOT_LIMIT}" ]; then - curl "https://api.vultr.com/v2/snapshots/${oldest_snapshot_id}" -X DELETE -H "Authorization: Bearer ${VULTR_API_KEY}" || exit 1; -fi - -# Create new snapshot for instance -curl 'https://api.vultr.com/v2/snapshots' \ - -X POST \ - -H "Authorization: Bearer ${VULTR_API_KEY}" \ - -H 'Content-Type: application/json' \ - --data '{ - "instance_id":"'${INSTANCE_ID}'", - "description":"Snapshot of '${INSTANCE}'" - }' +main() { + # Delete oldest snapshot if limit if reached + if [ "${snapshot_count}" -eq "${SNAPSHOT_LIMIT}" ]; then + curl "https://api.vultr.com/v2/snapshots/${oldest_snapshot_id}" -X DELETE -H "Authorization: Bearer ${VULTR_API_KEY}" || exit 1; + fi + + # Create new snapshot for instance + curl 'https://api.vultr.com/v2/snapshots' \ + -X POST \ + -H "Authorization: Bearer ${VULTR_API_KEY}" \ + -H 'Content-Type: application/json' \ + --data '{ + "instance_id":"'${INSTANCE_ID}'", + "description":"Snapshot of '${INSTANCE}'" + }' +} + +main "${@}" diff --git a/.local/share/wp b/.local/share/wp @@ -1 +1 @@ -/home/mc/pix/wp/mist.jpg -\ No newline at end of file +/home/mc/pix/wp/dream-of-arcadia.jpg +\ No newline at end of file