commit f1718502dc1cd5d83add32de79f234e95823930c Author: asdfasdf Date: Sat Mar 26 00:52:48 2022 -0500 initial commit diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..5cd8877 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Your Name +pkgname=myconf +pkgver=0.1 +pkgrel=1 +epoch= +pkgdesc="" +arch=('any') +url="" +license=('GPL') +groups=() +depends=( $( cat ./inst/pkgs/base.list ./inst/pkgs/runit.list ./inst/pkgs/wm.list ) ) +makedepends=() +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +source=( install\/install.sh ) +noextract=() +md5sums=() +validpgpkeys=() + +prepare() { + echo "PREPARE" +} + +build() { + echo "BUILD" + pwd -P + echo "before install.sh" + sh ./install/install.sh +} + +check() { + echo "CHECK" +} + +package() { + echo "PACKAGE" +} diff --git a/inst/install.sh b/inst/install.sh new file mode 100755 index 0000000..719f6df --- /dev/null +++ b/inst/install.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +################################################################### +# Required +################################################################### +#enables arch repos, and install yay aur helper + sh ./scripts/repo-enable.sh + +#runit init setup + sh ./scripts/runit-config.sh + +#install my aur packages + yay -S - < ./pkgs/aur.list + +#install development programs +echo "Install development programs (virt-manager) (y/N)?" +read input +if [ "$input" = "y" ]; then + sh ./scripts/devel.sh +fi + +#setup steam and lutris for gaming +#pass one of --amd,--nvidia,--intel to this script + +echo "Install gaming programs (lutris/steam) (y/N)?" +read input +if [ "$input" = "y" ]; then + echo "enter GPU type (amd nvidia intel):" + read input + sh ./scripts/gaming.sh --"$input" +fi + +#setup wireless (wifi,bluetooth) +if [ "$(ls /sys/class/net/ | grep w)" ]; then + sh ./scripts/wireless.sh +fi + +#do my configuration stuff, setup home directories, configure ufw, grub theming, etc. + sh ./scripts/config.sh + + +#install microcode for CPU +echo "enter CPU type to install microcode for (amd intel) (y/N)?" +read input +if [ "$input" = "amd" ]; then + sudo pacman -S amd-ucode +elif [ "$input" = "intel" ]; then + sudo pacman -S intel-ucode +fi + +#################################################################### +# Post Install +#################################################################### + +sudo mkinitcpio -P #rebuild kernel +sudo grub-mkconfig -o /boot/grub/grub.cfg #update grub + +echo "installation finished" diff --git a/inst/pkgs/aur.list b/inst/pkgs/aur.list new file mode 100644 index 0000000..633fe99 --- /dev/null +++ b/inst/pkgs/aur.list @@ -0,0 +1,10 @@ +lf +mutt-wizard +htim +jmtpfs +tremc-git +dashbinsh +pfetch +sysrq-enabler +wlr-randr +sfeed diff --git a/inst/pkgs/base.list b/inst/pkgs/base.list new file mode 100644 index 0000000..2906c80 --- /dev/null +++ b/inst/pkgs/base.list @@ -0,0 +1,64 @@ +pipewire +pipewire-alsa +pipewire-pulse +pipewire-jack +gst-plugin-pipewire +wireplumber +wireplumber-docs +alsa-utils +pacman-contrib +man-db +freetype2 +gst-libav +xdg-utils +xdg-user-dirs +fuse +python-urwid +btrfs-progs +reiserfsprogs +chrony +ufw +wget +curl +zip +unzip +p7zip +dash +mesa +rsync +cronie +connman +fakeroot +socklog +python-pip +udevil +pavucontrol +connman-gtk +youtube-dl +transmission-cli +neovim +mpd +mpv +opendoas +zsh +clang +librewolf +shellcheck +noto-fonts +noto-fonts-emoji +noto-fonts-cjk +lxappearance +qt5ct +imagemagick +ffmpegthumbnailer +python-pywal +pulsemixer +pamixer +papirus-icon-theme +python-pdftotext +viu +bat +zathura +zathura-cb +zathura-djvu +zathura-pdf-mupdf diff --git a/inst/pkgs/runit.list b/inst/pkgs/runit.list new file mode 100644 index 0000000..6628f3d --- /dev/null +++ b/inst/pkgs/runit.list @@ -0,0 +1,4 @@ +ufw-runit +cronie-runit +chrony-runit +connman-runit diff --git a/inst/pkgs/wm.list b/inst/pkgs/wm.list new file mode 100644 index 0000000..6ab41af --- /dev/null +++ b/inst/pkgs/wm.list @@ -0,0 +1,14 @@ +sway +swaybg +swayidle +swaylock +waybar +bemenu-wayland +mako +wl-clipboard +grim +slurp +xorg-xwayland +imv +alacritty +gammastep diff --git a/inst/scripts/config.sh b/inst/scripts/config.sh new file mode 100755 index 0000000..785874c --- /dev/null +++ b/inst/scripts/config.sh @@ -0,0 +1,97 @@ +#!/bin/sh +mkdir ~/docs/ +mkdir ~/dl/ +mkdir ~/media/ +mkdir -p ~/.local/share/gnupg/ +mkdir -p ~/.config/mpd/playlists +mkdir -p ~/.local/share/desktop + + sudo ufw default deny incoming + sudo ufw default allow outgoing + sudo ufw allow http + sudo ufw allow https + #sudo ufw allow ssh + sudo ufw allow ntp + sudo ufw allow 67:68/tcp + sudo ufw allow 53 + + #allow torrent client traffic + sudo ufw allow 56881:56889/tcp + + #rules to allow steam + sudo ufw allow 27000:27036/udp + sudo ufw allow 27036:27037/tcp + sudo ufw allow 4380/udp + + sudo ufw enable + + +#install zsh shell +chsh -s /bin/zsh "$USER" + +#setup .zprofile and zsh history file +cd ~ || return +ln -s ~/.profile ~/.zprofile +mkdir -p ~/.cache/zsh +touch ~/.cache/zsh/history + + +#replace sudo with doas +echo "installing doas, symlinking to sudo, and UNINSTALLING SUDO. sudo is uninstalled using doas so permissions should be setup right if you are able to uninstall. (y/N)" + +read input +if [ "$input" = "y" ]; then + echo "permit persist $USER as root" >> ~/.cache/doas.conf + sudo cp ~/.cache/doas.conf /etc/doas.conf + rm ~/.cache/doas.conf + doas pacman -R sudo && doas ln -s /bin/doas /bin/sudo #TODO ARCH SPECIFIC +fi + +#set limits for esync +sudo sh -c "echo '$USER hard nofile 524288' >> /etc/security/limits.conf" + +#set limits for monero +sudo sh -c "echo '$USER hard memlock 2048' >> /etc/security/limits.conf" +sudo sh -c "echo '$USER hard memlock 2048' >> /etc/security/limits.conf" + +sudo groupadd nogroup #needed to use slock + +### modify udevil config to add exec to mount options +#sudo sed -i 's/^allowed_options .*$/&, exec/g' /etc/udevil/udevil.conf + +### change dns to opendns for porn blocking +#sudo sh -c 'echo "static domain_name_servers=208.67.222.123 208.67.220.123" >> /etc/dhcpcd.conf' +### change dns to dns.watch, free speech dns +#sudo sh -c 'echo "static domain_name_servers=84.200.69.80 84.200.70.40 2001:1608:10:25::1c04:b12f 2001:1608:10:25::9249:d69b" >> /etc/dhcpcd.conf' + +#fix issue with arduino ide and tiling wms +sudo sh -c 'echo "export _JAVA_AWT_WM_NONREPARENTING=1" >> /etc/profile.d/jre.sh' + +#set console terminal font +sudo sh -c 'echo "FONT=Lat2-Terminus16" >> /etc/vconsole.conf' + +#set grub theme +sudo sed -i 's/#GRUB_COLOR_NORMAL/GRUB_COLOR_NORMAL/g' /etc/default/grub +sudo sed -i 's/#GRUB_COLOR_HIGHLIGHT/GRUB_COLOR_HIGHLIGHT/g' /etc/default/grub + +#symlink vim to neovim +sudo ln -s /bin/nvim /bin/vim + +#download collapse OS +mkdir -p "$HOME"/.local/src/ +cd "$HOME"/.local/src/ +wget http://collapseos.org/files/collapseos-latest.tar.gz +cd - + +#set wallpaper +ln -s ~/media/img/wallpapers/alena-aenami-eclipse-1k.jpg ~/.config/wall + +#link Xresources for xwayland +ln -s ~/.config/Xresources ~/.Xdefaults + +#set /tmp to tmpfs +sudo sh -c 'echo "tmpfs /tmp tmpfs rw,nodev,nosuid,size=2G 0 0" >> /etc/fstab' + + + + diff --git a/inst/scripts/devel.sh b/inst/scripts/devel.sh new file mode 100755 index 0000000..d028270 --- /dev/null +++ b/inst/scripts/devel.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "install Haskell? (y/N)?" +read -r input +if [ "$input" = 'y' ] || [ "$input" = 'Y' ]; then + sudo pacman -S --noconfirm ghc cabal-install stack +fi + +echo "install virt-manager?(y/N)" +read -r input +if [ "$input" = "y" ] || [ "$input" = "Y" ]; then + sudo pacman -S --noconfirm sudo pacman -S libvirt qemu virt-manager lxsession + sudo pacman -S --noconfirm gst-plugins-good libvirt-runit + + #TODO move this to runit_setup + sudo usermod -G libvirt -a "$USER" +fi diff --git a/inst/scripts/gaming.sh b/inst/scripts/gaming.sh new file mode 100755 index 0000000..a25beff --- /dev/null +++ b/inst/scripts/gaming.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +help() { + echo " \$1 -> select the GPU type: --nvidia, --amd, or --intel." + echo " \$2 -> if -R, will uninstall gaming programs" +} + +if [ "$1" = "--nvidia" ]; then + NVIDIA_GPU="TRUE" +elif [ "$1" = "--amd" ]; then + AMD_GPU="TRUE" +elif [ "$1" = "--intel" ]; then + INTEL_GPU="TRUE" +else + help && exit +fi + +CMD=" -S --noconfirm " + + +[ "$2" = "-R" ] && CMD=" -Rs " + + +[ -z "$(grep "^\[lib32" /etc/pacman.conf)" ] && [ -z "$NVIDIA_GPU" ] && [ -z "$AMD_GPU" ] && [ -z "$INTEL_GPU" ] && help && exit + + [ "$NVIDIA_GPU" = "TRUE" ] && sudo pacman $CMD nvidia-utils lib32-nvidia-utils + [ "$AMD_GPU" = "TRUE" ] && sudo pacman $CMD vulkan-radeon lib32-vulkan-radeon + [ "$INTEL_GPU" = "TRUE" ] && sudo pacman $CMD vulkan-intel lib32-vulkan-intel + + sudo pacman $CMD vulkan-mesa-layers lib32-vulkan-mesa-layers + + sudo pacman $CMD wine-staging winetricks + sudo pacman $CMD giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader cups samba dosbox + + sudo pacman $CMD gamemode lib32-gamemode + sudo pacman $CMD lutris steam diff --git a/inst/scripts/repo-enable.sh b/inst/scripts/repo-enable.sh new file mode 100755 index 0000000..428327a --- /dev/null +++ b/inst/scripts/repo-enable.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +if [ -z "$(grep "^\[lib32" /etc/pacman.conf)" ]; then + echo "lib32 not enabled. Appending lines to /etc/pacman.conf" + sleep 1 + + sudo sh -c 'echo "[lib32]" >> /etc/pacman.conf' + sudo sh -c 'echo "Include = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf' + sudo sh -c 'echo "" >> /etc/pacman.conf' +fi + +sudo pacman -Syu + +if [ -z "$(grep "community" /etc/pacman.conf)" ]; then + + #add arch linux repos + sudo pacman -S --noconfirm artix-archlinux-support lib32-artix-archlinux-support + sudo pacman-key --populate archlinux + sudo pacman -Sy + + sudo sh -c 'echo "[community]" >> /etc/pacman.conf' + sudo sh -c 'echo "Include = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf' + sudo sh -c 'echo "" >> /etc/pacman.conf' +fi + +#if [ -z "$(grep "extra" /etc/pacman.conf)" ]; then +# sudo sh -c 'echo "[extra]" >> /etc/pacman.conf' +# sudo sh -c 'echo "Include = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf' +# sudo sh -c 'echo "" >> /etc/pacman.conf' +#fi +# +#if [ -z "$(grep "multilib" /etc/pacman.conf)" ]; then +# sudo sh -c 'echo "[multilib]" >> /etc/pacman.conf' +# sudo sh -c 'echo "Include = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf' +#fi + +if [ -z "$(grep "universe" /etc/pacman.conf)" ]; then + sudo sh -c 'echo "[universe]" >> /etc/pacman.conf' + sudo sh -c 'echo "Server = https://universe.artixlinux.org/\$arch" >> /etc/pacman.conf' + sudo sh -c 'echo "Server = https://mirror1.artixlinux.org/universe/\$arch" >> /etc/pacman.conf' + sudo sh -c 'echo "Server = https://mirror.pascalpuffke.de/artix-universe/\$arch" >> /etc/pacman.conf' + sudo sh -c 'echo "Server = https://artixlinux.qontinuum.space:4443/universe/os/" >> /etc/pacman.conf' + sudo sh -c 'echo "Server = https://mirror1.cl.netactuate.com/artix/universe/\$arch" >> /etc/pacman.conf' + sudo sh -c 'echo "" >> /etc/pacman.conf' +fi + +sudo pacman -Syu + +#install yay for aur support + mkdir -p ~/.local/src/ + git clone https://aur.archlinux.org/yay.git ~/.local/src/yay/ + cd ~/.local/src/yay || return + makepkg -si diff --git a/inst/scripts/runit-config.sh b/inst/scripts/runit-config.sh new file mode 100755 index 0000000..fa4a44b --- /dev/null +++ b/inst/scripts/runit-config.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +help() { + echo "runit-config.sh [OPTIONS]" + echo " -virt-manager -> setup virt-manager services" + echo "" +} + +WIRELESS="" +VIRTMGR="" +for arg in "$@" +do + [ "$arg" = "--virt-manager" ] && VIRTMGR="true" + [ "$arg" = "--help" ] && help && exit +done + + +sudo ln -s /etc/runit/sv/ufw /run/runit/service/ +sudo ln -s /etc/runit/sv/cronie /run/runit/service/ +sudo ln -s /etc/runit/sv/chrony /run/runit/service/ +sudo ln -s /etc/runit/sv/connmand /run/runit/service/ +sudo ln -s /etc/runit/sv/socklog /run/runit/service/ + +if [ "$VIRTMGR" ]; then + sudo ln -s /etc/runit/sv/libvirtd /run/runit/service + sudo ln -s /etc/runit/sv/virtlockd /run/runit/service + sudo ln -s /etc/runit/sv/virtlogd /run/runit/service +fi diff --git a/inst/scripts/ungoogled-chromium.sh b/inst/scripts/ungoogled-chromium.sh new file mode 100755 index 0000000..4fc2c6d --- /dev/null +++ b/inst/scripts/ungoogled-chromium.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +echo "if this fails, you need to have universe repo enabled, and yay installed" + +CMD="-S" + +[ "$1" = "-R" ] && CMD="-Rs" + +sudo pacman "$CMD" ffmpeg4.4 +sudo pacman "$CMD" ungoogled-chromium +sudo pacman "$CMD" ublock-origin + +yay "$CMD" aur/chromium-extension-web-store +yay "$CMD" aur/chromium-widevine diff --git a/inst/scripts/wireless.sh b/inst/scripts/wireless.sh new file mode 100755 index 0000000..6cff582 --- /dev/null +++ b/inst/scripts/wireless.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +#install packages +sudo pacman -S --noconfirm wpa_supplicant bluez bluez-utils tlp +sudo pacman -S --noconfirm wpa_supplicant-runit tlp-runit + +#start services +sudo ln -s /etc/runit/sv/tlp /run/runit/service/ +sudo ln -s /etc/runit/sv/bluetoothd /run/runit/service/ diff --git a/root/bin/backup.sh b/root/bin/backup.sh new file mode 100755 index 0000000..e497b61 --- /dev/null +++ b/root/bin/backup.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +BACKUP_LOC="/media/SEAGATE/HOME_BACKUP/" +DIR="$HOME/" +EXCLUDE_CONF="$HOME/.config/rsync-exclude.conf" +INCLUDE_CONF="$HOME/.config/rsync-include.conf" + +EXCL_INCL="--exclude-from=$EXCLUDE_CONF --include-from=$INCLUDE_CONF" + +if [ "$1" = "-r" ]; then + notify-send "backup.sh" "restoring from backup" + rsync -ru $EXCL_INCL "$BACKUP_LOC" "$DIR" +else + + notify-send "backup.sh" "performing backup" + if [ -d $BACKUP_LOC ]; then + rsync -arP --delete $EXCL_INCL "$DIR" "$BACKUP_LOC" + else + notify-send "backup.sh" "backup location not found" + fi + +fi diff --git a/root/bin/bemenu-theme.sh b/root/bin/bemenu-theme.sh new file mode 100755 index 0000000..977d880 --- /dev/null +++ b/root/bin/bemenu-theme.sh @@ -0,0 +1,30 @@ +#!/bin/sh + + + COLOR0="#282936" + COLOR1="#3a3c4e" + COLOR2="#F7CA88" + COLOR3="#626483" + COLOR4="#62d6e8" + COLOR5="#e9e9f4" + COLOR6="#f1f2f8" + COLOR7="#f7f7fb" + COLOR8="#ea51b2" + COLOR9="#b45bcf" +COLOR10="#00f769" +COLOR11="#ebff87" +COLOR12="#a1efe4" +COLOR13="#62d6e8" +COLOR14="#b45bcf" +COLOR15="#00f769" + +WHITE="#ffffff" +BLACK="#000000" + + +BEMENU_OPTS="--nb $COLOR0 --nf $COLOR15 --hb $COLOR0 --hf $COLOR6 --sb $COLOR1 --sf $COLOR6 --tb $COLOR0 --tf $COLOR15 --fb $COLOR0 --ff $WHITE" + +mkdir .config/bemenu/ + +echo "#!/bin/sh" > ~/.config/bemenu/bemenu_opts.sh +echo "export BEMENU_OPTS=\"$BEMENU_OPTS\"" >> ~/.config/bemenu/bemenu_opts.sh diff --git a/root/bin/browser.sh b/root/bin/browser.sh new file mode 100755 index 0000000..d0717e0 --- /dev/null +++ b/root/bin/browser.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env sh + +#if [ -z "$(pgrep librewolf)" ]; then +# WBROWSER=surf +#else +# WBROWSER=chromium-wayland +WBROWSER=librewolf +#fi + + +#OPTS="       Torrent ) +OPTS="Web +Video +YT +Audio +Youtube-dl audio +File +RSS +Torrent" + +rss() { +#sfeed + sed -i '$d' ~/.config/sfeed/sfeedrc + FEED_NAME="$(echo "" | bemenu -p "Feed Name: ")" + echo "feed \"$FEED_NAME\" \"$1\"" >> ~/.config/sfeed/sfeedrc + echo "}" >> ~/.config/sfeed/sfeedrc + +#newsboat + #echo "$1" >> ~/.config/newsboat/urls +} + + +ydl() { + OPT="default +select" + + SEL="$( echo "$OPT" | bemenu)" + + LOC="$HOME/media/audio/" + + if [ "$SEL" = "select" ]; then + if [ ! -f ~/.cache/lf/lastpath ]; then + mkdir -p ~/.cache/lf/ + touch ~/.cache/lf/lastpath + echo "~" > ~/.cache/lf/lastpath + fi + $TERMINAL -e lf -last-dir-path ~/.cache/lf/lastpath "$(cat ~/.cache/lf/lastpath)" + LOC="$(cat ~/.cache/lf/lastpath)" + fi + + cd "$LOC" + youtube-dl "$1" -f 140 + sleep 5 + +} + + + +sel() { + SEL="$( echo "$OPTS" | bemenu)" + + [ "$SEL" = "Web" ] && $WBROWSER "$1" && exit + + [ "$SEL" = "Video" ] && mpv "$1" && exit + + [ "$SEL" = "YT" ] && mpv --ytdl-format=18 "$1" && exit + + [ "$SEL" = "Audio" ] && $TERMINAL -e mpv "$1" && exit + + [ "$SEL" = "Youtube-dl audio" ] && ydl "$1" && exit + + [ "$SEL" = "File" ] && cd "$XDG_DOWNLOAD_DIR" && curl -O -L "$1" && exit + + [ "$SEL" = "RSS" ] && rss "$1" && exit + + [ "$SEL" = "Torrent" ] && transadd "$1" && exit + +#$WBROWSER "$1" +} + +if [ -z "$1" ]; then + #$WBROWSER #URL="$( xclip -o | sed 's/$//g')" && sel "$URL" && exit + #$WBROWSER #URL="$(wl-paste)" && sel "$URL" && exit + sel "$(wl-paste)" +else + #echo "$1" >> ~/.cache/log/browsersh.log + sel "$1" +fi diff --git a/root/bin/caffeine.sh b/root/bin/caffeine.sh new file mode 100755 index 0000000..7991d12 --- /dev/null +++ b/root/bin/caffeine.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ "$1" = "on" ]; then + notify-send "caffeine.sh" 'Screen timeout is disabled.' + xset -dpms + xset s off + + pkill xautolock +else + notify-send "caffeine.sh" "Screen timeout is enabled." + xset +dpms + xset s on + + if [ -z "$(pgrep xautolock)" ]; then + xautolock -time 30 -locker slock & + fi +fi diff --git a/root/bin/days_since.sh b/root/bin/days_since.sh new file mode 100755 index 0000000..b5ed38e --- /dev/null +++ b/root/bin/days_since.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +help() { + echo "\$1 -> file to update or compare against" + echo "\$2 -> -u -> update file given by \$1" +} + +! [ -f "$1" ] && touch "$1" + +#Command for ~/.cache/last_fap +if [ "$2" = "-u" ]; then + echo $(date "+%y%m%d %H") >> "$1" +else + + LAST="$( awk 'END{print $1}' < "$1" )" + HOUR="$( awk 'END{print $2}' < "$1" )"".0" + HOUR_NOW="$(date +%H)"".0" + + DAYS=$(( (($(date --date="$(date +%y%m%d)" +%s) - $(date --date="$LAST" +%s) ))/(60*60*24) )) + RET=$(bc <<< "scale=2; $DAYS + (($HOUR_NOW - $HOUR)/24.0)") + + echo "$RET" +fi diff --git a/root/bin/encrypt.sh b/root/bin/encrypt.sh new file mode 100755 index 0000000..b13dbf0 --- /dev/null +++ b/root/bin/encrypt.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ "$1" = "-e" ];then + + if [ "$2" ]; then + tar -cvzf - "$2" | gpg -c > "$2".tar.gz.gpg + fi + +elif [ "$1" = "-d" ];then + + + if [ "$2" ]; then + gpg -d "$2" | tar -xvzf - + fi + +else + echo " $1 : -e, encrypt $2" + echo " -d, decrypt $2" + echo " $2 : directory or file to encrypt/decrypt" + +fi diff --git a/root/bin/fix-wacom.sh b/root/bin/fix-wacom.sh new file mode 100755 index 0000000..3e705a2 --- /dev/null +++ b/root/bin/fix-wacom.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +xsetwacom set 9 MapToOutput 1920x1080+0+0 diff --git a/root/bin/fixscr.sh b/root/bin/fixscr.sh new file mode 100755 index 0000000..b1f49ee --- /dev/null +++ b/root/bin/fixscr.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +RES="1920x1080" +MON="VGA-1" +LAPTOP="LVDS-1" + + +list_mons() { + wlr-randr | grep -v "^ " | awk '{print $1}' +} + +get_mon() { + echo "$(list_mons)" | bemenu -p "Select monitor: " +} + +#$1 -> monitor to get resolutions of +get_res() { + if [ -z "$1" ]; then + echo "$RES" + else + echo "$(wlr-randr | sed '1,/VGA-1/d' | sed '1,/[0-9]/d' | awk '{print $1}')" | bemenu + fi +} + +laptop_only() { + wlr-randr --output VGA-1 --off #TODO only needed because my thinkpad has an issue, remove when no longer needed + wlr-randr --output "$LAPTOP" --on +} + +#$1 -> monitor +#$2 -> resolution +monitor_only() { + MON="$1" + RES="$2" + + echo "$MON $RES" >> fixscrsh.log + + [ -z "$1" ] && MON="$(get_mon)" + [ -z "$2" ] && RES="$(get_res "$MON")" + + wlr-randr --output "$LAPTOP" --off + wlr-randr --output "$MON" --on --mode "$RES" +} + +span() { + MONS="$(list_mons)" + for i in $MONS + do + wlr-randr --output "$i" --on + done +} + +menu() { +OPTS="laptop_only\nmonitor_only\nmirror\nspan\nquit" + + SEL="$(echo "$OPTS" | bemenu)" + + [ "$SEL" = "laptop_only" ] && laptop_only + [ "$SEL" = "monitor_only" ] && monitor_only + [ "$SEL" = "span" ] && span +} + +help() { + echo "Usage: ./fixscr.sh" + echo " --menu => show bemenu prompts to select monitor configuration" + echo " --laptop-only => enable only laptop" + echo " --monitor-only [MONITOR] [RESOLUTION] => enable only external monitor" + echo " --help => show this help prompt" +} + +[ "$2" ] && MON="$2" +[ "$3" ] && RES="$3" + +if [ "$1" = "--menu" ]; then + menu +else + [ "$1" = "--monitor-only" ] && monitor_only "$MON" "$RES" + [ "$1" = "--laptop-only" ] && laptop_only + [ -z "$1" ] && help +fi diff --git a/root/bin/install.sh b/root/bin/install.sh new file mode 100755 index 0000000..77720d6 --- /dev/null +++ b/root/bin/install.sh @@ -0,0 +1,136 @@ +#!/bin/sh +###SUCKLESS INSTALL### + +INSTALL_DIR="/home/alex/.local/src" + +clone() { + cd "$INSTALL_DIR" || return + if [ "$( echo "$1" | grep -v "^#")" ]; then + git clone "$1" + fi +} + +add_repos() { + mkdir -p $INSTALL_DIR + + if [ -p /dev/stdin ]; then + while IFS= read -r line; do + clone "$line" + done + else + FN="$1" + ! [ -f "$FN" ] && FN= + cat "$1" | + while read -r line; do + clone "$line" + done + fi + + do_all install +} + +update() { + cd "$INSTALL_DIR"/"$1" || return + git pull origin master + #install "$1" +} + +list() { + ls -l "$INSTALL_DIR" | grep -v "total" | rev | cut -d ' ' -f 1 | rev +} + +do_all() { + for i in $(list) + do + $1 "$i" + done +} + +uninstall() { + cd "$INSTALL_DIR"/"$1" || return + case "$1" in + tiramisu*) + sudo rm /usr/local/bin/tiramisu + ;; + pfetch*) + sudo rm /usr/local/bin/pfetch + ;; + yacy_search_server*) + echo "ADD UNINSTALL FUNCTIONALITY FOR THIS REPO" + ;; + pipe-viewer* | straw-viewer*) + sudo ./Build uninstall #TODO test if this actually works + ;; + mcomix3) + rm "$INSTALL_DIR"/bin/mcomix + rm -rf "$INSTALL_DIR"/share/mcomix/ + rm /usr/share/applications/mcomix.desktop + ;; + *) + sudo make uninstall + ;; + esac +} + +install() { + cd "$INSTALL_DIR"/"$1" || return + case "$1" in + tiramisu*) + make + sudo cp tiramisu /usr/local/bin/ + ;; + pfetch*) + sudo cp pfetch /usr/local/bin/ + ;; + yacy_search_server*) + ant clean all dist + ;; + pipe-viewer* | straw-viewer*) + perl Build.PL + sudo ./Build installdeps + sudo ./Build install + ;; + mcomix3) + DEST_DIR="/usr/local" + mkdir -p "$DEST_DIR"/bin + mkdir -p "$DEST_DIR"/share + + sudo python3 installer.py --srcdir=mcomix --target="$DEST_DIR"/share + sudo ln -s "$DEST_DIR"/share/mcomix/mcomixstarter.py "$DEST_DIR"/bin/mcomix + sudo cp ./mime/mcomix.desktop /usr/share/applications/ + ;; + + tremc) + sudo sh -c 'export DESTDIR="/usr/local" && make install' + ;; + *) + sudo make install + ;; + esac +} + +help() { + echo "add-repos -> add collection of git repos to dir, from list of repos in file specified by \$2" + echo "add-repo -> add one specific repo to be handled by this script specified by \$2" + echo "list -> list all currently tracked repos" + echo "upgrade -> install all repos currently being tracked" + echo "install -> install specified program, should be name of repo seen from output of list" + echo "uninstall -> uninstall specified program, should be name of repo seen from output of list" + echo "update -> pull all repos currently being tracked" + echo "clean -> runs uninstall command on all repos currently being tracked" +} + + +case "$1" in + add-repos) add_repos "$2";; #add collection of git repos to dir, from list of repos in file specified by $2 + add-repo) clone "$2";; #add one specific repo to be handled by this script specified by $2 + list*) list;; #list all currently tracked repos + upgrade) do_all install;; #install all repos currently being tracked to the system + install*) install "$2";; #install specified program, should be name of repo seen from output of "list" + uninstall*) uninstall "$2";; #uninstall specified program, should be name of repo seen from output of "list" + update*) do_all update;; + clean*) do_all uninstall;; #runs uninstall command on all repos currently being tracked + *) help;; + + +esac diff --git a/root/bin/pipewire.sh b/root/bin/pipewire.sh new file mode 100755 index 0000000..e92d4e6 --- /dev/null +++ b/root/bin/pipewire.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +#programs to run to initialize pipewire, separated by spaces +PROGS="pipewire pipewire-pulse wireplumber" + +trap 'kill' 2 +trap 'kill' 15 + +kill() { + for PRG in $PROGS + do + pkill -KILL "$PRG" + sleep 1 + done +} + + +for PRG in $PROGS +do + + [ -z "$(pgrep "^$PRG\$")" ] && "$PRG" & + sleep 1 +done + +wait diff --git a/root/bin/set-colors.sh b/root/bin/set-colors.sh new file mode 100755 index 0000000..48582b9 --- /dev/null +++ b/root/bin/set-colors.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env sh + +FN="$HOME/.config/color" +VFN="$HOME/.config/nvim/colors/color.vim" +COLORSDIR="$HOME/.config/colors" + +if [ -z "$1" ]; then + SEL="$(echo "$(ls ~/.config/colors)\n PYWAL" | dmenu)" + [ -z "$SEL" ] && notify-send "set_colors.sh" "Colors not set" && exit + [ "$SEL" = " PYWAL" ] && FILENAME="$HOME/.cache/wal/colors" || FILENAME="$COLORSDIR/$SEL" +else + [ -f "$1" ] && FILENAME="$1" +fi + +mv "$FN" "$FN.bak" +rm "$VFN" +ENDCOLS="FALSE" +#wal -s -t -e -i "$1" + +{ echo "/* color theme set by scripts/set_colors.sh */" + echo "" + echo "generated from: $FILENAME" + echo "" + echo "!terminal colors" +} >> "$FN" + +COUNT=0 +while read -r line; do + [ -z "$line" ] && echo "broke while loop" && ENDCOLS="TRUE" + + if [ "$ENDCOLS" = "TRUE" ]; then + echo "$line" >> "$FN" + else + echo "#define COLOR$COUNT $line" >> "$FN" + COUNT=$((COUNT + 1)) + fi +done < "$FILENAME" + +notify-send "set_colors.sh" "Colors set to $FILENAME" diff --git a/root/bin/set-wp.sh b/root/bin/set-wp.sh new file mode 100755 index 0000000..8b44f14 --- /dev/null +++ b/root/bin/set-wp.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env sh +#sets a random wallpaper using feh from the ~/wallpapers directory + +setwp() { + #wal -n -s -t -e -i "$1" + rm ~/.config/wall + #rm ~/.fehbg + cp "$1" "$HOME/.config/wall" + #convert "$1" -set colorspace Gray -separate -average ~/.config/wall + #xwallpaper --zoom "$HOME/.config/wall" + #feh --bg-scale $HOME/.config/wall +} + + +#TODO convert this to be usable in wayland/sway +#[ "$1" = "-r" ] && WALLP=$(find -L ~/wallpapers/ -iname "*.*" -print | shuf -n 1) && feh --bg-scale "$WALLP" && exit + +#if [ -d "$1" ]; then +# case $1 in +# /*) sel="$(sxiv -o "$1" | sed '$!d')" ;; +# *) sel="$PWD/$(sxiv "$1" -o | sed '$!d')" ;; +# esac +# [ -f "$sel" ] && setwp "$sel" +# +#elif [ -f "$1" ]; then +# #setwp "$PWD/$1" + setwp "$1" +#fi + +if [ -f "$1" ]; then +# #setwp "$PWD/$1" + setwp "$1" +fi + diff --git a/root/bin/ss.sh b/root/bin/ss.sh new file mode 100755 index 0000000..acfe389 --- /dev/null +++ b/root/bin/ss.sh @@ -0,0 +1,77 @@ +#!/bin/sh +#Script wrapper for using grim for screenshots in sway +#commands taken from grim's github README, commands saved below for reference +#requires that sway, grim, jq, and imagemagick are installed + +#for all functions: +# $1 -> filename for output, will be set to - if -clip flag is set +# $2 -> program to pipe grim output to, defaults to cat, is set to wl-copy if -clip is set +# $3 -> seconds to wait before taking screenshot + +ss_all() { + sleep "$3" + grim "$1" | "$2" +} + +ss_mon() { + sleep "$3" + grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')" "$1" | "$2" +} + +ss_win() { + sleep "$3" + grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" "$1" | "$2" +} + +ss_sel() { + grim -g "$(slurp && sleep "$3")" "$1" | "$2" +} + +ss_color_pick() { + grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | "$2" +} + +help() { + echo "ss.sh [OPTIONS]" + echo " -a -> take screenshot of entire display" + echo " -m -> take screenshot of current monitor" + echo " -w -> take screenshot of currently active window" + echo " -s -> take screenshot of selection" + echo " -o FILENAME -> override filename output with given string FILENAME" + echo " --color-picker -> get the current color value of a selected pixel, prints data to stdout" + echo " --clip -> copy image to clipboard instead of writing to file" + echo " --secs SECS -> wait SECS seconds before taking screenshot" + echo " --help -> print this help message" + echo "" +} + +CMD="help" + +FN=$(date +'%s_grim.png') + +SECS="0" + +FN_FLAG="" +SL_FLAG="" + +PIPE_CMD="cat" + +for ARG in "$@" +do + [ "$ARG" = "-a" ] && CMD="ss_all" + [ "$ARG" = "-m" ] && CMD="ss_mon" + [ "$ARG" = "-w" ] && CMD="ss_win" + [ "$ARG" = "-s" ] && CMD="ss_sel" + [ "$ARG" = "--color-picker" ] && CMD="ss_color_pick" + [ "$ARG" = "--clip" ] && FN="-" && PIPE_CMD="wl-copy" + [ "$ARG" = "--help" ] && CMD="help" + + [ "$FN_FLAG" = "1" ] && FN_FLAG="" && FN="$ARG" #turn off FN_FLAG and set FN to argument after -o + [ "$ARG" = "-o" ] && FN_FLAG="1" #flag next argument to be file name + + [ "$SL_FLAG" = "1" ] && SL_FLAG="" && SECS="$ARG" #turn off SL_FLAG and set SECS to argument after -secs + [ "$ARG" = "-secs" ] && SL_FLAG="1" #flag next argument to be SECS + +done + +$CMD "$FN" "$PIPE_CMD" "$SECS" diff --git a/root/bin/supdate.sh b/root/bin/supdate.sh new file mode 100755 index 0000000..be1ee11 --- /dev/null +++ b/root/bin/supdate.sh @@ -0,0 +1,106 @@ +#!/bin/sh +# +# this script will pull updates from the suckless.org website and merge them into +# your local repository. +# +# suckless.org is assumed to be the upstream url, +# if a different url is desired, modify the UPSTREAM_URL variable accordingly + +# This script assumes all suckless repos are in the ~/.local/src/ directory. +# If your repos are in a different location, update the REPO_LOC variable accordingly +# +# These variables can either be modified in the script below directly, +# or defined before calling this script, ex: +# +# export REPO_LOC="https://github.com" +# sh supdate.sh -a dwm +# +# ARGUMENTS USED: +# $1 -> -p = pull updates, -m = merge updates, -a = add upstream branch +# $2 -> name of program to update, one of: dwm, st, dmenu, surf +# + +# HOW TO USE: +# +# dwm is used as an example here, replace "dwm" with any other suckless program name as needed. +# Make sure the name is as it appears in the git url. +# +# On the first time using this script, add a branch to hold the upstream repo for this repository +# +# sh supdate.sh -a dwm +# +# You should first pull any updates to the repository with: +# +# sh supdate.sh -p dwm +# +# That will create a temp branch with master merged with upstream updates. +# Fix any merge conflicts and commit to the temporary updates branch created above. +# Then run merge those updates to master with: +# +# sh supdate.sh -m dwm +# +########################################################################################## + +[ -z "$REPO_LOC" ] && REPO_LOC="$HOME/.local/src" +[ -z "$UPSTREAM_URL" ] && UPSTREAM_URL="https://git.suckless.org" + +pull_updates() { + + if ! [ "$1" = "" ]; then + + cd "$REPO_LOC"/"$1" || return + + git checkout upstream + git remote add upstream "$UPSTREAM_URL"/"$1" + git pull upstream master:upstream + git checkout -b updates + git merge master + + echo "Fix any merge errors here and commit them to branch \"updates\" " + echo "Once that is done, run this script with the -m flag to merge these updates to master." + else + echo "provide name of the program to update, one of: dwm, st, dmenu, surf" + fi +} + +merge_updates() { + + if ! [ "$1" = "" ]; then + + cd "$REPO_LOC"/"$1" || return + + git checkout master + git merge updates + git branch -d updates + + sudo make clean install + fi +} + +add_upstream_branch() { + if ! [ "$1" = "" ]; then + + cd "$REPO_LOC"/"$1" || return + + git checkout -b upstream + git remote add upstream "$UPSTREAM_URL"/"$1" + git fetch --all + git reset --hard upstream/master + fi +} + +help() { + echo "\$1 -> -p = pull updates, -m = merge updates" + echo "\$2 -> name of program to update, one of: dwm, st, dmenu, surf" +} + +if [ "$#" = "2" ]; then + case "$1" in + -p) pull_updates "$2";; + -m) merge_updates "$2";; + -a) add_upstream_branch "$2";; + *) help;; + esac +else + help +fi diff --git a/root/bin/sway-bar.sh b/root/bin/sway-bar.sh new file mode 100755 index 0000000..99432b1 --- /dev/null +++ b/root/bin/sway-bar.sh @@ -0,0 +1,146 @@ +#!/bin/sh +#========================================================================= +# This script is used to set the status bar for dwm, or +# other wms that use xsetroot for a status bar. +# +# by default this script will only run once, to run in +# a loop give it the -l flag: ./dwm-bar.sh -l +# +# Requires: pulsemixer, xbps (for sys_updates) +# +# ddate -> creates a date string +# audio -> creates a string representing the state of pulseaudio +# netup -> creates a string for the current network interface and status +# weather -> reads file written by ~/scripts/update-weather.sh to set the weather +# +# update -> calls all the above functions into xsetroot to set status bar +# +# https://gitlab.com/ahub/dotfiles +#======================================================================== + +MAIL_DIR="$HOME/.local/share/mail" + +SEP=" | " + +ddate () { + printf " %s\n" "$(date "+%b %d, %Y ( %I:%M )")" #(%a) +} + + +audio () { + #volstat="$(amixer get Master)" + # if [ -n "$(echo "$volstat" | grep "\[off\]")" ]; then + # icon="🔇" + # else + # icon="$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed 's/[^0-9]*//g' | sed -n 1p -) 🔊" + # fi + + icon="$(pamixer --get-volume) 🔊" + [ "$(pamixer --get-mute)" = "true" ] && icon="🔇" + + printf "%s\n" "$icon" +} + +rss() { + rss_cnt=$(sfeed_plain ~/.local/share/sfeed/feeds/* | grep -c "^N" ) + #rss_cnt="$(newsboat -x print-unread | awk '{print $1}')" + printf "%s \n" "$rss_cnt" +} + +mail() { + #MAIL_DIR="$HOME/.local/share/mail/main/INBOX/new" + #COUNT="$(ls "$MAIL_DIR" | wc -l)" + + COUNT=0 + for MBOX in $(ls "$MAIL_DIR") + do + TMP_DIR="$MAIL_DIR""/$MBOX""/INBOX/new" + COUNT=$((COUNT+$(ls "$TMP_DIR" | wc -l))) + + done + + + icon="$COUNT 📧" + + printf "%s\n" "$icon" + +} + +netup() { + icon="❗" + for iface in $(ls -1 /sys/class/net | sed '/^lo/d') + do + if [ $(cat /sys/class/net/"$iface"/operstate | grep up) ] ; then + if [ "$(echo "$iface" | grep w)" ]; then + icon=" " + else + icon="" + fi + elif [ -z "$icon" ]; then + icon="❗" + fi + done + + printf "%s\n" "$icon" +} + +weather() { + if ! [ -f ~/.cache/wttr ]; then + sh ~/.local/scripts/update-weather.sh + fi + icon="$(cat ~/.cache/wttr)" + + printf "%s\n" "$icon" +} + +cputemp() { + icon="$(cat /sys/class/thermal/thermal_zone0/temp | sed 's/\(.\)..$/.\1°C/')" + + printf "%s\n" "$icon" +} + +battery() { + BATT_DIR="/sys/class/power_supply/BAT0" + if [ -d "$BATT_DIR" ]; then + status="$(cat "$BATT_DIR"/status)" + charge="$(cat "$BATT_DIR"/capacity)" + fi + icon="" + if [ "$status" = "Discharging" ]; then + icon="${charge}% 🔋" + elif [ -z "$status" ]; then + icon="🔌" + else + icon="${charge}% 🔌" + fi + + printf "%s\n" "$icon" +} + +crypto() { + icon="$(cat ~/.cache/rate)" + printf "%s\n" "$icon" +} + +update() { + echo " $(crypto)$SEP$(cputemp)$SEP$(battery)$SEP$(netup)$SEP$(audio)$SEP$(rss)$SEP$(weather)$SEP$(ddate) " +} + + +#trap 'exit' 2 +#trap 'exit' 15 +#trap 'exit' 9 +if [ "$1" ] && [ "$1" = "-l" ]; then + echo "$$" > ~/.cache/statusbar_pid + + #sh ~/.local/scripts/update-crypto.sh -i & + #sh ~/.local/scripts/update-weather.sh -i & + + while true + do + update + sleep 60 + done +else + update +fi diff --git a/root/bin/update-crypto.sh b/root/bin/update-crypto.sh new file mode 100755 index 0000000..18f3931 --- /dev/null +++ b/root/bin/update-crypto.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +get() { + val="$(curl --connect-timeout 30 "rate.sx/1$1" | sed 's/\(\.[0-9][0-9]\).*$/\1/g')" + + printf "%s: %s\n" "$1" "$val" +} + +[ "$1" = "-i" ] && sleep 10 + + +UPDATE="$(get 'LINK') $(get 'XMR')" + +if [ $(echo $UPDATE | wc -m) -le 30 ]; then + echo "$UPDATE" > ~/.cache/rate +else + echo "❗" > ~/.cache/rate +fi diff --git a/root/bin/update-hosts.sh b/root/bin/update-hosts.sh new file mode 100755 index 0000000..a69681a --- /dev/null +++ b/root/bin/update-hosts.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env sh +#=================== +#TODO: +# + currently making /etc/hosts a symlink to a user owned file to allow script to run w/o sudo, possible security issue. +# +#FLAGS: +# if $1 is -u then update files from internet +# +# ================== + +BLOCKFILE="$HOME/.config/blocklist" + +update() { + mkdir -p ~/.local/share/update_hosts + cd ~/.local/share/update_hosts + + if [ ! -f "./.hosts.orig" ]; then + cp /etc/hosts ./.hosts.orig + fi + + if [ "$1" = "-u" ]; then + + rm ./.swc_hosts + #get someonewhocares.org hosts file + curl https://someonewhocares.org/hosts/hosts -o ./.swc_hosts + + fi + + curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts -o ./.sb_hosts + + [ -f "$BLOCKFILE" ] && echo "blocklist file found." && sed 's/^/127.0.0.1 /g' "$BLOCKFILE" > ./blocklist + + if [ -f "./blocklist" ]; then + cat ./.hosts.orig ./.swc_hosts ./.sb_hosts ./blocklist > ./hosts + else + cat ./.hosts.orig ./.swc_hosts ./.sb_hosts > ./hosts + fi + + #cat ./.hosts.orig ./.swc_hosts > ./hosts + + #sudo mv ./hosts /etc/ + [ "$1" = "-u" ] && sudo rm /etc/hosts && sudo ln -s $HOME/.local/share/update_hosts/hosts /etc/ && exit +} + + +update "$1" diff --git a/root/bin/update-weather.sh b/root/bin/update-weather.sh new file mode 100755 index 0000000..73af7b0 --- /dev/null +++ b/root/bin/update-weather.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh + +[ "$1" = "-i" ] && sleep 10 + +#UPDATE="$(curl --connect-timeout 30 "wttr.in/Huntsville+Alabama?format=1")" # > ~/.cache/wttr +UPDATE="$(curl --connect-timeout 30 "wttr.in/?format=1")" # > ~/.cache/wttr + +echo $UPDATE | wc -m + +if [ $(echo $UPDATE | wc -m) -le 30 ]; then + echo "$UPDATE" > ~/.cache/wttr + +else + echo "❗" > ~/.cache/wttr + +fi diff --git a/root/bin/volchange.sh b/root/bin/volchange.sh new file mode 100755 index 0000000..542ad1b --- /dev/null +++ b/root/bin/volchange.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +PERC="5" + +refbar() { + pkill sleep -P "$(cat ~/.cache/statusbar_pid )" +} + +inc() { + [ "$1" ] && PERC="$1" + #pulsemixer --change-volume +"$1" && refbar + #amixer sset Master 1%+ && refbar + pamixer -i "$PERC" && refbar +} + +dec() { + [ "$1" ] && PERC="$1" + #pulsemixer --change-volume -"$1" && refbar + #amixer sset Master 1%- && refbar + pamixer -d "$PERC" && refbar +} + +mute() { + #pulsemixer --toggle-mute && refbar + #amixer sset Master toggle && refbar + pamixer -t && refbar + +} + +help() { + echo "-i N -> increment volume by N amount" + echo "-d N -> decrement volume by N amount" + echo "--toggle-mute -> toggle mute sound" +} + +if [ "$1" = "-i" ]; then + inc "$2" +elif [ "$1" = "-d" ]; then + dec "$2" +elif [ "$1" = "--toggle-mute" ]; then + mute +else + help +fi diff --git a/root/bin/website_dl.sh b/root/bin/website_dl.sh new file mode 100755 index 0000000..681cc22 --- /dev/null +++ b/root/bin/website_dl.sh @@ -0,0 +1,2 @@ +#!/bin/sh +wget --mirror --convert-links --adjust-extension --page-requisites --no-parent "$1" diff --git a/root/etc/shell/cleanup.sh b/root/etc/shell/cleanup.sh new file mode 100755 index 0000000..ac88e72 --- /dev/null +++ b/root/etc/shell/cleanup.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +#remove things from $HOME +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CONFIG_DIRS="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DOCUMENTS_DIR="$HOME/docs" +export XDG_DOWNLOAD_DIR="$HOME/dl" +export XDG_MUSIC_DIR="$HOME/media/audio/music" +export XDG_PICTURES_DIR="$HOME/media/img" +export XDG_VIDEOS_DIR="$HOME/media/video" +export HISTFILE="$XDG_DATA_HOME"/bash/history +#XDG_DESKTOP_DIR="$HOME/Desktop" +#XDG_PUBLICSHARE_DIR="$HOME/Public" +#XDG_TEMPLATES_DIR="$HOME/Templates" + +export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch-config" +export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0" +export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" +export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/inputrc" +#export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc" +export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default" +export STACK_ROOT="$XDG_DATA_HOME"/stack +export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store" +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" +export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" +export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg" +export TMUX_TMPDIR="$XDG_RUNTIME_DIR" +export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android" +export MBSYNCRC="${XDG_CONFIG_HOME:-$HOME/.config}/mbsync/config" +export ELECTRUMDIR="${XDG_DATA_HOME:-$HOME/.local/share}/electrum" diff --git a/root/etc/shell/config.sh b/root/etc/shell/config.sh new file mode 100755 index 0000000..d621d05 --- /dev/null +++ b/root/etc/shell/config.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +#export PF_ASCII="artix" #set ascii art for pfetch +# OFF by default: shell editor wm de palette +export PF_INFO="ascii title os kernel uptime pkgs memory shell wm" + +export XCURSOR_THEME=Adwaita + +#other settings +export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. must have qt5-styleplugins installed +#export QT_QPA_PLATFORMTHEME="qt5ct" #have QT use qt5ct theme + +export LESSHISTFILE="-" + +export ZDOTDIR="$HOME/.config/zsh" + +#get colored man pages +export LESS_TERMCAP_mb="$(printf '%b' '')" +export LESS_TERMCAP_md="$(printf '%b' '')" +export LESS_TERMCAP_me="$(printf '%b' '')" +export LESS_TERMCAP_so="$(printf '%b' '')" +export LESS_TERMCAP_se="$(printf '%b' '')" +export LESS_TERMCAP_us="$(printf '%b' '')" +export LESS_TERMCAP_ue="$(printf '%b' '')" + +export MANPAGER=less + +#set preferred programs +export EDITOR=nvim +export VISUAL=nvim +export BROWSER=browser.sh +export TERMINAL=alacritty + +#sfeed vars +export SFEED_PLUMBER="$BROWSER" +export SFEED_URL_FILE="$HOME/.local/share/sfeed/read" + +# Add ~/.local/bin/ ~/.local/scripts/ and to PATH +export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/.local/appimages:$PATH" +export PATH="$HOME/.local/scripts:$PATH" + +#fix arduino ide issues +export AWT_TOOLKIT=MToolkit + +[ "$(tty)" = /dev/tty1 ] && exec dbus-launch sway diff --git a/root/etc/shell/lf-icons.sh b/root/etc/shell/lf-icons.sh new file mode 100755 index 0000000..791383a --- /dev/null +++ b/root/etc/shell/lf-icons.sh @@ -0,0 +1,163 @@ +#!/bin/sh + +export LF_ICONS="\ +di=:\ +fi=:\ +ln=:\ +or=:\ +ex=:\ +*.c=:\ +*.cc=:\ +*.clj=:\ +*.coffee=:\ +*.cpp=:\ +*.css=:\ +*.d=:\ +*.dart=:\ +*.erl=:\ +*.exs=:\ +*.fs=:\ +*.go=:\ +*.gitignore=:\ +*.h=:\ +*.hh=:\ +*.hpp=:\ +*.hs=:\ +*.html=:\ +*.java=:\ +*.jl=:\ +*.js=:\ +*.json=:\ +*.lua=:\ +*.md=:\ +*.php=:\ +*.pl=:\ +*.pro=:\ +*.py=:\ +*.rb=:\ +*.rs=:\ +*.scala=:\ +*.ts=:\ +*.vim=:\ +*.cmd=:\ +*.ps1=:\ +*.sh=:\ +*.bash=:\ +*.zsh=:\ +*.fish=:\ +*.tar=:\ +*.tgz=:\ +*.arc=:\ +*.arj=:\ +*.taz=:\ +*.lha=:\ +*.lz4=:\ +*.lzh=:\ +*.lzma=:\ +*.tlz=:\ +*.txz=:\ +*.tzo=:\ +*.t7z=:\ +*.zip=:\ +*.z=:\ +*.dz=:\ +*.gz=:\ +*.lrz=:\ +*.lz=:\ +*.lzo=:\ +*.xz=:\ +*.zst=:\ +*.tzst=:\ +*.bz2=:\ +*.bz=:\ +*.tbz=:\ +*.tbz2=:\ +*.tz=:\ +*.deb=:\ +*.rpm=:\ +*.jar=:\ +*.war=:\ +*.ear=:\ +*.sar=:\ +*.rar=:\ +*.alz=:\ +*.ace=:\ +*.zoo=:\ +*.cpio=:\ +*.7z=:\ +*.rz=:\ +*.cab=:\ +*.wim=:\ +*.swm=:\ +*.dwm=:\ +*.esd=:\ +*.exe=🍷:\ +*.jpg=:\ +*.jpeg=:\ +*.mjpg=:\ +*.mjpeg=:\ +*.gif=:\ +*.bmp=:\ +*.pbm=:\ +*.pgm=:\ +*.ppm=:\ +*.tga=:\ +*.xbm=:\ +*.xpm=:\ +*.tif=:\ +*.tiff=:\ +*.png=:\ +*.svg=:\ +*.svgz=:\ +*.mng=:\ +*.pcx=:\ +*.mov=:\ +*.mpg=:\ +*.mpeg=:\ +*.m2v=:\ +*.mkv=:\ +*.webm=:\ +*.ogm=:\ +*.mp4=:\ +*.m4v=:\ +*.mp4v=:\ +*.vob=:\ +*.qt=:\ +*.nuv=:\ +*.wmv=:\ +*.asf=:\ +*.rm=:\ +*.rmvb=:\ +*.flc=:\ +*.avi=:\ +*.fli=:\ +*.flv=:\ +*.gl=:\ +*.dl=:\ +*.xcf=:\ +*.xwd=:\ +*.yuv=:\ +*.cgm=:\ +*.emf=:\ +*.ogv=:\ +*.ogx=:\ +*.aac=:\ +*.au=:\ +*.flac=:\ +*.m4a=:\ +*.mid=:\ +*.midi=:\ +*.mka=:\ +*.mp3=:\ +*.mpc=:\ +*.ogg=:\ +*.ra=:\ +*.wav=:\ +*.oga=:\ +*.opus=:\ +*.spx=:\ +*.xspf=:\ +*.pdf=:\ +*.nix=:\ + " + diff --git a/root/etc/shell/wayland.sh b/root/etc/shell/wayland.sh new file mode 100755 index 0000000..714c1f1 --- /dev/null +++ b/root/etc/shell/wayland.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +BEMENU_CONF="$HOME/.config/bemenu/bemenu_opts.sh" +[ -f "$BEMENU_CONF" ] && . "$BEMENU_CONF" +#End wayland config + +#make librewolf use wayland +export GDK_BACKEND=wayland +export MOZ_ENABLE_WAYLAND=1 + diff --git a/root/etc/zsh/zshrc b/root/etc/zsh/zshrc new file mode 100644 index 0000000..0b8d6b5 --- /dev/null +++ b/root/etc/zsh/zshrc @@ -0,0 +1,92 @@ +# Luke's config for the Zoomer Shell + +# Enable colors and change prompt: +autoload -U colors && colors + +#PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " +PS1="%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~% %{$fg[yellow]%} -> " +# History in cache directory: +HISTSIZE=10000 +SAVEHIST=10000 +HISTFILE=~/.cache/zsh/history + +# Basic auto/tab complete: +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) # Include hidden files. + +# vi mode +bindkey -v +export KEYTIMEOUT=1 + +# Use vim keys in tab complete menu: +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -v '^?' backward-delete-char + +# Change cursor shape for different vi modes. +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[1 q' + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} +zle -N zle-keymap-select +zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + +# Use lf to switch directories and bind it to ctrl-o +lfcd () { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' 'lfcd\n' + +# Edit line in vim with ctrl-e: +autoload edit-command-line; zle -N edit-command-line +bindkey '^e' edit-command-line + +# Load aliases and shortcuts if existent. +[ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc" +[ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" + +#my additions +unsetopt nomatch + + +#source haskell file if it exists +[ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" + +if ! [ -f $HOME/.local/share/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then + mkdir -p $HOME/.local/share/zsh/ + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.local/share/zsh/zsh-syntax-highlighting +fi + +# prompt stuff +pfetch + +#if [ -f "/usr/bin/starship" ]; then +# eval "$(starship init zsh)" +#fi + +# Load zsh-syntax-highlighting; should be last. +source $HOME/.local/share/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null