" ============================================
" ~/.config/tridactyl/tridactylrc
" (or ~/.tridactylrc if XDG_CONFIG_HOME isn't set)
" Requires the native messenger to auto-load at startup.
" Install it from inside Tridactyl with :installnative,
" then restart LibreWolf (or run :source).
" ============================================

" ============================================
" LEADER KEY: comma (,) as prefix
" ============================================

bind ,h open https://homepage.liphlink.xyz
bind ,H tabopen https://homepage.liphlink.xyz
bind ,a open https://openwebui.liphlink.xyz
bind ,A tabopen https://openwebui.liphlink.xyz
bind ,j open https://jellyfin.liphlink.xyz
bind ,J tabopen https://jellyfin.liphlink.xyz
bind ,p pin
bind ,m mute

" ============================================
" UNDO / REDO & TAB CLOSE
" ============================================
bind x tabclose
bind X undo
bind R reloadhard

" ============================================
" SCROLL THROUGH TABS: forward / backward
" ============================================
bind J tabprev
bind K tabnext
bind gT tabprev
bind gt tabnext
bind g0 tabfirst
bind g$ tablast
bind < gtabmove -1
bind > gtabmove +1

" ============================================
" HISTORY: back / forward
" ============================================
bind H back
bind L forward

" ============================================
" SCROLLING: half-page jumps (vim Ctrl-d / Ctrl-u feel)
" ============================================
bind d scrollpage +0.5
bind u scrollpage -0.5

" ============================================
" RELOADING
" ============================================
bind r reload

" ============================================
" CLIPBOARD & YANKING
" ============================================
bind yy clipboard yank
bind yf hint -y
bind p open --clipboard
bind P tabopen --clipboard

" ============================================
" OTHER HANDY BINDS
" ============================================
bind / find 
bind n findnext
bind N findnext --reverse
bind ,<Space> nohlsearch
bind gi focusinput
bind gs viewsource
bind gd tabdetach
bind gD composite tabduplicate; tabdetach
bind zi zoom 1.1
bind zo zoom 0.9
bind zz zoom 100

" ============================================
" SETTINGS
" ============================================
set hintfiltermode vimperator-reflow
set hintnames numeric
set hintdelay 100
set smoothscroll true
set tabsort mru

" ============================================
" PER-SITE TWEAKS
" ============================================
" Google: only hint actual search results
bindurl www.google.com f hint -Jc #search a
bindurl www.google.com F hint -Jbc #search a

" Auto-redirect Reddit to old layout
autocmd DocStart ^http(s?)://www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")


" --- Comfortable scrolling & tabs ---
bind d scrollpage +0.5
bind u scrollpage -0.5
bind x tabclose
bind X undo
bind J tabprev
bind K tabnext

" Detach or duplicate tab to new window
bind gd tabdetach
bind gD composite tabduplicate; tabdetach

" --- Hinting (link selection) ---
set hintfiltermode vimperator-reflow
set hintnames numeric
set hintdelay 100

" --- General behaviour ---
set smoothscroll true
set tabsort mru

" --- Per-site tweaks ---
" Google: only hint actual search results
bindurl www.google.com f hint -Jc #search a
bindurl www.google.com F hint -Jbc #search a

" Auto-redirect reddit to old layout
autocmd DocStart ^http(s?)://www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")


" --- Quickmarks: favourite pages ---
" After defining these, press:
"   go<key>  -> open in current tab
"   gn<key>  -> open in new tab
"   gw<key>  -> open in new window
" quickmark a https://openwebui.liphlink.xyz
" quickmark h https://homepage.liphlink.xyz
" quickmark i https://invidious.liphlink.xyz
" quickmark r https://
" quickmark n https://news.ycombinator.com
" quickmark t https://github.com

