diff options
Diffstat (limited to 'config')
| -rw-r--r-- | config/lf/lfrc | 67 | ||||
| -rw-r--r-- | config/qutebrowser/.gitignore | 1 | ||||
| -rw-r--r-- | config/qutebrowser/config.py | 18 | ||||
| -rw-r--r-- | config/qutebrowser/quickmarks | 4 | ||||
| -rw-r--r-- | config/qutebrowser/security.py | 3 | ||||
| -rw-r--r-- | config/qutebrowser/ui.py | 2 | ||||
| -rw-r--r-- | config/zsh/aliases.zsh | 3 | ||||
| -rw-r--r-- | config/zsh/aliases/dev.zsh | 83 | ||||
| -rw-r--r-- | config/zsh/aliases/system.zsh | 16 | ||||
| -rw-r--r-- | config/zsh/plugins/fzf-cd.zsh | 16 |
10 files changed, 132 insertions, 81 deletions
diff --git a/config/lf/lfrc b/config/lf/lfrc index 671afbc..3df493b 100644 --- a/config/lf/lfrc +++ b/config/lf/lfrc @@ -34,13 +34,6 @@ cmd mkfile ${{ $EDITOR $ans }} -cmd move_to_trash ${{ - mkdir -p /tmp/.trash-cache/ - echo "$fx" | while read file; do - mv "$file" /tmp/.trash-cache/ - done; -}} - cmd show_images ${{ if [ "$(echo "$fx" | wc -l)" = "1" ]; then sxiv $(dirname "$fx") & @@ -61,22 +54,52 @@ cmd unzip_rar ${{ NIXPKGS_ALLOW_UNFREE=1 nix-shell -p unrar --run 'unrar x $f'; }} -# }}} +cmd unpack ${{ + typ=$(file --mime-type "$f" -bL); + case $(typ) in + application/zip) + unzip "$f" + ;; + application/x-tar|application/gzip) + tar xzf "$f" + ;; + application/x-7z-compressed) + nix-shell -p p7zip --run "7z x '$f'" + ;; + application/vnd.rar) + NIXPKGS_ALLOW_UNFREE=1 nix-shell -p unrar --run "unrar x '$f'" + ;; + *) + lf -remote "send $id echoerr 'Unknown archive type: $typ'"; + ;; + esac +}} + -# Unset old keys {{{ - map w - map m - map n - map "'" - map '"' - map d}} - map c - map e - map d -# }}} +# Unset old keys +map w +map m +map n +map p +map "'" +map '"' +map d}} +map c +map e +map d + +# TODO: fzf search through files + +# fzf search through directories +cmd fuzzy_search_dirs ${{ + dir=$(find . -type d | fzf); + if ! [ -z "$dir" ]; then + lf -remote "send $id cd $dir"; + fi +}} # Mutations -map dd move_to_trash +map dd delete map p paste map x cut map y copy @@ -91,8 +114,12 @@ map . :set hidden! map st :set sortby time; set info time map ss :set sortby size; set info size +# Search next/prev +map <tab> search-next +map <backtab> search-prev # Traversal keys +map \\f fuzzy_search_dirs map gdl cd ~/Downloads/dl map gdm cd ~/Downloads/music map gdv cd ~/dev diff --git a/config/qutebrowser/.gitignore b/config/qutebrowser/.gitignore index 3add446..a3555f0 100644 --- a/config/qutebrowser/.gitignore +++ b/config/qutebrowser/.gitignore @@ -1,2 +1,3 @@ qsettings/ autoconfig.yml +quickmarks diff --git a/config/qutebrowser/config.py b/config/qutebrowser/config.py index bb424a7..8fe4e10 100644 --- a/config/qutebrowser/config.py +++ b/config/qutebrowser/config.py @@ -159,8 +159,10 @@ nmap(localleader + 'td', ':toggle-darkmode') # c.aliases['load'] = 'session-load -t'; # Sessions -nmap(leader + 'sl', ':set-cmd-text :session-load '); -nmap(leader + 'sw', ':set-cmd-text :session-save '); +# nmap(leader + 'sl', ':set-cmd-text :session-load '); +# nmap(leader + 'sw', ':set-cmd-text :session-save '); +nmap(leader + 'sl', ':cmd-set-text :session-load '); +nmap(leader + 'sw', ':cmd-set-text :session-save --no-history'); # }}} #### Navigation {{{ @@ -192,8 +194,10 @@ c.tabs.new_position.unrelated = 'next' c.tabs.last_close = 'close' # 'close' for closing window on last d # Keybindings -nmap('o', 'set-cmd-text -s :open --tab') -nmap('O', 'set-cmd-text -s :open') +# nmap('o', 'set-cmd-text -s :open --tab') +# nmap('O', 'set-cmd-text -s :open') +nmap('o', 'cmd-set-text -s :open --tab') +nmap('O', 'cmd-set-text -s :open') # Tab nmap('d', 'tab-close') @@ -211,6 +215,7 @@ nmap('<Ctrl-j>', 'tab-next') nmap('<Ctrl-Shift-k>', 'tab-move -') nmap('<Ctrl-Shift-j>', 'tab-move +') nmap('b', 'set-cmd-text --space :buffer') # List buffers by index +# nmap('b', 'cmd-set-text --space :buffer') # List buffers by index for i in range(1, 10 + 1): key = 0 if i == 10 else i @@ -262,6 +267,7 @@ config.set('content.notifications.enabled', True, '*://chat.google.com') # Google meet config.set('content.notifications.enabled', False, '*://meet.google.com') +config.set('content.notifications.enabled', False, '*://*.basecamp.com') config.set('content.media.audio_video_capture', True, '*://meet.google.com') config.set('content.media.audio_capture', True, '*://meet.google.com') config.set('content.media.video_capture', True, '*://meet.google.com') @@ -331,8 +337,8 @@ nmap(leader + 'tj', 'format-json') # }}} #### History {{{ -nmap('<Shift-h>', 'back') -nmap('<Shift-l>', 'forward') +nmap('<Shift-h>', 'back --quiet') +nmap('<Shift-l>', 'forward --quiet') nmap(leader + 'hh', 'history --tab') # }}} diff --git a/config/qutebrowser/quickmarks b/config/qutebrowser/quickmarks deleted file mode 100644 index a5c1b35..0000000 --- a/config/qutebrowser/quickmarks +++ /dev/null @@ -1,4 +0,0 @@ -Whatsapp https://web.whatsapp.com/ -Gmail:personal https://mail.google.com/mail/u/0 -Gmail:colabra https://mail.google.com/mail/u/1 -Twitch:dashboard https://dashboard.twitch.tv/u/ediblemonad/stream-manager diff --git a/config/qutebrowser/security.py b/config/qutebrowser/security.py index 287442b..930368a 100644 --- a/config/qutebrowser/security.py +++ b/config/qutebrowser/security.py @@ -44,7 +44,8 @@ c.content.media.video_capture = 'ask' c.content.tls.certificate_errors = 'ask' c.content.desktop_capture = 'ask' c.content.mouse_lock = 'ask' -c.content.javascript.can_access_clipboard = True +# c.content.javascript.can_access_clipboard = True +c.content.javascript.clipboard = 'access' c.content.canvas_reading = True # c.content.fullscreen.window = True # Fullscreen fixed to window size diff --git a/config/qutebrowser/ui.py b/config/qutebrowser/ui.py index aa16249..f1479f3 100644 --- a/config/qutebrowser/ui.py +++ b/config/qutebrowser/ui.py @@ -19,7 +19,7 @@ c.fonts.default_family = 'JetBrainsMono Nerd Font' c.fonts.default_size = '12px' c.colors.webpage.preferred_color_scheme = 'dark' -c.colors.webpage.darkmode.enabled = True +c.colors.webpage.darkmode.enabled = False c.colors.webpage.darkmode.algorithm = "lightness-cielab" c.colors.webpage.darkmode.threshold.text = 150 c.colors.webpage.darkmode.threshold.background = 100 diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh index d9a5ef6..32586e0 100644 --- a/config/zsh/aliases.zsh +++ b/config/zsh/aliases.zsh @@ -9,6 +9,9 @@ alias e="sensible-editor"; alias v="nvim"; alias o='open $(fzf)'; +alias j='just'; +alias jl='just -l'; + # Load work aliases # source "$HOME/.work-config/zshconf/aliases.zsh"; diff --git a/config/zsh/aliases/dev.zsh b/config/zsh/aliases/dev.zsh index 4283a2d..cd2de8c 100644 --- a/config/zsh/aliases/dev.zsh +++ b/config/zsh/aliases/dev.zsh @@ -6,6 +6,13 @@ alias aws="docker run --rm -it amazon/aws-cli" # nix shell with zsh nix-zsh() { nix-shell --run "WITH_NIX_PREFIX='${NX_PREFIX:-':'}' zsh" "$@"; } +# Gitignore locally per-project +# Eg - gitignore-locally flake.nix flake.lock +gitignore-locally() { + git add --intent-to-add "$@"; + git update-index --assume-unchanged "$@"; +} + # :: Filename Pattern Replacetext far() { local file_r="$1"; shift; @@ -15,8 +22,8 @@ far() { } # :: FileType Filename -codi() { - local syntax="${1:-python}" +calc() { + local syntax="${1:-javascript}" shift nvim -c \ "let g:startify_disable_at_vimenter = 1 |\ @@ -27,18 +34,23 @@ codi() { Codi $syntax" "$@" } +get_node_script_runner() { + if [[ -f ./yarn.json ]]; then echo "yarn"; + elif [[ -f ./pnpm-lock.yaml ]]; then echo "pnpm"; + else echo "npm run"; fi; +} # Npm run key binding +# local commands=$(node -e 'const pkg = require("./package.json"); Object.entries(pkg.scripts || {}).map(([key, value]) => console.log(`${key}\t\t\t"${value}"`))'); +# local result=$(echo -e "$commands" | fzf | cut -f1); p__run_npm_script() { [[ ! -f "package.json" ]] && return 1; - local commands=$(node -e 'const pkg = require("./package.json"); Object.entries(pkg.scripts || {}).map(([key, value]) => console.log(`${key}\t\t "${value}"`))'); - # cat package.json | jq -r '.scripts | to_entries | map([.key, .value] | join("\t\t\t")) | .[]' | fzf | cut -f1 - - local result=$(echo -e "$commands" | fzf | cut -f1); - + local result=$(cat package.json | jq -r '.scripts | to_entries | map([.key, .value] | join("\t\t\t")) | .[]' | fzf | cut -f1); [[ -z "$result" ]] && return 1; - yarn "$result"; + + print -Rz - "$(get_node_script_runner) $result "; + zle send-break } zle -N p__run_npm_script; @@ -47,46 +59,25 @@ bindkey '^B' p__run_npm_script; # Load shell -p__load_nix_shell_file() { - if [[ -f "./default.nix" ]]; then - echo ""; - echo "ERR: default.nix already exists in directory"; - zle send-break; - return 1; - fi; +# p__load_nix_shell_file() { +# if [[ -f "./default.nix" ]]; then +# echo ""; +# echo "ERR: default.nix already exists in directory"; +# zle send-break; +# return 1; +# fi; +# +# local shells=$(ls ~/nixos/shell); +# local selected=$(echo -e "$shells" | fzf); +# [[ -z "$selected" ]] && return 1; +# cp ~/nixos/shell/$selected ./default.nix; +# zle send-break +# } +# +# zle -N p__load_nix_shell_file; +# bindkey '^N' p__load_nix_shell_file; - local shells=$(ls ~/nixos/shell); - local selected=$(echo -e "$shells" | fzf); - [[ -z "$selected" ]] && return 1; - cp ~/nixos/shell/$selected ./default.nix; - zle send-break -} - -zle -N p__load_nix_shell_file; -bindkey '^N' p__load_nix_shell_file; - - - -# Enter shell -p__enter_nixshell() { - if [[ -f "./default.nix" ]] || [[ -f "./shell.nix" ]]; then - shell="nix-zsh" - if [[ -f "./shell.nix" ]]; then - shell="nix-zsh ./shell.nix" - fi - $shell - zle send-break - return 0; - else - echo ""; - echo "ERR: No default.nix or shell.nix in directory"; - zle send-break; - return 1; - fi; -} -zle -N p__enter_nixshell; -bindkey '^X' p__enter_nixshell; fix-interpreter() { nix-shell -p patchelf --run "patchelf --set-interpreter \$(patchelf --print-interpreter \$(which mkdir)) $@" diff --git a/config/zsh/aliases/system.zsh b/config/zsh/aliases/system.zsh index 4554289..031bb1b 100644 --- a/config/zsh/aliases/system.zsh +++ b/config/zsh/aliases/system.zsh @@ -21,3 +21,19 @@ nix-rollback() { #sv_enable() { [[ -f "/etc/runit/sv/$1" ]] && sudo ln -s /etc/runit/sv/$1 /run/runit/service; } #sv_disable() { sudo unlink /run/runit/service/$1; } +setup_webcam_day() { + v4l2-ctl -d /dev/video2 --set-ctrl exposure_absolute=300 + v4l2-ctl -d /dev/video2 --set-ctrl gamma=180 + v4l2-ctl -d /dev/video2 --set-ctrl saturation=17 + v4l2-ctl -d /dev/video2 --set-ctrl contrast=12 + v4l2-ctl -d /dev/video2 --set-ctrl brightness=1 +} + +setup_webcam_night() { + v4l2-ctl -d /dev/video2 --set-ctrl exposure_absolute=400 + v4l2-ctl -d /dev/video2 --set-ctrl gamma=230 + v4l2-ctl -d /dev/video2 --set-ctrl saturation=16 + v4l2-ctl -d /dev/video2 --set-ctrl contrast=11 + v4l2-ctl -d /dev/video2 --set-ctrl brightness=1 +} + diff --git a/config/zsh/plugins/fzf-cd.zsh b/config/zsh/plugins/fzf-cd.zsh index e4b4337..f1897c5 100644 --- a/config/zsh/plugins/fzf-cd.zsh +++ b/config/zsh/plugins/fzf-cd.zsh @@ -1,12 +1,22 @@ + +fzf-change-dir-cwd() { # fzf + cd in cwd + selected=$(find . -maxdepth 1 -type d | fzf); + if [ ! -z "$selected" ] && [ "$selected" != "$(pwd)" ]; then + cd $selected; + fi + zle send-break +} + +zle -N fzf-change-dir-cwd; +bindkey '^O' fzf-change-dir-cwd; + fzf-change-dir() { local result=$(find -type d | fzf); - if ! [[ -z "$result" ]]; then cd "$result" fi - zle send-break } zle -N fzf-change-dir; -bindkey '^P' fzf-change-dir; +bindkey '^F' fzf-change-dir; |
