master
Hektor Misplon 2023-02-26 22:56:09 +00:00
commit 0d68784dcc
28 changed files with 765 additions and 248 deletions

View File

@ -16,4 +16,13 @@ font:
colors:
primary:
foreground: '0x111111'
background: '0xdddddd'
background: '0xcccccc'
normal:
black: '0x000000'
red: '0xcc3333'
green: '0x33cc33'
yellow: '0x885800'
blue: '0x3333cc'
magenta: '0xcc33cc'
cyan: '0x33cccc'
white: '0xcccccc'

View File

@ -48,12 +48,13 @@ alias df="df -kTh"
alias fzfpac="pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S"
alias o="xdg-open"
alias path="echo -e ${PATH//:/\\n}" # Pretty print path variables
alias wiki="vim +WikiIndex"
# Programs
alias feh="feh -B black --scale-down --auto-zoom"
alias fm='pcmanfm'
alias v="nvim"
alias w="nvim +WikiIndex"
alias g='git'
alias lm='xbacklight -set'
alias py='python'
@ -64,7 +65,15 @@ alias xev='xev | grep -A2 ButtonPress' # Ignore mouse movements
reboot_to_windows ()
{
# Check if grub is installed by checking if the command exists, if it does
# not, then assume that the system is using systemd-boot
if grub-install --version &>/dev/null; then
windows_title=$(grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2)
sudo grub-reboot "$windows_title" && sudo reboot
sudo grub-reboot "$windows_title"
echo "Grub set to reboot to Windows"
else
sudo bootctl set-oneshot windows.conf
echo "Systemd set to reboot to Windows"
fi
}
alias reboot-to-windows='reboot_to_windows'

81
.bashrc
View File

@ -3,13 +3,12 @@
source /etc/os-release
# Aliases {{{
# Load aliases dynamically
[ -f "$HOME/.bash_aliases" ] && source "$HOME/.bash_aliases"
# }}}
# Add ~/.bin to PATH
export PATH=~/.bin:$PATH
# Prompt
# Prompt {{{
get_branch_name() {
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|| git rev-parse --short HEAD 2>/dev/null \
@ -19,16 +18,35 @@ get_git_info() {
git rev-parse --is-inside-work-tree &>/dev/null || return
echo -e "$(get_branch_name)"
}
export PS1="\u \w ❭\[$(tput sgr0)\] "
# History
PS1="\u \w ❭\[$(tput sgr0)\] "
# Ellipsis when deep in directory
export PROMPT_DIRTRIM=2
export PS1
# }}}
# Path {{{
# Add ~/.bin to PATH
export PATH=~/.bin:$PATH
# }}}
# History {{{
export HISTCONTROL=ignoreboth:erasedups
export HISTSIZE=500000
# Omit `clear, ls...`; commands prepended with space
export HISTIGNORE="clear:l: *"
# }}}
# Man pages
# Man pages {{{
export MANWIDTH=120
# }}}
# Editor {{{
# Set vim as default editor
export EDITOR=nvim
# }}}
# Vim
export EDITOR=vim
@ -58,11 +76,50 @@ export PATH=~/.nvm/versions/node/v14.16.0/bin:$PATH
export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" --no-use
# X11
# X11 {{{
export XDG_SESSION_TYPE=X11
export XDG_CONFIG_HOME=$HOME/.config
# }}}
# Jupyter
# Nix package manager {{{
# Add ~/.nix-profile/bin to PATH
export PATH=~/.nix-profile/bin:$PATH
# }}}
# FZF {{{
# Check if fzf is installed
if [ -f "/usr/bin/fzf" ]; then
# Fuzzy finder setup
export FZF_COMPLETION_TRIGGER='**'
export FZF_DEFAULT_COMMAND='ag --hidden --skip-vcs-ignores -t -g ""'
export FZF_DEFAULT_OPTS="
--pointer='❭'
--height 10%
--color=fg:-1,bg:-1"
export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}"
export FZF_CTRL_T_OPTS="--preview='bat {} | head -500'"
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash
_fzf_setup_completion path vim
_fzf_setup_completion path zathura
_fzf_setup_completion path xournalpp
_fzf_setup_completion path nvim
else
echo "fzf not installed"
fi
# }}}
# Node {{{
# Move nvm folder away from home directory
export NVM_DIR="${XDG_CONFIG_HOME}/nvm"
# Pretty much what is in `/usr/share/nvm/init-nvm.sh` but we add the `--no-use`
# flag to `nvm.sh` to make it lazy
source /usr/share/nvm/nvm.sh --no-use
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec
# }}}
# Jupyter {{{
export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
# Ellipsis when deep in directory
export PROMPT_DIRTRIM=2
# }}}

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
sudo rtcwake -m no -l -t "$(date +%s -d 'tomorrow 09:30')"

View File

@ -2,4 +2,4 @@
# Open webcam window
ffplay -f v4l2 -s 640x480 -i /dev/video0 >/dev/null 2>&1 & disown
ffplay -f v4l2 -x 640 -y 480 -i /dev/video0 >/dev/null 2>&1 & disown

View File

@ -4,6 +4,6 @@ options="nl:en\nen:nl\nnl:fr\nfr:nl\nen:fr\nfr:en\nnl:de\nde:nl"
selected=$(echo -e "$options" | dmenu -p "s?:t?" -i -l 0)
notify-send --app-name= -t 3000 "$(trans $selected -b "$(dmenu -p $selected &)" \
notify-send --app-name= -t 3000 "$(trans "$selected" -b "$(dmenu -p "$selected" &)" \
| tr -d '\n' \
| xclip -sel clip -f)"

View File

@ -4,7 +4,8 @@
# Generate menu of book filenames and save paths
# Preview window contains metadata
selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)"
# selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)"
selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1)"
# Open and redirect output to /dev/null
zathura "$selected" 2> /dev/null &
zathura "$selected" --fork

View File

@ -11,11 +11,12 @@ update() {
font_list=$(fc-list -f "%{fullname}\n")
echo "$font_list" | while read -r line ; do
echo "$font_list" | while read line ; do
first="$(echo "$line" | cut -d',' -f1)"
last="$(echo "$line" | cut -d',' -f2)"
if "$(contains_dash "$first")"; then
if $(contains_dash "$first"); then
echo "$last" >> "$fn"
else
echo "$first" >> "$fn"
@ -25,5 +26,5 @@ update() {
case "$1" in
--update) update;;
*) sort "$fn" | uniq | awk 'NF' | fzf;;
*) cat "$fn" | sort | uniq | awk 'NF' | fzf;;
esac

3
.bin/pacman-remove-unrequired Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
sudo pacman -Qtdq | sudo pacman -Rns -

View File

@ -13,17 +13,23 @@ from argparse import ArgumentParser
from time import sleep
from plyer import notification
def clear():
os.system('echo -n "" > /tmp/pomo')
atexit.register(clear)
parser = ArgumentParser()
parser.add_argument('-p', '--prep-duration', type=int, help='Preparation duration of a session', default=0)
parser.add_argument('-w', '--work-duration', type=int, help='Duration of a session', default=25)
parser.add_argument('-b', '--break-duration', type=int, help='Duration of a break', default=5)
parser.add_argument('-r', '--repeats', type=int, help='Numer of sessions', default=1)
parser.add_argument('-p', '--prep-duration', type=int,
help='Pre session duration', default=0)
parser.add_argument('-w', '--work-duration', type=int,
help='Session duration', default=25)
parser.add_argument('-b', '--break-duration', type=int,
help='Break duration', default=5)
parser.add_argument('-r', '--repeats', type=int,
help='Numer of sessions', default=1)
args = parser.parse_args()
@ -32,26 +38,30 @@ work_duration = args.work_duration * 60
break_duration = args.break_duration * 60
repeats = args.repeats
def make_countdown(color):
def countdown(duration):
while duration!= 0:
while duration != 0:
mins = duration // 60
secs = duration % 60
os.system('echo -n "{:s} {:02d}:{:02d} \x01" > /tmp/pomo'.format(color, mins, secs))
# os.system('echo -n "{:s} {:02d}:{:02d} \x01" > /tmp/pomo'.format(color, mins, secs))
os.system('echo -n "{:02d}:{:02d}" > /tmp/pomo'.format(mins, secs))
sleep(1)
duration -= 1
return countdown
prep_countdown = make_countdown("\x01")
work_countdown = make_countdown("\x03")
break_countdown = make_countdown("\x02")
prep_countdown(prep_duration)
while repeats!=0:
while repeats != 0:
notification.notify(title="Get started")
work_countdown(work_duration)
if break_duration != 0:
notification.notify(title="Time for a break")
break_countdown(break_duration)
notification.notify(title="Break is over, set a new timer")
repeats-=1
notification.notify(title="Break is over, back to work")
repeats -= 1

25
.bin/script Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Script to create script
if [ -z "$1" ]; then
echo "Script name required"
exit
fi
path="$HOME/.bin/$1"
# Prevent overwriting existing script
set -o noclobber
# Create script
cat > "$path" << EOF
#!/usr/bin/env bash
EOF
chmod +x "$path"
# Open script in editor on line 3
"$EDITOR" +3 "$path"

4
.condarc Normal file
View File

@ -0,0 +1,4 @@
channels:
- conda-forge
- defaults
channel_priority: strict

4
.config/conda/condarc Normal file
View File

@ -0,0 +1,4 @@
channels:
- conda-forge
- defaults
channel_priority: strict

12
.config/feh/keys Normal file
View File

@ -0,0 +1,12 @@
prev_img h
next_img l
scroll_left L
scroll_right H
scroll_up J
scroll_down K
zoom_in j
zoom_out k
zoom_fit z
zoom_default =
mirror bar
close q Q

3
.config/feh/themes Normal file
View File

@ -0,0 +1,3 @@
feh \
-B black \
--auto-zoom

View File

@ -0,0 +1,56 @@
[General]
buttons=@Variant(\0\0\0\x7f\0\0\0\vQList<int>\0\0\0\0\xf\0\0\0\0\0\0\0\x2\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x6\0\0\0\x12\0\0\0\x13\0\0\0\a\0\0\0\t\0\0\0\x10\0\0\0\n\0\0\0\v\0\0\0\r\0\0\0\xe)
checkForUpdates=false
contrastOpacity=127
contrastUiColor=#ffffff
copyPathAfterSave=true
disabledTrayIcon=false
drawColor=#ff0044
drawFontSize=7
drawThickness=1
fontFamily=Inter
saveLastRegion=true
savePath=/home/h/doc/clips
savePathFixed=true
showDesktopNotification=false
showHelp=false
showSidePanelButton=true
showStartupLaunchMessage=false
startupLaunch=true
uiColor=#484848
undoLimit=106
userColors=picker, #800000, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ffffff, #000000
[Shortcuts]
TYPE_ARROW=A
TYPE_CIRCLE=C
TYPE_CIRCLECOUNT=
TYPE_COMMIT_CURRENT_TOOL=Ctrl+Return
TYPE_COPY=Ctrl+C
TYPE_DELETE_CURRENT_TOOL=Del
TYPE_DRAWER=D
TYPE_EXIT=Ctrl+Q
TYPE_IMAGEUPLOADER=Return
TYPE_MARKER=M
TYPE_MOVESELECTION=Ctrl+M
TYPE_MOVE_DOWN=Down
TYPE_MOVE_LEFT=Left
TYPE_MOVE_RIGHT=Right
TYPE_MOVE_UP=Up
TYPE_OPEN_APP=Ctrl+O
TYPE_PENCIL=P
TYPE_PIN=
TYPE_PIXELATE=B
TYPE_RECTANGLE=R
TYPE_REDO=Ctrl+Shift+Z
TYPE_RESIZE_DOWN=Shift+Down
TYPE_RESIZE_LEFT=Shift+Left
TYPE_RESIZE_RIGHT=Shift+Right
TYPE_RESIZE_UP=Shift+Up
TYPE_SAVE=Ctrl+S
TYPE_SELECTION=S
TYPE_SELECTIONINDICATOR=
TYPE_SELECT_ALL=Ctrl+A
TYPE_TEXT=T
TYPE_TOGGLE_PANEL=Space
TYPE_UNDO=Ctrl+Z

3
.config/nvim/init.vim Normal file
View File

@ -0,0 +1,3 @@
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

40
.config/picom/picom.conf Normal file
View File

@ -0,0 +1,40 @@
backend = "glx";
glx-no-stencil = true;
glx-copy-from-font = false;
active-opacity = 1.0;
inactive-opacity = 0.8;
frame-opacity = 0.8;
inactive-opacity-override = false;
shadow = true;
shadow-radius = 16;
shadow-opacity = 0.5;
shadow-offset-x = -16;
shadow-offset-y = -16;
shadow-color = "#000000"
fading = true;
fade-in-step = 0.05;
fade-out-step = 0.05;
fade-delta = 4
shadow-exclude = ["class_g = 'Rofi'", "class_g = 'albert'", "class_g = 'trayer'"];
focus-exclude = ["class_g = 'Rofi'", "class_g = 'albert'", "class_g = 'trayer'"];
blur-background-exclude = ["class_g = 'Rofi'", "class_g = 'albert'", "class_g = 'trayer'"];
blur-background = true;
blur-inactive = true;
blur-method = "dual_kawase";
blur-strength = 8;
wintypes:
{
dock = { shadow = false; };
dnd = { shadow = false; };
tooltip = { shadow = false; };
menu = { opacity = false; };
dropdown_menu = { opacity = false; };
popup_menu = { opacity = false; };
utility = { opacity = false; };
};

View File

@ -7,9 +7,9 @@ unmap f
map f toggle_fullscreen
map [fullscreen] f toggle_fullscreen
# Theme
set default-bg "#ffffff"
set default-fg "#eee"
# Initial theme
set default-bg "#cccccc"
set default-fg "#111"
set statusbar-bg "#111"
set statusbar-fg "#777"
set inputbar-bg "#111"
@ -23,14 +23,10 @@ set completion-highlight-bg "#333"
set highlight-fg "#ccc"
set highlight-color "#111"
set highlight-active-color "#333"
# Dark mode
set recolor
set recolor-darkcolor "#aaa"
set recolor-lightcolor "#111"
# midnight mode
map <F1> focus_inputbar "set default-bg \#111111"
set index-fg "#eee"
set index-bg "#111"
set index-active-fg "#eee"
set index-active-bg "#333"
# Hide status bar
set guioptions none
@ -38,5 +34,32 @@ set render-loading "false"
map J zoom out
map K zoom in
map i recolor
unmap q
#
# Hack for switching color themes (change default background too on recolor)
#
# Default to light recolor
set recolor
set recolor-lightcolor "#cccccc"
set recolor-darkcolor "#111"
set recolor-keephue
# No recolor
map <F1> focus_inputbar ":set recolor true"
map <F2> focus_inputbar ":set recolor false"
map <F3> focus_inputbar ":set default-bg \#fff"
map 1 feedkeys "<F2><Return><F3><Return>"
# Light recolor
map <F4> focus_inputbar ":set default-bg \#cccccc"
map <F5> focus_inputbar ":set recolor-lightcolor \#cccccc"
map <F6> focus_inputbar ":set recolor-darkcolor \#111"
map 2 feedkeys "<F1><Return><F4><Return><F5><Return><F6><Return>"
# Dark recolor
map <F7> focus_inputbar ":set default-bg \#111"
map <F8> focus_inputbar ":set recolor-lightcolor \#111"
map <F9> focus_inputbar ":set recolor-darkcolor \#aaa"
map 3 feedkeys "<F1><Return><F7><Return><F8><Return><F9><Return>"

256
.vimrc
View File

@ -104,12 +104,13 @@ nn <leader>so :so %<cr>
call plug#begin()
" Coc
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'github/copilot.vim'
" General
Plug 'unblevable/quick-scope'
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-sandwich'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'vimwiki/vimwiki'
" JS and TypeScript
Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'leafgarland/typescript-vim', { 'for': ['typescript', 'typescript.tsx'] }
@ -119,6 +120,11 @@ Plug 'evanleck/vim-svelte', {'branch': 'main'}
Plug 'neoclide/jsonc.vim'
" LaTeX & markdown
Plug 'lervag/vimtex'
" Wiki
Plug 'lervag/wiki.vim'
Plug 'hektor/taskwiki'
" Markdown
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
" TidalCycles
Plug 'supercollider/scvim'
@ -129,29 +135,77 @@ call plug#end()
"""""""""""""""
" Coc
" `.../sandwich` {{{
nmap s <Nop>
xmap s <Nop>
let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes)
" }}}
" `neoclide/coc.nvim` {{{
let g:coc_global_extensions = [
\'coc-dictionary',
\'coc-syntax',
\'coc-eslint',
\'coc-prettier',
\'coc-tsserver',
\'coc-python',
\'coc-html',
\'coc-emmet',
\'coc-css',
\'coc-svg',
\'coc-svelte',
\'coc-jedi',
\'coc-json',
\'coc-markdownlint',
\'coc-yaml',
\'coc-snippets',
\'coc-clangd'
\'coc-clangd',
\'coc-bibtex'
\]
" Autocomplete
imap <tab> <Plug>(coc-snippets-expand)
nn <leader>es :CocCommand snippets.editSnippets<cr>
ino <silent><expr><c-j> pumvisible() ? "\<c-n>" :
\ coc#refresh()
ino <expr><c-k> pumvisible() ? "\<C-p>" : "k"
"
" `coc-snippets`
" TODO: is this block even necessary anymore?
"
" I use `coc-snippets-exand-jump` here as it is more flexible afaics
" As stated in the docs:
" `coc-snippets-expand` Expand snippet w/ current inserted text
" `coc-snippets-expand-jump` Expand snippet or jump to next placeholder of current snippet if possible
" Use tab for expansion in every context Don't use it for jumping as
" expansions have priority over jumping (which is not always what you want)
"
" E.g. You don't want to expand `time` to say `12:05` upon `<tab>`bing to go
" from arguments to body in a function snippet
inor <silent><expr> <TAB>
\ coc#pum#visible() ? coc#_select_confirm() :
\ coc#expandable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ "\<TAB>"
" Use <c-j> and <c-k> to move through suggestions
" Open suggestions if not yet open
inor <silent><expr> <c-j> coc#pum#visible() ? coc#pum#next(1) : coc#refresh()
" NOTE: As the followning interfered with digraphs, I replaced `coc#refresh`
" with `"\<C-g>u\<c-k>"` which afaik just does c-k when no completion menu is
" shown
" ```
" inor <silent><expr> <c-k> coc#pum#visible() ? coc#pum#prev(1) : coc#refresh()
" ```
inor <silent><expr> <c-k> coc#pum#visible() ? coc#pum#prev(1) : "\<C-g>u\<c-k>"
" NOTE: this is cutting text in visual mode, it is replaces `$VISUAL` on next
" expansion
"
" although I mapped it, I have yet to test this feature
vmap <tab> <Plug>(coc-snippets-select)
ino <expr><cr> complete_info()["selected"] != "-1" ? "\<c-y>" : "\<c-g>u\<CR>"
" Show doccumentation
fu! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
@ -160,13 +214,21 @@ fu! s:show_documentation()
call CocAction('doHover')
endif
endfunction
nnoremap K :call show_documentation()
nn <leader>es :CocCommand snippets.editSnippets<cr>
" Code action on cursor position
nm <leader>do <Plug>(coc-codeaction)
" Coc statusline
se statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Prettier command
" Commands
com! -nargs=0 Prettier :CocCommand prettier.formatFile
" }}}
" `.../copilot` {{{
let g:copilot_node_command = "/home/h/.config/nvm/versions/node/v16.18.0/bin/node"
let g:copilot_no_tab_map = v:true
imap <c-l> <Plug>(copilot-next)
imap <c-h> <Plug>(copilot-prev)
imap <silent><script><expr> <s-tab> copilot#Accept("\<CR>")
" Show Copilot node v16 as it does not work with v18 yet
" LaTex
let g:vimtex_view_method='zathura'
@ -202,9 +264,77 @@ let g:fzf_colors =
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'], }
" Wiki
let g:vimwiki_auto_chdir = 1
let g:vimwiki_list = [{'path': '~/.vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
let g:ag_working_path_mode="r"
" }}}
" `vim-pandoc/vim-pandoc` {{{
" `vim-pandoc/vim-pandoc-syntax`
au FileType pandoc call pandoc#completion#Init()
let g:pandoc#filetypes#pandoc_markdown=0
let g:pandoc#spell#enabled=0
let g:pandoc#spell#default_langs=['en_us', 'nl_be']
let g:pandoc#syntax#conceal#urls=1
let g:pandoc#syntax#conceal#blacklist=[]
let g:pandoc#formatting#mode='a'
let g:pandoc#formatting#textwidth=90
let g:pandoc#modules#disabled = ["formatting", "dashes", "yaml", "metadata"]
" }}}
" `lervag/wiki.vim` {{{
" Only load wiki.vim for wiki directory
let g:wiki_global_load=0
let g:wiki_root='~/.wiki'
let g:wiki_index_name='index'
let g:wiki_zotero_root='~/doc/Zotero'
let g:wiki_filetypes=['md']
let g:wiki_completion_case_sensitive=0
" Mappings
" Remap <leader>p
augroup filetype_pandoc
autocmd!
au BufRead,BufNewFile /home/h/.wiki/*.md nn <buffer><leader>p :WikiFzfPages<cr>
au BufRead,BufNewFile /home/h/.wiki/*.md nnoremap <expr><buffer> sv empty(g:wiki#link#get()) ? ':vs<CR><c-w>w' : '<Plug>(wiki-link-follow-vsplit)'
au BufRead,BufNewFile /home/h/.wiki/*.md nnoremap <expr><buffer> ss empty(g:wiki#link#get()) ? ':sp<CR><c-w>w' : '<Plug>(wiki-link-follow-split)'
augroup END
" If we are on a wiki link
" let g:wiki_file_handlenmap r
" Links
let g:wiki_link_extension='.md'
" Do not automatically transform to link, use `<leader>wf` for this
let g:wiki_link_toggle_on_follow=0
let g:wiki_link_target_type='md'
let g:wiki_map_text_to_link='Slugify'
" E.g. transform `My link` into `[My link](my-link.md)`
function Slugify(text) abort
return [substitute(tolower(a:text), '\s\+', '-', 'g'), a:text]
endfunction
vmap <leader>wf <Plug>(wiki-link-toggle-visual)
" Automatically save when navigation
let g:wiki_write_on_nav=1
" }}}
" `tools-life/taskwiki` {{{
let g:taskwiki_taskrc_location='/home/h/.config/task/taskrc'
let g:taskwiki_disable_concealcursor=1
let g:taskwiki_dont_preserve_folds=1
let g:taskwiki_dont_fold=1
" }}}
" JS and TypeScript
let g:javascript_plugin_jsdoc = 1 " jsdoc syntax highlighting
@ -217,6 +347,13 @@ let g:svelte_indent_style = 0
" JSONC (see https://github.com/neoclide/jsonc.vim/pull/9")
autocmd BufNewFile,BufRead */.vscode/*.json setlocal filetype=jsonc
" `.../quickscope` {{{
let g:qs_max_chars=80
let g:qs_lazy_highlight = 1
" }}}
" SuperCollider
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd se filetype=supercollider
au Filetype supercollider packadd scvim
@ -238,24 +375,89 @@ let g:fzf_action = {
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
" Insert path completion
ino <expr><c-f> fzf#vim#complete#path('rg --files --sort path')
" Color theme & statusline
""""""""""""""""""""""""""
" }}}
" Color theme & statusline {{{
"
se nosc
se nosmd
se ls=2
se stl=\ %0*%n
se stl+=\ %m
se stl+=\ %y%1*
se stl+=\ %y%0*
se stl+=\ %<%F
se stl+=\ %1*%=%5l%*
se stl+=%2*/%L%*
se stl+=\ %0*%=%5l%*
se stl+=%0*/%L%*
colo simple-dark
colo yang
" Other
"""""""""""""""""""""""
" }}}
" Quick hacks {{{
"
fu! Compile()
if expand('%:e') == "md"
:silent exec "!pandoc % -s -o /tmp/op.pdf &"
endif
endfu
fu! Preview()
:call Compile()
:silent exec "!zathura /tmp/op.pdf &"
endfu
" VIM config hot reload
autocmd! bufwritepost .vimrc source %
au! bufwritepost .vimrc source $HOME/.vimrc
" TODO: separate to filetype specific files
" JS
" Jump between `=` and `;`
au FileType javascript set mps+==:;
" JSONC (see https://github.com/neoclide/jsonc.vim/pull/9")
au BufNewFile,BufRead */.vscode/*.json setlocal filetype=jsonc
" Hacky way to pass on active note to script for automated for HTML preview
au BufEnter /home/h/.wiki/*.md silent exe '!echo %:t > /home/h/.local/share/nvim/plugged/bro/current-page'
" }}}
highlight QuickScopeSecondary cterm=underline
highlight QuickScopePrimary ctermbg=253 ctermfg=232 cterm=none
highlight Pmenu ctermfg=232
function! SynGroup()
let l:s = synID(line('.'), col('.'), 1)
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
endfun
com! -nargs=0 Syn :call SynGroup()
" Taken from /usr/share/vim/vim90/defaults.vim
augroup vimStartup
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
" Highlight todo's for every filetype
" https://stackoverflow.com/questions/11709965/vim-highlight-the-word-todo-for-every-filetype
augroup HiglightTODO
autocmd!
autocmd WinEnter,VimEnter * :silent! call matchadd('Todo', 'TODO', -1)
autocmd WinEnter,VimEnter * :silent! call matchadd('Todo', 'FIXME', -1)
autocmd WinEnter,VimEnter * :silent! call matchadd('Todo', 'QUESTION', -1)
augroup END

View File

@ -1,5 +1,19 @@
# Vortex core
# Keyboard configuration
Generated from [TsFreddie's MPC tool](https://tsdo.in/much-programming-core/)
Keyboard configuration for the Vortex Core 40% keyboard.
![](layout.png)
Generated using [TsFreddie's MPC tool](https://tsdo.in/much-programming-core/).
Note: this is assuming `Caps lock` is remapped to `Esc` on press and `Ctrl` on hold (e.g. using `caps2esc`).
## Layer 0
Macros are mainly used for shift, ctrl & alt modifiers.
![](l0.png)
## Layer 1
Lighting configuration layer with some macros for workspaces.
![](l1.png)

BIN
.vortex-core/l0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
.vortex-core/l1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,21 @@
Config { overrideRedirect = False
, font = "xft:Iosevka Term SS08:size=12:antialias=true"
, bgColor = "#111"
, fgColor = "#ccc"
, position = TopW L 90
, bgColor = "#cccccc"
, fgColor = "#111"
, position = TopW L 100
, commands = [ Run Cpu
[ "-L", "3"
, "-H", "50"
, "--high" , "red"
, "--normal", "green"
] 10
, Run Battery [
"-t", "<acstatus>: <left>% - <timeleft>",
"--",
--"-c", "charge_full",
"-O", "AC",
"-o", "Bat",
"-h", "green",
"-l", "red"
] 10
, Run Alsa "default" "Master"
[ "--template", "Vol: <volumestatus>"
@ -17,9 +25,12 @@ Config { overrideRedirect = False
]
, Run Memory ["--template", "Mem: <usedratio>%"] 10
, Run Date "%a %Y-%m-%d %H:%M" "date" 10
, Run Com "sb-pomo" [] "pomo" 10
, Run Com "sb-anki" [] "anki" 10
, Run Com "sb-tasks" [] "tasks" 10
, Run XMonadLog
]
, sepChar = "%"
, alignSep = "}{"
, template = "%XMonadLog% }{ %alsa:default:Master% | %cpu% | %memory% | %date% "
, template = "%XMonadLog%%anki%%pomo%%tasks% }{ %alsa:default:Master% | %battery% | %date%"
}

View File

@ -1,45 +1,99 @@
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Magnifier
import qualified XMonad.Layout.Magnifier as Mag (MagnifyMsg (..))
import XMonad.Layout.Spacing
import XMonad.Layout.Tabbed (Theme (..), shrinkText,
tabbedAlways)
import XMonad.Layout.ThreeColumns
import XMonad.Layout.ToggleLayouts (ToggleLayout (..), toggleLayouts)
import XMonad.Layout.WindowArranger
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import XMonad.Util.Paste
import XMonad.Util.Run (spawnPipe)
import XMonad.Util.Ungrab
import XMonad.Actions.CycleWS
import XMonad.Actions.WindowGo
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ScreenCorners
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import qualified XMonad.Util.Hacks as Hacks
-- EWMH compliance
import XMonad.Hooks.EwmhDesktops
import qualified Data.Map.Strict as M
import XMonad.Layout.Magnifier
import qualified XMonad.Layout.Magnifier as Mag (MagnifyMsg (..))
import XMonad.Layout.NoBorders (hasBorder, smartBorders)
import XMonad.Layout.PerScreen
import XMonad.Layout.ResizableTile
import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns
import XMonad.Layout.ToggleLayouts
( ToggleLayout (..),
toggleLayouts,
)
import XMonad.Layout.WindowNavigation
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig
import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.Loggers
import XMonad.Util.Paste
import XMonad.Util.Run
( spawnExternalProcess,
spawnPipe,
)
import XMonad.Util.Ungrab
-- Magnifier is off by default (can be controlled using arrow keys)
myLayout = smartBorders $
threeColMid |||
magnifiercz magnificationFactorH tiled |||
magnifiercz magnificationFactorV (Mirror tiled) |||
Full
-- Statusbar
myXmobarPP :: PP
myXmobarPP =
def
{ ppSep = tertiaryColor " | ",
ppCurrent = brackitify,
ppHidden = secondaryColor,
ppHiddenNoWindows = tertiaryColor,
ppUrgent = red . wrap (yellow "!") (yellow "!"),
ppLayout = \l -> case l of
"Tall" -> "[]="
"Magnifier Tall" -> "[]+"
"Magnifier (off) Tall" -> "[]="
"Magnifier Mirror Tall" -> "+[]"
"Magnifier (off) Mirror Tall" -> "=[]"
"Full" -> "[ ]"
"ThreeCol" -> "|||"
_ -> l,
ppTitle = shorten 80,
ppTitleSanitize = xmobarStrip,
ppOrder = \[ws, l, _, wins] -> [ws, l, wins],
ppExtras = [logTitles formatFocused formatUnfocused]
}
where
brackitify = wrap "[" "]"
formatFocused = secondaryColor . brackitify . ppWindow
formatUnfocused = tertiaryColor . ppWindow
ppWindow = xmobarRaw . (\w -> if null w then "Untitled" else w) . shorten 16
primaryColor = xmobarColor "#000000" ""
secondaryColor = xmobarColor "#333333" ""
tertiaryColor = xmobarColor "#555555" ""
yellow = xmobarColor "#ff0" ""
red = xmobarColor "#ff5555" ""
-- Shift to workspace and view workspace
shiftAndView id = doF (W.view id) <> doF (W.shift id)
-- manageHook
myManageHook =
composeAll
[ className =? "Zathura" --> doShift "pdf",
className =? "firefox" --> shiftAndView "www",
className =? "Anki" --> shiftAndView "etc",
className =? "Obsidian" --> shiftAndView "etc",
className =? "Launcher" --> doRectFloat (W.RationalRect 0.05 0.4 0.9 0.5),
className =? "Calculator" --> doCenterFloat,
className =? "feh" --> doCenterFloat,
className =? "albert" --> hasBorder False,
className =? "Xournalpp" --> doRectFloat (W.RationalRect 0.5 0.5 0.5 0.5)
]
-- layoutHook
myLayoutHook =
smartBorders $
-- Column layouts
threeCol
||| threeColMid
-- Tiled layouts
-- Note: magnifier is off by default
-- (controllable usingarrow keys)
||| magnifiercz magnificationFactorH tiled
||| magnifiercz magnificationFactorV (Mirror tiled)
-- Single window / monocle layout
||| Full
where
magnificationFactorV = 1.384
magnificationFactorH = 1.621
@ -47,124 +101,103 @@ myLayout = smartBorders $
threeCol = ThreeCol nmaster delta ratio
threeColMid = ThreeColMid nmaster delta ratio
nmaster = 1
ratio = 1/2
delta = 4/100
myStartupHook = do
addScreenCorners [ (SCUpperRight, nextWS)
, (SCUpperLeft, prevWS)
]
myManageHook = composeAll
[ className =? "Zathura" --> doShift "ε"
, className =? "Launcher" --> doRectFloat (W.RationalRect 0.05 0.4 0.9 0.5)
]
myConfig = def
{
terminal = "alacritty"
ratio = 1 / 2
delta = 4 / 100
myConfig =
def
{ terminal = "alacritty",
-- Use Win key instead of Alt
, modMask = mod4Mask
, workspaces = ["α", "β", "γ", "δ", "ε", "ζ", "η"]
modMask = mod4Mask,
-- , workspaces = ["α", "β", "γ", "δ", "ε", "ζ", "η"]
workspaces =
[ "sh",
"www",
"dev",
-- "nix",
"pdf",
"etc"
],
-- Styling
, focusedBorderColor = "#888"
, normalBorderColor = "#000"
, borderWidth = 2
focusedBorderColor = "#888",
normalBorderColor = "#000",
borderWidth = 2,
-- Hooks
, startupHook = myStartupHook
, manageHook = myManageHook <+> manageHook def
, layoutHook = screenCornerLayoutHook $ avoidStruts myLayout
, handleEventHook = handleEventHook def <> Hacks.windowedFullscreenFixEventHook <+> screenCornerEventHook
} `additionalKeysP` myKeysP
manageHook = myManageHook <+> manageHook def,
layoutHook = avoidStruts myLayoutHook,
handleEventHook = handleEventHook def <> Hacks.windowedFullscreenFixEventHook
}
`additionalKeysP` myKeysP
`removeKeysP` myRemoveKeysP
-- Keybindings to be added/overridden
myKeysP = [
-- Fit floating windows back to layout
("M-S-<Space>", withFocused $ windows . W.sink)
-- Use rofi to launch programs
, ("M-p", spawn "launcher")
myKeysP =
[ -- Fit floating windows back to layout
("M-S-<Space>", withFocused $ windows . W.sink),
-- Launchers
("M-S-p", spawn "alacritty --class Launcher,Launcher"),
("M-p", spawn "albert toggle"),
-- Map insert key to paste from clipboard
, ("<Insert>", pasteSelection)
("<Insert>", pasteSelection),
-- Map print screen to take a screenshot with flameshot
, ("<Print>", spawn "flameshot gui")
("<Print>", spawn "flameshot gui"),
-- Map audio keys to control volume
, ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%")
, ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%")
, ("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")
("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%"),
("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%"),
("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"),
-- Map brightness keys to control brightness with brightnessctl
, ("<XF86MonBrightnessUp>", spawn "brightnessctl set 20+")
, ("<XF86MonBrightnessDown>", spawn "brightnessctl set 20-")
("<XF86MonBrightnessUp>", spawn "brightnessctl set 20+"),
("<XF86MonBrightnessDown>", spawn "brightnessctl set 20-"),
-- Map brightness keys + shift to adjust redshift temperature
, ("S-<XF86MonBrightnessUp>", spawn "echo $(($(cat /tmp/temperature) + 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything")
, ("S-<XF86MonBrightnessDown>", spawn "echo $(($(cat /tmp/temperature) - 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything")
("S-<XF86MonBrightnessUp>", spawn "echo $(($(cat /tmp/temperature) + 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"),
("S-<XF86MonBrightnessDown>", spawn "echo $(($(cat /tmp/temperature) - 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"),
-- Reset redshift temperature
, ("M-S-<XF86MonBrightnessUp>", spawn "echo 3000 > /tmp/temperature && redshift -x")
, ("M-S-<XF86MonBrightnessDown>", spawn "echo 3000 > /tmp/temperature && redshift -x")
("M-S-<XF86MonBrightnessUp>", spawn "echo 3000 > /tmp/temperature && redshift -x"),
("M-S-<XF86MonBrightnessDown>", spawn "echo 3000 > /tmp/temperature && redshift -x"),
-- Use power down key to suspend
, ("<XF86PowerOff>", spawn "systemctl suspend")
("<XF86PowerOff>", spawn "systemctl suspend"),
-- FIXME: Spawn firefox in fullscreen, but not in kiosk mode
, ("M-S-b", spawn "firefox --fullscreen")
("M-S-b", spawn "firefox --fullscreen"),
-- Magnify window using arrow keys
, ("M-=", sendMessage MagnifyMore >> sendMessage Mag.ToggleOn)
, ("M--", sendMessage MagnifyLess >> sendMessage Mag.ToggleOn)
("M-=", sendMessage MagnifyMore >> sendMessage Mag.ToggleOn),
("M--", sendMessage MagnifyLess >> sendMessage Mag.ToggleOn),
-- Reset magnification
, ("M-S-=", sendMessage Mag.ToggleOff)
, ("M-t", sendMessage $ JumpToLayout "Tall")
, ("M-f", sendMessage $ JumpToLayout "Full")
, ("M-S-\\", sendMessage $ JumpToLayout "ThreeCol")
("M-S-=", sendMessage Mag.ToggleOff),
("<XF86Calculator>", spawn "alacritty --class 'Calculator' -e ipython -i /home/h/.bin/calc.py"),
-- playerctl ncspot using arrow keys
("M-<Right>", spawn "playerctl next"),
("M-<Left>", spawn "playerctl previous"),
("M-<Up>", spawn "playerctl play"),
("M-<Down>", spawn "playerctl pause"),
-- Use a,s,d,f,g to switch to workspaces
("M-a", windows $ W.greedyView "sh"),
("M-s", windows $ W.greedyView "www"),
("M-d", windows $ W.greedyView "dev"),
("M-f", windows $ W.greedyView "pdf"),
("M-g", windows $ W.greedyView "etc"),
-- Use shift + a,s,d,f,g to move window to workspace
("M-S-a", windows $ W.shift "sh"),
("M-S-s", windows $ W.shift "www"),
("M-S-d", windows $ W.shift "dev"),
("M-S-f", windows $ W.shift "pdf"),
("M-S-g", windows $ W.shift "etc")
]
-- Keybindings to be removed
myRemoveKeysP = [ "M-t" ]
myXmobarPP :: PP
myXmobarPP = def
{ ppSep = tertiaryColor " | "
, ppTitleSanitize = xmobarStrip
, ppCurrent = brackitify
, ppHidden = secondaryColor . wrap " " ""
, ppHiddenNoWindows = secondaryColor . wrap " " ""
, ppUrgent = red . wrap (yellow "!") (yellow "!")
, ppLayout = \l -> case l of "Tall" -> "[]="
"Magnifier Tall" -> "[]+"
"Magnifier Mirror Tall" -> "+[]"
"Full" -> "[ ]"
"ThreeCol" -> "|||"
_ -> l
, ppTitle = shorten 80
, ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
, ppExtras = [logTitles formatFocused formatUnfocused]
}
where
brackitify = wrap "[" "]"
formatFocused = primaryColor . brackitify . ppWindow
formatUnfocused = secondaryColor . brackitify . ppWindow
ppWindow = xmobarRaw . (\w -> if null w then "Untitled" else w) . shorten 30
primaryColor = xmobarColor "#eeeeee" ""
secondaryColor = xmobarColor "#888888" ""
tertiaryColor = xmobarColor "#555555" ""
white = xmobarColor "#ffffff" ""
yellow = xmobarColor "#ff0" ""
red = xmobarColor "#ff5555" ""
myRemoveKeysP =
[ -- Remove 1,2,3,4,5 bindings for workspaces
"M-1",
"M-2",
"M-3",
"M-4",
"M-5",
-- Remove shift + 1,2,3,4,5 bindings for workspaces
"M-S-1",
"M-S-2",
"M-S-3",
"M-S-4",
"M-S-5"
]
main :: IO ()
main = do xmonad $ docks $ ewmh $ withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey myConfig