Compare commits

..

No commits in common. "master" and "main" have entirely different histories.
master ... main

38 changed files with 669 additions and 2289 deletions

View File

@ -9,27 +9,24 @@ alias cp='cp -i'
alias mv='mv -i'
# useful commands
alias pp="paruz -S"
alias pr="paruz -R"
alias upgrade="sudo pacman -Syyu"
alias ls="exa --icons"
alias l="exa --icons --group-directories-first -lh"
alias la="exa --icons --group-directories-first -alh"
alias lt="exa --icons --group-directories-first -lh --tree"
alias llt="exa --icons --group-directories-first -alh --tree"
alias p="sudo pacman"
alias y="yay"
alias upgrade="sudo pacman -Syyu && yay -Syyu"
alias ls="exa --group-directories-first -lh"
alias l="exa --group-directories-first -lh"
alias la="exa --group-directories-first -alh"
alias print="printf"
alias q="exit"
alias x="exit"
# nvim edits
alias cfi3="nvim ~/.config/i3/config"
alias cfi3s="nvim ~/.config/i3status/config"
alias cfn="nvim ~/.config/nvim/init.vim"
alias e="nvim"
alias e="nvim ."
# cd commands
alias c="cd ~/.config"
alias cuni="cd ~/Documents/Uni/CS && l"
# cli applications
alias yt="youtube-viewer"
@ -37,14 +34,5 @@ alias yt="youtube-viewer"
alias gs="git status"
alias gp="git push"
alias ga="git add"
alias gd="git diff origin/master"
#cat is now bat!
alias cat="bat"
# kitty
alias icat="kitty +kitten icat "
function fman() {
man -k . | fzf -q "$1" --prompt='man> ' --preview $'echo {} | tr -d \'()\' | awk \'{printf "%s ", $2} {print $1}\' | xargs -r man' | tr -d '()' | awk '{printf "%s ", $2} {print $1}' | xargs -r man
}

15
.bashrc
View File

@ -5,23 +5,15 @@ export VISUAL=/usr/bin/nvim
export EDITOR=/usr/bin/nvim
export SPOTIPY_CLIENT_ID='aafa7f3fb81f46f681415f2cedfda2c8'
export SPOTIPY_CLIENT_SECRET='6ebee1d932c34fcdb711d4bf14dac0de'
export BW_SESSION="dFERFxdk1zdXiPxf54dULKCONLUSfUsg3KJ65lqIxhSy0SVbNCO5redWZ85YaGQ4ShGAV6zuKif7RO4dAy/K4g=="
export BROWSER=brave
#export GOROOT=/usr/local/go
#export GOPATH=$HOME/go
#export GOBIN=$HOME/go/bin
#export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:$GOBIN
#export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store"
#export GNUPGHOME="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg"
# - Ui4axsk9mwfw? -
set -o vi
bind -m vi-command 'Control-l: clear-screen'
bind -m vi-insert 'Control-l: clear-screen'
#ufetch
#bash ~/Git/fetch.sh/fetch.sh
#bash ~/.scripts/we
#(cat $HOME/.config/wpg/sequences &)
function lazygit() {
git add .
@ -172,8 +164,3 @@ eval "$(zoxide init bash)"
eval "$(starship init bash)"
# BEGIN_KITTY_SHELL_INTEGRATION
if test -n "$KITTY_INSTALLATION_DIR" -a -e "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; then source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; fi
# END_KITTY_SHELL_INTEGRATION
source /home/simon/.config/broot/launcher/bash/br

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,6 @@
env:
TERM: xterm-256color
scrolling:
history: 5000
@ -9,7 +8,6 @@ window:
padding:
x: 0
y: 0
draw_bold_text_with_bright_colors: true
colors:
# Default colors
@ -107,11 +105,9 @@ font:
#family: IBM Plex Mono
#family: Source Code Pro
#family: BlexMono Nerd Font
#family: Fira Code
#family: Blex Mono Bold Nerd Font Complete
family: Comic Code Ligatures
family: Fira Code
style:
size: 12
size: 6.95
url:
# URL launcher
@ -132,3 +128,4 @@ Key_bindings:
- { key: C, mods: Control|Alt, action: Copy }
- { key: Return, mods: Control, action: SpawnNewInstance }
- { key: T, mods: Control, action: SpawnNewInstance }

194
i3/config
View File

@ -3,6 +3,8 @@
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@ -17,10 +19,8 @@ set_from_resource $split i3wm.color10 "#9E664B0"
#font pango: Source Code Pro 12px
#font pango: IBM Plex Mono 11px
#font pango: JetBrains Mono 8
font pango: BlexMono Nerd Font 11px
#font pango: Iosevka Nerd Font 13px
#font pango: Comic Code Ligatures Medium 11px
#font pango: Fira Code 11px
#font pango: BlexMono Nerd Font 11px
font pango: Fira Code 11px
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
@ -48,40 +48,38 @@ font pango: BlexMono Nerd Font 11px
# ------------------------- NEW COLORS -------------------------
# class border backgr. text indicator child_border
#client.focused $coloract $coloract $white $split $coloract
#client.focused_inactive $coloract $coloract $white $split $coloract
#client.unfocused $colorin $colorin #888888 $split $colorin
#client.urgent #2f343a #900000 $white #900000 #900000
#client.placeholder #000000 #0c0c0c $white #000000 #0c0c0c
client.focused $coloract $coloract $white $split $coloract
client.focused_inactive $coloract $coloract $white $split $coloract
client.unfocused $colorin $colorin #888888 $split $colorin
client.urgent #2f343a #900000 $white #900000 #900000
client.placeholder #000000 #0c0c0c $white #000000 #0c0c0c
client.background #ffffff
#client.background #ffffff
# -------------------- DRACULA THEME ----------------------------
client.focused #6272A4 #6272A4 #F8F8F2 #FF79C6 #6272A4
client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A
client.unfocused #282A36 #282A36 #BFBFBF #282A36 #282A36
client.urgent #44475A #FF5555 #F8F8F2 #FF5555 #FF5555
client.placeholder #282A36 #282A36 #F8F8F2 #282A36 #282A36
#
client.background #F8F8F2
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork --color=000000
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
exec --no-startup-id setxkbmap -option
exec --no-startup-id autotiling
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
exec --no-startup-id bash ~/.fehbg &
# exec --no-startup-id guake #retire until its fixed?
exec --no-startup-id redshift
#exec --no-startup-id teams
#exec --no-startup-id i3-msg 'workspace 10; exec teams'
#exec --no-startup-id i3-msg 'workspace 9; exec discord'
#exec --no-startup-id discord
#exec --no-startup-id nitrogen --restore
exec --no-startup-id nitrogen --set-zoom-fill --save /home/simon/Pictures/wallpapers/vidar-nordli-mathisen-Sk32_wG8lcQ-unsplash.jpg
#exec --no-startup-id wpg -mi && wpg --brt $(wpg -c) 10.6 && wpg -s $(wpg -c)
exec --no-startup-id guake
exec --no-startup-id picom -c
exec --no-startup-id xfce4-power-manager
exec --no-startup-id gammy
exec --no-startup-id emacs --daemon
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
@ -89,22 +87,13 @@ bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
# Binds for - and + for volume on keypad!
# Binds for - and + for volume
bindsym $mod+KP_Add exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym $mod+KP_Subtract exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym $mod+KP_Multiply exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use xev to find the keys on the keypad
# Binds for swapping between single laptop screen to 2 with an ultrawide
bindsym $mod+KP_End exec --no-startup-id bash ~/.scripts/laptop
bindsym $mod+KP_Down exec --no-startup-id bash ~/.scripts/ultrawide
bindsym $mod+KP_Next exec --no-startup-id bash ~/.scripts/tf2
bindsym $mod+KP_Left exec --no-startup-id bash ~/.scripts/one-mon.sh
# Make a note and push via gotify
#bindsym $mod+n exec --no-startup-id bash ~/.scripts/gnote # replaced with QOwnNotes as i use it more
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
@ -135,28 +124,22 @@ bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
bindsym $mod+Ctrl+Right resize shrink width 1 px or 1 ppt
bindsym $mod+Ctrl+Up resize grow height 1 px or 1 ppt
bindsym $mod+Ctrl+Down resize shrink height 1 px or 1 ppt
bindsym $mod+Ctrl+Left resize grow width 1 px or 1 ppt
# multi moniter support
# focus monitors
bindsym $mod+bracketleft focus output left
bindsym $mod+bracketright focus output right
bindsym $mod+greater move workspace to output right
bindsym $mod+less move workspace to output left
# move to monitors
bindsym $mod+Shift+bracketleft move output left
bindsym $mod+Shift+bracketright move output right
# split in horizontal orientation
#bindsym $mod+semicolon split h
bindsym $mod+semicolon split h
# split in vertical orientation
# bindsym $mod+v split v
# toggle split windows
bindsym $mod+semicolon split toggle
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
@ -164,8 +147,7 @@ bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
#bindsym $mod+s layout stacking
#bindsym $mod+w layout tabbed
#bindsym $mod+s layout toggle tabbed
bindsym $mod+Tab layout toggle tabbed split
bindsym $mod+s layout toggle split
# toggle tiling / floating
bindsym $mod+space floating toggle
@ -174,13 +156,13 @@ bindsym $mod+space floating toggle
bindsym $mod+Shift+space focus mode_toggle
# focus the parent container
#bindsym $mod+a focus parent
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
new_window pixel 3
default_border pixel 3
new_window pixel 2
default_border pixel 2
gaps inner 14
gaps outer 14
@ -196,20 +178,25 @@ bindsym $mod+shift+o gaps outer current minus 5
bindsym $mod+BackSpace gaps inner all set 14; gaps outer all set 14
bindsym $mod+shift+BackSpace gaps inner all set 0; gaps outer all set 0
#### Programs
bindsym $mod+Return exec kitty
bindsym $mod+Shift+Return exec alacritty -e ~/.scripts/web
# bindsym $mod+Ctrl+Return exec alacritty -e ~/.scripts/mc #BRING BACK THE MC SERVER???
bindsym $mod+x exec xinput-gui
bindsym $mod+c exec brave https://calendar.google.com/calendar/u/0/r?pli=1
bindsym $mod+Shift+b exec blueman-manager
bindsym $mod+p exec bwmenu
bindsym $mod+Shift+f exec --no-startup-id thunar
bindsym $mod+Ctrl+f exec --no-startup-id alacritty -e ranger
bindsym $mod+e exec emacsclient -c -a 'emacs'
bindsym $mod+n exec --no-startup-id QOwnNotes
# Print Screen :::
#### Programs
bindsym $mod+Return exec alacritty
bindsym $mod+Shift+Return exec alacritty -e ~/.scripts/web
bindsym $mod+Ctrl+Return exec alacritty -e nvim ~/vimwiki/index.md
bindsym $mod+d exec rofi -show run
bindsym $mod+Shift+d exec rofi -show drun -show-icons true
bindsym $mod+c exec gnome-calendar
bindsym $mod+Shift+b exec blueman-manager
bindsym $mod+Shift+t exec lyx &
bindsym $mod+p exec passmenu -l 30
bindsym $mod+Shift+p exec gpodder
bindsym $mod+Shift+f exec --no-startup-id nautilus
bindsym $mod+Ctrl+f exec --no-startup-id alacritty -e ranger
#WHOLE SCREEN
bindsym Print exec scrot $HOME/Pictures/Screenshots/`date +%Y-%m-%d_%H:%M:%S`.png
@ -220,36 +207,33 @@ bindsym $mod+Print exec scrot -u $HOME/Pictures/Screenshots/`date +%Y-%m-%d_%H:%
#bindsym --release $mod+Shift+Print exec --no-startup-id scrot -s $HOME/Pictures/Screenshots/`date +%Y-%m-%d_%H:%M:%S`.png
bindsym --release $mod+Shift+Print exec --no-startup-id bash /home/simon/.scripts/vscrnpaste
##OPEN DIR
bindsym $mod+s exec --no-startup-id nautilus ~/Pictures/Screenshots/
#### ROFI
#bindsym $mod+e exec --no-startup-id rofi -show
bindsym Menu exec --no-startup-id rofi -show
bindsym $mod+Shift+e exec --no-startup-id rofi -show emoji -modi emoji
bindsym $mod+d exec rofi -show run
bindsym $mod+Shift+d exec rofi -show drun -show-icons true
bindsym $mod+e exec --no-startup-id rofi -show emoji -modi emoji
bindsym $mod+Shift+e exec --no-startup-id rofi -show
#neomutt mail
#bindsym $mod+m exec --no-startup-id alacritty -e neomutt
#bindsym $mod+m exec --no-startup-id kitty -e neomutt
#bindsym $mod+Shift+m exec --no-startup-id mullvad-vpn #not used atm!
bindsym $mod+m exec --no-startup-id alacritty -e neomutt
#float certian windows
for_window [class="feh" instance="feh"] floating enable
for_window [class="org.pwmt.zathura" instance="zathura"] floating enable
for_window [class="gl" instance="mpv"] floating enable
for_window [instance="gammy"] floating enable
for_window [class="^.*"] border pixel 3
#wpg
#bindsym $mod+$alt+t exec wpg -m && wpg --brt $(wpg -c) 10.6 && wpg -s $(wpg -c) && bash /home/simon/.scripts/getwal
#bindsym $mod+$alt+t exec nitrogen --set-zoom-fill --random /home/simon/Pictures/wallpapers/
bindsym $mod+$alt+t exec nitrogen --set-zoom-fill /home/simon/Pictures/wallpapers/vidar-nordli-mathisen-Sk32_wG8lcQ-unsplash.jpg
bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness
bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness
bindsym $mod+w exec --no-startup-id brave
bindsym $mod+Shift+w exec --no-startup-id qutebrowser simonkellet.xyz
bindsym $mod+Ctrl+w exec --no-startup-id kitty -e amfora simonkellet.xyz
bindsym $mod+w exec --no-startup-id brave www.simonkellet.xyz
bindsym $mod+Shift+w exec --no-startup-id qutebrowser www.simonkellet.xyz
bindsym $mod+Ctrl+w exec --no-startup-id alacritty -e amfora simonkellet.xyz
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
@ -264,18 +248,6 @@ set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
workspace 1 output primary
workspace 2 output primary
workspace 3 output primary
workspace 4 output primary
workspace 5 output primary
workspace 6 output eDP-1
workspace 7 output eDP-1
workspace 8 output eDP-1
workspace 9 output eDP-1
workspace 10 output eDP-1
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
@ -332,10 +304,10 @@ mode "resize" {
bindsym $mod+r mode "default"
}
#bindsym $mod+r mode "resize" #not used!
bindsym $mod+r mode "resize"
set $Locker i3lock && sleep 1
#set $Locker i3lock --color=000000 && sleep 1
set $Locker sh ~/.config/i3lock/lock.sh
set $mode_system (l)lock (e)logout (s)suspend (h)hibernate (r)reboot (Shift+s)shutdown
mode "$mode_system" {
@ -350,8 +322,10 @@ mode "$mode_system" {
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Escape mode "$mode_system"
#
#set $coloract "#6a8e7a"
#set $colorin "#3c5045"
#set_from_resource $white i3wm.color15 "#fefbec"
@ -364,33 +338,21 @@ bar {
modifier none
status_command i3status
tray_output primary
tray_output eDP-1
i3bar_command i3bar
position top
position bottom
separator_symbol "|"
# colors {
# background #000000
# statusline $white
# separator $white
#
# focused_workspace $colorin $split #FFFFFF
# active_workspace #333333 #222222 #FFFFFF
# inactive_workspace #333333 #222222 #888888
# urgent_workspace #2F343A #900000 #FFFFFF
# binding_mode #2F343A #900000 #FFFFFF
# }
# DRACULA THEMMEMEMEMMEE
colors {
background #282A36
statusline #F8F8F2
separator #44475A
background #000000
statusline $white
separator $white
focused_workspace #44475A #44475A #F8F8F2
active_workspace #282A36 #44475A #F8F8F2
inactive_workspace #282A36 #282A36 #BFBFBF
urgent_workspace #FF5555 #FF5555 #F8F8F2
binding_mode #FF5555 #FF5555 #F8F8F2
focused_workspace $colorin $split #FFFFFF
active_workspace #333333 #222222 #FFFFFF
inactive_workspace #333333 #222222 #888888
urgent_workspace #2F343A #900000 #FFFFFF
binding_mode #2F343A #900000 #FFFFFF
}
}
bindsym $mod+b bar mode toggle

View File

@ -1,35 +0,0 @@
#!/bin/sh
BLANK='#282a36'
CLEAR='#282a36'
DEFAULT='#bd93f9'
TEXT='#bd93f9'
WRONG='#ff5555'
VERIFYING='#50fa7b'
i3lock \
--insidever-color=$CLEAR \
--ringver-color=$VERIFYING \
\
--insidewrong-color=$CLEAR \
--ringwrong-color=$WRONG \
\
--inside-color=$BLANK \
--ring-color=$DEFAULT \
--line-color=$BLANK \
--separator-color=$DEFAULT \
\
--verif-color=$TEXT \
--wrong-color=$TEXT \
--time-color=$TEXT \
--date-color=$TEXT \
--layout-color=$TEXT \
--keyhl-color=$WRONG \
--bshl-color=$WRONG \
\
--screen 1 \
--blur 5 \
--clock \
--indicator \
--time-str="%H:%M:%S" \
--date-str="%A %d/%m/%Y" \

View File

@ -1,31 +0,0 @@
#!/bin/sh
i3lock \
--blur 5 \
--bar-indicator \
--bar-pos y+h \
--bar-direction 1 \
--bar-max-height 50 \
--bar-base-width 50 \
--bar-color 000000cc \
--keyhl-color 880088cc \
--bar-periodic-step 50 \
--bar-step 50 \
--redraw-thread \
\
--clock \
--force-clock \
--time-pos x+5:y+h-80 \
--time-color 880088ff \
--date-pos tx:ty+15 \
--date-color 990099ff \
--date-align 1 \
--time-align 1 \
--ringver-color 8800ff88 \
--ringwrong-color ff008888 \
--status-pos x+5:y+h-16 \
--verif-align 1 \
--wrong-align 1 \
--verif-color ffffffff \
--wrong-color ffffffff \
--modif-pos -50:-50

View File

@ -66,5 +66,5 @@ cpu_temperature 0 {
}
tztime local {
format = " (%a) %d/%m/%Y %H:%M"
format = " %d/%m/%Y %H:%M"
}

View File

@ -1,19 +0,0 @@
foreground #f8f8f2
background #282a36
title_fg #f8f8f2
title_bg #282a36
margin_bg #6272a4
margin_fg #44475a
removed_bg #ff5555
highlight_removed_bg #ff5555
removed_margin_bg #ff5555
added_bg #50fa7b
highlight_added_bg #50fa7b
added_margin_bg #50fa7b
filler_bg #44475a
hunk_margin_bg #44475a
hunk_bg #bd93f9
search_bg #8be9fd
search_fg #282a36
select_bg #f1fa8c
select_fg #282a36

View File

@ -1,62 +0,0 @@
# https://draculatheme.com/kitty
#
# Installation instructions:
#
# cp dracula.conf ~/.config/kitty/
# echo "include dracula.conf" >> ~/.config/kitty/kitty.conf
#
# Then reload kitty for the config to take affect.
# Alternatively copy paste below directly into kitty.conf
foreground #f8f8f2
background #282a36
selection_foreground #ffffff
selection_background #44475a
url_color #8be9fd
# black
color0 #21222c
color8 #6272a4
# red
color1 #ff5555
color9 #ff6e6e
# green
color2 #50fa7b
color10 #69ff94
# yellow
color3 #f1fa8c
color11 #ffffa5
# blue
color4 #bd93f9
color12 #d6acff
# magenta
color5 #ff79c6
color13 #ff92df
# cyan
color6 #8be9fd
color14 #a4ffff
# white
color7 #f8f8f2
color15 #ffffff
# Cursor colors
cursor #f8f8f2
cursor_text_color background
# Tab bar colors
active_tab_foreground #282a36
active_tab_background #f8f8f2
inactive_tab_foreground #282a36
inactive_tab_background #6272a4
# Marks
mark1_foreground #282a36
mark1_background #ff5555

File diff suppressed because it is too large Load Diff

@ -1 +0,0 @@
Subproject commit b1abdd54ba655ef34f75a568d78625981bf1722c

View File

@ -1,5 +0,0 @@
snippet beg "begin{} / end{}" bA
\begin{$1}
$0
\end{$1}
endsnippet

View File

@ -1,3 +0,0 @@
snippet std "use namespace std" b
using namespace std;
endsnippet

View File

@ -1,22 +1,6 @@
call plug#begin('~/local/share/nvim/plugged')
" Lightline
Plug 'itchyny/lightline.vim'
let g:lightline ={
\ 'colorscheme' : 'dracula',
\ 'component_function': {
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ }
\}
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction
Plug 'editorconfig/editorconfig-vim'
" Fzf
@ -27,7 +11,7 @@ Plug 'junegunn/fzf.vim'
Plug 'junegunn/limelight.vim'
" NERDTree
Plug 'preservim/nerdtree'
Plug 'scrooloose/nerdtree'
" Improvements Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-eunuch'
@ -36,8 +20,8 @@ Plug 'scrooloose/syntastic'
Plug 'jiangmiao/auto-pairs'
"Airline
"Plug 'vim-airline/vim-airline'
"Plug 'vim-airline/vim-airline-themes'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'prabirshrestha/vim-lsp'
" Themes
@ -45,89 +29,26 @@ Plug 'tomasr/molokai'
Plug 'gko/vim-coloresque'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'joshdick/onedark.vim'
Plug 'Mofiqul/dracula.nvim'
" Lang. Support
"""""""""""""""""""""""""""""""GO"""""""""""""""""""""""""""""""""""""""
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
set completeopt-=preview
" Go related keybinds
autocmd FileType go nmap <leader>r <Plug>(go-run)
" Move through errors easier!
map <C-n> :cnext<CR>
map <C-m> :cprevious<CR>
nnoremap <leader>a :cclose<CR>
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_list_type = "quickfix"
let g:go_gopls_complete_unimported = 1
let g:go_gopls_use_placeholders = 1
set autowrite
""""""""""""""""""""""""""""""GO""""""""""""""""""""""""""""""""""""""""
" JAVA
Plug 'fatih/vim-go'
Plug 'artur-shaik/vim-javacomplete2'
autocmd FileType java setlocal omnifunc=javacomplete#Complete
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
Plug 'deoplete-plugins/deoplete-clang'
Plug 'davidhalter/jedi-vim'
" RUST
Plug 'rust-lang/rust.vim'
Plug 'simrat39/rust-tools.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'preservim/nerdcommenter'
Plug 'mattn/emmet-vim'
" Code Folding
Plug 'tmhedberg/SimpylFold'
" Code Formatting
Plug 'Chiel92/vim-autoformat'
noremap <F3> :Autoformat<CR>
" Indent Blanklines
Plug 'lukas-reineke/indent-blankline.nvim'
" Writing in LaTeX
" Writing
Plug 'junegunn/goyo.vim'
Plug 'lervag/vimtex'
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
" Plug 'conornewton/vim-latex-preview'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
let g:livepreview_previewer = 'zathura'
let g:livepreview_engine = 'xelatex'
set conceallevel=1
let g:tex_conceal='abdmg'
" Ultisnips
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsListSnippets="<c-;>"
"Zoxide
Plug 'nanotee/zoxide.vim'
@ -138,8 +59,6 @@ Plug 'mattn/calendar-vim'
" Animate
" Plug 'camspiers/animate.vim'
" Lens
Plug 'camspiers/lens.vim'
" Better Syntax Support
@ -152,25 +71,12 @@ Plug 'tpope/vim-fugitive'
" Icons
Plug 'ryanoasis/vim-devicons'
" Lightspeed
Plug 'ggandor/lightspeed.nvim'
" Markdown Preview
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': 'markdown' }
call plug#end()
"let g:molokai_original = 1
"let g:airline_theme='onedark'
"let g:airline_theme='dracula'
let g:airline_theme='onedark'
let g:ale_enable=0
let g:ale_linters = {
\ 'python': ['pylint'],
\ 'vim': ['vint'],
\ 'cpp': ['clang'],
\ 'c': ['clang'],
\ 'go': ['gopls'],
\}
syntax on
filetype plugin indent on
set shiftwidth=4
@ -178,14 +84,12 @@ set softtabstop=4
set tabstop=4
set expandtab
set number relativenumber
colorscheme dracula
colorscheme onedark
set nocompatible
set encoding=UTF-8
set clipboard+=unnamedplus
set mouse=a
set laststatus=3
set termguicolors
set mouse=a
" Map Leader
let mapleader = ","
@ -194,13 +98,11 @@ let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
:map <F11> :setlocal spell! spelllang=en_gb<CR>
"Quick spellcheck
inoremap <F10> <c-g>u<Esc>[s1z=`]a<c-g>u
au BufNewFile ~/vimwiki/diary/*.md :silent 0r !~/.config/nvim/generate-vimwiki-diary-template '%'
let NERDTreeMapOpenInTab='<ENTER>'
" Insert Date
nnoremap <silent><leader>d :put=system('date +%d/%b/%Y')<CR>
@ -216,10 +118,10 @@ let g:fzf_nvim_statusline = 0 " disable statusline overwriting
nnoremap <silent> <leader><space> :Files<CR>
nnoremap <silent> <leader>w :Windows<CR>
nnoremap <silent> <leader>h :History<CR>
nnoremap <silent> <leader>G :GFiles<CR>
" nnoremap <silent> <leader>GS :GFiles?<CR>
nnoremap <silent> <leader>G<space> :GFiles<CR>
nnoremap <silent> <leader>GS :GFiles?<CR>
" Easy update and reload nvim init file
" Easy to update and reload nvim init file
nnoremap <Leader>e :e $MYVIMRC<CR>
nnoremap <Leader>S :source $MYVIMRC<CR>
@ -228,12 +130,9 @@ let g:deoplete#enable_at_startup = 1
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
let g:jedi#completions_enabled = 0
let g:jedi#use_splits_not_buffers = "right"
" g:deoplete#sources#jedi#python_path = 'python3'
let g:python3_host_prog = '/usr/bin/python3'
" Limeligt + Goyo Binds
" Limeligt Binds
nnoremap <Leader>l :Limelight!!<CR>
nnoremap <Leader>g :Goyo<CR>
let g:limelight_conceal_guifg = 'DarkGray'
let g:limelight_conceal_guifg = '#777777'
let g:limelight_conceal_ctermfg = 'gray'
@ -256,13 +155,9 @@ nnoremap <A-Up> :tabn<CR>
" Basic cmd commands
nnoremap <A-n> :!touch<Space>
nnoremap <A-o> :e<Space>
nnoremap <A-O> :tabe<Space>
nnoremap <A-o> :tabe<Space>
nnoremap <A-v> :vsplit<Space>
" Markdown Preview
nnoremap <leader>m :MarkdownPreviewToggle<CR>
" Screenshot command
nnoremap <silent> <leader>s :!bash /home/simon/.scripts/vscrnpaste<CR><CR>
@ -276,7 +171,7 @@ vmap < <gv
vmap > >gv
" Open NERDTree
nnoremap <leader><enter> :NERDTreeToggle<CR>
nnoremap <leader>N :NERDTreeToggle<CR>
" Vimwiki md2html
let g:vimwiki_list = [{
@ -292,20 +187,3 @@ let g:vimwiki_list = [{
" Vimwiki
nnoremap <leader>T :VimwikiTable<CR>
" Rust
let g:rustfmt_autosave = 1
" C
let g:clang_complete_auto = 0
let g:clang_auto_select = 0
let g:neoformat_cpp_clangformat = {
\ 'exe': 'clang-format',
\ 'args': ['--style="{IndentWidth: 4}"']
\}
let g:neoformat_enabled_cpp = ['clangformat']
let g:neoformat_enabled_c = ['clangformat']
" Fullscreen on nvim in kitty term
"autocmd VimLeave * :silent !kitty @ set-spacing padding=20 margin=20
"autocmd VimEnter * :silent !kitty @ set-spacing padding=0 margin=0

View File

@ -60,152 +60,3 @@ loadpantomime
PlayID
AgentID
WAMP
i
GDPR
ProjID
DevID
DevProj
OCaml
tera
giga
milli
μ
PMOS
NMOS
Javascript
JSON
ANDed
ORed
xy
x'y
DNF
CNF
Minterms
minterm
Maxterms
maxterm
OO
FP
regex
TT
clockless
LD
JK
IOCCC
Mellon's
hasNextInt
ArithmeticExcpetion
plaintext
Ciphertext
cmp
ve
Rambus
RDRAM
RIMM
DIMM
SIMM
Inline
ASM
HLL
detailInfo
getInfo
getRegNum
p2
CSCU9V4
ACWL
DCBA
DCB'A
DC'BA
DC'B'A
D'CBA
D'CB'A
D'C'BA
D'C'B'A
Σ
CSCU9Y4
structs
RESTful
goroutines
wikipedia
org
Kernighan
Northeastern
RedHat
st
Griesemer
GitLab
CockroachDB
fmt
ioutil
ReadFile
dicts
len
gobyexample
com
struct
OpenWeatherMap
json
loadJson
WeatherAPI
sizeof
int
ptr
naddr
addr
max
of
maxptr
scanf
Fediverse
microblogging
fediverse
indeti
ActivityPub
W3C
linuxrocks
lgbt
flexability
simonkellet
Pixelfed
Instagram
Bookwyrm
BookWyrm
WebTorrent
Peertube
YouTuber's
PeerTube
Y4
2nd
malloc
JVM
Naur
BNF
src
CSCU9A5
EBNF
EOL
AST
CSCU9E5
toString
equals
Powerpoint
slideshow
HTML5
tannoy
Alexa
YT
command
Pantone
CSCU9X5
desample
Bicubic
Metafiles
UML
Backpatching
Inlining
JIT
GI
HotSpot
kern
CounterTeller
Arduino

Binary file not shown.

View File

@ -1,6 +1,6 @@
# If a config.py file exists, this file is ignored unless it's explicitly loaded
# via config.load_autoconfig(). For more information, see:
# https://github.com/qutebrowser/qutebrowser/blob/main/doc/help/configuring.asciidoc#loading-autoconfigyml
# https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#loading-autoconfigyml
# DO NOT edit this file by hand, qutebrowser will overwrite it.
# Instead, create a config.py - see :help for details.

View File

@ -227,7 +227,7 @@ config.bind('xt', 'config-cycle tabs.show always never')
config.bind('xx', 'config-cycle tabs.show always never;; config-cycle statusbar.show always never')
c.url.searchengines["g"] = "https://www.google.co.uk/search?q={}"
c.url.searchengines = {'DEFAULT': 'https://www.google.co.uk/search?q={}'}
c.url.searchengines["ddg"] = "https://www.duckduckgo.com/?q={}"
c.url.searchengines["b"] = "https://search.brave.com/search?q={}"
c.url.searchengines["aw"] = "https://wiki.archlinux.org/?search={}"
c.url.searchengines["yt"] = "http://www.youtube.com/results?search_query={}"

View File

@ -1,8 +0,0 @@
[FileDialog]
history=file:///home/simon/Calibre Library/Jason Cannon/Linux for Beginners_ An Introduction to the Linux Operating System and Command Line (7), file:///home/simon/Calibre Library/Jonathan Moeller/The Linux Command Line Beginner's Guide (6), file:///home/simon, file:///home/simon/Downloads
lastVisited=file:///home/simon/Downloads
qtVersion=5.15.2
shortcuts=file:, file:///home/simon
sidebarWidth=97
treeViewHeader="@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xeb\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\x1\b\0\0\0\x1\0\0\0\0\0\0\0;\0\0\0\x1\0\0\0\0\0\0\0@\0\0\0\x1\0\0\0\0\0\0\0h\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff)"
viewMode=Detail

278
qutebrowser/userscripts/qute-pass Executable file
View File

@ -0,0 +1,278 @@
#!/usr/bin/env python3
# Copyright 2017 Chris Braun (cryzed) <cryzed@googlemail.com>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>.
"""
Insert login information using pass and a dmenu-compatible application (e.g. dmenu, rofi -dmenu, ...). A short
demonstration can be seen here: https://i.imgur.com/KN3XuZP.gif.
"""
USAGE = """The domain of the site has to appear as a segment in the pass path,
for example: "github.com/cryzed" or "websites/github.com". How the username and
password are determined is freely configurable using the CLI arguments. As an
example, if you instead store the username as part of the secret (and use a
site's name as filename), instead of the default configuration, use
`--username-target secret` and `--username-pattern "username: (.+)"`.
The login information is inserted by emulating key events using qutebrowser's
fake-key command in this manner: [USERNAME]<Tab>[PASSWORD], which is compatible
with almost all login forms.
If you use gopass with multiple mounts, use the CLI switch --mode gopass to switch to gopass mode.
Suggested bindings similar to Uzbl's `formfiller` script:
config.bind('<z><l>', 'spawn --userscript qute-pass')
config.bind('<z><u><l>', 'spawn --userscript qute-pass --username-only')
config.bind('<z><p><l>', 'spawn --userscript qute-pass --password-only')
config.bind('<z><o><l>', 'spawn --userscript qute-pass --otp-only')
"""
EPILOG = """Dependencies: tldextract (Python 3 module), pass, pass-otp (optional).
For issues and feedback please use: https://github.com/cryzed/qutebrowser-userscripts.
WARNING: The login details are viewable as plaintext in qutebrowser's debug log (qute://log) and might be shared if
you decide to submit a crash report!"""
import argparse
import enum
import fnmatch
import functools
import os
import re
import shlex
import subprocess
import sys
import tldextract
def expanded_path(path):
# Expand potential ~ in paths, since this script won't be called from a shell that does it for us
expanded = os.path.expanduser(path)
# Add trailing slash if not present
return os.path.join(expanded, '')
argument_parser = argparse.ArgumentParser(description=__doc__, usage=USAGE, epilog=EPILOG)
argument_parser.add_argument('url', nargs='?', default=os.getenv('QUTE_URL'))
argument_parser.add_argument('--password-store', '-p',
default=expanded_path(os.getenv('PASSWORD_STORE_DIR', default='~/.password-store')),
help='Path to your pass password-store (only used in pass-mode)', type=expanded_path)
argument_parser.add_argument('--mode', '-M', choices=['pass', 'gopass'], default="pass",
help='Select mode [gopass] to use gopass instead of the standard pass.')
argument_parser.add_argument('--username-pattern', '-u', default=r'.*/(.+)',
help='Regular expression that matches the username')
argument_parser.add_argument('--username-target', '-U', choices=['path', 'secret'], default='path',
help='The target for the username regular expression')
argument_parser.add_argument('--password-pattern', '-P', default=r'(.*)',
help='Regular expression that matches the password')
argument_parser.add_argument('--dmenu-invocation', '-d', default='rofi -dmenu',
help='Invocation used to execute a dmenu-provider')
argument_parser.add_argument('--noinsert-mode', '-n', dest='insert_mode', action='store_false',
help="Don't automatically enter insert mode")
argument_parser.add_argument('--io-encoding', '-i', default='UTF-8',
help='Encoding used to communicate with subprocesses')
argument_parser.add_argument('--merge-candidates', '-m', action='store_true',
help='Merge pass candidates for fully-qualified and registered domain name')
argument_parser.add_argument('--extra-url-suffixes', '-s', default='',
help='Comma-separated string containing extra suffixes (e.g local)')
group = argument_parser.add_mutually_exclusive_group()
group.add_argument('--username-only', '-e', action='store_true', help='Only insert username')
group.add_argument('--password-only', '-w', action='store_true', help='Only insert password')
group.add_argument('--otp-only', '-o', action='store_true', help='Only insert OTP code')
stderr = functools.partial(print, file=sys.stderr)
class ExitCodes(enum.IntEnum):
SUCCESS = 0
FAILURE = 1
# 1 is automatically used if Python throws an exception
NO_PASS_CANDIDATES = 2
COULD_NOT_MATCH_USERNAME = 3
COULD_NOT_MATCH_PASSWORD = 4
class CouldNotMatchUsername(Exception):
pass
class CouldNotMatchPassword(Exception):
pass
def qute_command(command):
with open(os.environ['QUTE_FIFO'], 'w') as fifo:
fifo.write(command + '\n')
fifo.flush()
def find_pass_candidates(domain):
candidates = []
if arguments.mode == "gopass":
all_passwords = subprocess.run(["gopass", "list", "--flat" ], stdout=subprocess.PIPE).stdout.decode("UTF-8").splitlines()
for password in all_passwords:
if domain in password:
candidates.append(password)
else:
for path, directories, file_names in os.walk(arguments.password_store, followlinks=True):
secrets = fnmatch.filter(file_names, '*.gpg')
if not secrets:
continue
# Strip password store path prefix to get the relative pass path
pass_path = path[len(arguments.password_store):]
split_path = pass_path.split(os.path.sep)
for secret in secrets:
secret_base = os.path.splitext(secret)[0]
if domain not in (split_path + [secret_base]):
continue
candidates.append(os.path.join(pass_path, secret_base))
return candidates
def _run_pass(pass_arguments):
# The executable is conveniently named after it's mode [pass|gopass].
pass_command = [arguments.mode]
env = os.environ.copy()
env['PASSWORD_STORE_DIR'] = arguments.password_store
process = subprocess.run(pass_command + pass_arguments, env=env, stdout=subprocess.PIPE)
return process.stdout.decode(arguments.io_encoding).strip()
def pass_(path):
return _run_pass(['show', path])
def pass_otp(path):
if arguments.mode == "gopass":
return _run_pass(['otp', '-o', path])
return _run_pass(['otp', path])
def dmenu(items, invocation):
command = shlex.split(invocation)
process = subprocess.run(command, input='\n'.join(items).encode(arguments.io_encoding), stdout=subprocess.PIPE)
return process.stdout.decode(arguments.io_encoding).strip()
def fake_key_raw(text):
for character in text:
# Escape all characters by default, space requires special handling
sequence = '" "' if character == ' ' else '\{}'.format(character)
qute_command('fake-key {}'.format(sequence))
def extract_password(secret, pattern):
match = re.match(pattern, secret)
if not match:
raise CouldNotMatchPassword("Pattern did not match target")
try:
return match.group(1)
except IndexError:
raise CouldNotMatchPassword("Pattern did not contain capture group, please use capture group. Example: (.*)")
def extract_username(target, pattern):
match = re.search(pattern, target, re.MULTILINE)
if not match:
raise CouldNotMatchUsername("Pattern did not match target")
try:
return match.group(1)
except IndexError:
raise CouldNotMatchUsername("Pattern did not contain capture group, please use capture group. Example: (.*)")
def main(arguments):
if not arguments.url:
argument_parser.print_help()
return ExitCodes.FAILURE
extractor = tldextract.TLDExtract(extra_suffixes=arguments.extra_url_suffixes.split(','))
extract_result = extractor(arguments.url)
# Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains),
# the registered domain name, the IPv4 address if that's what the URL represents and finally the private domain
# (if a non-public suffix was used).
candidates = set()
attempted_targets = []
private_domain = ''
if not extract_result.suffix:
private_domain = ('.'.join((extract_result.subdomain, extract_result.domain))
if extract_result.subdomain else extract_result.domain)
for target in filter(None, [extract_result.fqdn, extract_result.registered_domain, extract_result.ipv4, private_domain]):
attempted_targets.append(target)
target_candidates = find_pass_candidates(target)
if not target_candidates:
continue
candidates.update(target_candidates)
if not arguments.merge_candidates:
break
else:
if not candidates:
stderr('No pass candidates for URL {!r} found! (I tried {!r})'.format(arguments.url, attempted_targets))
return ExitCodes.NO_PASS_CANDIDATES
selection = candidates.pop() if len(candidates) == 1 else dmenu(sorted(candidates), arguments.dmenu_invocation)
# Nothing was selected, simply return
if not selection:
return ExitCodes.SUCCESS
# If username-target is path and user asked for username-only, we don't need to run pass.
# Or if using otp-only, it will run pass on its own.
secret = None
if not (arguments.username_target == 'path' and arguments.username_only) and not arguments.otp_only:
secret = pass_(selection)
username_target = selection if arguments.username_target == 'path' else secret
try:
if arguments.username_only:
fake_key_raw(extract_username(username_target, arguments.username_pattern))
elif arguments.password_only:
fake_key_raw(extract_password(secret, arguments.password_pattern))
elif arguments.otp_only:
otp = pass_otp(selection)
fake_key_raw(otp)
else:
# Enter username and password using fake-key and <Tab> (which seems to work almost universally), then switch
# back into insert-mode, so the form can be directly submitted by hitting enter afterwards
fake_key_raw(extract_username(username_target, arguments.username_pattern))
qute_command('fake-key <Tab>')
fake_key_raw(extract_password(secret, arguments.password_pattern))
except CouldNotMatchPassword as e:
stderr('Failed to match password, target: secret, error: {}'.format(e))
return ExitCodes.COULD_NOT_MATCH_PASSWORD
except CouldNotMatchUsername as e:
stderr('Failed to match username, target: {}, error: {}'.format(arguments.username_target, e))
return ExitCodes.COULD_NOT_MATCH_USERNAME
if arguments.insert_mode:
qute_command('mode-enter insert')
return ExitCodes.SUCCESS
if __name__ == '__main__':
arguments = argument_parser.parse_args()
sys.exit(main(arguments))

View File

@ -0,0 +1,278 @@
#!/usr/bin/env python3
# Copyright 2017 Chris Braun (cryzed) <cryzed@googlemail.com>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>.
"""
Insert login information using pass and a dmenu-compatible application (e.g. dmenu, rofi -dmenu, ...). A short
demonstration can be seen here: https://i.imgur.com/KN3XuZP.gif.
"""
USAGE = """The domain of the site has to appear as a segment in the pass path,
for example: "github.com/cryzed" or "websites/github.com". How the username and
password are determined is freely configurable using the CLI arguments. As an
example, if you instead store the username as part of the secret (and use a
site's name as filename), instead of the default configuration, use
`--username-target secret` and `--username-pattern "username: (.+)"`.
The login information is inserted by emulating key events using qutebrowser's
fake-key command in this manner: [USERNAME]<Tab>[PASSWORD], which is compatible
with almost all login forms.
If you use gopass with multiple mounts, use the CLI switch --mode gopass to switch to gopass mode.
Suggested bindings similar to Uzbl's `formfiller` script:
config.bind('<z><l>', 'spawn --userscript qute-pass')
config.bind('<z><u><l>', 'spawn --userscript qute-pass --username-only')
config.bind('<z><p><l>', 'spawn --userscript qute-pass --password-only')
config.bind('<z><o><l>', 'spawn --userscript qute-pass --otp-only')
"""
EPILOG = """Dependencies: tldextract (Python 3 module), pass, pass-otp (optional).
For issues and feedback please use: https://github.com/cryzed/qutebrowser-userscripts.
WARNING: The login details are viewable as plaintext in qutebrowser's debug log (qute://log) and might be shared if
you decide to submit a crash report!"""
import argparse
import enum
import fnmatch
import functools
import os
import re
import shlex
import subprocess
import sys
import tldextract
def expanded_path(path):
# Expand potential ~ in paths, since this script won't be called from a shell that does it for us
expanded = os.path.expanduser(path)
# Add trailing slash if not present
return os.path.join(expanded, '')
argument_parser = argparse.ArgumentParser(description=__doc__, usage=USAGE, epilog=EPILOG)
argument_parser.add_argument('url', nargs='?', default=os.getenv('QUTE_URL'))
argument_parser.add_argument('--password-store', '-p',
default=expanded_path(os.getenv('PASSWORD_STORE_DIR', default='~/.password-store')),
help='Path to your pass password-store (only used in pass-mode)', type=expanded_path)
argument_parser.add_argument('--mode', '-M', choices=['pass', 'gopass'], default="pass",
help='Select mode [gopass] to use gopass instead of the standard pass.')
argument_parser.add_argument('--username-pattern', '-u', default=r'.*/(.+)',
help='Regular expression that matches the username')
argument_parser.add_argument('--username-target', '-U', choices=['path', 'secret'], default='path',
help='The target for the username regular expression')
argument_parser.add_argument('--password-pattern', '-P', default=r'(.*)',
help='Regular expression that matches the password')
argument_parser.add_argument('--dmenu-invocation', '-d', default='rofi -dmenu',
help='Invocation used to execute a dmenu-provider')
argument_parser.add_argument('--noinsert-mode', '-n', dest='insert_mode', action='store_false',
help="Don't automatically enter insert mode")
argument_parser.add_argument('--io-encoding', '-i', default='UTF-8',
help='Encoding used to communicate with subprocesses')
argument_parser.add_argument('--merge-candidates', '-m', action='store_true',
help='Merge pass candidates for fully-qualified and registered domain name')
argument_parser.add_argument('--extra-url-suffixes', '-s', default='',
help='Comma-separated string containing extra suffixes (e.g local)')
group = argument_parser.add_mutually_exclusive_group()
group.add_argument('--username-only', '-e', action='store_true', help='Only insert username')
group.add_argument('--password-only', '-w', action='store_true', help='Only insert password')
group.add_argument('--otp-only', '-o', action='store_true', help='Only insert OTP code')
stderr = functools.partial(print, file=sys.stderr)
class ExitCodes(enum.IntEnum):
SUCCESS = 0
FAILURE = 1
# 1 is automatically used if Python throws an exception
NO_PASS_CANDIDATES = 2
COULD_NOT_MATCH_USERNAME = 3
COULD_NOT_MATCH_PASSWORD = 4
class CouldNotMatchUsername(Exception):
pass
class CouldNotMatchPassword(Exception):
pass
def qute_command(command):
with open(os.environ['QUTE_FIFO'], 'w') as fifo:
fifo.write(command + '\n')
fifo.flush()
def find_pass_candidates(domain):
candidates = []
if arguments.mode == "gopass":
all_passwords = subprocess.run(["gopass", "list", "--flat" ], stdout=subprocess.PIPE).stdout.decode("UTF-8").splitlines()
for password in all_passwords:
if domain in password:
candidates.append(password)
else:
for path, directories, file_names in os.walk(arguments.password_store, followlinks=True):
secrets = fnmatch.filter(file_names, '*.gpg')
if not secrets:
continue
# Strip password store path prefix to get the relative pass path
pass_path = path[len(arguments.password_store):]
split_path = pass_path.split(os.path.sep)
for secret in secrets:
secret_base = os.path.splitext(secret)[0]
if domain not in (split_path + [secret_base]):
continue
candidates.append(os.path.join(pass_path, secret_base))
return candidates
def _run_pass(pass_arguments):
# The executable is conveniently named after it's mode [pass|gopass].
pass_command = [arguments.mode]
env = os.environ.copy()
env['PASSWORD_STORE_DIR'] = arguments.password_store
process = subprocess.run(pass_command + pass_arguments, env=env, stdout=subprocess.PIPE)
return process.stdout.decode(arguments.io_encoding).strip()
def pass_(path):
return _run_pass(['show', path])
def pass_otp(path):
if arguments.mode == "gopass":
return _run_pass(['otp', '-o', path])
return _run_pass(['otp', path])
def dmenu(items, invocation):
command = shlex.split(invocation)
process = subprocess.run(command, input='\n'.join(items).encode(arguments.io_encoding), stdout=subprocess.PIPE)
return process.stdout.decode(arguments.io_encoding).strip()
def fake_key_raw(text):
for character in text:
# Escape all characters by default, space requires special handling
sequence = '" "' if character == ' ' else '\{}'.format(character)
qute_command('fake-key {}'.format(sequence))
def extract_password(secret, pattern):
match = re.match(pattern, secret)
if not match:
raise CouldNotMatchPassword("Pattern did not match target")
try:
return match.group(1)
except IndexError:
raise CouldNotMatchPassword("Pattern did not contain capture group, please use capture group. Example: (.*)")
def extract_username(target, pattern):
match = re.search(pattern, target, re.MULTILINE)
if not match:
raise CouldNotMatchUsername("Pattern did not match target")
try:
return match.group(1)
except IndexError:
raise CouldNotMatchUsername("Pattern did not contain capture group, please use capture group. Example: (.*)")
def main(arguments):
if not arguments.url:
argument_parser.print_help()
return ExitCodes.FAILURE
extractor = tldextract.TLDExtract(extra_suffixes=arguments.extra_url_suffixes.split(','))
extract_result = extractor(arguments.url)
# Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains),
# the registered domain name, the IPv4 address if that's what the URL represents and finally the private domain
# (if a non-public suffix was used).
candidates = set()
attempted_targets = []
private_domain = ''
if not extract_result.suffix:
private_domain = ('.'.join((extract_result.subdomain, extract_result.domain))
if extract_result.subdomain else extract_result.domain)
for target in filter(None, [extract_result.fqdn, extract_result.registered_domain, extract_result.ipv4, private_domain]):
attempted_targets.append(target)
target_candidates = find_pass_candidates(target)
if not target_candidates:
continue
candidates.update(target_candidates)
if not arguments.merge_candidates:
break
else:
if not candidates:
stderr('No pass candidates for URL {!r} found! (I tried {!r})'.format(arguments.url, attempted_targets))
return ExitCodes.NO_PASS_CANDIDATES
selection = candidates.pop() if len(candidates) == 1 else dmenu(sorted(candidates), arguments.dmenu_invocation)
# Nothing was selected, simply return
if not selection:
return ExitCodes.SUCCESS
# If username-target is path and user asked for username-only, we don't need to run pass.
# Or if using otp-only, it will run pass on its own.
secret = None
if not (arguments.username_target == 'path' and arguments.username_only) and not arguments.otp_only:
secret = pass_(selection)
username_target = selection if arguments.username_target == 'path' else secret
try:
if arguments.username_only:
fake_key_raw(extract_username(username_target, arguments.username_pattern))
elif arguments.password_only:
fake_key_raw(extract_password(secret, arguments.password_pattern))
elif arguments.otp_only:
otp = pass_otp(selection)
fake_key_raw(otp)
else:
# Enter username and password using fake-key and <Tab> (which seems to work almost universally), then switch
# back into insert-mode, so the form can be directly submitted by hitting enter afterwards
fake_key_raw(extract_username(username_target, arguments.username_pattern))
qute_command('fake-key <Tab>')
fake_key_raw(extract_password(secret, arguments.password_pattern))
except CouldNotMatchPassword as e:
stderr('Failed to match password, target: secret, error: {}'.format(e))
return ExitCodes.COULD_NOT_MATCH_PASSWORD
except CouldNotMatchUsername as e:
stderr('Failed to match username, target: {}, error: {}'.format(arguments.username_target, e))
return ExitCodes.COULD_NOT_MATCH_USERNAME
if arguments.insert_mode:
qute_command('mode-enter insert')
return ExitCodes.SUCCESS
if __name__ == '__main__':
arguments = argument_parser.parse_args()
sys.exit(main(arguments))

View File

@ -1,126 +0,0 @@
/*Dracula theme based on the Purple official rofi theme*/
* {
font: "Fira Code 14";
foreground: #f8f8f2;
background-color: #282a36;
active-background: #6272a4;
urgent-background: #ff5555;
selected-background: @active-background;
selected-urgent-background: @urgent-background;
selected-active-background: @active-background;
separatorcolor: @active-background;
bordercolor: @active-background;
}
#window {
background-color: @background-color;
border: 1;
border-radius: 6;
border-color: @bordercolor;
padding: 5;
}
#mainbox {
border: 0;
padding: 0;
}
#message {
border: 1px dash 0px 0px ;
border-color: @separatorcolor;
padding: 1px ;
}
#textbox {
text-color: @foreground;
}
#listview {
fixed-height: 0;
border: 2px dash 0px 0px ;
border-color: @bordercolor;
spacing: 2px ;
scrollbar: false;
padding: 2px 0px 0px ;
}
#element {
border: 0;
padding: 1px ;
}
#element.normal.normal {
background-color: @background-color;
text-color: @foreground;
}
#element.normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
#element.normal.active {
background-color: @active-background;
text-color: @foreground;
}
#element.selected.normal {
background-color: @selected-background;
text-color: @foreground;
}
#element.selected.urgent {
background-color: @selected-urgent-background;
text-color: @foreground;
}
#element.selected.active {
background-color: @selected-active-background;
text-color: @foreground;
}
#element.alternate.normal {
background-color: @background-color;
text-color: @foreground;
}
#element.alternate.urgent {
background-color: @urgent-background;
text-color: @foreground;
}
#element.alternate.active {
background-color: @active-background;
text-color: @foreground;
}
#scrollbar {
width: 2px ;
border: 0;
handle-width: 8px ;
padding: 0;
}
#sidebar {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}
#button.selected {
background-color: @selected-background;
text-color: @foreground;
}
#inputbar {
spacing: 0;
text-color: @foreground;
padding: 1px ;
}
#case-indicator {
spacing: 0;
text-color: @foreground;
}
#entry {
spacing: 0;
text-color: @foreground;
}
#prompt {
spacing: 0;
text-color: @foreground;
}
#inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
#textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
text-color: @foreground;
}
element-text, element-icon {
background-color: inherit;
text-color: inherit;
}

View File

@ -1,27 +0,0 @@
rofi.modi: window,run,ssh
rofi.width: 50
rofi.lines: 15
rofi.columns: 1
rofi.font: roboto mono 10
rofi.color-normal: #0e4470, #9dd9df, #0e4470, #016694, #9dd9df
rofi.color-urgent: #0e4470, #d6b48d, #22231D, #d6b48d, #9dd9df
rofi.color-active: #0e4470, #2db1b9, #0e4470, #2db1b9, #0e4470
rofi.color-window: #0e4470, #016694, #014665
rofi.bw: 5
rofi.location: 0
rofi.padding: 5
rofi.yoffset: 0
rofi.xoffset: 0
rofi.fixed-num-lines: true
rofi.terminal: rofi-sensible-terminal
rofi.ssh-client: ssh
rofi.ssh-command: {terminal} -e {ssh-client} {host}
rofi.run-command: {cmd}
rofi.parse-hosts: true
rofi.matching: normal
rofi.separator-style: none
rofi.scrollbar-width: 0
rofi.kb-mode-next: Shift+Right,Control+Tab,Alt+l
rofi.kb-mode-previous: Shift+Left,Control+Shift+Tab,Alt+h
rofi.kb-row-up: Up,Control+p,Shift+Tab,Shift+ISO_Left_Tab,Alt+k
rofi.kb-row-down: Down,Control+n,Alt+j

View File

@ -1,5 +1,5 @@
[directory]
truncation_length = 3
truncation_length = 8
truncation_symbol = "…/"
[line_break]