dots

git clone git://mattcarlson.org/repos/dots.git
Log | Files | Refs

commit 8e36164527a1ad35b4488d5929299c976da8bc62
parent 13e6a29ec0ee0d7e872ccee35432be8ef8279f39
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Sun,  9 Jan 2022 00:05:09 -0500

grayscale (requires picom); removed bc dependency; changed cache dir structure

Diffstat:
A.config/picom/picom.conf | 0
M.config/vim/vimrc | 16+++++++++-------
M.config/x/xprofile | 2+-
M.config/x/xresources | 32++++++++++++++++----------------
M.config/zathura/zathurarc | 54+++++++++++++++++++++++++++---------------------------
M.local/bin/bar/cpu.sh | 2+-
M.local/bin/bar/monitor.sh | 2+-
M.local/bin/bar/pkgs.sh | 2+-
A.local/bin/color.sh | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.local/bin/menu.sh | 2++
M.local/bin/shot.sh | 12++++++------
M.local/share/wp | 4++--
12 files changed, 147 insertions(+), 62 deletions(-)

diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf diff --git a/.config/vim/vimrc b/.config/vim/vimrc @@ -21,7 +21,9 @@ filetype plugin indent on " vim-plug: a minimalist vim plugin manager call plug#begin('~/.config/vim/plugged') Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' Plug 'cormacrelf/vim-colors-github' +Plug 'fxn/vim-monochrome' Plug 'Valloric/YouCompleteMe' call plug#end() @@ -31,15 +33,15 @@ set termguicolors let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" -" enable github color scheme (dark) -let g:github_colors_soft = 1 +" enable monochrome color scheme (dark) +" let g:github_colors_soft = 1 set background=dark -let g:github_colors_block_diffmark = 0 -colorscheme github +" let g:github_colors_block_diffmark = 0 +colorscheme monochrome -" enable github color scheme for airline -let g:airline_theme = "github" -let g:lightline = { 'colorscheme': 'github' } +" enable minimalist scheme for airline +let g:airline_theme = "minimalist" +" let g:lightline = { 'colorscheme': 'github' } " transparent background if compositor is running autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE diff --git a/.config/x/xprofile b/.config/x/xprofile @@ -3,11 +3,11 @@ # xprofile autorandr -c +"${HOME}/.local/bin/color.sh" -s # picom is compositor; touch blank config file to make picom like xcompmgr xrdb "${XDG_CONFIG_HOME:-${HOME}/.config/}/x/xresources" "${HOME}/.local/bin/lock.sh" & feh --no-fehbg --bg-scale "${XDG_DATA_HOME:-${HOME}/.local/share/}/wp" xclickroot -r "${HOME}/.local/bin/menu.sh" & -xcompmgr & mpd & unclutter & xset r rate 250 50 diff --git a/.config/x/xresources b/.config/x/xresources @@ -1,20 +1,20 @@ ! colors -#define col0 #17100c -#define col1 #936521 -#define col2 #9f6f5c -#define col3 #bd904a -#define col4 #a67e81 -#define col5 #c8b3b1 -#define col6 #d5caca -#define col7 #e9e3df -#define col8 #a39e9c -#define col9 #936521 -#define col10 #9f6f5c -#define col11 #bd904a -#define col12 #a67e81 -#define col13 #c8b3b1 -#define col14 #d5caca -#define col15 #e9e3df +#define col0 #000000 +#define col1 #6c6d6d +#define col2 #7f807f +#define col3 #8e8e8e +#define col4 #9fa09f +#define col5 #b1b1b1 +#define col6 #c0c1bf +#define col7 #dedede +#define col8 #9b9b9b +#define col9 #6c6d6d +#define col10 #7f807f +#define col11 #8e8e8e +#define col12 #9fa09f +#define col13 #b1b1b1 +#define col14 #c0c1bf +#define col15 #dedede ! font Xft.antialias : 1 diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc @@ -19,35 +19,35 @@ set recolor-keephue 'false' set recolor-reverse-video 'false' # Command line completion entries -set completion-fg '#e9e3df' -set completion-bg '#17100c' +set completion-fg '#dedede' +set completion-bg '#000000' # Command line completion group elements -set completion-group-fg '#9F6F5C' -set completion-group-bg '#17100c' +set completion-group-fg '#7F807F' +set completion-group-bg '#000000' # Current command line completion element -set completion-highlight-fg '#17100c' -set completion-highlight-bg '#e9e3df' +set completion-highlight-fg '#000000' +set completion-highlight-bg '#dedede' # Default foreground/background color -set default-bg rgba(23,16,12,0.95) +set default-bg rgba(0,0,0,0.95) # Input bar -set inputbar-fg '#e9e3df' -set inputbar-bg '#17100c' +set inputbar-fg '#dedede' +set inputbar-bg '#000000' # Notification -set notification-fg '#e9e3df' -set notification-bg '#17100c' +set notification-fg '#dedede' +set notification-bg '#000000' # Error notification -set notification-error-fg '#e9e3df' -set notification-error-bg '#936521' +set notification-error-fg '#dedede' +set notification-error-bg '#6C6D6D' # Warning notification -set notification-warning-fg '#e9e3df' -set notification-warning-bg '#936521' +set notification-warning-fg '#dedede' +set notification-warning-bg '#6C6D6D' # Tab - TODO # set tabbar-fg @@ -58,25 +58,25 @@ set notification-warning-bg '#936521' # set tabbar-focus-bg # Status bar -set statusbar-fg '#e9e3df' -set statusbar-bg '#17100c' +set statusbar-fg '#dedede' +set statusbar-bg '#000000' # Highlighting parts of the document (e.g. show search results) -set highlight-color '#9F6F5C' -set highlight-active-color '#9F6F5C' +set highlight-color '#7F807F' +set highlight-active-color '#7F807F' # Represent light/dark colors in recoloring mode set recolor-lightcolor rgba(0,0,0,0) -set recolor-darkcolor '#e9e3df' +set recolor-darkcolor '#dedede' # 'Loading...' text -set render-loading-fg '#e9e3df' -set render-loading-bg '#17100c' +set render-loading-fg '#dedede' +set render-loading-bg '#000000' # Index mode -set index-fg '#e9e3df' -set index-bg '#17100c' +set index-fg '#dedede' +set index-bg '#000000' # Selected element in index mode -set index-active-fg '#17100c' -set index-active-bg '#e9e3df' -\ No newline at end of file +set index-active-fg '#000000' +set index-active-bg '#dedede' +\ No newline at end of file diff --git a/.local/bin/bar/cpu.sh b/.local/bin/bar/cpu.sh @@ -16,7 +16,7 @@ DELAY=3.15 TEMP="$(ls /sys/class/thermal/thermal_zone2*/temp)" # cache used b/c awk and delay is time expensive -USAGE="${XDG_CACHE_HOME:-${HOME}/.cache/}/bar/usage" +USAGE="${XDG_CACHE_HOME:-${HOME}/.cache/}/dots/bar/usage" calculate_temp() { [ -f "${TEMP}" ] && temp=$(cat "${TEMP}") diff --git a/.local/bin/bar/monitor.sh b/.local/bin/bar/monitor.sh @@ -6,7 +6,7 @@ ICON='' # brightness vcp code is 10 VCP_CODE=10 # cache used b/c ddcutil getvcp too expensive -BRIGHTNESS="${XDG_CACHE_HOME:-${HOME}/.cache/}/bar/brightness" +BRIGHTNESS="${XDG_CACHE_HOME:-${HOME}/.cache/}/dots/bar/brightness" get_brightness() { [ ! -f "${BRIGHTNESS}" ] && return 1 diff --git a/.local/bin/bar/pkgs.sh b/.local/bin/bar/pkgs.sh @@ -6,7 +6,7 @@ ICON='' UPGRADE_ICON='' UPGRADE_TMP='/tmp/upgrade-pkgs' AUR_HELPER='paru' -PKGS="${XDG_CACHE_HOME:-${HOME}/.cache}/bar/pkgs" +PKGS="${XDG_CACHE_HOME:-${HOME}/.cache}/dots/bar/pkgs" GET_TMP='/tmp/get-pkgs' GET_ICON='' diff --git a/.local/bin/color.sh b/.local/bin/color.sh @@ -0,0 +1,81 @@ +#!/bin/sh +# +# color + +COLOR="${XDG_CACHE_HOME:-${HOME}/.cache/}/dots/color" + +# should work with compton too +COMPOSITOR='picom' + +# we can make windows mono via shader +SHADER='uniform sampler2D tex; uniform float opacity; void main() { vec4 c = texture2D(tex, gl_TexCoord[0].xy); float y = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722)); gl_FragColor = opacity*vec4(y, y, y, c.a); }' + +start() { + # get mode stored in cache + # 0 means mono + # 1 means color + mode=$(cat "${COLOR}") + + # start compositor + [ "${mode}" -eq 1 ] && ${COMPOSITOR} -b \ + || ${COMPOSITOR} -b --backend glx --glx-fshader-win "${SHADER}" 2>/dev/null +} + +toggle() { + # check shader status and thus check mode + #shellcheck disable=SC2009 + shader_id=$(ps -ef | grep 'glx-fshader-win' | grep -iv '\<grep\>' | awk '{ printf "%s ", $2 }') + + # shader enabled, meaning mono + # ENABLE COLOR + if [ "${shader_id}" ]; then + #shellcheck disable=SC2086 + $(kill ${shader_id} && \ + sleep 1 && \ + ${COMPOSITOR} -b) || return 1 + mode=1 + # shader disabled, meaning color + # DISABLE COLOR + else + #shellcheck disable=SC2086 + $(kill ${comp_id} && \ + sleep 1 && \ + ${COMPOSITOR} -b --backend glx --glx-fshader-win "${SHADER}" 2>/dev/null) || return 1 + mode=0 + fi + + # print mode to cache so we remember mode at launch + printf '%s\n' "${mode}" > "${COLOR}" +} + +main() { + if [ ${#} -eq 0 ]; then + # get compositor id + #shellcheck disable=SC2009 + comp_id=$(ps -ef | grep "\<${COMPOSITOR}\>" | grep -iv '\<grep\>' | awk '{ printf "%s ", $2 }') + + # compositor not running, so return + [ -z "${comp_id}" ] && printf '%s\n' "${COMPOSITOR} is not running" && return 1 + + # toggle between mono/color modes + if toggle; then + # get mode + [ "${mode}" -eq 1 ] && msg='Color enabled' || msg='Color disabled' + else printf '%s\n' 'Toggle failed' && return 1 + fi + + # print notification + env HERBE_ID=/0 herbe "${msg}" & + fi + + # flags for profile + while getopts 's' opt; do + case "${opt}" in + # automatically pick mode based on cache + s) start ;; + *) return ;; + esac + done +} + +main "${@}" diff --git a/.local/bin/menu.sh b/.local/bin/menu.sh @@ -10,7 +10,9 @@ main() {  Text Editor "${TERMINAL}" -c "${EDITOR}" -e "${EDITOR}"  Music Player "${HOME}/.local/bin/bar/music.sh" -o  Mail Client "${HOME}/.local/bin/bar/mail.sh" -o +  RSS Feed Reader "${HOME}/.local/bin/bar/rss.sh" -o  YouTube "${TERMINAL}" -c "${YOUTUBE_CLIENT}" -e "${YOUTUBE_CLIENT}" +  Torrent Client "${TORRENT_CLIENT}"  Image Editor "${IMAGE_EDITOR}"  Tools  Terminal "${TERMINAL}" diff --git a/.local/bin/shot.sh b/.local/bin/shot.sh @@ -13,13 +13,13 @@ main() { b=$(printf '%s' "${hex}" | cut -c 3-4) c=$(printf '%s' "${hex}" | cut -c 5-6) - r=$(printf '%s\n' "ibase=16; ${a}" | bc) - g=$(printf '%s\n' "ibase=16; ${b}" | bc) - b=$(printf '%s\n' "ibase=16; ${c}" | bc) + r=$(printf '%d' 0x${a}) + g=$(printf '%d' 0x${b}) + b=$(printf '%d' 0x${c}) - rf=$(printf '%s\n' "scale=10; ${r}/255" | bc) - gf=$(printf '%s\n' "scale=10; ${g}/255" | bc) - bf=$(printf '%s\n' "scale=10; ${b}/255" | bc) + rf=$(awk -v var=${r} 'BEGIN { print var/255 }') + gf=$(awk -v var=${g} 'BEGIN { print var/255 }') + bf=$(awk -v var=${b} 'BEGIN { print var/255 }') scrot -a "$(slop -b 3 -c "${rf}","${gf}","${bf}",1.0 -f '%x,%y,%w,%h')" -q 100 -z -C 'screenshot' "${PICTURES_DIR}/shots/%m-%d-%Y-%I-%M-%S.png" } diff --git a/.local/share/wp b/.local/share/wp @@ -1 +1 @@ -/home/mc/pix/wp/dream-of-arcadia.jpg -\ No newline at end of file +/home/mc/pix/wp/minimal-scenery.jpg +\ No newline at end of file