From 2702e7c59f911cff6d25ebcb9791e38f9d8ba30b Mon Sep 17 00:00:00 2001 From: ayham Date: Fri, 19 Nov 2021 19:40:24 +0300 Subject: [PATCH] update --- .config/X11/enlightenment | 9 ++++++++ .config/alacritty.yml | 2 +- .config/newsboat/urls | 5 ++-- .config/picom.conf | 6 ++--- .config/zsh/.zshrc | 13 ++++------- .zprofile | 7 +++++- update-motd.d/10-hostname-color | 3 +++ update-motd.d/20-sysinfo | 27 ++++++++++++++++++++++ update-motd.d/20-uptime | 4 ++++ update-motd.d/30-diskspace | 41 +++++++++++++++++++++++++++++++++ update-motd.d/40-services | 38 ++++++++++++++++++++++++++++++ update-motd.d/50-public-ip | 13 +++++++++++ update-motd.d/60-tmux | 23 ++++++++++++++++++ update-motd.d/70-updates | 13 +++++++++++ 14 files changed, 188 insertions(+), 16 deletions(-) create mode 100644 .config/X11/enlightenment create mode 100755 update-motd.d/10-hostname-color create mode 100755 update-motd.d/20-sysinfo create mode 100755 update-motd.d/20-uptime create mode 100755 update-motd.d/30-diskspace create mode 100755 update-motd.d/40-services create mode 100755 update-motd.d/50-public-ip create mode 100755 update-motd.d/60-tmux create mode 100755 update-motd.d/70-updates diff --git a/.config/X11/enlightenment b/.config/X11/enlightenment new file mode 100644 index 0000000..6ec0ff6 --- /dev/null +++ b/.config/X11/enlightenment @@ -0,0 +1,9 @@ +exec rm -r ~/.cache/wal/ & +exec xmodmap ~/.config/Xmodmap & +source ~/.config/env & +exec xset s 300 5 & +xset r rate 300 50 & +umask 002 & +eval $(keychain --absolute --dir "$XDG_RUNTIME_DIR"/keychain --eval --quiet id_ed25519) +exec xhost +si:localuser:"$USER" +exec /usr/bin/enlightenment_start diff --git a/.config/alacritty.yml b/.config/alacritty.yml index e1420c2..99b56d8 100644 --- a/.config/alacritty.yml +++ b/.config/alacritty.yml @@ -135,7 +135,7 @@ font: style: Bold Italic # Point size - size: 11.0 + size: 9.0 # Offset is the extra space around each character. `offset.y` can be thought of # as modifying the line spacing, and `offset.x` as modifying the letter spacing. diff --git a/.config/newsboat/urls b/.config/newsboat/urls index 8b71cb6..1099b33 100644 --- a/.config/newsboat/urls +++ b/.config/newsboat/urls @@ -39,8 +39,6 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCbfYPyITQ-7l4upoX8nvctg two "---- Podcasts" "-----------------" https://anchor.fm/s/149fd51c/podcast/rss TechOverTea -https://www.youtube.com/feeds/videos.xml?channel_id=UCLwNTXWEjVd2qIHLcXxQWxA timcast right-center commentary -https://www.youtube.com/feeds/videos.xml?channel_id=UCMMCy1le81jHY8rwcaqQrtA thedrip right-center left-center commentary finance https://chinaunscripted.libsyn.com/rss china-unscripted https://odysee.com/$/rss/@BretWeinstein:f @@ -80,6 +78,9 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCL_f53ZEJxp8TtlOkHwMV9Q jor https://www.youtube.com/feeds/videos.xml?channel_id=UCoryWpk4QVYKFCJul9KBdyw switched-to-linux politics conservative https://www.youtube.com/feeds/videos.xml?channel_id=UCwUizOU8pPWXdXNniXypQEQ awakenjp satire far-right https://www.youtube.com/feeds/videos.xml?channel_id=UCVtkjwwba5AyYyIkq-DSZkw ben-joseph-stewart +https://www.youtube.com/feeds/videos.xml?channel_id=UCLwNTXWEjVd2qIHLcXxQWxA timcast right-center commentary +https://www.youtube.com/feeds/videos.xml?channel_id=UCMMCy1le81jHY8rwcaqQrtA thedrip right-center left-center commentary finance +https://www.youtube.com/feeds/videos.xml?channel_id=UCnQC_G5Xsjhp9fEJKuIcrSw shabiro moderately-far-right commentary "-----------------" "---- Youtube-Food" diff --git a/.config/picom.conf b/.config/picom.conf index ef04d22..20c11b1 100644 --- a/.config/picom.conf +++ b/.config/picom.conf @@ -3,7 +3,7 @@ ################################# # requires https://github.com/jonaburg/picom # (These are also the default values) -transition-length = 25 +transition-length = 250 transition-pow-x = 0.1 transition-pow-y = 0.1 transition-pow-w = 0.1 @@ -15,7 +15,7 @@ size-transition = true # Corners # ################################# # requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom -corner-radius = 5.0; +corner-radius = 7.5; rounded-corners-exclude = [ #"window_type = 'normal'", "class_g = 'dwm'", @@ -47,7 +47,7 @@ round-borders-exclude = [ # unless explicitly requested using the wintypes option. # # shadow = false -shadow = true; +shadow = false; # The blur radius for shadows, in pixels. (defaults to 12) # shadow-radius = 12 diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 93851f6..9dd8cc9 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -11,21 +11,16 @@ SAVEHIST=10000000 HISTFILE=~/.cache/zsh/history # Basic auto/tab complete -autoload -U compinit -zstyle ':completion:*' menu select -zmodload zsh/complist -compinit -_comp_options+=(globdots) +#autoload -U compinit +#zstyle ':completion:*' menu select +#zmodload zsh/complist compinit +#_comp_options+=(globdots) # 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. diff --git a/.zprofile b/.zprofile index 2b23969..5c75564 100755 --- a/.zprofile +++ b/.zprofile @@ -5,8 +5,9 @@ DwmOption="DWM" EXWMOption="EXWM" MATEOption="MATE" +EnlightenmentOption="Enlightenment" ConsoleOption="Console" -menu=("$DwmOption" "$EXWMOption" "$MATEOption" "$ConsoleOption") +menu=("$DwmOption" "$EXWMOption" "$MATEOption" "$EnlightenmentOption" "$ConsoleOption") echo "Which WM would you like to run?" select opt in "${menu[@]}" @@ -24,6 +25,10 @@ do exec ssh-agent sx mate-session break ;; + $EnlightenmentOption) + exec ssh-agent sx sh ~/.config/X11/enlightenment + break + ;; $ConsoleOption) exec zsh break diff --git a/update-motd.d/10-hostname-color b/update-motd.d/10-hostname-color new file mode 100755 index 0000000..b4e12f2 --- /dev/null +++ b/update-motd.d/10-hostname-color @@ -0,0 +1,3 @@ +#!/bin/bash + +/usr/bin/env figlet "sisyphus@$(hostname)" | /usr/bin/env lolcat -f diff --git a/update-motd.d/20-sysinfo b/update-motd.d/20-sysinfo new file mode 100755 index 0000000..61f07d1 --- /dev/null +++ b/update-motd.d/20-sysinfo @@ -0,0 +1,27 @@ +#!/bin/bash + +# get load averages +IFS=" " read LOAD1 LOAD5 LOAD15 <<<$(cat /proc/loadavg | awk '{ print $1,$2,$3 }') +# get free memory +IFS=" " read USED AVAIL TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$7,$2'}) +# get processes +PROCESS=`ps -eo user=|sort|uniq -c | awk '{ print $2 " " $1 }'` +PROCESS_ALL=`echo "$PROCESS"| awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'` +PROCESS_ROOT=`echo "$PROCESS"| grep root | awk {'print $2'}` +PROCESS_USER=`echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'` +# get processors +PROCESSOR_NAME=`grep "model name" /proc/cpuinfo | cut -d ' ' -f3- | awk {'print $0'} | head -1` +PROCESSOR_COUNT=`grep -ioP 'processor\t:' /proc/cpuinfo | wc -l` + +W="\e[0;39m" +G="\e[1;32m" + +echo -e " +${W}system info: +$W Distro......: $W`cat /etc/*release | grep "PRETTY_NAME" | cut -d "=" -f 2- | sed 's/"//g'` +$W Kernel......: $W`uname -sr` +$W Uptime......: $W`uptime -p` +$W Load........: $G$LOAD1$W (1m), $G$LOAD5$W (5m), $G$LOAD15$W (15m) +$W Processes...:$W $G$PROCESS_ROOT$W (root), $G$PROCESS_USER$W (user), $G$PROCESS_ALL$W (total) +$W CPU.........: $W$PROCESSOR_NAME ($G$PROCESSOR_COUNT$W vCPU) +$W Memory......: $G$USED$W used, $G$AVAIL$W avail, $G$TOTAL$W total$W" diff --git a/update-motd.d/20-uptime b/update-motd.d/20-uptime new file mode 100755 index 0000000..20c52d3 --- /dev/null +++ b/update-motd.d/20-uptime @@ -0,0 +1,4 @@ +#!/bin/bash + +printf "\n" +uptime -p diff --git a/update-motd.d/30-diskspace b/update-motd.d/30-diskspace new file mode 100755 index 0000000..c4215c9 --- /dev/null +++ b/update-motd.d/30-diskspace @@ -0,0 +1,41 @@ +#!/bin/bash + +# config +max_usage=90 +bar_width=50 +# colors +white="\e[39m" +green="\e[1;32m" +red="\e[1;31m" +dim="\e[2m" +undim="\e[0m" + +# disk usage: ignore zfs, squashfs & tmpfs +mapfile -t dfs < <(df -H -x zfs -x squashfs -x tmpfs -x devtmpfs -x overlay --output=target,pcent,size | tail -n+2) +printf "\ndisk usage:\n" + +for line in "${dfs[@]}"; do + # get disk usage + usage=$(echo "$line" | awk '{print $2}' | sed 's/%//') + used_width=$((($usage*$bar_width)/100)) + # color is green if usage < max_usage, else red + if [ "${usage}" -ge "${max_usage}" ]; then + color=$red + else + color=$green + fi + # print green/red bar until used_width + bar="[${color}" + for ((i=0; i<$used_width; i++)); do + bar+="=" + done + # print dimmmed bar until end + bar+="${white}${dim}" + for ((i=$used_width; i<$bar_width; i++)); do + bar+="=" + done + bar+="${undim}]" + # print usage line & bar + echo "${line}" | awk '{ printf("%-31s%+3s used out of %+4s\n", $1, $2, $3); }' | sed -e 's/^/ /' + echo -e "${bar}" | sed -e 's/^/ /' +done diff --git a/update-motd.d/40-services b/update-motd.d/40-services new file mode 100755 index 0000000..43be844 --- /dev/null +++ b/update-motd.d/40-services @@ -0,0 +1,38 @@ +#!/bin/bash + +# set column width +COLUMNS=3 +# colors +green="\e[1;32m" +red="\e[1;31m" +undim="\e[0m" + +services=("iwd" "libvirtd" "docker" "cupsd") +# sort services +IFS=$'\n' services=($(sort <<<"${services[*]}")) +unset IFS + +service_status=() +# get status of all services +for service in "${services[@]}"; do + service_status+=($(rc-service "$service" status | awk '{print $NF}' -)) +done + +out="" +for i in ${!services[@]}; do + # color green if service is active, else red + if [[ "${service_status[$i]}" == "started" ]]; then + out+="${services[$i]}:,${green}${service_status[$i]}${undim}," + else + out+="${services[$i]}:,${red}${service_status[$i]}${undim}," + fi + # insert \n every $COLUMNS column + if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then + out+="\n" + fi +done +out+="\n" + +printf "\nservices:\n" +printf "$out" | column -ts $',' | sed -e 's/^/ /' +echo "" diff --git a/update-motd.d/50-public-ip b/update-motd.d/50-public-ip new file mode 100755 index 0000000..2262b87 --- /dev/null +++ b/update-motd.d/50-public-ip @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +COLUMNS=3 + +ip_v4="$(cat /tmp/ip)" + +[ "${ip_v4}" == "" ] && curl -s ifconfig.me/ip >> /tmp/ip + +ip_v4="$(cat /tmp/ip)" + +echo "public IP address:" +printf "${ip_v4}" | column -ts $',' | sed -e 's/^/ /' +echo "" diff --git a/update-motd.d/60-tmux b/update-motd.d/60-tmux new file mode 100755 index 0000000..473e35b --- /dev/null +++ b/update-motd.d/60-tmux @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -euo pipefail + +type tmux >/dev/null 2>&1 || exit 1 + +set +e; sessions="$(tmux ls 2>&1)"; tmux_exit="$?"; set -e + +text="" +if [ $tmux_exit -ne 0 ]; then + text+="no sessions\n" +else + while IFS= read -r line; do + name="$(cut -d ':' -f 1 <<< $line)" + windows="$(cut -d ' ' -f 2,3 <<< $line)" + date="$(cut -d ' ' -f 5,6,7,8 <<< $line)" + text+="$name ($windows) $date\n" + done <<< $sessions +fi + +echo "Tmux sessions:" +printf "${text::-2}" | column -ts $',' | sed -e 's/^/ /' +echo "" diff --git a/update-motd.d/70-updates b/update-motd.d/70-updates new file mode 100755 index 0000000..aca3c1f --- /dev/null +++ b/update-motd.d/70-updates @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +updates_aur="$(cat /tmp/upgrades)" + +[ "${updates_aur}" == "" ] && paru -Qum 2> /dev/null | wc -l > /tmp/upgrades + +updates_aur=$(cat /tmp/upgrades) + +text="$updates_aur package updates available" + +printf "$text" +echo "" +echo ""