From 43dbb32d741e11f8e06341f515944ec757d4578f Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Mon, 2 Sep 2024 23:34:01 -0400 Subject: Lot's of stuff --- .config/aliasrc | 1 + .config/mimeapps.list | 2 +- .config/protonmail/bridge-v3/keychain.json | 3 + .config/w3m/config | 157 +++++++++++++++++++++++++ .config/w3m/keymap | 180 +++++++++++++++++++++++++++++ .local/bin/backlightctl | 52 ++++----- .local/bin/makewall | 45 ++++---- .local/share/applications/lynx.desktop | 8 ++ .profile | 13 ++- 9 files changed, 408 insertions(+), 53 deletions(-) create mode 100644 .config/protonmail/bridge-v3/keychain.json create mode 100644 .config/w3m/config create mode 100644 .config/w3m/keymap create mode 100644 .local/share/applications/lynx.desktop diff --git a/.config/aliasrc b/.config/aliasrc index 3853818..f8ccd09 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -33,3 +33,4 @@ tmls, tmux list-sessions xx, chmod +x adog, git log --all --decorate --oneline --graph yadog, yadm log --all --decorate --oneline --graph +z, zathura --fork diff --git a/.config/mimeapps.list b/.config/mimeapps.list index 0a6cf5a..473920f 100644 --- a/.config/mimeapps.list +++ b/.config/mimeapps.list @@ -4,7 +4,7 @@ x-scheme-handler/magnet=torrent.desktop; application/x-bittorrent=torrent.desktop; x-scheme-handler/mailto=mail.desktop; text/plain=text.desktop; -text/html=text.desktop; +text/html=lynx.desktop; application/postscript=pdf.desktop; application/pdf=pdf.desktop; image/png=img.desktop; diff --git a/.config/protonmail/bridge-v3/keychain.json b/.config/protonmail/bridge-v3/keychain.json new file mode 100644 index 0000000..2dc0094 --- /dev/null +++ b/.config/protonmail/bridge-v3/keychain.json @@ -0,0 +1,3 @@ +{ + "Helper": "pass-app" +} \ No newline at end of file diff --git a/.config/w3m/config b/.config/w3m/config new file mode 100644 index 0000000..03e67f4 --- /dev/null +++ b/.config/w3m/config @@ -0,0 +1,157 @@ +tabstop 2 +indent_incr 4 +pixel_per_char 16 +pixel_per_line 22 +frame 0 +target_self 0 +open_tab_blank 0 +open_tab_dl_list 0 +display_link 0 +display_link_number 0 +decode_url 0 +display_lineinfo 0 +ext_dirlist 1 +dirlist_cmd file:///$LIB/dirlist.cgi +use_dictcommand 1 +dictcommand file:///$LIB/w3mdict.cgi +multicol 0 +alt_entity 0 +graphic_char 0 +display_borders 0 +disable_center 0 +fold_textarea 0 +display_ins_del 1 +ignore_null_img_alt 1 +view_unseenobject 0 +display_image 1 +pseudo_inlines 1 +auto_image 1 +max_load_image 4 +ext_image_viewer 0 +image_scale 100 +inline_img_protocol 2 +imgdisplay w3mimgdisplay +image_map_list 1 +fold_line 0 +show_lnum 0 +show_srch_str 1 +label_topline 0 +nextpage_topline 0 +color 1 +high-intensity 0 +basic_color terminal +anchor_color blue +image_color green +form_color red +mark_color cyan +bg_color terminal +active_style 0 +active_color cyan +visited_anchor 0 +visited_color magenta +pagerline 10000 +use_history 1 +history 100 +save_hist 1 +confirm_qq 1 +close_tab_back 0 +mark 0 +emacs_like_lineedit 0 +space_autocomplete 0 +vi_prec_num 0 +mark_all_pages 0 +wrap_search 0 +ignorecase_search 1 +clear_buffer 1 +decode_cte 0 +auto_uncompress 0 +preserve_timestamp 1 +keymap_file keymap +document_root +personal_document_root +cgi_bin +index_file +tmp_dir +mime_types ~/.mime.types, /etc/mime.types +mailcap ~/.w3m/mailcap, /etc/w3m/mailcap +urimethodmap ~/.w3m/urimethodmap, /etc/w3m/urimethodmap +editor /usr/bin/vi +mailto_options 1 +mailer +extbrowser /usr/bin/xdg-open +extbrowser2 +extbrowser3 +extbrowser4 +extbrowser5 +extbrowser6 +extbrowser7 +extbrowser8 +extbrowser9 +bgextviewer 1 +use_lessopen 0 +passwd_file ~/.w3m/passwd +disable_secret_security_check 0 +ftppasswd +ftppass_hostnamegen 1 +pre_form_file ~/.w3m/pre_form +siteconf_file ~/.w3m/siteconf +user_agent +no_referer 0 +cross_origin_referer 1 +accept_language en;q=1.0 +accept_encoding gzip, compress, bzip, bzip2, deflate, br +accept_media text/html, text/*;q=0.5, image/*, application/* +argv_is_url 1 +retry_http 1 +default_url 1 +follow_redirection 10 +meta_refresh 0 +localhost_only 0 +dns_order 0 +use_proxy 1 +http_proxy +https_proxy +gopher_proxy +ftp_proxy +no_proxy +noproxy_netaddr 1 +no_cache 0 +ssl_forbid_method 2, 3, t, 5 +ssl_min_version +ssl_cipher +ssl_verify_server 1 +ssl_cert_file +ssl_key_file +ssl_ca_path +ssl_ca_file +ssl_ca_default 1 +use_cookie 1 +show_cookie 0 +accept_cookie 1 +accept_bad_cookie 0 +cookie_reject_domains +cookie_accept_domains +cookie_avoid_wrong_number_of_dots +display_charset UTF-8 +document_charset UTF-8 +auto_detect 2 +system_charset UTF-8 +follow_locale 1 +ext_halfdump 0 +use_wide 1 +use_combining 1 +east_asian_width 0 +use_language_tag 1 +ucs_conv 1 +pre_conv 0 +search_conv 1 +fix_width_conv 1 +use_gb12345_map 0 +use_jisx0201 0 +use_jisc6226 0 +use_jisx0201k 0 +use_jisx0212 0 +use_jisx0213 0 +strict_iso2022 1 +gb18030_as_ucs 0 +simple_preserve_space 0 diff --git a/.config/w3m/keymap b/.config/w3m/keymap new file mode 100644 index 0000000..010f48a --- /dev/null +++ b/.config/w3m/keymap @@ -0,0 +1,180 @@ +# Removing Defaults + +keymap + NULL +keymap C-v NULL +keymap SPC NULL +keymap ^[[6~ NULL +keymap - NULL +keymap ESC-v NULL +keymap ^[[5~ NULL +keymap b NULL +keymap C-f NULL +keymap C-b NULL +keymap C-f NULL +keymap C-b NULL +keymap C-n NULL +keymap C-p NULL +keymap J NULL +keymap K NULL +keymap > NULL +keymap < NULL +keymap , NULL +keymap . NULL +keymap C-a NULL +keymap ^ NULL +keymap $ NULL +keymap C-e NULL +keymap 0 NULL +keymap Z NULL +keymap z NULL +keymap w NULL +keymap W NULL +keymap b NULL +keymap ESC-g NULL +keymap ESC-< NULL +keymap ESC-> NULL +keymap ^[[1~ NULL +keymap ^[[4~ NULL +keymap G NULL +keymap g NULL +keymap [ NULL +keymap ] NULL +keymap TAB NULL +keymap C-u NULL +keymap ESC-TAB NULL +keymap ^[[Z NULL +keymap ESC-m NULL +keymap u NULL +keymap C-r NULL +keymap C-j NULL +keymap C-m NULL +keymap C-t NULL +keymap ESC-C-j NULL +keymap ESC-C-m NULL +keymap a NULL +keymap I NULL +keymap ESC-I NULL +keymap c NULL +keymap u NULL +keymap i NULL +keymap = NULL +keymap C-g NULL +keymap : NULL +keymap ";" NULL +keymap ESC-: NULL +keymap F NULL +keymap M NULL +keymap ESC-M NULL +keymap L NULL +keymap ESC-l NULL +keymap U NULL +keymap ESC-u NULL +keymap V NULL +keymap @ NULL +keymap "#" NULL +keymap | NULL +keymap B NULL +keymap C-_ NULL +keymap s NULL +keymap v NULL +keymap ESC-s NULL +keymap S NULL +keymap E NULL +keymap ESC-e NULL +keymap R NULL +keymap r NULL +keymap C-l NULL +keymap T NULL +keymap C-q NULL +keymap { NULL +keymap } NULL +keymap ESC-t NULL +keymap J NULL +keymap K NULL +keymap ESC-b NULL +keymap ESC-a NULL +keymap / NULL +keymap ? NULL +keymap n NULL +keymap N NULL +keymap C-s NULL +keymap C-r NULL +keymap ESC-w NULL +keymap ESC-W NULL +keymap C-@ NULL +keymap ESC-n NULL +keymap ESC-p NULL +keymap \" NULL +keymap ^[[28~ NULL +keymap ^[[2~ NULL +keymap ^[[E NULL +keymap ^[[L NULL +keymap H NULL +keymap o NULL +keymap r NULL +keymap C-k NULL +keymap C-h NULL +keymap D NULL +keymap m NULL +keymap C-w NULL +keymap ESC-c NULL +keymap ESC-o NULL +keymap ESC-k NULL +keymap ! NULL +keymap C-z NULL +keymap q NULL +keymap Q NULL + +# New keybinds + +# Navigation +keymap $ LINE_END +keymap ^ LINE_BEGIN +keymap 0 LINE_BEGIN +keymap G END +keymap gg BEGIN +keymap ESC-g GOTO_LINE +keymap w NEXT_WORD +keymap b PREV_WORD + +# NPage Navigation +keymap j COMMAND "MOVE_DOWN1" +keymap k COMMAND "MOVE_UP1" + +# Undo +keymap C-r REDO + +#keymap C-f NEXT_PAGE +keymap C-f COMMAND "NEXT_PAGE" +#keymap C-b PREV_PAGE +keymap C-b COMMAND "PREV_PAGE" +keymap H BACK +keymap r RELOAD + +# Tab stuff +keymap J NEXT_TAB +keymap K PREV_TAB +keymap o GOTO +keymap O TAB_GOTO + +# Search +keymap / WHEREIS +keymap ? SEARCH_BACK +keymap n SEARCH_NEXT +keymap N SEARCH_PREV + +# Commands +keymap :: COMMAND +keymap :help HELP +keymap :downloads DOWNLOAD_LIST +#keymap :hist HISTORY +keymap :q EXIT +keymap ZZ EXIT +keymap :settings OPTIONS + +# copy url to clipboard +keymap yy EXTERN 'printf %s | wl-copy' + +keymap e EXTERN +keymap f EXTERN_LINK + diff --git a/.local/bin/backlightctl b/.local/bin/backlightctl index 1d38c07..453c3c0 100755 --- a/.local/bin/backlightctl +++ b/.local/bin/backlightctl @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Get the correct sub-directory for your backlight device root_path="/sys/class/backlight/" @@ -12,26 +12,26 @@ default_step=10 default_set=50 to_percent() { - printf "%d" "$((100 * $1 / $max))" + printf "%d" "$((100 * $1 / $max))" } to_value() { - printf "%d" "$((max * $1 / 100))" + printf "%d" "$((max * $1 / 100))" } get_status() { - cat "$device/brightness" + cat "$device/brightness" } get_percent() { - to_percent "$(get_status)" + to_percent "$(get_status)" } # Add $1 to current brightness. Adjust if out of bounds (0-$max) # $1 is converted to a value between 0-$max within this function get_total() { - value="$(to_value "$1")" - printf "%d" "$(($(get_status) + $value))" + value="$(to_value "$1")" + printf "%d" "$(($(get_status) + $value))" } helpmsg="Usage: backlightctl -[FLAG] [PERCENTAGE] @@ -46,38 +46,38 @@ helpmsg="Usage: backlightctl -[FLAG] [PERCENTAGE] case "$1" in -i | --increase) - [ -z "$2" ] && step="$default_step" || step="$2" - get_total "$step" >"$device/brightness" - ;; + [ -z "$2" ] && step="$default_step" || step="$2" + get_total "$step" >"$device/brightness" + ;; -d | --decrease) - [ -z "$2" ] && step="$default_step" || step="$2" - get_total "-$step" >"$device/brightness" - ;; + [ -z "$2" ] && step="$default_step" || step="$2" + get_total "-$step" >"$device/brightness" + ;; -s | --set) - [ -z "$2" ] && set="$default_set" || set="$2" - to_value "$set" >"$device/brightness" - ;; + [ -z "$2" ] && set="$default_set" || set="$2" + to_value "$set" >"$device/brightness" + ;; -g | --get) - printf "󰃠 %s\n" "$(get_status)%" - ;; + printf "󰃠 %s\n" "$(get_status)%" + ;; -h | --help) - printf "%s" "$helpmsg" - ;; + printf "%s" "$helpmsg" + ;; *) - printf "\033[31mInvalid option: $1\033[0m\n%s" "$helpmsg" && exit 1 - ;; + printf "\033[31mInvalid option: $1\033[0m\n%s" "$helpmsg" && exit 1 + ;; esac # Send notification case "$@" in *-q* | *--quiet*) - exit 0 - ;; + exit 0 + ;; *) - notify-send.sh -t 1000 --replace-file /tmp/bl-notif -a "󰃠 Brightness:" "$(get_percent)%" - ;; + notify-send.sh -t 1000 --replace-file /tmp/bl-notif -a "󰃠 Brightness:" "$(get_percent)%" + ;; esac diff --git a/.local/bin/makewall b/.local/bin/makewall index 614d030..3458676 100755 --- a/.local/bin/makewall +++ b/.local/bin/makewall @@ -2,29 +2,34 @@ wallDir="${XDG_CONFIG_HOME:-$HOME}/wallpapers" -# Acquire the list of connected displays -displays="$(wlr-randr --json | jq -r '.[] | select(.enabled) | .name')" +# Acquire the list of connected displays and their models +displays="$(wlr-randr --json | jq -r '.[] | select(.enabled) | "\(.name) \(.model)"')" echo "$displays" -# If there is a wallpaper with a filename matching the display -# name, set it as the wallpaper for that display. -# ex: DP-1.jpg and DP-1.png are both valid filenames -# Otherwise, set the wallpaper to the default wallpaper -# (default.png or default.jpg) +# Sanitize the model names by replacing spaces with hyphens +sanitize_model() { + echo "$1" | sed 's/\s/-/g' +} + +# If there is a wallpaper with a filename matching the display name or sanitized model, +# set it as the wallpaper for that display. setDisplay() { - case $(ls $wallDir) in - *"$1"*) - wall=$(ls $wallDir | grep "$1" | head -n 1) - ;; - *) - wall=$(ls $wallDir | grep "default" | head -n 1) - ;; - esac - swaybg --output $1 -m fill --image $wallDir/$wall & + name="$1" + model="$2" + case $(ls $wallDir) in + *"$name"*|*"$model"*) + wall=$(ls $wallDir | grep -E "$name|$model" | head -n 1) + ;; + *) + wall=$(ls $wallDir | grep "default" | head -n 1) + ;; + esac + swaybg --output "$name" -m fill --image "$wallDir/$wall" & } # Set the wallpaper for each display -killall swaybg > /dev/null 2>&1 -for display in $displays; do - setDisplay $display -done +killall swaybg >/dev/null 2>&1 +while IFS=' ' read -r name model; do + sanitized_model=$(sanitize_model "$model") + setDisplay "$name" "$sanitized_model" +done <<< "$displays" diff --git a/.local/share/applications/lynx.desktop b/.local/share/applications/lynx.desktop new file mode 100644 index 0000000..d89da4f --- /dev/null +++ b/.local/share/applications/lynx.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Lynx Web Browser +Comment=Text-based web browser +Exec=/usr/bin/foot -e w3m -sixel %u +Categories=Network;WebBrowser; +MimeType=text/html; +Icon=utilities-terminal diff --git a/.profile b/.profile index e9d6b92..fc7733d 100644 --- a/.profile +++ b/.profile @@ -3,9 +3,9 @@ # enable certain tools only if on macOS case "$OSTYPE" in - darwin*) - eval "$(/opt/homebrew/bin/brew shellenv)" - ;; +darwin*) + eval "$(/opt/homebrew/bin/brew shellenv)" + ;; esac unsetopt PROMPT_SP 2>/dev/null @@ -21,6 +21,7 @@ export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" export XDG_CACHE_HOME="$HOME/.cache" export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" +export W3M_DIR="$XDG_CONFIG_HOME/w3m" export DISTRIB_ID=arch export DISTRIB_RELEASE="$(uname -r)" @@ -33,7 +34,7 @@ export CARGO_HOME="$XDG_DATA_HOME/cargo" export TMUX_TMPDIR="$XDG_RUNTIME_DIR" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" export QT_QPA_PLATFORMTHEME="gtk2" -export MOZ_USE_XINPUT2=1 # Mozilla smooth scrolling/touchpad +export MOZ_USE_XINPUT2=1 # Mozilla smooth scrolling/touchpad export AWT_TOOLKIT="MToolkit wmname LG3D" # Fix for Java applications in dwm export _JAVA_AWT_WM_NONREPARENTING=1 # (this too) export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default" @@ -74,10 +75,10 @@ aliasgen >/dev/null 2>&1 # Ensure XDG_RUNTIME_DIR is set if test -z "$XDG_RUNTIME_DIR"; then - export XDG_RUNTIME_DIR="$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX)" + export XDG_RUNTIME_DIR="$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX)" fi -startw(){ +startw() { dbus-launch --exit-with-session dwl } -- cgit v1.2.3