From 4ef38f411ec198328b5c18ba4b56b1499e4bc798 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 7 Jun 2017 13:04:32 +0100 Subject: Add script to facilitate qutebrowser navigation --- Xresources/.Xresources/base | 3 ++ bin/bin/email | 2 +- git/.gitconfig | 2 + mutt/.mutt/muttrc | 2 +- qutebrowser/.config/qutebrowser/keys.conf | 21 ++++++-- .../qutebrowser/userscripts/dictionary-search | 2 +- .../.local/share/qutebrowser/userscripts/explorer | 15 ++++++ .../.local/share/qutebrowser/userscripts/history | 10 ++++ .../share/qutebrowser/userscripts/quickmarks | 10 ++++ .../share/qutebrowser/userscripts/quickmarks-dmenu | 7 --- .../share/qutebrowser/userscripts/tab-switch | 6 --- .../.local/share/qutebrowser/userscripts/tabs | 14 +++++ vim/.vim/compiler/gmsh.vim | 12 +++++ vim/.vim/ftplugin/gmsh.vim | 1 + vim/.vim/indent/gmsh.vim | 59 ++++++++++++++++++++++ 15 files changed, 145 insertions(+), 21 deletions(-) create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/explorer create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/history create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/quickmarks delete mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu delete mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/tab-switch create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/tabs create mode 100644 vim/.vim/compiler/gmsh.vim create mode 100644 vim/.vim/ftplugin/gmsh.vim create mode 100644 vim/.vim/indent/gmsh.vim diff --git a/Xresources/.Xresources/base b/Xresources/.Xresources/base index 71bd329..0afa832 100644 --- a/Xresources/.Xresources/base +++ b/Xresources/.Xresources/base @@ -30,3 +30,6 @@ URxvt.resize-font.bigger: C-plus URxvt*font: xft:monaco:size=11.5 URxvt*scrollBar: false URxvt*internalBorder: 0 + +rofi.kb-mode-next: Tab +rofi.kb-mode-previous: Shift+Tab diff --git a/bin/bin/email b/bin/bin/email index b4fe9fa..c2f9998 100755 --- a/bin/bin/email +++ b/bin/bin/email @@ -10,7 +10,7 @@ new_mails=$(find $HOME/.mail -path '*/new/*' -type f -not -path '*/rss/*') if [[ ! -z ${new_mails} ]]; then subjects=$(cat $(echo -e ${new_mails/'\n'/' '}) | grep "^Subject: " | sed "s/^Subject: //g") - /usr/bin/notify-send -t 3 "New mail(s)!" "${subjects}" + DISPLAY=:0 /usr/bin/notify-send -t 3 "New mail(s)!" "${subjects}" fi echo "Email last checked on $(date)". diff --git a/git/.gitconfig b/git/.gitconfig index 15a64c3..382259b 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -11,3 +11,5 @@ submodulesummary = 1 [alias] yolo = !git commit -am "Update" && git push origin master +[core] + fileMode = false diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc index 4f91cf6..67d9918 100644 --- a/mutt/.mutt/muttrc +++ b/mutt/.mutt/muttrc @@ -90,7 +90,7 @@ folder-hook 'Work*' 'source ~/.mutt/id_work' folder-hook 'Personal*' 'source ~/.mutt/id_personal' macro index,pager gr " +Misc/rss" -folder-hook 'Misc/rss' 'unset trash' +folder-hook 'Misc/rss' 'unset trash; unset from' # Source mutt solarized `[[ "$COLORSCHEME" = "solarized" && "$BACKGROUND" = "light" ]] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-light-16.muttrc || echo set` diff --git a/qutebrowser/.config/qutebrowser/keys.conf b/qutebrowser/.config/qutebrowser/keys.conf index 8fd0d48..c7555a1 100644 --- a/qutebrowser/.config/qutebrowser/keys.conf +++ b/qutebrowser/.config/qutebrowser/keys.conf @@ -55,8 +55,17 @@ set-cmd-text -s :spawn --userscript url-from-surfraw set-cmd-text -s :spawn --userscript url-from-surfraw -t t -spawn --userscript tab-switch - T +spawn --userscript explorer -b + eb + +spawn --userscript explorer -h + eh + +spawn --userscript explorer -t + et + +spawn --userscript explorer + b spawn mpv {url} y @@ -260,9 +269,6 @@ set-cmd-text -s :quickmark-load -w bookmark-add M -spawn --userscript quickmarks-dmenu - b - set-cmd-text -s :bookmark-load -t gB @@ -460,6 +466,9 @@ forward -w fullscreen +set-cmd-text -s :quickmark-load + xxb + [insert] # Keybindings for insert mode. # Since normal keypresses are passed through, only special keys are @@ -716,6 +725,8 @@ scroll up scroll right L +[caret,normal] + spawn --userscript dictionary-search gD diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search b/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search index 3155c91..cb9ad7d 100755 --- a/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search +++ b/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search @@ -1,3 +1,3 @@ #!/bin/bash -echo "open -t http://dictionary.cambridge.org/dictionary/english/$QUTE_SELECTED_TEXT" >> "$QUTE_FIFO" +echo "open -t http://dictionary.cambridge.org/dictionary/english/$QUTE_SELECTED_TEXT" > "$QUTE_FIFO" diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/explorer b/qutebrowser/.local/share/qutebrowser/userscripts/explorer new file mode 100755 index 0000000..f134aa5 --- /dev/null +++ b/qutebrowser/.local/share/qutebrowser/userscripts/explorer @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +scripts_dir="$HOME/.local/share/qutebrowser/userscripts" +rofi_modi="quickmarks:$scripts_dir/quickmarks,tabs:$scripts_dir/tabs,history:$scripts_dir/history" +rofi_comand="rofi -combi-modi $rofi_modi -modi $rofi_modi -show" + +if [[ "$1" = "-t" ]]; then + $rofi_comand tabs +elif [[ "$1" = "-b" ]]; then + $rofi_comand quickmarks +elif [[ "$1" = "-h" ]]; then + $rofi_comand history +else + $rofi_comand combi +fi diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/history b/qutebrowser/.local/share/qutebrowser/userscripts/history new file mode 100755 index 0000000..2122666 --- /dev/null +++ b/qutebrowser/.local/share/qutebrowser/userscripts/history @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -n "$1" ] +then + echo "open $(echo $1 | awk '{print $NF}')" >> $QUTE_FIFO + exit; +fi + +# List history +cat ~/.local/share/qutebrowser/history | awk '{print $3 ": " $2}' diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks b/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks new file mode 100755 index 0000000..a55b23b --- /dev/null +++ b/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -n "$1" ] +then + echo "open $(echo $1 | awk '{print $NF}')" >> $QUTE_FIFO + exit; +fi + +# List of marks +cat ~/.config/qutebrowser/quickmarks diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu b/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu deleted file mode 100755 index 354b398..0000000 --- a/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -url=$(cat ~/.config/qutebrowser/quickmarks | dmenu -i -l 15 | awk '{print $NF}') - -[ -z ${url} ] && exit - -echo "open $url" >> "$QUTE_FIFO" diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/tab-switch b/qutebrowser/.local/share/qutebrowser/userscripts/tab-switch deleted file mode 100755 index b82ed36..0000000 --- a/qutebrowser/.local/share/qutebrowser/userscripts/tab-switch +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -tabs=$(i3-msg -t get_tree | grep -o '"window":[0-9]*[^{]*{[^}]*qutebrowser[^}]*}') -selected_title=$(echo "$tabs" | sed 's/^.*title":"\(.*\) - qutebrowser.*/\1/g' | dmenu) -selected_id=$(echo "$tabs" | grep "$selected_title" | sed 's/^.*window":\([0-9]*\).*$/\1/') -i3-msg "[id=$selected_id] focus" diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/tabs b/qutebrowser/.local/share/qutebrowser/userscripts/tabs new file mode 100755 index 0000000..7f9e226 --- /dev/null +++ b/qutebrowser/.local/share/qutebrowser/userscripts/tabs @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# List of tabs +tabs=$(i3-msg -t get_tree | grep -o '"window":[0-9]*[^{]*{[^}]*qutebrowser[^}]*}') + +if [ -n "$1" ] +then + selected_id=$(echo "$tabs" | grep "$@" | sed 's/^.*window":\([0-9]*\).*$/\1/') + i3-msg "[id=$selected_id] focus" > /dev/null 2>&1 + exit; +fi + +# Sanitized List of tabs +echo "$tabs" | sed 's/^.*title":"\(.*\) - qutebrowser.*/\1/g' diff --git a/vim/.vim/compiler/gmsh.vim b/vim/.vim/compiler/gmsh.vim new file mode 100644 index 0000000..70148e8 --- /dev/null +++ b/vim/.vim/compiler/gmsh.vim @@ -0,0 +1,12 @@ +if exists("current_compiler") + finish +endif + +let current_compiler = "gmsh" + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +setlocal errorformat=Error\ \ \ :\ \'%f\'\\,\ line\ %l\ :\ %m +setlocal makeprg=gmsh\ %\ -\\|&\ grep\ Error diff --git a/vim/.vim/ftplugin/gmsh.vim b/vim/.vim/ftplugin/gmsh.vim new file mode 100644 index 0000000..ec58378 --- /dev/null +++ b/vim/.vim/ftplugin/gmsh.vim @@ -0,0 +1 @@ +compiler gmsh diff --git a/vim/.vim/indent/gmsh.vim b/vim/.vim/indent/gmsh.vim new file mode 100644 index 0000000..845b668 --- /dev/null +++ b/vim/.vim/indent/gmsh.vim @@ -0,0 +1,59 @@ +" Vim indent file + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetGeoIndent() +setlocal indentkeys& +setlocal autoindent +setlocal commentstring=//%s + +if exists("*GetGeoIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let s:skip_syntax = '\%(Comment\|String\)$' + +function! GetGeoIndent() + + let lnum = prevnonblank(v:lnum - 1) + + if lnum == 0 + return 0 + endif + + let ind = indent(lnum) + let last_line = getline(lnum) + let current_line = getline(v:lnum) + + if last_line =~ '\(^\/\/\|^\/\*\)' + return ind + endif + + if last_line =~ '\(\\|\\|\\)' + let ind += &shiftwidth + endif + + if last_line =~ '\({[^}]*$\)' + let ind += &shiftwidth + endif + + if current_line =~ '\(^[^{]*}\)' + let ind -= &shiftwidth + endif + + if current_line =~ '\(\\|\\|\\)$' + let ind -= &shiftwidth + endif + + return ind + +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save -- cgit v1.2.3