diff --git a/.asoundrc b/.asoundrc deleted file mode 100644 index 38722f08..00000000 --- a/.asoundrc +++ /dev/null @@ -1,21 +0,0 @@ -# Find and use input "Microphone" for input -pcm.usb -{ - type hw - card Microphone -} -pcm.!default -{ - type asym - playback.pcm - { - # Use the dmix plug to allow multiple outputs. - type plug - slave.pcm "dmix" - } - capture.pcm - { - type plug - slave.pcm "usb" - } -} diff --git a/.cache/bg b/.cache/bg deleted file mode 120000 index 787af6fd..00000000 --- a/.cache/bg +++ /dev/null @@ -1 +0,0 @@ -../.config/wall.png \ No newline at end of file diff --git a/.config/aliasrc b/.config/aliasrc index e07ee7a8..468483ac 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" \ yt="youtube-dl --add-metadata -i" \ yta="yt -x -f bestaudio/best" \ @@ -34,13 +33,11 @@ alias \ p="sudo pacman" \ xi="sudo xbps-install" \ xr="sudo xbps-remove -R" \ - xq="xbps-query" + xq="xbps-query" \ + z="zathura" -# This alias is important. It enables the `pauseallmpv` command. -alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)" - -# Some other stuff alias \ magit="nvim -c MagitOnly" \ - ref="shortcuts >/dev/null; source ~/.config/shortcutrc" \ - weath="less -S ~/.local/share/weatherreport" \ + ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" \ + weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \ + tmux="tmux -f ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf" \ diff --git a/.config/directories b/.config/directories index 24bdd218..879219c8 100644 --- a/.config/directories +++ b/.config/directories @@ -5,6 +5,7 @@ D ~/Downloads m ~/Music pp ~/Pictures vv ~/Videos -cf ~/.config -sc ~/.local/bin +cf ${XDG_CONFIG_HOME:-$HOME/.config} +cac ${XDG_CACHE_HOME:-$HOME/.cache} +sc ~/.local/bin mn /mnt diff --git a/.config/files b/.config/files index b34f1849..235762fe 100644 --- a/.config/files +++ b/.config/files @@ -1,15 +1,16 @@ -bf ~/.config/files -bd ~/.config/directories -bw ~/.config/bookmarks -cfa ~/.config/aliasrc +bf ${XDG_CONFIG_HOME:-$HOME/.config}/files +bd ${XDG_CONFIG_HOME:-$HOME/.config}/directories +bw ${XDG_CONFIG_HOME:-$HOME/.config}/bookmarks +cfa ${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc cfz $ZDOTDIR/.zshrc -cfv ~/.config/nvim/init.vim -cfm ~/.config/mutt/muttrc -cfd ~/.Xdefaults -cfu ~/.config/newsboat/urls -cfn ~/.config/newsboat/config -cfmb ~/.config/ncmpcpp/bindings -cfmc ~/.config/ncmpcpp/config -cfk ~/.config/sxhkd/sxhkdrc -cfi ~/.config/i3/config -cfb ~/.config/i3blocks/config +cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim +cft ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/.tmux.conf +cfm ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc +cfx ${XDG_CONFIG_HOME:-$HOME/.config}/Xresources +cfu ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls +cfn ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config +cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings +cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config +cfk ${XDG_CONFIG_HOME:-$HOME/.config}/sxhkd/sxhkdrc +cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config +cfb ${XDG_CONFIG_HOME:-$HOME/.config}/i3blocks/config diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf index cc435d5e..2d58803c 100755 --- a/.config/fontconfig/fonts.conf +++ b/.config/fontconfig/fonts.conf @@ -28,10 +28,8 @@ monospace + Noto Sans Mono Liberation Mono - Inconsolata - Joy Pixels - Noto Color Emoji diff --git a/.config/i3/config b/.config/i3/config index a22fe8ec..ed7e7a59 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -59,7 +59,7 @@ bindsym $mod+grave exec --no-startup-id dmenuunicode ##bindsym $mod+asciitilde #STOP/HIDE EVERYTHING: -bindsym $mod+Shift+Delete exec --no-startup-id lmc mute ; exec --no-startup-id mpc pause && pkill -RTMIN+10 i3blocks ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e lf +bindsym $mod+Shift+Delete exec --no-startup-id pulsemixer --mute ; exec --no-startup-id mpc pause && pkill -RTMIN+10 i3blocks ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e lf # Show selection: bindsym $mod+Insert exec --no-startup-id showclip @@ -97,7 +97,7 @@ bindsym $mod+p exec --no-startup-id mpc toggle bindsym $mod+Shift+p exec --no-startup-id mpc pause bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24 -bindsym $mod+Shift+a exec $term -e alsamixer +bindsym $mod+Shift+a exec $term -e pulsemixer bindsym $mod+s gaps inner current plus 5 bindsym $mod+Shift+s gaps inner current minus 5 @@ -134,7 +134,7 @@ bindsym $mod+Ctrl+l move workspace to output right bindsym $mod+z gaps outer current plus 5 bindsym $mod+Shift+z gaps outer current minus 5 -bindsym $mod+x exec --no-startup-id mpc pause; exec --no-startup-id pauseallmpv ; exec --no-startup-id i3lock -e -f -c 1d2021 ; exec --no-startup-id xset dpms force off +bindsym $mod+x exec --no-startup-id xset dpms force off && mpc pause && pauseallmpv && slock & bindsym $mod+Shift+x exec --no-startup-id prompt "Shutdown computer?" "$shutdown" bindsym $mod+c exec --no-startup-id cabl @@ -150,7 +150,7 @@ bindsym $mod+n exec $term -e newsboat && pkill -RTMIN+6 i3blocks bindsym $mod+Shift+n floating toggle; sticky toggle; exec --no-startup-id hover right bindsym $mod+m exec --no-startup-id $term -e ncmpcpp -bindsym $mod+Shift+m exec --no-startup-id lmc toggle +bindsym $mod+Shift+m exec --no-startup-id pulsemixer --toggle-mute && pkill -RTMIN+10 i3blocks # #---Workspace Bindings---# # bindsym $mod+Home workspace $ws1 @@ -222,7 +222,7 @@ for_window [title="mpvfloat"] border pixel 0 no_focus [title="mpvfloat"] # #---Function Buttons---# # -bindsym $mod+F1 exec --no-startup-id groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - +bindsym $mod+F1 exec --no-startup-id groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - bindsym $mod+F2 restart bindsym $mod+F3 exec --no-startup-id displayselect bindsym $mod+F4 exec --no-startup-id prompt "Hibernate computer?" "$hibernate" @@ -252,10 +252,10 @@ bindsym $mod+Ctrl+Right move workspace to output right # #---Media Keys---# # # Volume keys -bindsym $mod+plus exec --no-startup-id lmc up -bindsym $mod+Shift+plus exec --no-startup-id lmc up 15 -bindsym $mod+minus exec --no-startup-id lmc down -bindsym $mod+Shift+minus exec --no-startup-id lmc down 15 +bindsym $mod+plus exec --no-startup-id pulsemixer --change-volume +5 && pkill -RTMIN+10 i3blocks +bindsym $mod+Shift+plus exec --no-startup-id pulsemixer --change-volume +15 && pkill -RTMIN+10 i3blocks +bindsym $mod+minus exec --no-startup-id pulsemixer --change-volume -5 && pkill -RTMIN+10 i3blocks +bindsym $mod+Shift+minus exec --no-startup-id pulsemixer --change-volume -15 && pkill -RTMIN+10 i3blocks bindsym $mod+less exec --no-startup-id mpc prev bindsym $mod+Shift+less exec --no-startup-id mpc seek 0% bindsym $mod+greater exec --no-startup-id mpc next @@ -276,13 +276,13 @@ bindsym $mod+Delete exec $stoprec bindsym XF86Launch1 exec --no-startup-id xset dpms force off # #---Extra XF86 Keys---# # -bindsym XF86AudioMute exec --no-startup-id lmc toggle -bindsym XF86AudioLowerVolume exec --no-startup-id lmc down -bindsym Shift+XF86AudioLowerVolume exec --no-startup-id lmc down 10 -bindsym Control+XF86AudioLowerVolume exec --no-startup-id lmc down 1 -bindsym XF86AudioRaiseVolume exec --no-startup-id lmc up -bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id lmc up 10 -bindsym Control+XF86AudioRaiseVolume exec --no-startup-id lmc up 1 +bindsym XF86AudioMute exec --no-startup-id pulsemixer --toggle-mute && pkill -RTMIN+10 i3blocks +bindsym XF86AudioLowerVolume exec --no-startup-id pulsemixer --change-volume -5 && pkill -RTMIN+10 i3blocks +bindsym Shift+XF86AudioLowerVolume exec --no-startup-id pulsemixer --change-volume -10 && pkill -RTMIN+10 i3blocks +bindsym Control+XF86AudioLowerVolume exec --no-startup-id pulsemixer --change-volume -1 && pkill -RTMIN+10 i3blocks +bindsym XF86AudioRaiseVolume exec --no-startup-id pulsemixer --change-volume +5 && pkill -RTMIN+10 i3blocks +bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id pulsemixer --change-volume +10 && pkill -RTMIN+10 i3blocks +bindsym Control+XF86AudioRaiseVolume exec --no-startup-id pulsemixer --change-volume +1 && pkill -RTMIN+10 i3blocks bindsym XF86PowerOff exec --no-startup-id prompt "Shutdown computer?" "$shutdown" ##bindsym XF86Copy exec ##bindsym XF86Open exec diff --git a/.config/i3blocks/config b/.config/i3blocks/config index e4626545..e83de5a0 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -37,11 +37,9 @@ signal=12 #[memory] #interval=30 -#label=🧠 #[cpu] #interval=15 -#label=💻 [volume] interval=once @@ -53,7 +51,7 @@ signal=10 #[disk] #interval=60 -#command=disk /home 🏠 +#command=disk /home [battery] command=battery BAT0 @@ -66,5 +64,5 @@ interval=30 [internet] interval=10 -[help] +[help-icon] interval=once diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 27900a1d..e3c72730 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -1,31 +1,36 @@ # Luke's lf settings # Basic vars -set shell sh -set previewer ~/.config/lf/scope +set shell bash set shellopts '-eu' set ifs "\n" set scrolloff 10 set color256 -set icons # Enable icons. Requires nerd fonts and LF_ICONS variable. +set icons +set period 1 + +# Vars that depend on environmental variables +$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope" # cmds/functions cmd open ${{ case $(file --mime-type $f -b) in + image/vnd.djvu|application/pdf|application/octet-stream) setsid zathura $fx >/dev/null 2>&1 & ;; text/troff) man ./ $f;; text/*) $EDITOR $fx;; image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;; - image/*) rotdir $f | setsid sxiv -aio 2>/dev/null | lf-select & ;; - audio/*) mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f ;; - video/*) setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f -quiet >/dev/null 2>&1 & ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\)\(_large\)*$" | setsid sxiv -aio 2>/dev/null | lf-select & ;; + audio/*) mpv $f ;; + video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;; application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;; *) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;; esac }} -cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1 +cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold set -f printf "%s\n\t" "$fx" printf "delete?[y/N]" @@ -34,17 +39,19 @@ cmd delete ${{ }} cmd moveto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Move to where?" - dest="$(cut -d' ' -f2- ~/.config/directories | fzf)" && + dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && eval mv -iv $fx $dest && notify-send "🚚 File(s) moved." "File(s) moved to $dest." }} cmd copyto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Copy to where?" - dest="$(cut -d' ' -f2- ~/.config/directories | fzf)" && + dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && eval cp -ivr $fx $dest && notify-send "📋 File(s) copied." "File(s) copies to $dest." }} @@ -54,21 +61,28 @@ cmd bulkrename ${{ }} # Bindings -map c $lf -remote "send $id cd $(cut -d' ' -f2 ~/.config/directories | fzf)" map $lf -remote "send $id select '$(fzf)'" -map J $lf -remote "send $id cd $(cut -d' ' -f2 ~/.config/directories | fzf)" +map J $lf -remote "send $id cd $(cut -d' ' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" map gh map g top map D delete map C copyto map M moveto -map a push %mkdir -map r push :rename -map R $lf -remote "send $id push :rename$f" -map b bulkrename +map push :mkdir map reload map shell map x $$f map X !$f -map o &mimeopen "$f" -map O $mimeopen --ask "$f" +map o &mimeopen $f +map O $mimeopen --ask $f + +map A rename # at the very end +map c push A # new rename +map I push A # at the very beginning +map i push A # before extention +map a push A # after extention +map b bulkrename + +map down +map up +map V push :!nvim diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index a0548ecd..bf329d61 100644 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -1,26 +1,21 @@ -db_file "~/.config/mpd/database" -log_file "~/.config/mpd/log" -music_directory "~/Music" -playlist_directory "~/.config/mpd/playlists" -pid_file "~/.config/mpd/pid" -state_file "~/.config/mpd/state" -sticker_file "~/.config/mpd/sticker.sql" +music_directory "~/Music" +playlist_directory "~/.config/mpd/playlists" auto_update "yes" - bind_to_address "127.0.0.1" restore_paused "yes" max_output_buffer_size "16384" audio_output { - type "alsa" - name "alsa for audio soundcard" - mixer_type "software" + type "pulse" + name "pulse" + #type "alsa" + #name "ALSA" } audio_output { -type "fifo" -name "toggle_visualizer" -path "/tmp/mpd.fifo" -format "44100:16:2" + type "fifo" + name "Visualizer feed" + path "/tmp/mpd.fifo" + format "44100:16:2" } diff --git a/.config/mpv/scripts/modules.lua b/.config/mpv/scripts/modules.lua new file mode 100644 index 00000000..37b69b30 --- /dev/null +++ b/.config/mpv/scripts/modules.lua @@ -0,0 +1,3 @@ +local mpv_scripts_dir_path = os.getenv("HOME") .. "/.config/mpv/scripts/" +function load(relative_path) dofile(mpv_scripts_dir_path .. relative_path) end +load("mpvSockets/mpvSockets.lua") diff --git a/.config/mpv/scripts/mpvSockets b/.config/mpv/scripts/mpvSockets new file mode 160000 index 00000000..8415a08d --- /dev/null +++ b/.config/mpv/scripts/mpvSockets @@ -0,0 +1 @@ +Subproject commit 8415a08d99a46213c918613cfe1e088071018db9 diff --git a/.config/ncmpcpp/config b/.config/ncmpcpp/config index 2c9eda4c..36324960 100644 --- a/.config/ncmpcpp/config +++ b/.config/ncmpcpp/config @@ -1,537 +1,32 @@ -############################################################################## -## This is the example configuration file. Copy it to $HOME/.ncmpcpp/config ## -## or $XDG_CONFIG_HOME/ncmpcpp/config and set up your preferences. ## -############################################################################## -# -ncmpcpp_directory = ~/.config/ncmpcpp -# -## -## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other -## MPD clients (eg. ncmpc) also use that location. -## -# -lyrics_directory = ~/.local/share/lyrics -# -##### connection settings ##### -# -#mpd_host = localhost -# -#mpd_port = 6600 -# -#mpd_connection_timeout = 5 -# -## Needed for tag editor and file operations to work. -## +# vim: filetype=conf + +ncmpcpp_directory = "~/.config/ncmpcpp" +lyrics_directory = "~/.local/share/lyrics" mpd_music_dir = "~/Music" -# -#mpd_crossfade_time = 5 -# -##### music visualizer ##### -## -## Note: In order to make music visualizer work you'll need to use mpd fifo -## output, whose format parameter has to be set to 44100:16:1 for mono -## visualization or 44100:16:2 for stereo visualization. Example configuration -## (it has to be put into mpd.conf): -## -## audio_output { -## type "fifo" -## name "Visualizer feed" -## path "/tmp/mpd.fifo" -## format "44100:16:2" -## } -## -# -#visualizer_fifo_path = /tmp/mpd.fifo -# -## -## Note: Below parameter is needed for ncmpcpp to determine which output -## provides data for visualizer and thus allow syncing between visualization and -## sound as currently there are some problems with it. -## -# -#visualizer_output_name = Visualizer feed -# -## -## If you set format to 44100:16:2, make it 'yes'. -## -#visualizer_in_stereo = yes -# -## -## Note: Below parameter defines how often ncmpcpp has to "synchronize" -## visualizer and audio outputs. 30 seconds is optimal value, but if you -## experience synchronization problems, set it to lower value. Keep in mind -## that sane values start with >=10. -## -# -#visualizer_sync_interval = 30 -# -## -## Note: To enable spectrum frequency visualization you need to compile ncmpcpp -## with fftw3 support. -## -# -## Available values: spectrum, wave, wave_filled, ellipse. -## -visualizer_type = spectrum -# -#visualizer_look = ●卐 -#visualizer_look = 卐 -# -#visualizer_color = blue, cyan, green, yellow, magenta, red -# -## Alternative subset of 256 colors for terminals that support it. -## -#visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161 -# -##### system encoding ##### -## -## ncmpcpp should detect your charset encoding but if it failed to do so, you -## can specify charset encoding you are using here. -## -## Note: You can see whether your ncmpcpp build supports charset detection by -## checking output of `ncmpcpp --version`. -## -## Note: Since MPD uses UTF-8 by default, setting this option makes sense only -## if your encoding is different. -## -# -#system_encoding = "" -# -##### delays ##### -# -## Time of inactivity (in seconds) after playlist highlighting will be disabled -## (0 = always on). -## -#playlist_disable_highlight_delay = 5 -# -## Defines how long messages are supposed to be visible. -## -message_delay_time = 1 -# -##### song format ##### -## -## For a song format you can use: -## -## %l - length -## %f - filename -## %D - directory -## %a - artist -## %A - album artist -## %t - title -## %b - album -## %y - date -## %n - track number (01/12 -> 01) -## %N - full track info (01/12 -> 01/12) -## %g - genre -## %c - composer -## %p - performer -## %d - disc -## %C - comment -## %P - priority -## $R - begin right alignment -## -## If you want to make sure that a part of the format is displayed only when -## certain tags are present, you can archieve it by grouping them with brackets, -## e.g. '{%a - %t}' will be evaluated to 'ARTIST - TITLE' if both tags are -## present or '' otherwise. It is also possible to define a list of -## alternatives by providing several groups and separating them with '|', -## e.g. '{%t}|{%f}' will be evaluated to 'TITLE' or 'FILENAME' if the former is -## not present. -## -## Note: If you want to set limit on maximal length of a tag, just put the -## appropriate number between % and character that defines tag type, e.g. to -## make album take max. 20 terminal cells, use '%20b'. -## -## In addition, formats support markers used for text attributes. They are -## followed by character '$'. After that you can put: -## -## - 0 - default window color (discards all other colors) -## - 1 - black -## - 2 - red -## - 3 - green -## - 4 - yellow -## - 5 - blue -## - 6 - magenta -## - 7 - cyan -## - 8 - white -## - 9 - end of current color -## - b - bold text -## - u - underline text -## - r - reverse colors -## - a - use alternative character set -## -## If you don't want to use a non-color attribute anymore, just put it again, -## but this time insert character '/' between '$' and attribute character, -## e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag or filename with -## reversed colors. -## -## If you want to use 256 colors and/or background colors in formats (the naming -## scheme is described below in section about color definitions), it can be done -## with the syntax $(COLOR), e.g. to set the artist tag to one of the -## non-standard colors and make it have yellow background, you need to write -## $(197_yellow)%a$(end). Note that for standard colors this is interchangable -## with attributes listed above. -## -## Note: colors can be nested. -## -# +message_delay_time = "1" +visualizer_type = "spectrum" song_list_format = {$4%a - }{%t}|{$8%f$9}$R{$3(%l)$9} -# song_status_format = $b{{$8"%t"}} $3by {$4%a{ $3in $7%b{ (%y)}} $3}|{$8%f} -# song_library_format = {%n - }{%t}|{%f} -# alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b -# alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D} -# current_item_prefix = $(cyan)$r$b -# current_item_suffix = $/r$(end)$/b -# current_item_inactive_column_prefix = $(magenta)$r -# current_item_inactive_column_suffix = $/r$(end) -# -#now_playing_prefix = $b -# -#now_playing_suffix = $/b -# -#browser_playlist_prefix = "$2playlist$9 " -# -#selected_item_prefix = $6 -# -#selected_item_suffix = $9 -# -#modified_item_prefix = $3> $9 -# -## -## Note: attributes are not supported for the following variables. -## -#song_window_title_format = {%a - }{%t}|{%f} -## -## Note: Below variables are used for sorting songs in browser. The sort mode -## determines how songs are sorted, and can be used in combination with a sort -## format to specify a custom sorting format. Available values for -## browser_sort_mode are "name", "mtime", "format" and "noop". -## -# -#browser_sort_mode = name -# -#browser_sort_format = {%a - }{%t}|{%f} {(%l)} -# -##### columns settings ##### -## -## syntax of song columns list format is "column column etc." -## -## - syntax for each column is: -## -## (width of the column)[color of the column]{displayed tag} -## -## Note: Width is by default in %, if you want a column to have fixed size, add -## 'f' after the value, e.g. (10)[white]{a} will be the column that take 10% of -## screen (so the real width will depend on actual screen size), whereas -## (10f)[white]{a} will take 10 terminal cells, no matter how wide the screen -## is. -## -## - color is optional (if you want the default one, leave the field empty). -## -## Note: You can give a column additional attributes by putting appropriate -## character after displayed tag character. Available attributes are: -## -## - r - column will be right aligned -## - E - if tag is empty, empty tag marker won't be displayed -## -## You can also: -## -## - give a column custom name by putting it after attributes, separated with -## character ':', e.g. {lr:Length} gives you right aligned column of lengths -## named "Length". -## -## - define sequence of tags, that have to be displayed in case predecessor is -## empty in a way similar to the one in classic song format, i.e. using '|' -## character, e.g. {a|c|p:Owner} creates column named "Owner" that tries to -## display artist tag and then composer and performer if previous ones are not -## available. -## -# -#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l} -# -##### various settings ##### -# -## -## Note: Custom command that will be executed each time song changes. Useful for -## notifications etc. -## -#execute_on_song_change = "" -# -## -## Note: Custom command that will be executed each time player state -## changes. The environment variable MPD_PLAYER_STATE is set to the current -## state (either unknown, play, pause, or stop) for its duration. -## -# -#execute_on_player_state_change = "" -# -#playlist_show_mpd_host = no -# -#playlist_show_remaining_time = no -# -#playlist_shorten_total_times = no -# -#playlist_separate_albums = no -# -## -## Note: Possible display modes: classic, columns. -## playlist_display_mode = columns -# browser_display_mode = columns -# -#search_engine_display_mode = classic -# -#playlist_editor_display_mode = classic -# -#discard_colors_if_item_is_selected = yes -# -#show_duplicate_tags = true -# -#incremental_seeking = yes -# -#seek_time = 1 -# -#volume_change_step = 2 -# -#autocenter_mode = no -# -#centered_cursor = no -# -## -## Note: You can specify third character which will be used to build 'empty' -## part of progressbar. -## progressbar_look = -> -# -## Available values: database, playlist. -## -#default_place_to_search_in = database -# -## Available values: classic, alternative. -## -#user_interface = classic -# -#data_fetching_delay = yes -# -## Available values: artist, album_artist, date, genre, composer, performer. -## media_library_primary_tag = album_artist -# media_library_albums_split_by_date = no -# -## Available values: wrapped, normal. -## -#default_find_mode = wrapped -# -#default_tag_editor_pattern = %n - %t -# -#header_visibility = yes -# -#statusbar_visibility = yes -# -#titles_visibility = yes -# -#header_text_scrolling = yes -# -#cyclic_scrolling = no -# -#lines_scrolled = 2 -# -#lyrics_fetchers = lyricwiki, azlyrics, genius, sing365, lyricsmania, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, internet -# -#follow_now_playing_lyrics = no -# -#fetch_lyrics_for_current_song_in_background = no -# -#store_lyrics_in_song_dir = no -# -#generate_win32_compatible_filenames = yes -# -#allow_for_physical_item_deletion = no -# -## -## Note: If you set this variable, ncmpcpp will try to get info from last.fm in -## language you set and if it fails, it will fall back to english. Otherwise it -## will use english the first time. -## -## Note: Language has to be expressed as an ISO 639 alpha-2 code. -## -#lastfm_preferred_language = en -# -#space_add_mode = add_remove -# -#show_hidden_files_in_local_browser = no -# -## -## How shall screen switcher work? -## -## - "previous" - switch between the current and previous screen. -## - "screen1,...,screenN" - switch between given sequence of screens. -## -## Screens available for use: help, playlist, browser, search_engine, -## media_library, playlist_editor, tag_editor, outputs, visualizer, clock, -## lyrics, last_fm. -## -#screen_switcher_mode = playlist, browser -# -## -## Note: You can define startup screen by choosing screen from the list above. -## -startup_screen = media_library -# -## -## Note: You can define startup slave screen by choosing screen from the list -## above or an empty value for no slave screen. -## -#startup_slave_screen = "" -# -#startup_slave_screen_focus = no -# -## -## Default width of locked screen (in %). Acceptable values are from 20 to 80. -## -# -#locked_screen_width_part = 50 -# -#ask_for_locked_screen_width_part = yes -# -#jump_to_now_playing_song_at_start = yes -# -#ask_before_clearing_playlists = yes -# -#clock_display_seconds = no -# +startup_screen = "media_library" display_volume_level = no -# -#display_bitrate = no -# -#display_remaining_time = no -# -## Available values: none, basic, extended, perl. -## -#regular_expressions = perl -# -## -## Note: if below is enabled, ncmpcpp will ignore leading "The" word while -## sorting items in browser, tags in media library, etc. -## ignore_leading_the = yes -# -## -## Note: if below is enabled, ncmpcpp will ignore diacritics while searching and -## filtering lists. This takes an effect only if boost was compiled with ICU -## support. -## -#ignore_diacritics = no -# -#block_search_constraints_change_if_items_found = yes -# -#mouse_support = yes -# -#mouse_list_scroll_whole_page = yes -# -#empty_tag_marker = -# -#tags_separator = " | " -# -#tag_editor_extended_numeration = no -# -#media_library_sort_by_mtime = no -# -#enable_window_title = yes -# -## -## Note: You can choose default search mode for search engine. Available modes -## are: -## -## - 1 - use mpd built-in searching (no regexes, pattern matching) -## -## - 2 - use ncmpcpp searching (pattern matching with support for regexes, but -## if your mpd is on a remote machine, downloading big database to process -## it can take a while -## -## - 3 - match only exact values (this mode uses mpd function for searching in -## database and local one for searching in current playlist) -## -# -#search_engine_default_search_mode = 1 -# -external_editor = vim -# -## Note: set to yes if external editor is a console application. -## +external_editor = nvim use_console_editor = yes -# -##### colors definitions ##### -## -## It is possible to set a background color by setting a color value -## "_", e.g. red_black will set foregound color to red -## and background color to black. -## -## In addition, for terminals that support 256 colors it is possible to set one -## of them by using a number in range [1, 256] instead of color name, -## e.g. numerical value corresponding to red_black is 2_1. To find out if the -## terminal supports 256 colors, run ncmpcpp and check out the bottom of the -## help screen for list of available colors and their numerical values. -## -## What is more, there are two special values for the background color: -## "transparent" and "current". The first one explicitly sets the background to -## be transparent, while the second one allows you to preserve current -## background color and change only the foreground one. It's used implicitly -## when background color is not specified. -## -## Moreover, it is possible to attach format information to selected color -## variables by appending to their end a colon followed by one or more format -## flags, e.g. black:b or red:ur. The following variables support this syntax: -## visualizer_color, color1, color2, empty_tag_color, volume_color, -## state_line_color, state_flags_color, progressbar_color, -## progressbar_elapsed_color, player_state_color, statusbar_time_color, -## alternative_ui_separator_color. -## -## Note: due to technical limitations of older ncurses version, if 256 colors -## are used there is a possibility that you'll be able to use only colors with -## transparent background. -# -#colors_enabled = yes -# empty_tag_color = magenta -# -#header_window_color = magenta -# -#volume_color = default -# -#state_line_color = default -# -#state_flags_color = default:b -# main_window_color = white -# -#color1 = white -# -#color2 = green -# progressbar_color = black:b -# progressbar_elapsed_color = blue:b -# statusbar_color = red -# statusbar_time_color = cyan:b -# -#player_state_color = default:b -# -#alternative_ui_separator_color = black:b -# -#window_border_color = green -# -#active_window_border = red -# diff --git a/.config/newsboat/config b/.config/newsboat/config index 5366202f..3da9b5ea 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -27,13 +27,26 @@ color listfocus black yellow standout bold color listnormal_unread blue default color listfocus_unread yellow default bold color info red black bold -color article cyan default +color article white default bold browser linkhandler macro , open-in-browser -macro t set browser "tsp youtube-dl --add-metadata -ic"; open-in-browser ; set browser linkhandler +macro t set browser "qndl"; open-in-browser ; set browser linkhandler macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser linkhandler macro v set browser "setsid nohup mpv"; open-in-browser ; set browser linkhandler -macro w set browser "w3m"; open-in-browser ; set browser linkhandler +macro w set browser "lynx"; open-in-browser ; set browser linkhandler macro p set browser "dmenuhandler"; open-in-browser ; set browser linkhandler macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler + +highlight all "---.*---" yellow +highlight feedlist ".*(0/0))" black +highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold +highlight article "(^Link:.*|^Date:.*)" default default +highlight article "https?://[^ ]+" green default +highlight article "^(Title):.*$" blue default +highlight article "\\[[0-9][0-9]*\\]" magenta default bold +highlight article "\\[image\\ [0-9]+\\]" green default bold +highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold +highlight article ":.*\\(link\\)$" cyan default +highlight article ":.*\\(image\\)$" blue default +highlight article ":.*\\(embedded flash\\)$" magenta default diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index d8b0ba20..48635a4a 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,15 +1,15 @@ let mapleader ="," -if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) +if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ~/.config/nvim/autoload/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim + silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ + silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim autocmd VimEnter * PlugInstall endif -call plug#begin('~/.config/nvim/plugged') +call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) 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 " vimling: nm d :call ToggleDeadKeys() @@ -103,8 +109,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/commands.py b/.config/ranger/commands.py index 71fd2a24..c1c74193 100755 --- a/.config/ranger/commands.py +++ b/.config/ranger/commands.py @@ -38,7 +38,7 @@ class my_edit(Command): # reference to the currently selected file. target_filename = self.fm.thisfile.path - # This is a generic function to print text in ranger. + # This is a generic function to print text in ranger. self.fm.notify("Let's edit the file " + target_filename + "!") # Using bad=True in fm.notify allows you to print error messages: diff --git a/.config/ranger/luke_ranger_readme.md b/.config/ranger/luke_ranger_readme.md index 51c5dd10..45111514 100644 --- a/.config/ranger/luke_ranger_readme.md +++ b/.config/ranger/luke_ranger_readme.md @@ -60,7 +60,7 @@ Press any "verb" followed by any "argument" to perform a folder operation. "gd" + Txs -- copy slideshow/beamer template to new file + Txh -- copy handout template to new file + Image commands: - + bg -- (for i3 users) makes an image your background (assuming i3 is looking at ~/.config/wall.png for your background) + + bg -- makes an image your background (assuming i3 is looking at ~/.local/share/bg for your background) + bw -- runs Pywal on the selected image, making it your background and generating a color scheme based off of it. + C -- rotates an image (requires imagemagick) + F -- flips an image (requires imagemagick) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 89b4b8c2..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 ~/.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 ~/.config/ranger/shortcuts.conf + +eval cmd('source ' + fm.confpath('shortcuts.conf')) diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index 97410d99..8f661b2a 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -101,7 +101,7 @@ ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" ext nes, has fceux, X = fceux "$1" ext exe = wine "$1" name ^[mM]akefile$ = make -ext asf, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" +ext asf, has mpv, X, flag f = mpv -- "$@" #-------------------------------------------- # Code @@ -118,11 +118,11 @@ ext php = php -- "$1" #------------------------------------------- mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" mime ^video|audio, has smplayer, X, flag f = smplayer "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-video -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --fs -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --loop -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --title="obs" --autofit=1050x700 -- "$@" +mime ^video, has mpv, X, flag f = mpv -- "$@" +mime ^video, has mpv, X, flag f = mpv --no-video -- "$@" +mime ^video, has mpv, X, flag f = mpv --fs -- "$@" +mime ^video, has mpv, X, flag f = mpv --loop -- "$@" +mime ^video, has mpv, X, flag f = mpv --title="obs" --autofit=1050x700 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" mime ^video, has mplayer, X, flag f = mplayer -- "$@" @@ -135,16 +135,16 @@ mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" #------------------------------------------- mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" -mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-audio-display -- "$@" +mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" mime ^audio|ogg$ = tag "$@" -mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" +mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" ext midi?, terminal, has wildmidi = wildmidi -- "$@" #-------------------------------------------- # Video without X: #------------------------------------------- -mime ^video, terminal, !X, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" +mime ^video, terminal, !X, has mpv = mpv -- "$@" mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" mime ^video, terminal, !X, has mplayer = mplayer -- "$@" diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 0b05a3df..1f37d24f 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -15,7 +15,7 @@ super + d super + r $TERMINAL -e $FILE super + e - $TERMINAL -e neomutt; pkill -RTMIN+12 $STATUSBAR + $TERMINAL -e neomutt; pkill -RTMIN+12 blocks super + m $TERMINAL -e ncmpcpp super + n @@ -25,7 +25,7 @@ super + c super + v $TERMINAL -e nvim -c VimwikiIndex super + shift + a - $TERMINAL -e alsamixer; pkill -RTMIN+10 $STATUSBAR + $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 @@ -93,18 +93,18 @@ super + {_,shift +} bracketleft mpc seek -{10,120} # Increase volume super + {equal,plus} - amixer sset Master {5,15}%+; pkill -RTMIN+10 $STATUSBAR + amixer sset Master {5,15}%+; pkill -RTMIN+10 blocks # Decrease volume super {_,shift +} + minus - amixer sset Master {5,15}%-; pkill -RTMIN+10 $STATUSBAR + amixer sset Master {5,15}%-; pkill -RTMIN+10 blocks super + shift + m - amixer sset Master toggle; pkill -RTMIN+10 $STATUSBAR + amixer sset Master toggle; pkill -RTMIN+10 blocks # Audiokeys XF86AudioMute - amixer sset Master toggle; pkill -RTMIN+10 $STATUSBAR + amixer sset Master toggle; pkill -RTMIN+10 blocks XF86Audio{Raise,Lower}Volume - amixer sset Master 5%{+,-}; pkill -RTMIN+10 $STATUSBAR + amixer sset Master 5%{+,-}; pkill -RTMIN+10 blocks XF86Audio{Next,Prev} mpc {next,prev} XF86Audio{Pause,Play,Stop} @@ -137,10 +137,10 @@ XF86MyComputer # 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 "$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." ) + 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 $HOME/.local/share/larbs/readme.mom -Tpdf | zathura - + 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 diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index d9f18254..dc68313d 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -4,13 +4,15 @@ do case "$1" in "w") setbg "$file" & ;; "c") - [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/directories | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" [ -z "$destdir" ] && exit + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & ;; "m") - [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/directories | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" [ -z "$destdir" ] && exit + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & ;; "r") diff --git a/.tmux.conf b/.config/tmux/tmux.conf similarity index 100% rename from .tmux.conf rename to .config/tmux/tmux.conf diff --git a/.config/vifm/vifmrc b/.config/vifm/vifmrc index b327786c..59210cd3 100644 --- a/.config/vifm/vifmrc +++ b/.config/vifm/vifmrc @@ -1,5 +1,5 @@ " vim: filetype=vifm -source ~/.config/vifm/vifmshortcuts +source ${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts set vicmd=$EDITOR set syscalls @@ -54,11 +54,11 @@ fileviewer *.odt odt2txt %c - filetype *.csv,*.xlsx sc-im %c fileviewer *.csv sed "s/,,,,/,,-,,/g;s/,,/ /g" %c | column -t | sed "s/ - / /g" | cut -c -%pw -filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display --input-ipc-server=/tmp/mpvsoc$(date +%%s) %c +filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display %c filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu,*.epub,*.cbz,*.cbr,*.cb7 zathura %f 2>/dev/null &, fileviewer *.pdf pdftotext -l 1 -nopgbrk %c - fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.qt,*.divx,*.as[fx],*mp3,*.flac file -filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) %f 2>/dev/null &, +filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] mpv %f 2>/dev/null &, fileview *.tar.gz atool -l --format=tar %f 2>/dev/null | awk '{$1=$2=$3=$4=$5=""; print $0}' fileview *.zip,*.cbz atool -l --format=zip %f 2>/dev/null | tail +4 | awk '{$1=$2=$3=""; print $0}' diff --git a/.config/wal/postrun b/.config/wal/postrun index 00f66a14..74d551b5 100755 --- a/.config/wal/postrun +++ b/.config/wal/postrun @@ -24,7 +24,4 @@ done fix_sequences <"${HOME}/.cache/wal/sequences" -xsetroot -name "fsignal:xrdb" -pkill dunst -dunst-theme -dunst & +pkill dunst; dunst & diff --git a/.config/xinitrc b/.config/xinitrc new file mode 100755 index 00000000..f38086e8 --- /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. + +. ~/.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/zsh/.zshrc b/.config/zsh/.zshrc index 63c0049b..70459837 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,19 +1,31 @@ # Luke's config for the Zoomer Shell -autoload -U colors && colors +# Enable colors and change prompt: +autoload -U colors && colors # Load colors PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " +setopt autocd # Automatically cd into typed directory. +stty stop undef # Disable ctrl-s to freeze terminal. + +# History in cache directory: +HISTSIZE=10000 +SAVEHIST=10000 +HISTFILE=~/.cache/zsh/history # Load aliases and shortcuts if existent. -[ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc" -[ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" +# Basic auto/tab complete: autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit +_comp_options+=(globdots) # Include hidden files. -# Include hidden files in autocomplete: -_comp_options+=(globdots) +# vi mode +bindkey -v +export KEYTIMEOUT=1 # Use vim keys in tab complete menu: bindkey -M menuselect 'h' vi-backward-char @@ -22,14 +34,11 @@ bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history bindkey -v '^?' backward-delete-char -export KEYTIMEOUT=1 - # Change cursor shape for different vi modes. function zle-keymap-select { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then echo -ne '\e[1 q' - elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || @@ -38,17 +47,13 @@ function zle-keymap-select { fi } zle -N zle-keymap-select - zle-line-init() { zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) echo -ne "\e[5 q" } zle -N zle-line-init - -# Use beam shape cursor on startup. -echo -ne '\e[5 q' -# Use beam shape cursor for each new prompt. -preexec() { echo -ne '\e[5 q' ;} +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. # Use lf to switch directories and bind it to ctrl-o lfcd () { @@ -56,16 +61,21 @@ lfcd () { lf -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" - rm -f "$tmp" - if [ -d "$dir" ]; then - if [ "$dir" != "$(pwd)" ]; then - cd "$dir" - fi - fi + rm -f "$tmp" >/dev/null + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" fi } +bindkey -s '^o' 'lfcd\n' -bindkey -s '^o' 'lfcd\n' # zsh +bindkey -s '^a' 'bc -l\n' -# Load zsh-syntax-highlighting; should be last. -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null +bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n' + +bindkey '^[[P' delete-char + +# Edit line in vim with ctrl-e: +autoload edit-command-line; zle -N edit-command-line +bindkey '^e' edit-command-line + +# 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/.gitmodules b/.gitmodules new file mode 100644 index 00000000..4f7c5dd1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".config/mpv/scripts/mpvSockets"] + path = .config/mpv/scripts/mpvSockets + url = https://github.com/wis/mpvSockets.git diff --git a/.local/bin/compiler b/.local/bin/compiler index 2fefdf5a..51d14f5e 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -20,18 +20,20 @@ textype() { \ biber --input-directory "$dir" "$base" && $command --output-directory="$dir" "$base" && $command --output-directory="$dir" "$base" - } +} 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)" ;; + *\.ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; + *\.mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; + *\.[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; + *\.[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" ;; + *\.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/cron/crontog b/.local/bin/cron/crontog index 67f620b9..8168012e 100755 --- a/.local/bin/cron/crontog +++ b/.local/bin/cron/crontog @@ -3,4 +3,4 @@ # Toggles all cronjobs off/on. # Stores disabled crontabs in ~/.consaved until restored. -([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") +([ -f ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && rm ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup index dd270921..bf8898ea 100755 --- a/.local/bin/cron/newsup +++ b/.local/bin/cron/newsup @@ -7,11 +7,11 @@ ping -q -c 1 1.1.1.1 > /dev/null || exit /usr/bin/notify-send "📰 Updating RSS feeds..." -pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit +ps ax | grep -q newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit echo 🔃 > /tmp/newsupdate -pkill -RTMIN+6 "${STATUSBAR:?}" +pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" /usr/bin/newsboat -x reload rm -f /tmp/newsupdate -pkill -RTMIN+6 "${STATUSBAR:?}" +pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" /usr/bin/notify-send "📰 RSS feed update complete." diff --git a/.local/bin/displayselect b/.local/bin/displayselect index c0e34795..57120ec2 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -48,25 +48,36 @@ morescreen() { # If multi-monitor is selected and there are more than two screen multimon() { # Multi-monitor handler. case "$(echo "$screens" | wc -l)" in - 1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; 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"}' | paste -sd ' ') + } + +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" | grep " connected" | awk '{print $1}') +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 ;; - *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; + *) onescreen "$chosen" ;; esac -setbg # Fix background if screen size/arangement has changed. -remaps # Re-remap keys if keyboard added (for laptop bases) -pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen +postrun diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index c7e27400..8ada2f42 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -6,11 +6,11 @@ case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in "copy url") echo "$1" | xclip -selection clipboard ;; mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; - "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;; + "mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; feh) setsid feh "$1" >/dev/null 2>&1 & ;; w3m) w3m "$1" >/dev/null 2>&1 ;; - "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; + "mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; esac diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index c192873a..75e11b55 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -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/dmenupass b/.local/bin/dmenupass index 8631a134..2c14e6f0 100755 --- a/.local/bin/dmenupass +++ b/.local/bin/dmenupass @@ -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/dmenurecord b/.local/bin/dmenurecord index a0339e45..49a2fbf8 100755 --- a/.local/bin/dmenurecord +++ b/.local/bin/dmenurecord @@ -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/dmenuumount b/.local/bin/dmenuumount index da0f4016..26612efe 100755 --- a/.local/bin/dmenuumount +++ b/.local/bin/dmenuumount @@ -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 index 12240e74..de1421b9 100755 --- a/.local/bin/dmenuunicode +++ b/.local/bin/dmenuunicode @@ -2,16 +2,16 @@ # The famous "get a menu of emojis to copy" script. -# Must have xclip installed to even show menu. -xclip -h 2>/dev/null || exit 1 +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//") -chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//") +# Exit if none chosen. +[ -z "$chosen" ] && exit -[ "$chosen" != "" ] || exit - -# If you run this command with an argument, it will automatically insert the character. +# 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 key Shift+Insert + xdotool type "$chosen" else echo "$chosen" | tr -d '\n' | xclip -selection clipboard notify-send "'$chosen' copied to clipboard." & diff --git a/.local/bin/getkeys b/.local/bin/getkeys index 8871d414..0a0e86e1 100755 --- a/.local/bin/getkeys +++ b/.local/bin/getkeys @@ -1,5 +1,5 @@ #!/bin/sh -cat ~/.local/share/larbs/getkeys/"$1" 2>/dev/null && exit +cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit echo "Run command with one of the following arguments for info about that program:" -ls ~/.local/share/larbs/getkeys +ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys diff --git a/.local/bin/i3cmds/toggle-welcome b/.local/bin/i3cmds/toggle-welcome index 715db09e..d15ca143 100755 --- a/.local/bin/i3cmds/toggle-welcome +++ b/.local/bin/i3cmds/toggle-welcome @@ -2,9 +2,9 @@ # Toggles the LARBS welcome message. -PIC="$HOME/.local/share/larbs/larbs.png" +PIC="${XDG_DATA_HOME:-$HOME/.local/share}/larbs/larbs.png" -grep LARBSWELCOME "$HOME/.xprofile" && - ( sed -i "/LARBSWELCOME/d" ~/.xprofile && notify-send -i "$PIC" "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) || - ( echo "notify-send -i \"$PIC\" \"Welcome to LARBS\" \"Press super+F1 for the help menu.\" # LARBSWELCOME" >> ~/.xprofile && +grep LARBSWELCOME "$XDG_CONFIG_HOME/xprofile" && + ( sed -i "/LARBSWELCOME/d" "$XDG_CONFIG_HOME/xprofile" && notify-send -i "$PIC" "LARBS welcome message" "Welcome message disabled. Press Super+Shift+F1 again to reverse." ) || + ( echo "notify-send -i \"$PIC\" \"Welcome to LARBS\" \"Press super+F1 for the help menu.\" # LARBSWELCOME" >> "$XDG_CONFIG_HOME/xprofile" && notify-send -i "$PIC" "LARBS welcome message" "Welcome message re-enabled." ) diff --git a/.local/bin/ifinstalled b/.local/bin/ifinstalled index c8e1c2ec..04c0eef4 100755 --- a/.local/bin/ifinstalled +++ b/.local/bin/ifinstalled @@ -1,4 +1,8 @@ #!/bin/sh -# 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 ;} +# Some optional functions in LARBS require programs not installed by default. I +# use this little script to check to see if a command exists and if it doesn't +# it informs the user that they need that command to continue. This is used in +# various other scripts for clarity's sake. + +pacman -Qq "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;} diff --git a/.local/bin/launch_polybar b/.local/bin/launch_polybar index 291d1834..8786be6c 100755 --- a/.local/bin/launch_polybar +++ b/.local/bin/launch_polybar @@ -4,8 +4,6 @@ killall -q polybar # Wait until the processes have been shut down -while pgrep -x polybar >/dev/null; do sleep 1; done +while pidof polybar >/dev/null; do sleep 1; done for i in $(polybar -m | awk -F: '{print $1}'); do MONITOR=$i polybar default & done - -echo "Bars launched..." diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index 2c64dcbc..06600115 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -11,7 +11,7 @@ case "$1" in *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) - setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;; + setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; *png|*jpg|*jpe|*jpeg|*gif) curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) diff --git a/.local/bin/lmc b/.local/bin/lmc index bbe99a56..d4314952 100755 --- a/.local/bin/lmc +++ b/.local/bin/lmc @@ -10,11 +10,13 @@ if [ "$PULSE" ]; then mute() { pulsemixer --mute ;} up() { pulsemixer --change-volume +"$NUM" ;} down() { pulsemixer --change-volume -"$NUM" ;} + control() { pulsemixer ;} else toggle() { amixer sset Master toggle ;} mute() { amixer sset Master mute ;} up() { amixer sset Master "$NUM"%+ ;} down() { amixer sset Master "$NUM"%- ;} + control() { alsamixer ;} fi case "$1" in @@ -22,6 +24,5 @@ case "$1" in mute) mute ;; up) up ;; down) down ;; -esac >/dev/null - -pkill -RTMIN+10 "${STATUSBAR:?}" & + control) control ;; +esac diff --git a/.local/bin/pauseallmpv b/.local/bin/pauseallmpv index 85a7032c..15b9f599 100755 --- a/.local/bin/pauseallmpv +++ b/.local/bin/pauseallmpv @@ -5,6 +5,6 @@ # every single one of them with one command! This is bound to super + shift + p # (with other things) by default and is used in some other places. -for i in $(ls /tmp/mpvsoc*); do +for i in $(ls /tmp/mpvSockets/*); do echo '{ "command": ["set_property", "pause", true] }' | socat - $i; done diff --git a/.local/bin/podentr b/.local/bin/podentr index e765c584..9a8313ab 100755 --- a/.local/bin/podentr +++ b/.local/bin/podentr @@ -4,4 +4,4 @@ [ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit -echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null +echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null diff --git a/.local/bin/queueandnotify b/.local/bin/queueandnotify index 867b15e6..a54b13e9 100755 --- a/.local/bin/queueandnotify +++ b/.local/bin/queueandnotify @@ -3,7 +3,7 @@ # Podboat sucks. This script replaces it. # It reads the newsboat queue, queuing downloads with taskspooler. # It also removes the junk from extentions. -queuefile="$HOME/.local/share/newsboat/queue" +queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue" while read -r line; do [ -z "$line" ] && continue diff --git a/.local/bin/rssadd b/.local/bin/rssadd index 4ef31a4c..2ce421bd 100755 --- a/.local/bin/rssadd +++ b/.local/bin/rssadd @@ -2,7 +2,7 @@ ! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null && notify-send "That doesn't look like a full URL." && exit -RSSFILE="$HOME/.config/newsboat/urls" +RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls" if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then notify-send "You already have this RSS feed." else diff --git a/.local/bin/setbg b/.local/bin/setbg index 7b07e23e..5f70fa54 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -4,16 +4,17 @@ # Run by itself, set the wallpaper (at X start). # If given a file, set that as the new wallpaper. # If given a directory, choose random file in it. -# If wal is installed, also generate a colorscheme. +# If wal is installed, also generates a colorscheme. # Location of link to wallpaper link. -bgloc="${XDG_CACHE_HOME:-$HOME/.cache/}/bg" +bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg" [ -f "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." [ -d "$1" ] && ln -sf "$(find "$(readlink -f "$1")" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." # If pywal is installed, use it. -wal -s -i "$(readlink -f "$bgloc")" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 +wal -i "$(readlink -f "$bgloc")" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 +pidof dwm >/dev/null && xdotool key super+F12 xwallpaper --zoom "$bgloc" diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 55ce30ae..19d3ffd4 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -1,27 +1,29 @@ #!/usr/bin/env bash # Output locations. Unactivated progs should go to /dev/null. -shell_shortcuts="$HOME/.config/shortcutrc" -ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf" +shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" +zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" +ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf" qute_shortcuts="/dev/null" fish_shortcuts="/dev/null" -vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts" +vifm_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts" # Remove, prepare files -rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null +rm -f "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null printf "# vim: filetype=sh\\n" > "$fish_shortcuts" printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ +sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ + >(awk '{print "hash -d "$1"="$2}' >> "$zsh_named_dirs") \ >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \ >(awk '{print "map g" $1, ":cd", $2 "\nmap t" $1, ":cd", $2 "\nmap M" $1, ":cd", $2 ":mo\nmap Y" $1, ":cd", $2 ":co" }' >> "$vifm_shortcuts") \ >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \ | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" # Format the `files` file in the correct syntax and sent it to both configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ +sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ >(awk '{print "map", $1, ":e", $2 "" }' >> "$vifm_shortcuts") \ | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index 69da3f5e..a6fb62d1 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -1,30 +1,31 @@ #!/bin/sh # Prints all batteries, their percentage remaining and an emoji corresponding -# to charge status (🔌 for pluged up, 🔋 for discharging on battery, etc.). +# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). case $BLOCK_BUTTON in - 3) pgrep -x dunst >/dev/null && notify-send "🔋 Battery module" "🔋: discharging + 3) notify-send "🔋 Battery module" "🔋: discharging 🛑: not charging ♻: stagnant charge 🔌: charging ⚡: charged ❗: battery very low!" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac +# acpi alternative +# acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, /🔋/;s/[Nn]ot charging, /🛑/;s/[Cc]harging, /🔌/;s/[Uu]nknown, /♻️/;s/[Ff]ull, /⚡/;s/ \(remaining\|until charged\)//"; exit + # Loop through all attached batteries. for battery in /sys/class/power_supply/BAT? do # Get its remaining capacity and charge status. - capacity=$(cat "$battery"/capacity) || exit - status=$(cat "$battery"/status) + capacity=$(cat "$battery"/capacity) || break + status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status) # If it is discharging and 25% or less, we will add a ❗ as a warning. - [ "$status" = "Discharging" ] && [ "$capacity" -le 25 ] && warn="❗" + [ "$capacity" -le 25 ] && [ "$status" = "🔋" ] && warn="❗" - # Print the battery status (replaced by a cooresponding emoji with - # sed), the percentage left and the warning if there is one. - printf "%s%s%s\n" "$(echo "$status" | sed "s/,//;s/Discharging/🔋/;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" + printf "%s%s%s%% " "$status" "$warn" "$capacity" unset warn -done - +done | sed 's/ *$//' diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock index d17f3c63..431a7f09 100755 --- a/.local/bin/statusbar/clock +++ b/.local/bin/statusbar/clock @@ -1,10 +1,29 @@ #!/bin/sh -date '+%Y %b %d (%a) %I:%M%p' +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) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; - 2) $TERMINAL -e calcurse -D ~/.config/calcurse ;; - 3) pgrep -x dunst >/dev/null && 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\` + 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 + +date "+%Y %b %d (%a) $icon%I:%M%p" diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu index 3b1394af..9225c1e8 100755 --- a/.local/bin/statusbar/cpu +++ b/.local/bin/statusbar/cpu @@ -1,10 +1,12 @@ #!/bin/sh case $BLOCK_BUTTON in - 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)" ;; + 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. -- % is of single core." ;; +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -sensors | awk '/Core 0/ {print $3}' +sensors | awk '/Core 0/ {print "🌡" $3}' diff --git a/.local/bin/statusbar/crypto b/.local/bin/statusbar/crypto new file mode 100755 index 00000000..bb19fc94 --- /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 index 2ca88059..e947509d 100755 --- a/.local/bin/statusbar/disk +++ b/.local/bin/statusbar/disk @@ -1,18 +1,23 @@ #!/bin/sh # Status bar module for disk space -# $1 should be drive mountpoint -# $2 is optional icon, otherwise mountpoint will displayed +# $1 should be drive mountpoint, otherwise assumed /. -[ -z "$1" ] && exit +location=${1:-/} -icon="$2" -[ -z "$2" ] && icon="$1" +[ -d "$location" ] || exit case $BLOCK_BUTTON in - 1) pgrep -x dunst >/dev/null && notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;; - 3) pgrep -x dunst >/dev/null && notify-send "💽 Disk module" "\- Shows used hard drive space. + 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 -printf "%s: %s\n" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')" +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 b/.local/bin/statusbar/help deleted file mode 100755 index d7345dc9..00000000 --- a/.local/bin/statusbar/help +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - ;; - 2) i3 restart ;; - 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide. -- Middle click to refresh i3.";; -esac; echo "❓" 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 index 8063e193..d8bd8969 100755 --- a/.local/bin/statusbar/internet +++ b/.local/bin/statusbar/internet @@ -1,16 +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) $TERMINAL -e nmtui ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module" "\- Click to connect + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; + 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 -[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡" || - wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }') +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)" +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 index 4ca4f107..02adab8d 100755 --- a/.local/bin/statusbar/iplocate +++ b/.local/bin/statusbar/iplocate @@ -4,6 +4,7 @@ # displays that information in the statusbar # # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ -ifinstalled "geoiplookup" || exit + +ifinstalled "geoip" || exit addr="$(curl ifconfig.me 2>/dev/null)" || exit -grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" +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 index 3ace5f5b..8f87d757 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -1,20 +1,20 @@ #!/bin/sh -# i3blocks mail module. # Displays number of unread mail and an loading icon if updating. # When clicked, brings up `neomutt`. case $BLOCK_BUTTON in - 1) "$TERMINAL" -e neomutt ;; + 1) setsid "$TERMINAL" -e neomutt & ;; 2) setsid mailsync >/dev/null & ;; - 3) pgrep -x dunst >/dev/null && notify-send "📬 Mail module" "\- Shows unread mail + 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 ~/.local/share/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)" +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")" +pidof mbsync >/dev/null 2>&1 && icon="🔃" -[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬 $unread$(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 index dfd3d7b0..07a0f41b 100755 --- a/.local/bin/statusbar/memory +++ b/.local/bin/statusbar/memory @@ -2,8 +2,11 @@ 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." ;; +- Click to show memory hogs. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -free -h | awk '/^Mem:/ {print $3 "/" $2}' +free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠%2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}' diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase index d2bbad61..fab8b4da 100755 --- a/.local/bin/statusbar/moonphase +++ b/.local/bin/statusbar/moonphase @@ -1,17 +1,37 @@ #!/bin/sh -mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') -prcnt=$(pom $1 | grep -o '[[:digit:]]*%') -case "$mnphs" in - "New") icon="🌑" prcnt="0%" ;; - "Waxing Crescent") icon="🌒" ;; - "First Quarter") icon="🌓" prcnt="50%" ;; - "Waxing Gibbous") icon="🌔" ;; - "Full") icon="🌕" prcnt="100%" ;; - "Waning Gibbous") icon="🌖" ;; - "Last Quarter") icon="🌗" prcnt="50%" ;; - "Waning Crescent") icon="🌘" ;; - *) echo errorrrr ;; +# 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 -printf "%s %s\\n" "$icon" "$prcnt" +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/mpd-module-update b/.local/bin/statusbar/mpdup similarity index 69% rename from .local/bin/mpd-module-update rename to .local/bin/statusbar/mpdup index da8d9fc8..af81a7d6 100755 --- a/.local/bin/mpd-module-update +++ b/.local/bin/statusbar/mpdup @@ -2,6 +2,7 @@ # This loop will update the mpd statusbar module whenever a command changes the # music player's status. mpd must be running on X's start for this to work. + while : ; do - mpc idle >/dev/null && pkill -RTMIN+11 "${STATUSBAR:?}" || break + mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break done diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music index fadc15e5..54eced50 100755 --- a/.local/bin/statusbar/music +++ b/.local/bin/statusbar/music @@ -1,18 +1,19 @@ #!/bin/sh -filter() { - sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>\n/g" - } +filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ';} + +pidof -x mpdup >/dev/null 2>&1 || mpdup & 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 && pgrep -x dunst >/dev/null && notify-send "🎵 Music module" "\- Shows mpd song playing. + 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 - *) mpc status | filter ;; -esac; exit + 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..3c41dfc7 --- /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 | paste -sd '+' | bc)" +txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)" + +printf "🔻%sKiB 🔺%sKiB\\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 index a8842ad8..69d9bf32 100755 --- a/.local/bin/statusbar/news +++ b/.local/bin/statusbar/news @@ -1,17 +1,17 @@ #!/bin/sh -# i3blocks newsboat module. # 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) pgrep -x dunst >/dev/null && notify-send "📰 News module" "\- Shows unread news items + 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 ~/.config/newsboat/.update 2>/dev/null)" + 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 index 4273c868..e61660c2 100755 --- a/.local/bin/statusbar/pacpackages +++ b/.local/bin/statusbar/pacpackages @@ -15,14 +15,15 @@ # [Action] # Description = Updating statusbar... # When = PostTransaction -# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks +# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. case $BLOCK_BUTTON in - 1) $TERMINAL -e popupgrade ;; + 1) setsid "$TERMINAL" -e popupgrade & ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;; - 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module" "📦: number of upgradable packages + 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 -v "\[ignored\]" | wc -l | sed "s/^/📦/;s/^📦0$//g" +pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g" diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade index ba6678c3..3a62727d 100755 --- a/.local/bin/statusbar/popupgrade +++ b/.local/bin/statusbar/popupgrade @@ -3,7 +3,7 @@ printf "Beginning upgrade.\\n" yay -Syu -pkill -RTMIN+8 "${STATUSBAR:?}" +pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" read -r diff --git a/.local/bin/statusbar/price b/.local/bin/statusbar/price new file mode 100755 index 00000000..953df3b0 --- /dev/null +++ b/.local/bin/statusbar/price @@ -0,0 +1,34 @@ +#!/bin/sh + +# Usage: +# price +# price bat "Basic Attention Token" 🦁 +# When the name of the currency is multi-word, put it in quotes. + +[ -z "$3" ] && exit 1 +interval="@7d" # History contained in chart preceded by '@' (7d = 7 days) +dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" +pricefile="$dir/$1" +chartfile="$dir/$1-chart" + +[ -d "$dir" ] || mkdir -p "$dir" + +[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && + { ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && curl -s "rate.sx/1$1" > "$pricefile" || exit ;} + +printf "$3$%0.2f" "$(cat "$pricefile")" + +[ "$(stat -c %x "$chartfile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && + { ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && curl -s "rate.sx/$1$interval" > "$chartfile" || exit ;} + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e less -Sf "$chartfile" ;; + 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" + notify-send "$3 $2 module" "\- Exact price: \$$(cat "$pricefile") +- Left click for chart of changes. +- Middle click to update. +- Shows 🔃 if updating prices. +- Last updated: + $uptime" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent index 4b559b89..e9e7fce3 100755 --- a/.local/bin/statusbar/torrent +++ b/.local/bin/statusbar/torrent @@ -10,18 +10,24 @@ transmission-remote -l | grep % | s/.*%.*/M/g" | sort -h | uniq -c | sed " # Now we replace the standin letters with icons. s/A/🛑/g; - s/B/⌛️/g; + s/B/🕰/g; s/L/🔼/g; s/M/🔽/g; s/N/✅/g; - s/Z/🌱/g" | awk '{print $2, $1}' | sed -e "s/ $//g" | tr '\n' ' ' + s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' ' case $BLOCK_BUTTON in - 1) $TERMINAL -e transmission-remote-cli ;; - 3) pgrep -x dunst >/dev/null && notify-send "Torrent module" "🛑: paused -⏳: idle (seeds needed) + 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 index fd59a6f9..b64744ff 100755 --- a/.local/bin/statusbar/volume +++ b/.local/bin/statusbar/volume @@ -1,20 +1,31 @@ #!/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 ;; - 3) pgrep -x dunst >/dev/null && notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. + # 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." +- Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -volstat="$(amixer get Master)" +volstat="$(pactl list sinks)" +# volstat="$(amixer get Master)" # ALSA only equivalent. -echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit +echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit +# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA -vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") +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="🔊" @@ -24,4 +35,4 @@ else icon="🔉" fi -printf "%s %s%%\\n" "$icon" "$vol" +printf "%s%s%%\\n" "$icon" "$vol" diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather index 285ac917..2599e915 100755 --- a/.local/bin/statusbar/weather +++ b/.local/bin/statusbar/weather @@ -1,22 +1,34 @@ #!/bin/sh -getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 -curl -sf "wttr.in/$LOCATION" > "$HOME/.local/share/weatherreport" || exit 1 ;} +# Displays todays precipication chance (☔) and daily low (🥶) and high (🌞). +# Usually intended for the statusbar. -showweather() { printf "%s" "$(sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" -sed '13q;d' "$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 "°"}' ;} +# 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) $TERMINAL -e less -Srf "$HOME/.local/share/weatherreport" ;; - 2) getforecast && showweather ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast. + 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 low 🌞: Daily high" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -if [ "$(stat -c %y "$HOME/.local/share/weatherreport" 2>/dev/null | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] - then getforecast && showweather - else showweather -fi +# 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 index dfac906f..d2ba76ae 100755 --- a/.local/bin/td-toggle +++ b/.local/bin/td-toggle @@ -1,11 +1,12 @@ #!/bin/sh # If transmission-daemon is running, will ask to kill, else will ask to start. -if pgrep -x transmission-da >/dev/null ; + +if pidof transmission-daemon >/dev/null ; then - [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed." + [ "$(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 "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started." + [ "$(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:?}" +sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/torwrap b/.local/bin/torwrap index 0fbb3a80..4f94053e 100755 --- a/.local/bin/torwrap +++ b/.local/bin/torwrap @@ -1,7 +1,7 @@ #!/bin/sh -ifinstalled tremc transmission-cli || exit +ifinstalled tremc-git transmission-cli || exit -! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:?}" +! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." -$TERMINAL -e tremc +$TERMINAL -e tremc; pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/transadd b/.local/bin/transadd index 5d8f510d..a598fad3 100755 --- a/.local/bin/transadd +++ b/.local/bin/transadd @@ -2,8 +2,8 @@ # 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. +# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. -pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:?}") +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/applications/img.desktop b/.local/share/applications/img.desktop index d1582a5e..42aa81e0 100644 --- a/.local/share/applications/img.desktop +++ b/.local/share/applications/img.desktop @@ -1,4 +1,4 @@ [Desktop Entry] Type=Application Name=Image viewer -Exec=/usr/bin/sxiv -a %u +Exec=/usr/bin/sxiv -a %f diff --git a/.local/share/bg b/.local/share/bg new file mode 120000 index 00000000..6c5d2998 --- /dev/null +++ b/.local/share/bg @@ -0,0 +1 @@ +../../.config/wall.png \ No newline at end of file diff --git a/.local/share/larbs/readme.mom b/.local/share/larbs/readme.mom index c46b1a82..fb8feb8b 100644 --- a/.local/share/larbs/readme.mom +++ b/.local/share/larbs/readme.mom @@ -137,7 +137,7 @@ Naturally, you can use \f(CWyay\fP to look for and install any you want to add. .ITEM \f(CWMod+n\fP \(en newsboat (RSS feed reader) .ITEM -\f(CWMod+A\fP \(en alsa (audio system control) +\f(CWMod+A\fP \(en pulsemixer (audio system control) .ITEM \f(CWMod+w\fP \(en Web Browser (Brave) .ITEM @@ -209,7 +209,7 @@ I use ncmpcpp as a music player, which is a front end for mpd. .ITEM \f(CWMod+]\fP \(en Forward 10 seconds (holding shift increases amount) .ITEM -\f(CWMod+A\fP \(en alsamixer (general volume sink/source control) +\f(CWMod+A\fP \(en pulsemixer (general volume sink/source control) .LIST OFF .HEADING 2 "Workspaces" .PP @@ -266,9 +266,7 @@ These settings may override your preferred settings, so you should open this fil .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(CWalsamixer\fP (\f(CWmod+A\fP). - -If you have a more complex audio setup and can't be bothered to figure out ALSA, you might want to install and enable PulseAudio, which general "just werks". +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. diff --git a/.profile b/.profile deleted file mode 100644 index 1b5460a0..00000000 --- a/.profile +++ /dev/null @@ -1,46 +0,0 @@ -# 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/:*$//')" - -# Get default LARBS WM from ~/.local/share/larbs/wm -export LARBSWM="$(cat ~/.local/share/larbs/wm 2>/dev/null)" && - [ "$LARBSWM" = "dwm" ] || export LARBSWM="i3" - -# Default programs: -export EDITOR="nvim" -export TERMINAL="st" -export BROWSER="brave" -export READER="zathura" -export STATUSBAR="${LARBSWM}blocks" - -# ~/ Clean-up: -#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs. -export NOTMUCH_CONFIG="$HOME/.config/notmuch-config" -export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" -export LESSHISTFILE="-" -export WGETRC="$HOME/.config/wget/wgetrc" -export INPUTRC="$HOME/.config/inputrc" -export ZDOTDIR="$HOME/.config/zsh" -export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" - -# 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' '')" - -[ ! -f ~/.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 ~/.local/share/larbs/ttymaps.kmap 2>/dev/null diff --git a/.profile b/.profile new file mode 120000 index 00000000..c1abe3fd --- /dev/null +++ b/.profile @@ -0,0 +1 @@ +.zprofile \ No newline at end of file diff --git a/.xinitrc b/.xinitrc deleted file mode 100644 index c669ad2b..00000000 --- a/.xinitrc +++ /dev/null @@ -1,22 +0,0 @@ -#!/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 ~/.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. - -[ -f ~/.xprofile ] && . ~/.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. - -case "$LARBSWM" in - dwm) while :; do - ssh-agent dwm || break - done ;; - i3) exec i3 ;; - *) echo "No valid LARBS window manager detected." ;; -esac diff --git a/.xinitrc b/.xinitrc new file mode 120000 index 00000000..6fefdaf0 --- /dev/null +++ b/.xinitrc @@ -0,0 +1 @@ +.config/xinitrc \ No newline at end of file diff --git a/.xprofile b/.xprofile old mode 100644 new mode 100755 index 677eff10..861443b8 --- a/.xprofile +++ b/.xprofile @@ -10,72 +10,8 @@ dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XA 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 ~/.config/Xresources & # Uncomment to use Xresources colors/settings on startup +#xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/Xresources & # Uncomment to use Xresources colors/settings on startup xcompmgr & # xcompmgr for transparency -$STATUSBAR & # start the statusbar dunst & # dunst for notifications xset r rate 300 50 & # Speed xrate up unclutter & # Remove mouse when idle -mpd-module-update & # Check for when to update the mpd module - -# 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=🎥:\ -*.zip=📦:\ -*.rar=📦:\ -*.7z=📦:\ -*.tar.gz=📦:\ -*.z64=🎮:\ -*.v64=🎮:\ -*.n64=🎮:\ -*.1=ℹ:\ -*.nfo=ℹ:\ -*.info=ℹ:\ -*.log=📙:\ -*.iso=📀:\ -*.img=📀:\ -*.bib=🎓:\ -*.ged=👪:\ -*.part=💔:\ -*.torrent=🔽:\ -" 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..8a7d2764 --- /dev/null +++ b/.zprofile @@ -0,0 +1,125 @@ +#!/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 | paste -sd ':')" + +# 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 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 AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname +export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm + +# 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