diff --git a/.config/aliasrc b/.config/aliasrc index 5f635bb2..b8911e61 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -5,10 +5,9 @@ command -v nvim >/dev/null && alias vim="nvim" vimdiff="nvim -d" # Verbosity and settings that you pretty much just always are going to want. alias \ - bat="cat /sys/class/power_supply/BAT?/capacity" \ cp="cp -iv" \ mv="mv -iv" \ - rm="rm -v" \ + rm="rm -vI" \ mkd="mkdir -pv" \ ffmpeg="ffmpeg -hide_banner" @@ -28,9 +27,10 @@ alias \ e="$EDITOR" \ v="$EDITOR" \ p="sudo pacman" \ + z="zathura" -# Some other stuff alias \ magit="nvim -c MagitOnly" \ ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" \ - tmux="tmux -f ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf" + tmux="tmux -f ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf" \ + weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \ diff --git a/.asoundrc b/.config/alsa/asoundrc similarity index 100% rename from .asoundrc rename to .config/alsa/asoundrc diff --git a/.config/directories b/.config/directories index 58421165..28630222 100644 --- a/.config/directories +++ b/.config/directories @@ -1,5 +1,6 @@ # You can add comments to these files with # cf ${XDG_CONFIG_HOME:-$HOME/.config} +cac ${XDG_CACHE_HOME:-$HOME/.cache} d ~/downloads gh ~/github h ~/ diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index eac55eec..98c95ddb 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -10,7 +10,7 @@ endif call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'tpope/vim-surround' -Plug 'scrooloose/nerdtree' +Plug 'preservim/nerdtree' Plug 'junegunn/goyo.vim' Plug 'PotatoesMaster/i3-vim-syntax' Plug 'jreybert/vimagit' @@ -18,6 +18,7 @@ Plug 'vimwiki/vimwiki' Plug 'bling/vim-airline' Plug 'tpope/vim-commentary' Plug 'kovetskiy/sxhkd-vim' +Plug 'ap/vim-css-color' call plug#end() set bg=light @@ -50,6 +51,11 @@ set clipboard+=unnamedplus " Nerd tree map n :NERDTreeToggle autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + if has('nvim') + let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks' + else + let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks' + endif " Shortcutting split navigation, saving a keypress: map h @@ -92,8 +98,9 @@ set clipboard+=unnamedplus autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x! autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q! -" Automatically deletes all trailing whitespace on save. +" Automatically deletes all trailing whitespace and newlines at end of file on save. autocmd BufWritePre * %s/\s\+$//e + autocmd BufWritepre * %s/\n\+\%$//e " When shortcut files are updated, renew bash and ranger configs with new material: autocmd BufWritePost files,directories !shortcuts diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index ba5ec84f..efbb3180 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -5,7 +5,6 @@ set column_ratios 1,3,4 set hidden_filter ^\.|\.(?:pyc|vrb|pyo|lof|bak|swp|aux|log|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)$|^lost\+found$|^__(py)?cache__$ set show_hidden false set confirm_on_delete multiple -set preview_script ${XDG_CONFIG_HOME:-$HOME/.config}/ranger/scope.sh set use_preview_script true set automatically_count_files true set open_all_images true @@ -505,4 +504,5 @@ map Tn eval fm.open_console('shell eyeD3 -n "" ' + fm.thisfile.relative_path, po #Downloading map ytv console shell youtube-dl -ic%space map yta console shell youtube-dl -xic%space -source ${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf + +eval cmd('source ' + fm.confpath('shortcuts.conf')) diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc new file mode 100644 index 00000000..1f37d24f --- /dev/null +++ b/.config/sxhkd/sxhkdrc @@ -0,0 +1,270 @@ +# The Simple X Hotkey Daemon is the program used by LARBS to map most of the +# dwm-independent commands. This file is pretty readable, so I'll let you read +# it. + +# The keys NOT bound here by sxhkd, but by dwm or i3 are: +# The t thru p keys on the top row +# The f thru ; keys on the home row +# The b key on the bottom row (hides the bar in either case) + +# Basic binds +super + Return + $TERMINAL +super + d + dmenu_run +super + r + $TERMINAL -e $FILE +super + e + $TERMINAL -e neomutt; pkill -RTMIN+12 blocks +super + m + $TERMINAL -e ncmpcpp +super + n + $TERMINAL -e newsboat +super + c + $TERMINAL -e calcurse +super + v + $TERMINAL -e nvim -c VimwikiIndex +super + shift + a + $TERMINAL -e alsamixer; pkill -RTMIN+10 blocks +super + shift + c + mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --title='mpvfloat' /dev/video0 +super + shift + e + tutorialvids +super + w + $TERMINAL -e sudo nmtui +super + shift + w + $BROWSER + +# Et cetera... +super + grave + dmenuunicode +super + Scroll_Lock + killall screenkey || screenkey +super + Insert + showclip +super + shift + x + prompt "Shutdown computer?" "sudo -A shutdown -h now" +super + shift + BackSpace + prompt "Reboot computer?" "sudo -A reboot" +super + shift + Escape + prompt 'Leave Xorg?' 'killall Xorg' +super + x + ifinstalled slock && ( slock & xset dpms force off ; mpc pause ; pauseallmpv ) +XF86Launch1 + xset dpms force off +XF86TouchpadToggle + (synclient | grep "TouchpadOff.*1" && synclient TouchpadOff=0) || synclient TouchpadOff=1 +XF86Touchpad{Off,On} + synclient TouchpadOff={1,0} +XF86MonBrightnessDown + xbacklight -dec 15 +XF86MonBrightnessUp + xbacklight -inc 15 + +# Recording +# Take screenshot +Print + maim pic-full-$(date '+%y%m%d-%H%M-%S').png +# Pick screenshot type +shift + Print + maimpick +# Print: Record audio or video; Del: kill recording +super + Print + dmenurecord +super + Delete + dmenurecord kill + +# Pause audio +super + p + mpc toggle +super + shift + p + mpc pause; pauseallmpv +# Changes to next/previous tracks +super + {comma,period} + mpc {prev,next} +# Restart track +super + shift + less + mpc seek 0% +# Seek foward in song +super + {_,shift +} bracketright + mpc seek +{10,120} +# Seek backward in song +super + {_,shift +} bracketleft + mpc seek -{10,120} +# Increase volume +super + {equal,plus} + amixer sset Master {5,15}%+; pkill -RTMIN+10 blocks +# Decrease volume +super {_,shift +} + minus + amixer sset Master {5,15}%-; pkill -RTMIN+10 blocks +super + shift + m + amixer sset Master toggle; pkill -RTMIN+10 blocks + +# Audiokeys +XF86AudioMute + amixer sset Master toggle; pkill -RTMIN+10 blocks +XF86Audio{Raise,Lower}Volume + amixer sset Master 5%{+,-}; pkill -RTMIN+10 blocks +XF86Audio{Next,Prev} + mpc {next,prev} +XF86Audio{Pause,Play,Stop} + mpc {pause,play,stop} +XF86Audio{Rewind,Forward} + mpc seek {-,+}10 +XF86AudioRecord + dmenurecord +XF86AudioMedia + $TERMINAL -e ncmpcpp + +XF86PowerOff + prompt "Shutdown computer?" "sudo -A shutdown -h now" +XF86Calculator + $TERMINAL -e bc +XF86Sleep + prompt 'Hibernate computer?' 'sudo -A zzz' +XF86WWW + $BROWSER +XF86DOS + $TERMINAL +XF86ScreenSaver + mpc pause; pauseallmpv; i3lock -e -f -c 1d2021; xset dpms force off +XF86TaskPane + $TERMINAL -e htop +XF86Mail + $TERMINAL -e neomutt +XF86MyComputer + $TERMINAL -e $FILE / + +# Function keys +super + shift + F1 + grep LARBSWELCOME ~/.xprofile && ( sed -i "/LARBSWELCOME/d" ~/.xprofile && notify-send "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) || ( echo "notify-send -i "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/larbs.png" \"Welcome to LARBS\" \"Press super+F1 for the help menu.\" # LARBSWELCOME" >> ~/.xprofile && notify-send "LARBS welcome message" "Welcome message re-enabled." ) +# Show readme +super + F1 + groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - +# F2 restarts either dwm or i3 and is bound in each. +# Change display +super + F3 + displayselect +# Hibernate +super + F4 + prompt 'Hibernate computer?' 'sudo -A zzz -Z' +super + F5 is unbound. +# Start torrent daemon/open interface +super + F6 + torwrap +# toggle torrent daemon +super + F7 + td-toggle +# sync email +super + F8 + mailsync +# Mount a USB drive or Android device +super + {F9,F10} + {dmenumount,dmenuumount} + + + +# close and kill +super + {_,shift + }q + bspc node -{c,k} + +# alternate between the tiled and monocle layout +super + {_,shift + }f + bspc {desktop -l next,node -t ~fullscreen} + +# rotate current node 90 degrees +super + y + bspc node @focused:/ -R 90 + +# swap the current node and the biggest local node +super + space + bspc node -s biggest.local || bspc node -s next.local + +# +# state/flags +# + +# set the window state +#super + {t,shift + t,s} +#bspc node -t {tiled,pseudo_tiled,floating} + +super + shift + space + bspc node focused -t \~floating + +# focus/swap + +# focus the node in the given direction +super + {_,shift + }{h,j,k,l} + bspc node -{f,s} {west,south,north,east} + +# focus the node for the given path jump +super + {p,b,comma,period} + bspc node -f @{parent,brother,first,second} + +super + {g,semicolon} + bspc desktop {prev,next}.occupied --focus +super + {Prior,Next} + bspc desktop {prev,next}.occupied --focus +super + {Tab,backslash} + bspc desktop last --focus + +# focus or swap the next node +super + {_,shift + }c + bspc node -{f,s} next.local + +# focus the older or newer node in the focus history + +# focus or send to the given desktop +super + {_,shift + }{1-9,0} + bspc {desktop -f,node -d} ^{1-9,10} + +# preselect the direction +#super + {u,o} +#bspc node -p {south,east} + +# preselect the ratio +super + ctrl + {1-9} + bspc node -o 0.{1-9} + +# cancel the preselection for the focused node +super + ctrl + space + bspc node -p cancel + +# cancel the preselection for the focused desktop +#super + space +#bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel + +# expand a window by moving one of its side outward +super + shift + {y,u,i,o} + bspc node -z {right -20 0,bottom 0 20,bottom 0 -20,right 20 0} + +# contract a window by moving one of its side inward + +# move a floating window +super + {Left,Down,Up,Right} + bspc node -v {-20 0,0 20,0 -20,20 0} + +# Toggle gaps +super + shift + d + bspc config window_gap {0,15} +# Increase/descrease gap size +super { ,+ shift }+ z + bspc config window_gap $(($(bspc config window_gap) {+,-} 3)) + +super + u + cat /tmp/dropdown | xargs -I win bspc node win --flag hidden;bspc node -f win + +# Make a windoww sticky/non-sticky +super + o + bspc node -g sticky={on,off} + +# remove and restore polybar +#super + b +#\{ pgrep polybar && \{ killall polybar ; bspc config top_padding 0 \} \} || \{ launch_polybar ; bspc config top_padding 24 \} + +super + {i,o} + bspc node -f {prev,next}.local +super + shift + n + bspc node focused -t \~floating ; hover right +super + shift + b + bspc node focused -t \~floating ; hover left diff --git a/.config/wal/postrun b/.config/wal/postrun new file mode 100755 index 00000000..74d551b5 --- /dev/null +++ b/.config/wal/postrun @@ -0,0 +1,27 @@ +#!/bin/bash + +source "${HOME}/.cache/wal/colors.sh" + +mkdir -p "${HOME}/.config/dunst" +mkdir -p "${HOME}/.config/zathura" +ln -sf "${HOME}/.cache/wal/dunstrc" "${HOME}/.config/dunst/dunstrc" +ln -sf "${HOME}/.cache/wal/zathurarc" "${HOME}/.config/zathura/zathurarc" + +fix_sequences() { + e=$'\e' + sequences=$(cat) + foreground_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]10[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")" + background_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]11[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")" + cursor_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]12[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")" + +for term in /dev/pts/{0..9}* +do +echo -e "\e]4;256;${cursor_color}\a\c" > "${term}" 2>/dev/null +echo -e "\e]4;258;${background_color}\a\c" > "${term}" 2>/dev/null +echo -e "\e]4;259;${foreground_color}\a\c" > "${term}" 2>/dev/null +done +} + +fix_sequences <"${HOME}/.cache/wal/sequences" + +pkill dunst; dunst & diff --git a/.config/xinitrc b/.config/xinitrc new file mode 100755 index 00000000..e636c90d --- /dev/null +++ b/.config/xinitrc @@ -0,0 +1,21 @@ +#!/bin/sh + +# xinitrc runs automatically when you run startx. + +# There are some small but important commands that need to be run when we start +# the graphical environment. I keep those commands in ~/config/xprofile because +# that file is run automatically if someone uses a display manager (login +# screen) and so they are needed there. To prevent doubling up commands, I +# source them here with the line below. + +# export STATUSBAR="i3blocks" # Uncomment this line when using i3. + +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/xprofile" ] && . "${XDG_CONFIG_HOME:-$HOME/.config}/xprofile" + +# Your default LARBS WM is determined in your `~/.profile` on login. Here we +# run the proper command to run when the graphical environment starts. + +# Comment/uncomment these lines depending on what wm you want to use. Also +# check the i3blocks line above. +ssh-agent dwm +# ssh-agent i3 diff --git a/.config/xprofile b/.config/xprofile new file mode 100755 index 00000000..92861d16 --- /dev/null +++ b/.config/xprofile @@ -0,0 +1,21 @@ +#!/bin/sh + +# This file runs when a DM logs you into a graphical session. +# If you use startx/xinit like a Chad, this file will also be sourced. + +# This file's true location is in ~/.config/xprofile and a link exists to it in +# ~/.xprofile. If you do not use a DM, you may remove the link to it to have a +# cleaner home. + +# Fix Gnome Apps Slow Start due to failing services +# Add this when you include flatpak in your system +dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY + +mpd & # music player daemon-you might prefer it as a service though +remaps & # run the remaps script, switching caps/esc and more; check it for more info +setbg & # set the background with the `setbg` script +#xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/Xresources & # Uncomment to use Xresources colors/settings on startup +xcompmgr & # xcompmgr for transparency +dunst & # dunst for notifications +xset r rate 300 50 & # Speed xrate up +unclutter & # Remove mouse when idle diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c64c8e52..0e403b6f 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -62,5 +62,5 @@ preexec() { echo -ne '\e[5 q' ;} alias clear='timeout 6 cbeams -o; clear' -# Load zsh-syntax-highlighting; should be last. -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null +# Load syntax highlighting; should be last. +source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null diff --git a/.local/bin/compiler b/.local/bin/compiler index 2fefdf5a..0f693d27 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -26,12 +26,14 @@ case "$file" in *\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf > "$base".pdf ;; *\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;; *\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;; - *\.[rR]md) Rscript -e "require(rmarkdown); rmarkdown::render('$file', quiet=TRUE)" ;; + *\.[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; *\.tex) textype "$file" ;; *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; *config.h) sudo make install ;; *\.c) cc "$file" -o "$base" && "$base" ;; *\.py) python "$file" ;; + *\.m) octave "$file" ;; + *\.scad) openscad -o "$base".stl "$file" ;; *\.go) go run "$file" ;; *\.sent) setsid sent "$file" 2>/dev/null & ;; *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index 57bb6d45..34ed61e3 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -9,7 +9,7 @@ notify-send "📦 Repository Sync" "Checking for package updates..." sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. Check your internet connection, if pacman is already running, or run update manually to see errors." -pkill -RTMIN+8 "${STATUSBAR:?}" +pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" if pacman -Qu | grep -v "\[ignored\]" then diff --git a/.local/bin/displayselect b/.local/bin/displayselect new file mode 100755 index 00000000..02b35c2c --- /dev/null +++ b/.local/bin/displayselect @@ -0,0 +1,83 @@ +#!/bin/sh + +# A UI for detecting and selecting all displays. Probes xrandr for connected +# displays and lets user select one to use. User may also select "manual +# selection" which opens arandr. + +twoscreen() { # If multi-monitor is selected and there are two screens. + + mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?") + # Mirror displays using native resolution of external display and a scaled + # version for the internal display + if [ "$mirror" = "yes" ]; then + external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:") + internal=$(echo "$screens" | grep -v "$external") + + res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \ + tail -n 1 | awk '{print $1}') + res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ + tail -n 1 | awk '{print $1}') + + res_ext_x=$(echo $res_external | sed 's/x.*//') + res_ext_y=$(echo $res_external | sed 's/.*x//') + res_int_x=$(echo $res_internal | sed 's/x.*//') + res_int_y=$(echo $res_internal | sed 's/.*x//') + + scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l) + scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l) + + xrandr --output "$external" --auto --scale 1.0x1.0 \ + --output "$internal" --auto --same-as "$external" \ + --scale "$scale_x"x"$scale_y" + else + + primary=$(echo "$screens" | dmenu -i -p "Select primary display:") + secondary=$(echo "$screens" | grep -v "$primary") + direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") + xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 + fi + } + +morescreen() { # If multi-monitor is selected and there are more than two screens. + primary=$(echo "$screens" | dmenu -i -p "Select primary display:") + secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") + direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") + tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") + xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto + } + +multimon() { # Multi-monitor handler. + case "$(echo "$screens" | wc -l)" in + 2) twoscreen ;; + *) morescreen ;; + esac ;} + +onescreen() { # If only one output available or chosen. + xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$1" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') + } + +postrun() { # Stuff to run to clean up. + setbg # Fix background if screen size/arangement has changed. + remaps # Re-remap keys if keyboard added (for laptop bases) + { killall dunst ; setsid dunst & } >/dev/null 2>&1 # Restart dunst to ensure proper location on screen + } + +# Get all possible displays +allposs=$(xrandr -q | grep "connected") + +# Get all connected screens. +screens=$(echo "$allposs" | awk '/ connected/ {print $1}') + +# If there's only one screen +[ "$(echo "$screens" | wc -l)" -lt 2 ] && + { onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;} + +# Get user choice including multi-monitor and manual selection: +chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && +case "$chosen" in + "manual selection") arandr ; exit ;; + "multi-monitor") multimon ;; + *) onescreen "$chosen" ;; +esac + +postrun diff --git a/.local/bin/dmenu_mount b/.local/bin/dmenu_mount index c192873a..75e11b55 100755 --- a/.local/bin/dmenu_mount +++ b/.local/bin/dmenu_mount @@ -7,18 +7,20 @@ getmount() { \ [ -z "$chosen" ] && exit 1 - mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" + # shellcheck disable=SC2086 + mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 [ "$mp" = "" ] && exit 1 if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") fi } mountusb() { \ - chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 - alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \\( -path *%s -prune \\) \\ \n",$3}') + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" partitiontype="$(lsblk -no "fstype" "$chosen")" case "$partitiontype" in @@ -29,23 +31,25 @@ mountusb() { \ } mountandroid() { \ - chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1) + chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 + chosen="$(echo "$chosen" | cut -d : -f 1)" getmount "$HOME -maxdepth 3 -type d" simple-mtpfs --device "$chosen" "$mp" - echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" + echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 simple-mtpfs --device "$chosen" "$mp" notify-send "🤖 Android Mounting" "Android device mounted to $mp." } asktype() { \ - case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 + case $choice in USB) mountusb ;; Android) mountandroid ;; esac } anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')" +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$4==""{printf "%s (%s)\n",$1,$3}')" if [ -z "$usbdrives" ]; then [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit diff --git a/.local/bin/dmenu_pass b/.local/bin/dmenu_pass index 8631a134..2c14e6f0 100755 --- a/.local/bin/dmenu_pass +++ b/.local/bin/dmenu_pass @@ -3,4 +3,4 @@ # This script is the SUDO_ASKPASS variable, meaning that it will be used as a # password prompt if needed. -dmenu -fn Monospace-18 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo +dmenu -fn Monospace-18 -P -p "$1" <&- && echo diff --git a/.local/bin/dmenu_record b/.local/bin/dmenu_record index a0339e45..49a2fbf8 100755 --- a/.local/bin/dmenu_record +++ b/.local/bin/dmenu_record @@ -11,7 +11,7 @@ updateicon() { \ echo "$1" > /tmp/recordingicon - pkill -RTMIN+9 "${STATUSBAR:?}" + pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" } killrecording() { @@ -20,7 +20,7 @@ killrecording() { kill -15 "$recpid" rm -f /tmp/recordingpid updateicon "" - pkill -RTMIN+9 "${STATUSBAR:?}" + pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" # even after SIGTERM, ffmpeg may still run, so SIGKILL it. sleep 3 kill -9 "$recpid" @@ -31,20 +31,20 @@ screencast() { \ ffmpeg -y \ -f x11grab \ -framerate 60 \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ - -i $DISPLAY \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ + -i "$DISPLAY" \ -f alsa -i default \ -r 30 \ - -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ - "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & + -c:v h264 -crf 0 -preset ultrafast -c:a aac \ + "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & echo $! > /tmp/recordingpid updateicon "⏺️🎙️" } video() { ffmpeg \ -f x11grab \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ - -i $DISPLAY \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ + -i "$DISPLAY" \ -c:v libx264 -qp 0 -r 30 \ "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & echo $! > /tmp/recordingpid diff --git a/.local/bin/dmenu_umount b/.local/bin/dmenu_umount index da0f4016..26612efe 100755 --- a/.local/bin/dmenu_umount +++ b/.local/bin/dmenu_umount @@ -6,25 +6,27 @@ unmountusb() { [ -z "$drives" ] && exit - chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') + chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" [ -z "$chosen" ] && exit sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted." } unmountandroid() { \ - chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?") + chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1 [ -z "$chosen" ] && exit sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted." } asktype() { \ - case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1 + case "$choice" in USB) unmountusb ;; Android) unmountandroid ;; esac } -drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') +drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') if ! grep simple-mtpfs /etc/mtab; then [ -z "$drives" ] && echo "No drives to unmount." && exit diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode new file mode 100755 index 00000000..de1421b9 --- /dev/null +++ b/.local/bin/dmenuunicode @@ -0,0 +1,18 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + echo "$chosen" | tr -d '\n' | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi diff --git a/.local/bin/ifinstalled b/.local/bin/ifinstalled index b70c2bbf..a2a403e5 100755 --- a/.local/bin/ifinstalled +++ b/.local/bin/ifinstalled @@ -2,3 +2,5 @@ # If $1 command is not available, error code and notify. command -v "$1" >/dev/null || { notify-send "$1" "must be installed for this function." && exit 1 ;} + +pacman -Qq "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;} diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock new file mode 100755 index 00000000..49cdc0b4 --- /dev/null +++ b/.local/bin/statusbar/clock @@ -0,0 +1,32 @@ +#!/bin/sh + +clock=$(date '+%I') + +case "$clock" in + "00") icon="🕛" ;; + "01") icon="🕐" ;; + "02") icon="🕑" ;; + "03") icon="🕒" ;; + "04") icon="🕓" ;; + "05") icon="🕔" ;; + "06") icon="🕕" ;; + "07") icon="🕖" ;; + "08") icon="🕗" ;; + "09") icon="🕘" ;; + "10") icon="🕙" ;; + "11") icon="🕚" ;; + "12") icon="🕛" ;; +esac + +case $BLOCK_BUTTON in + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; + 2) setsid "$TERMINAL" -e calcurse -D ~/.config/calcurse & ;; + 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` +- Middle click opens calcurse if installed" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +printf '%s %s%s\n' "$(date '+%Y %b %d (%a)')" "$icon" "$(date '+%I:%M%p')" + +#for europeans, use this +#printf '%s %s%s\n' "$(date '+%a %d/%m')" "$icon" "$(date '+%I:%M%p')" diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu new file mode 100755 index 00000000..b26f9d9c --- /dev/null +++ b/.local/bin/statusbar/cpu @@ -0,0 +1,12 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; + 2) setsid "$TERMINAL" -e htop & ;; + 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. +- Click to show intensive processes. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +sensors | awk '/Core 0/ {print "🌡", $3}' diff --git a/.local/bin/statusbar/crypto b/.local/bin/statusbar/crypto new file mode 100755 index 00000000..2e37f133 --- /dev/null +++ b/.local/bin/statusbar/crypto @@ -0,0 +1,54 @@ +#!/bin/sh + +# Shows the price for desired cryptocurrencies. Module updates automatically +# every calendar day, but can also be updated with a middle click. + +# Currencies should be ;-separated: +# human-readable name;urlname;icon +coins="Bitcoin;btc;💰 +Etherium;eth;🍸 +Basic Attention Token;bat;🦁 +LBC;lbc;📚" + +# Directory where currency info is stored. +dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" + +getprices() { # The command to get the desired prices + printf "🔃 "; printprices + { rm -rf "${dir:?}/*" + echo "$coins" | while IFS=';' read -r human web icon; do + val="$(curl -s "rate.sx/1$web")" && + echo "$icon;$val;$human" > "$dir/$web" + done; [ -d "$dir" ] && touch "$dir" + pkill -RTMIN+13 "${STATUSBAR:-dwmblocks}" ;} & + exit + } + +printprices() { # Print/format all prices + for x in "$dir"/*; do + [ -f "$x" ] || break + info="$(cut -d';' -f-2 --output-delimiter=' ' "$x")" + printf "%s $%0.2f " $info + done | sed "s/ $/\n/" + } + +[ ! -d "$dir" ] && mkdir -p "$dir" && { getprices; exit ;} + +# If currencies haven't been updated today, try to update them. +[ "$(stat -c %x "$HOME/.local/share/crypto-prices" | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && + { ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && getprices || exit ;} + +case $BLOCK_BUTTON in + 1) uptime="$(date -d "$(stat -c %x "$dir")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" + notify-send "Exact prices in USD" "$(awk -F';' '{print $1, $3 ":\n\t$" $2}' "$dir"/*) +Last updated: + $uptime" ;; + 2) getprices ;; + 3) notify-send "💸 Crypto-currency module" "\- Left click for exact prices. +- Middle click to update. +- Shows 🔃 if updating prices. +- Manually add/remove currencies to list in the script." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +printprices diff --git a/.local/bin/statusbar/disk b/.local/bin/statusbar/disk new file mode 100755 index 00000000..e947509d --- /dev/null +++ b/.local/bin/statusbar/disk @@ -0,0 +1,23 @@ +#!/bin/sh + +# Status bar module for disk space +# $1 should be drive mountpoint, otherwise assumed /. + +location=${1:-/} + +[ -d "$location" ] || exit + +case $BLOCK_BUTTON in + 1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;; + 3) notify-send "💽 Disk module" "\- Shows used hard drive space. +- Click to show all disk info." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +case "$location" in + "/home"* ) icon="🏠" ;; + "/mnt"* ) icon="💾" ;; + *) icon="🖥";; +esac + +printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.local/bin/statusbar/help-icon b/.local/bin/statusbar/help-icon new file mode 100755 index 00000000..9c90964a --- /dev/null +++ b/.local/bin/statusbar/help-icon @@ -0,0 +1,17 @@ +#!/bin/sh + +# The clickable help menu. Middle click to restart wm. + +# If dwm is running, use dwm's readme and restart. +ps ax | grep -q "\sdwm$" && + READMEFILE=/usr/local/share/dwm/larbs.mom + restartwm() { pkill -HUP dwm ;} || + restartwm() { i3 restart ;} + +case $BLOCK_BUTTON in + 1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;; + 2) restartwm ;; + 3) notify-send "❓ Help module" "\- Left click to open LARBS guide. +- Middle click to refresh window manager." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac; echo "❓" diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet new file mode 100755 index 00000000..94eb47f2 --- /dev/null +++ b/.local/bin/statusbar/internet @@ -0,0 +1,22 @@ +#!/bin/sh + +# Show wifi 📶 and percent strength or 📡 if none. +# Show 🌐 if connected to ethernet or ❎ if none. + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e nmtui & ;; + 3) notify-send "🌐 Internet module" "\- Click to connect +📡: no wifi connection +📶: wifi connection with quality +❎: no ethernet +🌐: ethernet working +" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in + down) wifiicon="📡 " ;; + up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; +esac + +printf "%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" diff --git a/.local/bin/statusbar/iplocate b/.local/bin/statusbar/iplocate new file mode 100755 index 00000000..02adab8d --- /dev/null +++ b/.local/bin/statusbar/iplocate @@ -0,0 +1,10 @@ +#!/bin/sh + +# Gets your public ip address checks which country you are in and +# displays that information in the statusbar +# +# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ + +ifinstalled "geoip" || exit +addr="$(curl ifconfig.me 2>/dev/null)" || exit +grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox new file mode 100755 index 00000000..95603888 --- /dev/null +++ b/.local/bin/statusbar/mailbox @@ -0,0 +1,20 @@ +#!/bin/sh + +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e neomutt & ;; + 2) setsid mailsync >/dev/null & ;; + 3) notify-send "📬 Mail module" "\- Shows unread mail +- Shows 🔃 if syncing mail +- Left click opens neomutt +- Middle click syncs mail" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" + +icon="$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)" + +[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬 $unread$icon" diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory new file mode 100755 index 00000000..66fcd8be --- /dev/null +++ b/.local/bin/statusbar/memory @@ -0,0 +1,12 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 2) setsid "$TERMINAL" -e htop & ;; + 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. +- Click to show memory hogs. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +free -h | sed -n '2{p;q}' | awk '{print "🧠", $3 "/" $2}' diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase new file mode 100755 index 00000000..fab8b4da --- /dev/null +++ b/.local/bin/statusbar/moonphase @@ -0,0 +1,37 @@ +#!/bin/sh + +# Shows the current moon phase. + +moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" + +[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} + +icon="$(cat "$moonfile")" + +case "$icon" in + 🌑) name="New" ;; + 🌒) name="Waxing Crescent" ;; + 🌓) name="First Quarter" ;; + 🌔) name="Waxing Gibbous" ;; + 🌕) name="Full" ;; + 🌖) name="Waning Gibbous" ;; + 🌗) name="Last Quarter" ;; + 🌘) name="Waning Crescent" ;; + *) exit 1 ;; +esac + +echo "${icon-?}" + +case $BLOCK_BUTTON in + 3) notify-send "🌜 Moon phase module" "Displays current moon phase. +- 🌑: New +- 🌒: Waxing Crescent +- 🌓: First Quarter +- 🌔: Waxing Gibbous +- 🌕: Full +- 🌖: Waning Gibbous +- 🌗: Last Quarter +- 🌘: Waning Crescent" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music new file mode 100755 index 00000000..6d22467b --- /dev/null +++ b/.local/bin/statusbar/music @@ -0,0 +1,17 @@ +#!/bin/sh + +filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | tr '\n' ' ' | sed 's/ $//' ;} + +case $BLOCK_BUTTON in + 1) mpc status | filter ; setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause + 2) mpc toggle | filter ;; # right click, pause/unpause + 3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing. +- Italic when paused. +- Left click opens ncmpcpp. +- Middle click pauses. +- Scroll changes track.";; # right click, pause/unpause + 4) mpc prev | filter ;; # scroll up, previous + 5) mpc next | filter ;; # scroll down, next + 6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;; + *) mpc status | filter ;; +esac diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf new file mode 100755 index 00000000..bac22d87 --- /dev/null +++ b/.local/bin/statusbar/nettraf @@ -0,0 +1,25 @@ +#!/bin/sh + +# Module showing network traffic. Shows how much data has been received (RX) or +# transmitted (TX) since the previous time this script ran. So if run every +# second, gives network traffic per second. + +case "$BLOCK_BUTTON" in + 3) notify-send "🌐 Network traffic module" "🔻: Traffic received +🔺: Traffic transmitted" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog" +txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog" + +rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | tr '\n' '+' | sed 's/+$/\n/' | bc)" +txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | tr '\n' '+' | sed 's/+$/\n/' | bc)" + +printf "🔻%skB 🔺%skB\\n" \ + "$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \ + "$(printf -- "(%s-%s)/1024\\n" "$txcurrent" "$(cat "$txfile")" | bc)" + +# Log the current values for next run. +echo "$rxcurrent" > "$rxfile" +echo "$txcurrent" > "$txfile" diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news new file mode 100755 index 00000000..ffaadfbc --- /dev/null +++ b/.local/bin/statusbar/news @@ -0,0 +1,17 @@ +#!/bin/sh + +# Displays number of unread news items and an loading icon if updating. +# When clicked, brings up `newsboat`. + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e newsboat ;; + 2) setsid newsup >/dev/null & exit ;; + 3) notify-send "📰 News module" "\- Shows unread news items +- Shows 🔃 if updating with \`newsup\` +- Left click opens newsboat +- Middle click syncs RSS feeds +Note: Only one instance of newsboat (including updates) may be running at a time." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰 " $1}' | sed 's/^📰 0$//g')$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages new file mode 100755 index 00000000..e61660c2 --- /dev/null +++ b/.local/bin/statusbar/pacpackages @@ -0,0 +1,29 @@ +#!/bin/sh + +# Displays number of upgradeable packages. +# For this to work, have a `pacman -Sy` command run in the background as a +# cronjob every so often as root. This script will then read those packages. +# When clicked, it will run an upgrade via pacman. +# +# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook: +# +# [Trigger] +# Operation = Upgrade +# Type = Package +# Target = * +# +# [Action] +# Description = Updating statusbar... +# When = PostTransaction +# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e popupgrade & ;; + 2) notify-send "$(/usr/bin/pacman -Qu)" ;; + 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages +- Left click to upgrade packages +- Middle click to show upgradable packages" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g" diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade new file mode 100755 index 00000000..3a62727d --- /dev/null +++ b/.local/bin/statusbar/popupgrade @@ -0,0 +1,9 @@ +#!/bin/sh + +printf "Beginning upgrade.\\n" + +yay -Syu +pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" + +printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" +read -r diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent new file mode 100755 index 00000000..99ed5c85 --- /dev/null +++ b/.local/bin/statusbar/torrent @@ -0,0 +1,33 @@ +#!/bin/sh + +transmission-remote -l | grep % | + sed " # This first sed command is to ensure a desirable order with sort + s/.*Stopped.*/A/g; + s/.*Seeding.*/Z/g; + s/.*100%.*/N/g; + s/.*Idle.*/B/g; + s/.*Uploading.*/L/g; + s/.*%.*/M/g" | + sort -h | uniq -c | sed " # Now we replace the standin letters with icons. + s/A/🛑/g; + s/B/🕰/g; + s/L/🔼/g; + s/M/🔽/g; + s/N/✅/g; + s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed 's/ $//' + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e tremc & ;; + 2) td-toggle ;; + 3) notify-send "🌱 Torrent module" "\- Left click to open tremc. +- Middle click to toggle transmission. +- Shift click to edit script. +Module shows number of torrents: +🛑: paused +🕰: idle (seeds needed) +🔼: uploading (unfinished) +🔽: downloading +✅: done +🌱: done and seeding" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume new file mode 100755 index 00000000..8df98c8f --- /dev/null +++ b/.local/bin/statusbar/volume @@ -0,0 +1,38 @@ +#!/bin/sh + +# Prints the current volume or 🔇 if muted. Uses PulseAudio by default, +# uncomment the ALSA lines if you remove PulseAudio. + +case $BLOCK_BUTTON in + # 1) setsid "$TERMINAL" -e alsamixer & ;; + # 2) amixer sset Master toggle ;; + # 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; + # 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;; + 1) setsid "$TERMINAL" -e pulsemixer & ;; + 2) pamixer -t ;; + 4) pamixer --allow-boost -i 1 ;; + 5) pamixer --allow-boost -d 1 ;; + 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. +- Middle click to mute. +- Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +volstat="$(pactl list sinks)" +# volstat="$(amixer get Master)" # ALSA only equivalent. + +echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit +# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA + +vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")" +# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA + +if [ "$vol" -gt "70" ]; then + icon="🔊" +elif [ "$vol" -lt "30" ]; then + icon="🔈" +else + icon="🔉" +fi + +printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather new file mode 100755 index 00000000..76a84d90 --- /dev/null +++ b/.local/bin/statusbar/weather @@ -0,0 +1,34 @@ +#!/bin/sh + +# Displays todays precipication chance (☔) and daily low (🥶) and high (🌞). +# Usually intended for the statusbar. + +# If we have internet, get a weather report from wttr.in and store it locally. +# You could set up a shell alias to view the full file in a pager in the +# terminal if desired. This function will only be run once a day when needed. +getforecast() { curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" || exit 1 ;} + +# Some very particular and terse stream manipulation. We get the maximum +# precipication chance and the daily high and low from the downloaded file and +# display them with coresponding emojis. +showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | + grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔ /g;1q" | tr -d '\n')" +sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶",$1 "°","🌞",$2 "°"}' ;} + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" & ;; + 2) getforecast && showweather ;; + 3) notify-send "🌈 Weather module" "\- Left click for full forecast. +- Middle click to update forecast. +☔: Chance of rain/snow +🥶: Daily low +🌞: Daily high" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# The test if our forcecast is updated to the day. If it isn't download a new +# weather report from wttr.in with the above function. +[ "$(stat -c %y "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + getforecast + +showweather diff --git a/.local/bin/sysact b/.local/bin/sysact new file mode 100755 index 00000000..0a7cdd02 --- /dev/null +++ b/.local/bin/sysact @@ -0,0 +1,21 @@ +#!/bin/sh + +# A dmenu wrapper script for system functions. + +# For non-systemd init systems. +case "$(readlink -f /sbin/init)" in + *runit*) hib="sudo -A zzz" ;; + *openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p" ;; +esac + +cmds="\ +🔒 lock slock +🚪 leave dwm kill -TERM $(pidof -s dwm) +♻ renew dwm kill -HUP $(pidof -s dwm) +🐻 hibernate ${hib:-sudo -A systemctl suspend-then-hibernate} +🔃 reboot ${reb:-sudo -A reboot} +🖥 shutdown ${shut:-sudo -A shutdown -h now}" + +choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1 + +`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-` diff --git a/.local/bin/td-toggle b/.local/bin/td-toggle new file mode 100755 index 00000000..d2ba76ae --- /dev/null +++ b/.local/bin/td-toggle @@ -0,0 +1,12 @@ +#!/bin/sh + +# If transmission-daemon is running, will ask to kill, else will ask to start. + +if pidof transmission-daemon >/dev/null ; +then + [ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon disabled." +else + ifinstalled transmission-cli || exit + [ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon enabled." +fi +sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/torwrap b/.local/bin/torwrap new file mode 100755 index 00000000..4f94053e --- /dev/null +++ b/.local/bin/torwrap @@ -0,0 +1,7 @@ +#!/bin/sh + +ifinstalled tremc-git transmission-cli || exit + +! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." + +$TERMINAL -e tremc; pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/transadd b/.local/bin/transadd new file mode 100755 index 00000000..1b9599ed --- /dev/null +++ b/.local/bin/transadd @@ -0,0 +1,9 @@ +#!/bin/sh + +# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. + +# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. + +pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") & + +transmission-remote -a "$@" && notify-send "🔽 Torrent added." diff --git a/.local/share/larbs/readme.mom b/.local/share/larbs/readme.mom new file mode 100644 index 00000000..fb8feb8b --- /dev/null +++ b/.local/share/larbs/readme.mom @@ -0,0 +1,323 @@ +.de LI +.LIST +.SHIFT_LIST 10p +.. +.PARA_SPACE 1m +.TITLE "\s+(10A Friendly Guide to LARBS!\s0" +.AUTHOR "\s+5Luke Smith\s0" +.DOCTYPE DEFAULT +.COPYSTYLE FINAL +.PRINTSTYLE TYPESET +.PT_SIZE 12 +.START +Use vim keys (\f(CWh/j/k/l\fP) to navigate this document. +Pressing \f(CWs\fP will fit it to window width (\f(CWa\fP to revert). +\f(CWK\fP and \f(CWJ\fP zoom in and out. +\f(CWSuper+f\fP to toggle fullscreen. +\f(CWf\fP will highlight links to follow which are selectable by typing the number that appears plus \f(CWEnter\fP. +\f(CWq\fP to quit. +(These are general binds set for \fBzathura\fP, the pdf reader.) +.LI +.ITEM +\f(CWMod+F1\fP will show this document at any time. +.ITEM +By \f(CWMod\fP I mean the Super Key, usually known as "the Windows Key." +.LIST OFF +.PP +FAQs are at the end of this document. +.HEADING 1 "Welcome!" +.HEADING 2 "Basic goals and principles of this system:" +.LI +.ITEM +\fBNaturalness\fP \(en +Remove the border between mind and matter: +everything important should be as few keypresses as possible away from you, +and you shouldn't have to think about what you're doing. +Immersion. +.ITEM +\fBEconomy\fP \(en +Programs should be simple and light on system resources and highly extensible. +Because of this, many are terminal or small ncurses programs that have all the magic inside of them. +.ITEM +\fBKeyboard/vim-centrality\fP \(en +All terminal programs (and other programs) use vim keys when possible. +Your hands never need leave the home row or thereabout. +.ITEM +\fBDecentralization\fP \(en +This system is a web of small, modifiable and replaceable programs that users can easily customize. +.LIST OFF +.HEADING 2 "General keyboard changes" +.LI +.ITEM +Capslock is a useless key in high quality space. +It's now remapped. +If you press it alone, it will function as escape, making vimcraft much more natural, +but you can also hold it down and it will act as another Windows/super/mod key. +.ITEM +The menu button (usually between the right Alt and Ctrl) is an alternative Super/Mod button. +This is to make one-handing on laptops easier. +.LIST OFF +If you'd like to change any of these keyboard changes, you need only open and change the \f(CWremaps\fP script. +All custom scripts in LARBS are located in \f(CW~/.local/bin/\fP. +Actually, this should go without saying, but \fIeverything\fP here can easily be changed. +Below in this document, there is information about where to change programs/components. +.PP +Additionally, while this isn't a part of the desktop environment, the default editing mode in the shell is using vi bindings. +If you want to learn more of this, run \f(CWMod+Shift+E\fP and type and select the option for "vi mode in shell". +This setting can be changed if you don't like it by deleting or commenting out the contents of \f(CW~/.config/inputrc\fP. +.HEADING 2 "The Status Bar" +.PP +To the left, you'll see the numbers of your current workspace/tag(s). +On the right, you'll see various system status notifiers, the date, volume, even music and local weather if possible, etc. +Each module on the right of the status bar is a script located in \f(CW~/.local/bin/statusbar/\fP. +You can see what they do and modify them from there. +I'm sure you can figure it out. +.PP +In i3, the program i3blocks controls what modules appear in the statusbar; its config file is in \f(CW~/.config/i3blocks/config\fP. +.HEADING 2 "Deeper Tutorials" +.PP +Press \f(CWmod+shift+e\fP at any time to get a menu of programs to watch videos about streaming directly from YouTube. +You can also check the config files for programs which detail a lot of the specific bindings. +.HEADING 1 "Key Bindings" +.HEADING 2 "Window basics" +.PP +Notice the case sensitivity of the shortcuts\c +.FOOTNOTE +To type capital letters, hold down the \f(CWShift\fP key\(emthat might sound like an obvious and condescending thing to tell you, but there have literally been multiple people (Boomers) who have emailed me asking how to type a capital letter since caps lock isn't enabled. +.FOOTNOTE OFF + , Be sure you play around with these. Be flexible with the basic commands and the system will grow on you quick. +.LI +.ITEM +\f(CWMod+Enter\fP \(en Spawn terminal (the default terminal is \f(CWst\fP; run \f(CWman st\fP for more.) +.ITEM +\f(CWMod+q\fP \(en Close window (Hold down shift to force kill.) +.ITEM +\f(CWMod+d\fP \(en dmenu (For running commands or programs without shortcuts) +.ITEM +\f(CWMod+h/j/k/l\fP \(en Move to different windows +.ITEM +\f(CWMod+H/J/K/L\fP \(en Move a window around +.ITEM +\f(CWMod+Y/U/I/O\fP \(en Resize windows +.ITEM +\f(CWMod+s/S\fP \(en Increase/decrease inner gaps +.ITEM +\f(CWMod+z/Z\fP \(en Increase/decrease outer gaps +.ITEM +\f(CWMod+D\fP \(en Toggle gaps +.ITEM +\f(CWMod+T\fP \(en Restore gaps to default +.ITEM +\f(CWMod+Shift+Space\fP \(en Make a window float (it will still be resizeable) +.ITEM +\f(CWMod+Space\fP \(en Switch focus from a floating window to a non-floating one (or + vice versa) +.ITEM +\f(CWMod+b\fP \(en Toggle status bar +.ITEM +\f(CWMod+B\fP \(en Toggle window float in bottom left corner (good for video watched intermittently) +.ITEM +\f(CWMod+N\fP \(en Same as above, but for the bottom right corner. +.LIST OFF +.HEADING 2 "Basic Programs" +.PP +\fINote:\fP LARBS will install nearly all of these programs by default, but some only come if you chose an extra option. +Naturally, you can use \f(CWyay\fP to look for and install any you want to add. +.LI +.ITEM +\f(CWMod+r\fP \(en lf (file browser/manager) +.ITEM +\f(CWMod+e\fP \(en neomutt (email) \(en Must be first configured by running \f(CWmw add\fP. +.ITEM +\f(CWMod+m\fP \(en ncmpcpp (music player) +.ITEM +\f(CWMod+a\fP \(en Dropdown calculator (hide with \f(CWmod+a\fP) +.ITEM +\f(CWMod+i\fP \(en htop (system info) +.ITEM +\f(CWMod+n\fP \(en newsboat (RSS feed reader) +.ITEM +\f(CWMod+A\fP \(en pulsemixer (audio system control) +.ITEM +\f(CWMod+w\fP \(en Web Browser (Brave) +.ITEM +\f(CWMod+W\fP \(en nmtui (for connecting to wireless internet) +.ITEM +\f(CWMod+G\fP \(en GIMP (for general image manipulation) \(en Not installed by default. +.LIST OFF +.HEADING 2 "System" +.LI +.ITEM +\f(CWMod+x\fP \(en lock screen (Enter password to return) +.ITEM +\f(CWMod+X\fP \(en shutdown (will ask to confirm) +.ITEM +\f(CWMod+Shift+Backspace\fP \(en reboot (will ask to confirm) +.ITEM +\f(CWMod+Shift+Escape\fP \(en log out of the graphical environment (will ask to confirm) +.ITEM +\f(CWMod+F1\fP \(en Shows this document +.ITEM +\f(CWMod+Shift+F1\fP \(en Toggle the LARBS welcome message +.ITEM +\f(CWMod+F2\fP \(en Refresh/reload i3 +.ITEM +\f(CWMod+F3\fP \(en Select screen/display to use +.ITEM +\f(CWMod+F4\fP \(en Hibernate (will ask to confirm) +.ITEM +\f(CWMod+F5\fP \(en Reset Network Manager, search for new networks +.ITEM +\f(CWMod+F6\fP \(en transmission torrent client (cli) +.ITEM +\f(CWMod+F7\fP \(en Toggle on/off transmission client via dmenu +.ITEM +\f(CWMod+F8\fP \(en Check mail, if +.PDF_WWW_LINK "https://github.com/lukesmithxyz/mutt-wizard" "mutt-wizard" +is installed. +.ITEM +\f(CWMod+F9\fP \(en Mount a USB drive/hard drive or Android +.ITEM +\f(CWMod+F10\fP \(en Unmount a non-essential drive or Android +.ITEM +\f(CWMod+`\fP \(en Select an emoji to copy to clipboard +.ITEM +\f(CWMod+Insert\fP \(en Show contents of clipboard/primary selection +.LIST OFF +.HEADING 2 "Audio" +.PP +I use ncmpcpp as a music player, which is a front end for mpd. +.LI +.ITEM +\f(CWMod+m\fP \(en ncmpcpp music player +.ITEM +\f(CWMod+.\fP \(en Next track +.ITEM +\f(CWMod+,\fP \(en Previous track +.ITEM +\f(CWMod+<\fP \(en Restart track +.ITEM +\f(CWMod+p\fP \(en Pause +.ITEM +\f(CWMod+M\fP \(en Mute all audio +.ITEM +\f(CWMod+-\fP \(en Decrease volume (holding shift increases amount) +.ITEM +\f(CWMod++\fP \(en Increase volume (holding shift increases amount) +.ITEM +\f(CWMod+[\fP \(en Back 10 seconds (holding shift increases amount) +.ITEM +\f(CWMod+]\fP \(en Forward 10 seconds (holding shift increases amount) +.ITEM +\f(CWMod+A\fP \(en pulsemixer (general volume sink/source control) +.LIST OFF +.HEADING 2 "Workspaces" +.PP +There are ten workspaces, active workspaces are highlighted in the top left. +.LI +.ITEM +\f(CWMod+(Number)\fP \(en Go to that number workspace +.ITEM +\f(CWMod+Shift+(Number)\fP \(en Send window to that workspace +.ITEM +\f(CWMod+Tab\fP \(en Go to previous workspace (may also use \f(CW\\\fP for Tab) +.ITEM +\f(CWMod+g\fP \(en Go to left workspace +.ITEM +\f(CWMod+;\fP \(en Go to right workspace +.LIST OFF +.HEADING 2 "Recording" +.PP +I use maim and ffmpeg to make different recordings of the desktop and audio. +All of these recording shortcuts will output into \f(CW~\fP, and will not overwrite +previous recordings as their names are based on their exact times. +.LI +.ITEM +\f(CWPrintScreen\fP \(en Take a screenshot +.ITEM +\f(CWShift+PrintScreen\fP \(en Select area to screenshot +.ITEM +\f(CWMod+PrintScreen\fP \(en Opens dmenu menu to select kind of audio/video recording +.ITEM +\f(CWMod+Delete\fP \(en Kills any recording started in the above way. +.ITEM +\f(CWMod+Shift+c\fP \(en Toggles a webcam in the bottom right for screencasting. +.ITEM +\f(CWMod+ScrollLock\fP \(en Toggle screenkey (if installed) to show keypresses +.LIST OFF +.HEADING 2 "Other buttons" +.PP +I've mapped those extra buttons that some keyboards have (play and pause +buttons, screen brightness, email, web browsing buttons, etc.) to what you +would expect. +.HEADING 1 "Configuration" +.PP +Dotfiles/settings files are located in \f(CW~/.config/\fP, note that dotfiles to programs not included in LARBS are there as well by requests of users. I do not necessarily maintain all these dotfiles, but they remain as legacy. +.PP +Suckless programs, st (the terminal) and dmenu among others do not have traditional config files, but have their source code location in \f(CW~/.local/src/\fP. +There you can modify their \f(CWconfig.h\fP files, then \f(CWsudo make install\fP to reinstall. +(You'll have to restart the program to see its effects obviously.) +.HEADING 1 "Frequently Asked Questions (FAQs)" +.HEADING 2 "My keyboard isn't working as expected!" +.PP +LARBS runs some custom keyboard settings in \f(CW~/.xinitrc\fP. +These settings may override your preferred settings, so you should open this file and comment out troublesome lines if you have issues. +.HEADING 2 "My audio isn't working!" +.PP +On fresh install, the Linux audio system (ALSA) often mutes outputs. +You may want to unbind +You may also need to set your preferred default output sink which you can do by the command line, or by selecting one with \f(CWpulsemixer\fP (\f(CWmod+A\fP). +.HEADING 2 "How do I copy and paste?" +.PP +Copying and pasting is always program-specific on any system. +In most graphical programs, copy and paste will be the same as they are on Windows: \f(CWctrl-c\fP and \f(CWctrl-v\fP. +In the Linux terminal, those binds have other more important purposes, so you can run \f(CWman st\fP to see how to copy and paste in my terminal build. +.PP +Additionally, I've set vim to use the clipboard as the default buffer, which means when you copy or delete something in vim, it will be in your system clipboard as well, so you can \f(CWctrl-v\fP it into your browser instance, etc. You can also paste material copied from other programs into vim with the typical vim bindings. +.HEADING 2 "How do I change the background/wallpaper?" +.PP +The system will always read the file \f(CW~/.config/wall.png\fP as the wallpaper. +The script \f(CWsetbg\fP, if run on an image will set it as the persistent background. +When using the file manager, you can simply hover over an image name and type \f(CWbg\fP and this will run \f(CWsetbg\fP. +.HEADING 2 "How I change the colorscheme?" +.PP +LARBS no longer deploys Xresource by default, but you can still add an \f(CW~/.Xdefaults\fP file and add color settings to change the theme of numerous programs, including the terminal. See +.PDF_WWW_LINK "https://wiki.archlinux.org/index.php/X_resources" "the Arch Wiki's article" +for more information. +.HEADING 2 "How do I set up my email?" +.PP +LARBS is automatically set up to be compatible with \f(CWmutt-wizard\fP, which is now in the AUR and can be installed by running \f(CWyay -S mutt-wizard-git\fP. +You can then add email accounts by running \f(CWmw add\fP. +.PP +Once you have successfully added your email address(es), you can open your mail with \f(CWneomutt\fP which is also bound to \f(CWMod+e\fP. +You can sync your mail by pressing \f(CWMod+F8\fP and you can set a cronjob to sync mail every several minutes by running \f(CWmw cron\fP. +.HEADING 2 "How do I set up my music?" +.PP +By default, mpd, the music daemon assumes that \f(CW~/Music\fP is your music directory. +This can be changed in \f(CW~/.config/mpd/mpd.conf\fP. +When you add music to your music folder, you may have to run \f(CWmpc up\fP in the terminal to update the database. +mpd is controlled by ncmpcpp, which is accessible by \f(CWMod+m\fP. +.HEADING 2 "How do I update LARBS?" +.PP +LARBS is deployed as a git repository in your home directory. +You can use it as such to fetch, diff and merge changes from the remote repository. +If you don't want to do that or don't know how to use git, you can actually just rerun the script (as root) and reinstall LARBS and it will automatically update an existing install if you select the same username. +This will overwrite the original config files though, including changes you made for them, but this is an easier brute force approach that will also install any new dependencies. +.HEADING 1 "Contact" +.LI +.ITEM +.PDF_WWW_LINK "mailto:luke@lukesmith.xyz" "luke@lukesmith.xyz" +\(en For questions! +.ITEM +.PDF_WWW_LINK "http://lukesmith.xyz" "https://lukesmith.xyz" +\(en For stalking! +.ITEM +.PDF_WWW_LINK "https://lukesmith.xyz/donate" "https://lukesmith.xyz/donate" +\(en To incentivize more development of LARBS! +.ITEM +.PDF_WWW_LINK "https://github.com/LukeSmithxyz" "My Github Page" +\(en For the code behind it! +.ITEM +.PDF_WWW_LINK "http://lukesmith.xyz/rss.xml" "RSS" +\(en For updates! +.LIST OFF diff --git a/.profile b/.profile index db1ad5b0..c1abe3fd 100644 --- a/.profile +++ b/.profile @@ -1,47 +1 @@ -# Profile file. Runs on login. Environmental variables are set here. - -# Adds `~/.local/bin` to $PATH -export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" - -# Default programs: -export EDITOR="nvim" -export TERMINAL="st" -export BROWSER="google-chrome-stable" -export READER="zathura" -export FILE="ranger" -export STATUSBAR="polybar" - -# Export XDG environmental variables from '~/.config/user-dirs.dirs' -eval "$(sed 's/^[^#].*/export &/g;t;d' ~/.config/user-dirs.dirs)" - -# ~/ Clean-up: -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_DATA_HOME="$HOME/.local/share" -export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" -export LESSHISTFILE="-" -export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" -export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/inputrc" -export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" -export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store" -export TMUX_TMPDIR="$XDG_RUNTIME_DIR" -export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" - -# Other program settings: -export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" -export FZF_DEFAULT_OPTS="--layout=reverse --height 40%" -export LESS=-R -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' '')" - -[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 - -# Start graphical server on tty1 if not already running. -[ "$(tty)" = "/dev/tty1" ] && ! pgrep -x Xorg >/dev/null && exec startx - -# Switch escape and caps if tty and no passwd required: -sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/dotfiles/ttymaps.kmap 2>/dev/null +.zprofile \ No newline at end of file diff --git a/.xinitrc b/.xinitrc index df60731b..6fefdaf0 100644 --- a/.xinitrc +++ b/.xinitrc @@ -1,15 +1 @@ -#!/bin/sh - -# xinitrc runs automatically when you run startx. - -# There are some small but important commands that need to be run when we start -# the graphical environment. Those commands reside in ~/.xprofile because that -# file runs automatically. - -[ -f ~/.xprofile ] && . ~/.xprofile -# [ -f ~/.profile ] && . ~/.profile - -# Log to file in $HOME for debugging: -#exec i3 -V >> $HOME/i3log-$(date +'%F-%k-%M-%S') 2>&1 -# else: -exec i3 +.config/xinitrc \ No newline at end of file diff --git a/.xprofile b/.xprofile index 680ee86f..c0008966 100644 --- a/.xprofile +++ b/.xprofile @@ -1,11 +1 @@ -#!/bin/sh - -# This file runs when a DM logs you into a graphical session. -# If you use startx/xinit like a Chad, this file will also be sourced. - -remaps & # run the remaps script, switching caps/esc and more; check it for more info -setbg & # set the background with the `setbg` script -xcompmgr & # xcompmgr for transparency -dunst & # dunst for notifications -xset r rate 300 50 & # Speed xrate up -unclutter & # Remove mouse when idle \ No newline at end of file +.config/xprofile \ No newline at end of file diff --git a/.zprofile b/.zprofile deleted file mode 120000 index aa7da3a9..00000000 --- a/.zprofile +++ /dev/null @@ -1 +0,0 @@ -.profile \ No newline at end of file diff --git a/.zprofile b/.zprofile new file mode 100644 index 00000000..20c9a821 --- /dev/null +++ b/.zprofile @@ -0,0 +1,126 @@ +#!/bin/zsh + +# zsh profile file. Runs on login. Environmental variables are set here. + +# If you don't plan on reverting to bash, you can remove the link in ~/.profile +# to clean up. + +# Adds `~/.local/bin` to $PATH +export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" + +# Default programs: +export EDITOR="nvim" +export TERMINAL="st" +export BROWSER="brave" +export READER="zathura" + +# ~/ Clean-up: +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" +#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs. +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 LESSHISTFILE="-" +export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" +export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/inputrc" +export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" +export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc" +#export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local/share}/wineprefixes/default" +export KODI_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/kodi" +export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store" +export TMUX_TMPDIR="$XDG_RUNTIME_DIR" +export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android" +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" + +# Other program settings: +export DICS="/usr/share/stardict/dic/" +export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" +export FZF_DEFAULT_OPTS="--layout=reverse --height 40%" +export LESS=-R +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 LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null" +export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. +export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads. +export _JAVA_AWT_WM_NONREPARENTING=1 # Java doesn't understand tiling windows +export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname + +# This is the list for lf icons: +export LF_ICONS="di=📁:\ +fi=📃:\ +tw=🤝:\ +ow=📂:\ +ln=⛓:\ +or=❌:\ +ex=🎯:\ +*.txt=✍:\ +*.mom=✍:\ +*.me=✍:\ +*.ms=✍:\ +*.png=🖼:\ +*.ico=🖼:\ +*.jpg=📸:\ +*.jpeg=📸:\ +*.gif=🖼:\ +*.svg=🗺:\ +*.xcf=🖌:\ +*.html=🌎:\ +*.xml=📰:\ +*.gpg=🔒:\ +*.css=🎨:\ +*.pdf=📚:\ +*.djvu=📚:\ +*.epub=📚:\ +*.csv=📓:\ +*.xlsx=📓:\ +*.tex=📜:\ +*.md=📘:\ +*.r=📊:\ +*.R=📊:\ +*.rmd=📊:\ +*.Rmd=📊:\ +*.mp3=🎵:\ +*.opus=🎵:\ +*.ogg=🎵:\ +*.m4a=🎵:\ +*.flac=🎼:\ +*.mkv=🎥:\ +*.mp4=🎥:\ +*.webm=🎥:\ +*.mpeg=🎥:\ +*.avi=🎥:\ +*.zip=📦:\ +*.rar=📦:\ +*.7z=📦:\ +*.tar.gz=📦:\ +*.z64=🎮:\ +*.v64=🎮:\ +*.n64=🎮:\ +*.1=ℹ:\ +*.nfo=ℹ:\ +*.info=ℹ:\ +*.log=📙:\ +*.iso=📀:\ +*.img=📀:\ +*.bib=🎓:\ +*.ged=👪:\ +*.part=💔:\ +*.torrent=🔽:\ +" + +[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 & + +# Start graphical server on tty1 if not already running. +[ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx + +# Switch escape and caps if tty and no passwd required: +sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/ttymaps.kmap 2>/dev/null