diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d800130 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "zsh-autosuggestions"] + path = config/zsh/zsh-autosuggestions + url = https://github.com/zsh-users/zsh-autosuggestions +[submodule "zsh-history-substring-search"] + path = config/zsh/zsh-history-substring-search + url = https://github.com/zsh-users/zsh-history-substring-search +[submodule "zsh-syntax-highlighting"] + path = config/zsh/zsh-syntax-highlighting + url = https://github.com/zsh-users/zsh-syntax-highlighting diff --git a/README.md b/README.md index 4953268..c119fca 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # SelimovDE -"Desktop Environment" repo which provides basic scripts for building out my linux system \ No newline at end of file +"Desktop Environment" repo which provides basic scripts for building out my linux system + +## Installation + + diff --git a/bin/albumsplit b/bin/albumsplit new file mode 100755 index 0000000..62d1d6f --- /dev/null +++ b/bin/albumsplit @@ -0,0 +1,46 @@ +#!/bin/sh + +# Requires ffmpeg (audio splitting) and my `tag` wrapper script. + +[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit + +echo "Enter the album/book title:"; read -r booktitle + +echo "Enter the artist/author:"; read -r author + +echo "Enter the publication year:"; read -r year + +inputaudio="$1" + +# Get a safe file name from the book. +escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" + +! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && exit 1 + +# As long as the extension is in the tag script, it'll work. +ext="${1##*.}" +#ext="${1#*.}" + +# Get the total number of tracks from the number of lines. +total="$(wc -l < "$2")" + +while read -r x; +do + end="$(echo "$x" | cut -d' ' -f1)" + + [ -n "$start" ] && + echo "From $start to $end; $track $title" + file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext" + [ -n "$start" ] && echo "Splitting \"$title\"..." && + ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$file" && + echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" + title="$(echo "$x" | cut -d' ' -f 2-)" + esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" + track="$((track+1))" + start="$end" +done < "$2" +# The last track must be done outside the loop. +echo "From $start to the end: $title" +file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext" +echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" && + echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" diff --git a/bin/bar_bat.sh b/bin/bar_bat.sh new file mode 100755 index 0000000..0a0e8ae --- /dev/null +++ b/bin/bar_bat.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +#First we get the capacity +charge=$(cat /sys/class/power_supply/BAT0/capacity) + +#Now get the status +bstat=$(cat /sys/class/power_supply/BAT0/status) + +#Get the symbol for the capacity +if [ "$bstat" = "Charging" ]; then + cstat="" +else + cstat="" +fi +if [ "$charge" -gt 90 ]; then + bat="$cstat" +elif [ "$charge" -gt 70 ]; then + bat="$cstat" +elif [ "$charge" -gt 50 ]; then + bat="$cstat" +elif [ "$charge" -gt 20 ]; then + bat="$cstat" +else + bat=" $cstat" +fi + + + + +battery="$bat $charge%" + +if [ -d /sys/class/power_supply/BAT1 ]; then + + #First we get the capacity + charge=$(cat /sys/class/power_supply/BAT1/capacity) + + #Now get the status + bstat=$(cat /sys/class/power_supply/BAT1/status) + if [ "$bstat" = "Charging" ]; then + cstat="" + else + cstat="" + fi + #Get the symbol for the capacity + if [ "$charge" -gt 90 ]; then + bat="$cstat" + elif [ "$charge" -gt 70 ]; then + bat="$cstat" + elif [ "$charge" -gt 50 ]; then + bat="$cstat" + elif [ "$charge" -gt 20 ]; then + bat="$cstat" + else + bat=" $cstat" + fi + + echo "$bat $charge% $battery" +else + echo $battery +fi + + diff --git a/bin/bar_bit.sh b/bin/bar_bit.sh new file mode 100755 index 0000000..1437b02 --- /dev/null +++ b/bin/bar_bit.sh @@ -0,0 +1,10 @@ +#!/bin/bash +#price=$(curl rate.sx/1btc | cut -d '.' -f 1) +price=$(coinmon -f BTC | tail -n2 | head -n1 | cut -d ' ' -f 10 | cut -d '.' -f1) + +echo "฿ $price" + +# Check to see if it's a number +#re='^[0-9]+$' +#if [[ $price =~ $re ]] ; then +#fi diff --git a/bin/bar_cpu.sh b/bin/bar_cpu.sh new file mode 100755 index 0000000..442d4b8 --- /dev/null +++ b/bin/bar_cpu.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +loads=($(mpstat -P ALL 1 1 | awk '/Average:/ && $2 ~ /[0-9]/ {print $3}')) + +warn='' +if [ ${loads[0]} -gt 80 ]; then + warn=$(echo "1 "$warn) +fi +if [ ${loads[1]} -gt 80 ]; then + warn=$(echo "2 "$warn) +fi +if [ ${loads[2]} -gt 80 ]; then + warn=$(echo "3 "$warn) +fi +if [ ${loads[3]} -gt 80 ]; then + warn=$(echo "4 "$warn) +fi +avg=$(echo "(${loads[0]}+${loads[1]}+${loads[2]}+${loads[3]})/4" | bc) +echo $warn $avg% diff --git a/bin/bar_date.sh b/bin/bar_date.sh new file mode 100755 index 0000000..ddc745a --- /dev/null +++ b/bin/bar_date.sh @@ -0,0 +1 @@ +echo " $(date '+%b %d (%a) %I:%M%p') " diff --git a/bin/bar_mem.sh b/bin/bar_mem.sh new file mode 100755 index 0000000..a64d509 --- /dev/null +++ b/bin/bar_mem.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +free=$(grep -oP '^MemFree: *\K[0-9]+' /proc/meminfo) +available=$(grep -oP '^MemAvailable: *\K[0-9]+' /proc/meminfo) +total=$(grep -oP '^MemTotal: *\K[0-9]+' /proc/meminfo) +mem=" $(echo "scale=1; 100*($total-$available)/$total"| bc | cut -d '.' -f1 )" + +if [ $mem -gt 80 ]; then + mem=" $mem" +elif [ $mem -gt 50 ]; then + mem="$mem" +else + mem="$mem" +fi +echo "$mem%" diff --git a/bin/bar_music.sh b/bin/bar_music.sh new file mode 100755 index 0000000..b4fe60b --- /dev/null +++ b/bin/bar_music.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +#First we get the next appointmen +var=$(mpc current); + +if [ "$var" = "" ]; then + echo "" +else + echo " ${var:0:30}" +fi + + diff --git a/bin/bar_volume.sh b/bin/bar_volume.sh new file mode 100755 index 0000000..757a1f0 --- /dev/null +++ b/bin/bar_volume.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash +[ $(pamixer --get-mute) = true ] && echo 婢 && exit + +vol="$(pamixer --get-volume)" + +if [ "$vol" -gt "70" ]; then + icon="󰕾" +elif [ "$vol" -gt "30" ]; then + icon="󰖀" +else + icon="󰕿" +fi + +echo "$icon $vol%" diff --git a/bin/bar_vpn.sh b/bin/bar_vpn.sh new file mode 100755 index 0000000..6052765 --- /dev/null +++ b/bin/bar_vpn.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Check to see if openvpn is running. If it is then output a message + +pgrep openvpn 1>/dev/null && + echo " VPN ACTIVATED" diff --git a/bin/bar_wifi.sh b/bin/bar_wifi.sh new file mode 100755 index 0000000..521c941 --- /dev/null +++ b/bin/bar_wifi.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in + down) echo " 󰖪 ";; + up) percentage="$(awk '/^\s*w/ { print int($3 * 100 / 70) "% " }' /proc/net/wireless)" + ssid=$(iwgetid -r) + echo \ $ssid  +esac diff --git a/bin/daily_scripture.sh b/bin/daily_scripture.sh new file mode 100755 index 0000000..3115908 --- /dev/null +++ b/bin/daily_scripture.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Define the input file + input_file="$HOME/docs/kjv.txt" + + # Generate a unique identifier based on the current date + date=$( date +%Y%m%d ) + + # Generate random data with a seed + get_seeded_random() +{ + seed="$1" + openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \ + /dev/null +} + +random_line=$(shuf -n 1 --random-source=<(get_seeded_random "$date") $input_file) + + # Print the randomly selected line + echo "$random_line" diff --git a/bin/kjv b/bin/kjv new file mode 100755 index 0000000..2f0b221 Binary files /dev/null and b/bin/kjv differ diff --git a/bin/mpdnotif.sh b/bin/mpdnotif.sh new file mode 100755 index 0000000..1f63271 --- /dev/null +++ b/bin/mpdnotif.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# notify when mpd music changed +while "true"; do + status="`mpc status`" + if [[ ${status} == *"[playing]"* ]]; then + dunstify -a Music --replace=27072 -t 2000 -i "$HOME/media/pics/music.png" "Now Playing:" "Artist: $(mpc --format '%artist%' current)\nSong: $(mpc --format '%title%' current)" + fi + mpc current --wait > /dev/null +done + diff --git a/bin/notify-send.sh b/bin/notify-send.sh new file mode 100755 index 0000000..4149966 --- /dev/null +++ b/bin/notify-send.sh @@ -0,0 +1,326 @@ +#!/usr/bin/env bash + +# notify-send.sh - drop-in replacement for notify-send with more features +# Copyright (C) 2015-2021 notify-send.sh authors (see AUTHORS file) + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Desktop Notifications Specification +# https://developer.gnome.org/notification-spec/ + +VERSION=1.2 +NOTIFY_ARGS=(--session + --dest org.freedesktop.Notifications + --object-path /org/freedesktop/Notifications) +EXPIRE_TIME=-1 +APP_NAME="${0##*/}" +REPLACE_ID=0 +URGENCY=1 +HINTS=() +SUMMARY_SET=n + +help() { + cat < [BODY] - create a notification + +Help Options: + -?|--help Show help options + +Application Options: + -u, --urgency=LEVEL Specifies the urgency level (low, normal, critical). + -t, --expire-time=TIME Specifies the timeout in milliseconds at which to expire the notification. + -f, --force-expire Forcefully closes the notification when the notification has expired. + -a, --app-name=APP_NAME Specifies the app name for the icon. + -i, --icon=ICON[,ICON...] Specifies an icon filename or stock icon to display. + -c, --category=TYPE[,TYPE...] Specifies the notification category. + -h, --hint=TYPE:NAME:VALUE Specifies basic extra data to pass. Valid types are int, double, string and byte. + -o, --action=LABEL:COMMAND Specifies an action. Can be passed multiple times. LABEL is usually a button's label. COMMAND is a shell command executed when action is invoked. + -d, --default-action=COMMAND Specifies the default action which is usually invoked by clicking the notification. + -l, --close-action=COMMAND Specifies the action invoked when notification is closed. + -p, --print-id Print the notification ID to the standard output. + -r, --replace=ID Replace existing notification. + -R, --replace-file=FILE Store and load notification replace ID to/from this file. + -s, --close=ID Close notification. + -v, --version Version of the package. + +EOF +} + +convert_type() { + case "$1" in + int) echo int32 ;; + double|string|byte) echo "$1" ;; + *) echo error; return 1 ;; + esac +} + +make_action_key() { + echo "$(tr -dc _A-Z-a-z-0-9 <<< \"$1\")${RANDOM}" +} + +make_action() { + local action_key="$1" + printf -v text "%q" "$2" + echo "\"$action_key\", \"$text\"" +} + +make_hint() { + type=$(convert_type "$1") + [[ ! $? = 0 ]] && return 1 + name="$2" + [[ "$type" = string ]] && command="\"$3\"" || command="$3" + echo "\"$name\": <$type $command>" +} + +concat_actions() { + local result="$1" + shift + for s in "$@"; do + result="$result, $s" + done + echo "[$result]" +} + +concat_hints() { + local result="$1" + shift + for s in "$@"; do + result="$result, $s" + done + echo "{$result}" +} + +parse_notification_id(){ + sed 's/(uint32 \([0-9]\+\),)/\1/g' +} + +notify() { + local actions="$(concat_actions "${ACTIONS[@]}")" + local hints="$(concat_hints "${HINTS[@]}")" + + NOTIFICATION_ID=$(gdbus call "${NOTIFY_ARGS[@]}" \ + --method org.freedesktop.Notifications.Notify \ + -- \ + "$APP_NAME" "$REPLACE_ID" "$ICON" "$SUMMARY" "$BODY" \ + "${actions}" "${hints}" "int32 $EXPIRE_TIME" \ + | parse_notification_id) + + if [[ -n "$STORE_ID" ]] ; then + echo "$NOTIFICATION_ID" > "$STORE_ID" + fi + if [[ -n "$PRINT_ID" ]] ; then + echo "$NOTIFICATION_ID" + fi + + if [[ -n "$FORCE_EXPIRE" ]] ; then + SLEEP_TIME="$( LC_NUMERIC=C printf %f "${EXPIRE_TIME}e-3" )" + ( sleep "$SLEEP_TIME" ; notify_close "$NOTIFICATION_ID" ) & + fi + + maybe_run_action_handler +} + +notify_close () { + gdbus call "${NOTIFY_ARGS[@]}" --method org.freedesktop.Notifications.CloseNotification "$1" >/dev/null +} + +process_urgency() { + case "$1" in + low) URGENCY=0 ;; + normal) URGENCY=1 ;; + critical) URGENCY=2 ;; + *) echo "Unknown urgency $URGENCY specified. Known urgency levels: low, normal, critical." + exit 1 + ;; + esac +} + +process_category() { + IFS=, read -a categories <<< "$1" + for category in "${categories[@]}"; do + hint="$(make_hint string category "$category")" + HINTS=("${HINTS[@]}" "$hint") + done +} + +process_hint() { + IFS=: read type name command <<< "$1" + if [[ -z "$name" ]] || [[ -z "$command" ]] ; then + echo "Invalid hint syntax specified. Use TYPE:NAME:VALUE." + exit 1 + fi + hint="$(make_hint "$type" "$name" "$command")" + if [[ ! $? = 0 ]] ; then + echo "Invalid hint type \"$type\". Valid types are int, double, string and byte." + exit 1 + fi + HINTS=("${HINTS[@]}" "$hint") +} + +maybe_run_action_handler() { + if [[ -n "$NOTIFICATION_ID" ]] && [[ -n "$ACTION_COMMANDS" ]]; then + local notify_action="$(dirname ${BASH_SOURCE[0]})/notify-action.sh" + if [[ -x "$notify_action" ]] ; then + "$notify_action" "$NOTIFICATION_ID" "${ACTION_COMMANDS[@]}" & + exit 0 + else + echo "executable file not found: $notify_action" + exit 1 + fi + fi +} + +process_action() { + IFS=: read name command <<<"$1" + if [[ -z "$name" ]] || [[ -z "$command" ]]; then + echo "Invalid action syntax specified. Use NAME:COMMAND." + exit 1 + fi + + local action_key="$(make_action_key "$name")" + ACTION_COMMANDS=("${ACTION_COMMANDS[@]}" "$action_key" "$command") + + local action="$(make_action "$action_key" "$name")" + ACTIONS=("${ACTIONS[@]}" "$action") +} + +process_special_action() { + action_key="$1" + command="$2" + + if [[ -z "$action_key" ]] || [[ -z "$command" ]]; then + echo "Command must not be empty" + exit 1 + fi + + ACTION_COMMANDS=("${ACTION_COMMANDS[@]}" "$action_key" "$command") + + if [[ "$action_key" != close ]]; then + local action="$(make_action "$action_key" "$name")" + ACTIONS=("${ACTIONS[@]}" "$action") + fi +} + +process_posargs() { + if [[ "$1" = -* ]] && ! [[ "$positional" = yes ]] ; then + echo "Unknown option $1" + exit 1 + else + if [[ "$SUMMARY_SET" = n ]]; then + SUMMARY="$1" + SUMMARY_SET=y + else + BODY="$1" + fi + fi +} + +while (( $# > 0 )) ; do + case "$1" in + -\?|--help) + help + exit 0 + ;; + -v|--version) + echo "${0##*/} $VERSION" + exit 0 + ;; + -u|--urgency|--urgency=*) + [[ "$1" = --urgency=* ]] && urgency="${1#*=}" || { shift; urgency="$1"; } + process_urgency "$urgency" + ;; + -t|--expire-time|--expire-time=*) + [[ "$1" = --expire-time=* ]] && EXPIRE_TIME="${1#*=}" || { shift; EXPIRE_TIME="$1"; } + if ! [[ "$EXPIRE_TIME" =~ ^-?[0-9]+$ ]]; then + echo "Invalid expire time: ${EXPIRE_TIME}" + exit 1; + fi + ;; + -f|--force-expire) + FORCE_EXPIRE=yes + ;; + -a|--app-name|--app-name=*) + [[ "$1" = --app-name=* ]] && APP_NAME="${1#*=}" || { shift; APP_NAME="$1"; } + ;; + -i|--icon|--icon=*) + [[ "$1" = --icon=* ]] && ICON="${1#*=}" || { shift; ICON="$1"; } + ;; + -c|--category|--category=*) + [[ "$1" = --category=* ]] && category="${1#*=}" || { shift; category="$1"; } + process_category "$category" + ;; + -h|--hint|--hint=*) + [[ "$1" = --hint=* ]] && hint="${1#*=}" || { shift; hint="$1"; } + process_hint "$hint" + ;; + -o | --action | --action=*) + [[ "$1" == --action=* ]] && action="${1#*=}" || { shift; action="$1"; } + process_action "$action" + ;; + -d | --default-action | --default-action=*) + [[ "$1" == --default-action=* ]] && default_action="${1#*=}" || { shift; default_action="$1"; } + process_special_action default "$default_action" + ;; + -l | --close-action | --close-action=*) + [[ "$1" == --close-action=* ]] && close_action="${1#*=}" || { shift; close_action="$1"; } + process_special_action close "$close_action" + ;; + -p|--print-id) + PRINT_ID=yes + ;; + -r|--replace|--replace=*) + [[ "$1" = --replace=* ]] && REPLACE_ID="${1#*=}" || { shift; REPLACE_ID="$1"; } + ;; + -R|--replace-file|--replace-file=*) + [[ "$1" = --replace-file=* ]] && filename="${1#*=}" || { shift; filename="$1"; } + if [[ -s "$filename" ]]; then + REPLACE_ID="$(< "$filename")" + fi + STORE_ID="$filename" + ;; + -s|--close|--close=*) + [[ "$1" = --close=* ]] && close_id="${1#*=}" || { shift; close_id="$1"; } + # always check that --close provides a numeric value + if [[ -z "$close_id" || ! "$close_id" =~ ^[0-9]+$ ]]; then + echo "Invalid close id: '$close_id'" + exit 1 + fi + notify_close "$close_id" + exit $? + ;; + --) + positional=yes + ;; + *) + process_posargs "$1" + ;; + esac + shift +done + +# always force --replace and --replace-file to provide a numeric value; 0 means no id provided +if [[ -z "$REPLACE_ID" || ! "$REPLACE_ID" =~ ^[0-9]+$ ]]; then + REPLACE_ID=0 +fi + +# urgency is always set +HINTS=("$(make_hint byte urgency "$URGENCY")" "${HINTS[@]}") + +if [[ "$SUMMARY_SET" = n ]] ; then + help + exit 1 +else + notify +fi diff --git a/bin/pubs-rofi.sh b/bin/pubs-rofi.sh new file mode 120000 index 0000000..8373977 --- /dev/null +++ b/bin/pubs-rofi.sh @@ -0,0 +1 @@ +/home/aselimov/projects/utility/scripts/pubs-rofi.sh \ No newline at end of file diff --git a/bin/viewurl b/bin/viewurl new file mode 100755 index 0000000..f513042 --- /dev/null +++ b/bin/viewurl @@ -0,0 +1,46 @@ +#!/bin/bash + +# Feed script a url. +# If an image, it will view in feh, +# if a video or gif, it will view in mpv +# if a music file or pdf, it will download, +# otherwise it opens link in browser. + +# List of sites that will be opened in mpv. +vidsites="youtube.com + \|youtu.be + \|hooktube.com + \|bitchute.com + \|lukesmith.xyz + \|odysee.com + \|rumble.com + " +if [ -p /dev/stdin ]; then + read url +else + url=$1 +fi +echo $url +ext="${url##*.}" +mpvFiles="ogg mkv mp4 gif mp3 mp3?source=feed" +sxivFiles="png jpg jpeg jpe" +mpvAdd="mp3?updated=*" +wgetFiles="mp3 flac opus mp3?source=feed pdf" + +if echo $sxivFiles | grep -w $ext > /dev/null; then + view_url_image "$url" >/dev/null & +elif echo $mpvFiles | grep -w $ext > /dev/null; then + mpv --audio-display=no --loop "$url" +elif echo $wgetFiles | grep -w $ext > /dev/null; then + wget "$url" >/dev/null & +elif echo "$url" | grep "$vidsites">/dev/null; then + mpv "$url" > /dev/null & +elif echo "$url" | grep "$mpvAdd" > /dev/null; then + mpv --audio-display=no --loop "$url" +elif echo "$url" | grep "doi.org" > /dev/null; then + view_doc $url +elif echo "$url" | grep "mp3" > /dev/null; then + mpv --audio-display=no --loop "$url" +else + $BROWSER "$url" 2>/dev/null & disown +fi diff --git a/bin/volume.sh b/bin/volume.sh new file mode 100755 index 0000000..bd45ba4 --- /dev/null +++ b/bin/volume.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# You can call this script like this: +# $./volume.sh up +# $./volume.sh down +# $./volume.sh mute + +function get_volume { + pamixer --get-volume +} + +function is_mute { + [ $(pamixer --get-mute) = 'true'] +} + +function send_notification { + DIR=$(dirname "$0") + volume=$(get_volume) + # Make the bar with the special character ─ (it's not dash -) + # https://en.wikipedia.org/wiki/Box-drawing_character + #bar=$(seq -s "─" $(($volume/5)) | sed 's/[0-9]//g') + if [ "$volume" = "0" ]; then + icon_name="/usr/share/icons/Papirus/48x48/status/notification-audio-volume-muted.svg" + $DIR/notify-send.sh "$volume"" " -i "$icon_name" -t 2000 -h string:synchronous:"─" --replace=555 + else + if [ "$volume" -lt "10" ]; then + icon_name="/usr/share/icons/Papirus/48x48/status/notification-audio-volume-low.svg" + $DIR/notify-send.sh "$volume"" " -i "$icon_name" --replace=555 -t 2000 + else + if [ "$volume" -lt "30" ]; then + icon_name="/usr/share/icons/Papirus/48x48/status/notification-audio-volume-low.svg" + else + if [ "$volume" -lt "70" ]; then + icon_name="/usr/share/icons/Papirus/48x48/status/notification-audio-volume-medium.svg" + else + icon_name="/usr/share/icons/Papirus/48x48/status/notification-audio-volume-high.svg" + fi + fi + fi + fi + bar=$(seq -s "─" $(($volume / 5)) | sed 's/[0-9]//g') + # Send the notification + $DIR/notify-send.sh "$volume%"" ""$bar" -i "$icon_name" -t 2000 -h string:synchronous:"$bar" --replace=555 + +} + +case $1 in + up) + # Set the volume on (if it was muted) + #amixer -D pulse set Master on > /dev/null + # Up the volume (+ 5%) + pactl set-sink-volume @DEFAULT_SINK@ +5% + send_notification + ;; + down) + #amixer -D pulse set Master on > /dev/null + pactl set-sink-volume @DEFAULT_SINK@ -5% + send_notification + ;; + mute) + # Toggle mute + #amixer -D pulse set Master 1+ toggle > /dev/null + if is_mute; then + DIR=$(dirname "$0") + $DIR/notify-send.sh -i "/usr/share/icons/Papirus/48x48/status/notification-audio-volume-muted.svg" --replace=555 -u normal "Mute" -t 2000 + else + send_notification + fi + ;; +esac diff --git a/bin/wallpaper_randomizer.sh b/bin/wallpaper_randomizer.sh new file mode 100755 index 0000000..df9c9d9 --- /dev/null +++ b/bin/wallpaper_randomizer.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +papesdir=$HOME/media/wallpapers/current_rotation + +# Kill existing execution if it exists +pgrep -fl wallpaper_randomizer.sh | while read -r line; do + pid=$(echo $line | cut -d " " -f1) + process=$(echo $line | cut -d " " -f2) + if [[ "$pid" != "$$" ]] && [[ "$process" == "wallpaper_rando" ]]; then + kill $pid + fi +done + +last_index="" +index="" +while :; do + files=($papesdir/*) + count=$(find -L $papesdir -type f | wc -l) + + # Get a new wallpaper + while [ "$index" == "$last_index" ]; do + index=$((($RANDOM % $count))) + done + + feh --bg-fill ${files[$index]} + last_index=$index + sleep 15m +done diff --git a/config/dunst/dunstrc b/config/dunst/dunstrc new file mode 100644 index 0000000..58b1455 --- /dev/null +++ b/config/dunst/dunstrc @@ -0,0 +1,305 @@ +[global] + frame_width = 1 + frame_color = "#888694" + + font = FiraCode Nerd Font 11 + + # Allow a small subset of html markup: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # If markup is not allowed, those tags will be stripped out of the + # message. + markup = yes + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # Markup is allowed + format = "%s %p\n%b" + + # Sort messages by urgency. + sort = yes + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # The frequency with wich text that is longer than the notification + # window allows bounces back and forth. + # This option conflicts with "word_wrap". + # Set to 0 to disable. + bounce_freq = 5 + + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectevly. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + origin="top-right" + offset= 25x25 + width=350 + height=200 + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = yes + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing windowmanager is + # present (e.g. xcompmgr, compiz, etc.). + transparency =25 + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + # default 120 + idle_threshold = 120 + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a windowmanager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern windowmanagers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = mouse + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = no + + # Maximum amount of notifications kept in history + history_length = 5 + + # Display indicators for URLs (U) and actions (A). + show_indicators = no + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + # This adds empty space above and under the text. + line_height = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 1 + + # Padding between text and separator. + # padding = 8 + padding = 8 + + # Horizontal padding. + horizontal_padding = 10 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = foreground + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = qutebrowser + + # Align icons left/right/off + icon_position = left + + # Paths to default icons. + icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/ + + # Limit icons size. + max_icon_size=128 + +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = mod1+space + + # Close all notifications. + # close_all = ctrl+shift+space + close_all = ctrl+mod1+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + history = ctrl+mod4+h + + # Context menu. + context = ctrl+mod1+c + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#191919" + foreground = "#8e8e8e" + timeout = 5 + +[urgency_normal] + background = "#191919" + foreground = "#BBBBBB" + timeout = 5 + +[urgency_critical] + background = "#de6e7c" + foreground = "#BBBBBB" + timeout = 0 + + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +#[Claws Mail] +# appname = claws-mail +# category = email.arrived +# urgency = normal +# background = "#2F899E" +# foreground = "#FFA247" +# +#[mute.sh] +# appname = mute +# category = mute.sound +# script = mute.sh +# +#[JDownloader] +# appname = JDownloader +# category = JD +# background = "#FFA247" +# foreground = "#FFFFFF" +# +#[newsbeuter] +# summary = *Feeds* +# background = "#A8EB41" +# foreground = "#FFFFFF" +# +#[irc] +# appname = weechat +# timeout = 0 +# background = "#0033bb" +# foreground = "#dddddd" +## +#[weechat hl] +# appname = weechat +# category = weechat.HL +# background = "#FF5C47" +# foreground = "#FFFFFF" +## +#[weechat pn] +# appname = weechat +# category = weechat.PM +# background = "#D53B84" +# foreground = "#FFFFFF" +# +#[CMUS] +# appname = CMUS +# category = cmus +# background = "#6C4AB7" +# foreground = "#FFE756" +# +# +# background = "#30AB70" +# foreground = "#F67245" +# +# vim: ft=cfg diff --git a/config/nsxiv/exec/key-handler b/config/nsxiv/exec/key-handler new file mode 100755 index 0000000..3a55cc1 --- /dev/null +++ b/config/nsxiv/exec/key-handler @@ -0,0 +1,8 @@ +#!/bin/sh + +case "$1" in +"C-w") while read file; do feh --bg-scale "$file"; done;; +"C-d") while read file; do rm "$file"; done;; +"C-c") while read file; do cp "$file" $HOME/pics/signal.png; done;; +"w") while read file; do cp "$file" $HOME/dotfiles/wallpapers/; done;; +esac diff --git a/config/starship.toml b/config/starship.toml new file mode 100644 index 0000000..b0f7530 --- /dev/null +++ b/config/starship.toml @@ -0,0 +1,168 @@ +#8e8e8e normal +#BBBBBB bold +#66a5ad accent + +format = """ +$username\ +$hostname\ +$shlvl\ +$kubernetes\ +$directory\ +$git_branch\ +$git_commit\ +$git_state\ +$git_status\ +$hg_branch\ +$docker_context\ +$package\ +$cmake\ +$dart\ +$dotnet\ +$elixir\ +$elm\ +$erlang\ +$golang\ +$helm\ +$java\ +$julia\ +$kotlin\ +$nim\ +$nodejs\ +$ocaml\ +$perl\ +$php\ +$purescript\ +$python\ +$ruby\ +$rust\ +$swift\ +$terraform\ +$zig\ +$nix_shell\ +$conda\ +$memory_usage\ +$aws\ +$gcloud\ +$openstack\ +$env_var\ +$crystal\ +$custom\ +$cmd_duration\ +$line_break\ +$lua\ +$jobs\ +$battery\ +$time\ +$status\ +$character""" + +[username] +style_user = 'bold #66a5ad' + +[hostname] +style = 'bold #BBBBBB' +ssh_symbol = "" + +[singularity] +style = 'bold #BBBBBB' + +[kubernetes] +style = 'bold #BBBBBB' + +[vcsh] +style = 'bold white' + +[git_branch] +style = 'bold #BBBBBB' + +[git_commit] +style = 'bold #BBBBBB' + +[docker_context] +style = 'bold #BBBBBB' +[package] +style = 'bold #BBBBBB' +symbol = " " +[cmake] +style = 'bold #BBBBBB' +[dart] +style = 'bold #BBBBBB' +[dotnet] +style = 'bold #BBBBBB' +[elixir] +style = 'bold #BBBBBB' +[elm] +style = 'bold #BBBBBB' +[erlang] +style = 'bold #BBBBBB' +[golang] +style = 'bold #BBBBBB' +[helm] +style = 'bold #BBBBBB' +[java] +style = 'bold #BBBBBB' +[julia] +style = 'bold #BBBBBB' +[kotlin] +style = 'bold #BBBBBB' +[nim] +style = 'bold #BBBBBB' +[nodejs] +style = 'bold #BBBBBB' +[ocaml] +style = 'bold #BBBBBB' +[perl] +style = 'bold #BBBBBB' +[php] +style = 'bold #BBBBBB' +[purescript] +style = 'bold #BBBBBB' +[ruby] +style = 'bold #BBBBBB' +[swift] +style = 'bold #BBBBBB' +[terraform] +style = 'bold #BBBBBB' +[zig] +style = 'bold #BBBBBB' +[nix_shell] +style = 'bold #BBBBBB' +[conda] +style = 'bold #BBBBBB' +[memory_usage] +style = 'bold #BBBBBB' +[aws] +style = 'bold #BBBBBB' +[gcloud] +style = 'bold #BBBBBB' +[openstack] +style = 'bold #BBBBBB' +[crystal] +style = 'bold #BBBBBB' +[cmd_duration] +style = 'bold #BBBBBB' +[lua] +style = 'bold #BBBBBB' +symbol = "󰢱 " +[jobs] +style = 'bold #BBBBBB' +[time] +style = 'bold #BBBBBB' + + +[python] +symbol = "󱔎 " +style = 'bold #BBBBBB' + +[rust] +symbol = "󱘗 " +style = 'bold #BBBBBB' + +[directory] +truncate_to_repo = false +style = 'bold #BBBBBB' + +[character] +success_symbol = "[❯](bold green)" +error_symbol = "[❯](bold red)" +vicmd_symbol = "[N](bold green)" diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc new file mode 100644 index 0000000..7edf066 --- /dev/null +++ b/config/sxhkd/sxhkdrc @@ -0,0 +1,49 @@ +XF86Audio{Prev,Next} + mpc {cdprev,next}; kill -45 $(cat ~/.cache/pidofbar) + +XF86AudioPlay + mpc toggle + +XF86Audio{Raise,Lower}Volume + volume.sh {up,down}; kill -44 $(pidof dwmblocks) + +XF86AudioMute + volume.sh mute; kill -44 $(pidof dwmblocks) + +XF86MonBrightness{Up,Down} + xbacklight -{inc,dec} 10 + +super+ctrl+p + pubs-rofi.sh open + +super+ctrl+i + pubs-rofi.sh tag + +super+ctrl+d + pubs-rofi.sh url + +super+ctrl+t + textbooks.sh + +super+ctrl+l + passmenu --type + +ctrl+shift+v + paste_from_primary.sh + +super+shift+s + maim -s --hidecursor | xclip -selection clipboard -t image/png + +super+o + find_open +super+y + xclip -o | viewurl + +ctrl+shift+s + swap_monitor.sh + +ctrl+shift+d + dock.sh + +shift+super+i + rofi-connman diff --git a/config/user-dirs.dirs b/config/user-dirs.dirs new file mode 100644 index 0000000..aed00ac --- /dev/null +++ b/config/user-dirs.dirs @@ -0,0 +1,15 @@ +# This file is written by xdg-user-dirs-update +# If you want to change or add directories, just edit the line you're +# interested in. All local changes will be retained on the next run. +# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped +# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an +# absolute path. No other format is supported. +# +XDG_DOWNLOAD_DIR="$HOME/down" +XDG_DOCUMENTS_DIR="$HOME/docs" +XDG_MUSIC_DIR="$HOME/media/music" +XDG_PICTURES_DIR="$HOME/media/pics" +XDG_VIDEOS_DIR="$HOME/media/vids" +XDG_DESKTOP_DIR="$HOME/down" +XDG_TEMPLATES_DIR="$HOME/down" +XDG_PUBLICSHARE_DIR="$HOME/down" diff --git a/config/user-dirs.locale b/config/user-dirs.locale new file mode 100644 index 0000000..3e0b419 --- /dev/null +++ b/config/user-dirs.locale @@ -0,0 +1 @@ +en_US \ No newline at end of file diff --git a/config/zathura/zathurarc b/config/zathura/zathurarc new file mode 100644 index 0000000..948a10d --- /dev/null +++ b/config/zathura/zathurarc @@ -0,0 +1,15 @@ +set statusbar-h-padding 0 +set statusbar-v-padding 0 +map u scroll half-up +map d scroll half-down +map D toggle_page_mode +map r reload +map R rotate +map K zoom in +map J zoom out +map i recolor +map p print +set default-bg "#191919" +set recolor true +set recolor-darkcolor "#BBBBBB" +set recolor-lightcolor "#191919" diff --git a/config/zsh/zsh-autosuggestions b/config/zsh/zsh-autosuggestions new file mode 160000 index 0000000..ae315de --- /dev/null +++ b/config/zsh/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit ae315ded4dba10685dbbafbfa2ff3c1aefeb490d diff --git a/config/zsh/zsh-history-substring-search b/config/zsh/zsh-history-substring-search new file mode 160000 index 0000000..0f80b8e --- /dev/null +++ b/config/zsh/zsh-history-substring-search @@ -0,0 +1 @@ +Subproject commit 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb diff --git a/config/zsh/zsh-syntax-highlighting b/config/zsh/zsh-syntax-highlighting new file mode 160000 index 0000000..ebef4e5 --- /dev/null +++ b/config/zsh/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit ebef4e55691f62e630318d56468e5798367aa81c diff --git a/home/.zshrc b/home/.zshrc new file mode 100644 index 0000000..d3574c0 --- /dev/null +++ b/home/.zshrc @@ -0,0 +1,55 @@ +# Lines configured by zsh-newuser-install +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt extendedglob notify +unsetopt autocd beep +bindkey -v +# End of lines configured by zsh-newuser-install +# The following lines were added by compinstall +zstyle :compinstall filename '/home/aselimov/.zshrc' + +~/bin/daily_scripture.sh +autoload -Uz compinit +compinit +# End of lines added by compinstall +# +export OMPI_MCA_rmaps_base_oversubscribe=1 +export CLICOLOR=1 +export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd +alias vi="nvim" +alias vim="nvim" +alias mergepdf="gs -dBATCH -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOutputFile=output.pdf" +alias ddg="w3m ddg.gg" +alias cal="khal calendar" +#alias sxiv="sxiv-rifle" +function addbin(){ + ln -s $PWD/$1 /home/aselimov/bin +} +eval "$(starship init zsh)" +zstyle -e ':completion:*:hosts' hosts 'reply=( + ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//,/ } + ${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}} +)' + +source "/home/aselimov/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" +source "/home/aselimov/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" +source "/home/aselimov/.config/zsh/zsh-history-substring-search/zsh-history-substring-search.zsh" + +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down +export XKB_DEFAULT_OPTIONS="caps:escape" + + + +function panbeamer (){ + pandoc --pdf-engine=xelatex -o "${1/md/pdf}" -t beamer "$1" +} + +export panbeamer + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +[ -f "/home/aselimov/.ghcup/env" ] && . "/home/aselimov/.ghcup/env" # ghcup-env \ No newline at end of file diff --git a/wallpapers/current_rotation.txt b/wallpapers/current_rotation.txt new file mode 100644 index 0000000..f9f5d74 --- /dev/null +++ b/wallpapers/current_rotation.txt @@ -0,0 +1,2 @@ +./linux/void-linux-minimal.png +./minimalist/zen-maze.png diff --git a/wallpapers/linux/void-linux-minimal.png b/wallpapers/linux/void-linux-minimal.png new file mode 100644 index 0000000..dd7c739 Binary files /dev/null and b/wallpapers/linux/void-linux-minimal.png differ diff --git a/wallpapers/minimalist/zen-maze.png b/wallpapers/minimalist/zen-maze.png new file mode 100644 index 0000000..d670bb4 Binary files /dev/null and b/wallpapers/minimalist/zen-maze.png differ