├── ranger ├── plugins │ ├── __init__.py │ └── choose.py ├── colorschemes │ ├── __init__.py │ └── main.py └── commands.py ├── nvim ├── snippets │ ├── all.snippets │ ├── svelte.snippets │ ├── typescriptreact.snippets │ ├── gitcommit.snippets │ ├── ledger.snippets │ ├── snippets.snippets │ ├── dosini.snippets │ ├── javascript-requirejs.snippets │ ├── bash.snippets │ ├── scss.snippets │ ├── javascript-redux.snippets │ ├── sql.snippets │ ├── javascript.node.snippets │ ├── lua.snippets │ ├── typescript.snippets │ ├── rst.snippets │ ├── vim.snippets │ ├── sh.snippets │ ├── elm.snippets │ ├── jinja.snippets │ └── htmldjango.snippets ├── after │ └── ftplugin │ │ ├── man.vim │ │ ├── snippets.vim │ │ ├── fugitive.vim │ │ ├── help.vim │ │ ├── vim.vim │ │ ├── python.vim │ │ ├── lua.vim │ │ ├── go.vim │ │ ├── text.vim │ │ └── markdown.vim ├── stylua.toml ├── syntax │ └── ledger.vim └── plugins │ ├── vifm │ ├── plugin │ │ └── vifm.vim │ └── autoload │ │ └── vifm.vim │ ├── find │ ├── ftplugin │ │ └── find.vim │ └── plugin │ │ └── find.vim │ ├── grep │ ├── plugin │ │ └── grep.vim │ └── autoload │ │ └── grep.vim │ ├── objects │ └── plugin │ │ └── objects.vim │ ├── fzf │ └── plugin │ │ └── fzf.vim │ ├── quickfix │ ├── after │ │ └── ftplugin │ │ │ └── qf.vim │ └── autoload │ │ └── quickfix.vim │ ├── bookmarks │ └── plugin │ │ └── bookmarks.vim │ ├── search │ └── plugin │ │ └── search.vim │ └── explorer │ └── plugin │ └── explorer.vim ├── bash ├── .bash_profile └── .bashrc ├── mpd ├── start.sh └── mpd.conf ├── bin ├── orphans-check ├── orphans-rm ├── updates-check ├── kbset ├── polybar-toggle ├── colors ├── autolock ├── xprop-notify ├── text-pixel-size ├── gpu-info ├── cheatsheet ├── fzf-preview ├── calc-tmux ├── nemo-term ├── tmux-notes ├── vim-xdotool ├── toseconds ├── cursor ├── gpu ├── colorscheme ├── t ├── rofi-tmux ├── volume ├── scan ├── rofi-edit ├── play ├── sensors-notify └── lock ├── elixir └── iex.exs ├── compton └── start.sh ├── redshift ├── start.sh └── redshift.conf ├── imwheel ├── start.sh └── imwheelrc ├── polybar ├── start.sh └── modules │ ├── eth │ ├── wlan │ ├── volume │ ├── sync │ ├── lib │ ├── battery │ ├── backup │ ├── updates │ ├── timer │ ├── datetime │ └── kb ├── x ├── Xmodmap ├── Xresources ├── xinitrc └── Xresources.d │ ├── x11-askpass │ ├── colors-dark │ ├── colors-light │ ├── calc │ ├── xterm │ ├── colors │ └── urxvt ├── ledger └── ledgerrc ├── mpv └── lua-settings │ └── osc.conf ├── nemo └── actions │ ├── crop.sh │ ├── mpv_append_condition.sh │ ├── tojpg.sh │ ├── mpv_append.sh │ ├── convert-to-pdf.nemo_action │ ├── copy-path-to-clipboard.sh │ ├── mpv_append.nemo_action │ ├── copy-path-to-clipboard.nemo_action │ ├── vidir.nemo_action │ ├── resize.sh │ ├── size.sh │ ├── square.sh │ ├── tojpg.nemo_action │ ├── size_delta.sh │ ├── crop.nemo_action │ ├── resize.nemo_action │ ├── size.nemo_action │ ├── square.nemo_action │ ├── size_delta.nemo_action │ ├── vidir.sh │ └── convert-to-pdf.sh ├── urxvt ├── rxvt-unicode-9.31.tar.bz2 ├── urxvt.desktop ├── perl-5.38.patch ├── font-width.patch ├── ext │ ├── focus │ ├── message │ └── font-manager └── PKGBUILD ├── i3 ├── i3-msg-dialog ├── i3-focus-last-window ├── i3-slop-resize ├── i3-swap ├── i3-titlebar-menu ├── i3-new-workspace ├── i3-only ├── i3-t ├── i3-mark ├── i3-next-window ├── i3-border ├── i3-history ├── i3-rotate ├── i3-rename-workspace ├── i3-scratch ├── i3-next-workspace ├── i3-sys-menu ├── i3-choose-workspace └── i3-move-to-workspace ├── systemd ├── user │ ├── sync.service │ ├── mbsync.service │ ├── lib.service │ ├── notify-fail@.service │ ├── updates-check.service │ ├── sync-check.service │ ├── mbsync.timer │ ├── updates-check.timer │ ├── lib.timer │ └── sync-check.timer ├── gpu-od.service ├── suspend-workaround.service └── lock@gcmt.service ├── vifm ├── scripts │ ├── vifm-default-viewer │ ├── vifm-default-opener │ ├── vifm-root │ ├── vifm-fzf │ └── vifm-fzf-filter ├── plugins │ └── mcd │ │ └── init.lua └── colors │ └── main.vifm ├── .gitignore ├── cmus ├── cmus.desktop ├── dark.theme └── rc ├── rofi ├── ranger-menu.rasi ├── i3-input.rasi ├── system-menu.rasi ├── term-light.rasi ├── term-dark.rasi ├── main-light.rasi ├── config.rasi ├── term-base.rasi └── main-base.rasi ├── pacman └── hooks │ ├── orphans-check.hook │ ├── updates-check.hook │ ├── kbd-repeat.hook │ └── trim-cache.hook ├── gtk-2.0 ├── gtkfilechooser.ini └── gtkrc ├── zsh ├── .zprofile ├── .zshenv └── ext │ └── rofi.zsh ├── dunst └── start.sh ├── firefox ├── chrome │ └── userChrome.css ├── userChrome.notabbar.css └── user.js ├── osx ├── DefaultKeyBinding.dict └── brew.sh ├── vim └── syntax │ └── ledger.vim ├── gtk-3.0 ├── gtk.css └── settings.ini ├── sxiv └── exec │ ├── image-info │ └── key-handler ├── kitty ├── kitty.conf ├── light.conf └── dark.conf ├── wezterm ├── wezterm.lua ├── dark.lua └── light.lua ├── LICENSE ├── i3lock └── PKGBUILD ├── zathura └── zathurarc ├── git ├── config └── gitk ├── ctags └── ctags ├── fontconfig └── fonts.conf └── pudb └── midnight-theme.py /ranger/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ranger/colorschemes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nvim/snippets/all.snippets: -------------------------------------------------------------------------------- 1 | extends _ 2 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/man.vim: -------------------------------------------------------------------------------- 1 | 2 | setl wrap 3 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/snippets.vim: -------------------------------------------------------------------------------- 1 | setl noexpandtab 2 | -------------------------------------------------------------------------------- /bash/.bash_profile: -------------------------------------------------------------------------------- 1 | [[ -f ~/.bashrc ]] && source ~/.bashrc 2 | -------------------------------------------------------------------------------- /mpd/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killall -qw mpd 4 | mpd 5 | -------------------------------------------------------------------------------- /nvim/snippets/svelte.snippets: -------------------------------------------------------------------------------- 1 | extends html, javascript, css 2 | -------------------------------------------------------------------------------- /nvim/snippets/typescriptreact.snippets: -------------------------------------------------------------------------------- 1 | extends typescript 2 | -------------------------------------------------------------------------------- /bin/orphans-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pacman -Qtdq 4 | exit 0 5 | -------------------------------------------------------------------------------- /elixir/iex.exs: -------------------------------------------------------------------------------- 1 | IEx.configure colors: [eval_error: [:red, :bright]] 2 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/fugitive.vim: -------------------------------------------------------------------------------- 1 | nnoremap q c 2 | -------------------------------------------------------------------------------- /bash/.bashrc: -------------------------------------------------------------------------------- 1 | 2 | [[ $- != *i* ]] && return 3 | 4 | PS1='\u@\h \W \$ ' 5 | -------------------------------------------------------------------------------- /bin/orphans-rm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pacman -Qtdq | sudo pacman -Rnsc - 4 | -------------------------------------------------------------------------------- /compton/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killall -qw compton 4 | compton & 5 | -------------------------------------------------------------------------------- /redshift/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killall -qw redshift 4 | redshift & 5 | -------------------------------------------------------------------------------- /imwheel/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killall -wq imwheel 4 | imwheel -b 45 & 5 | -------------------------------------------------------------------------------- /nvim/snippets/gitcommit.snippets: -------------------------------------------------------------------------------- 1 | snippet co 2 | Co-authored-by: ${1} <${2}> 3 | -------------------------------------------------------------------------------- /polybar/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killall -qw polybar 4 | polybar -r main & 5 | -------------------------------------------------------------------------------- /x/Xmodmap: -------------------------------------------------------------------------------- 1 | 2 | !! CapsLock -> Escape 3 | !!clear lock 4 | !!keycode 66 = Escape 5 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | wincmd J 2 | 3 | nnoremap q c 4 | -------------------------------------------------------------------------------- /ledger/ledgerrc: -------------------------------------------------------------------------------- 1 | --input-date-format %Y-%m-%d 2 | --date-format %Y-%m-%d 3 | --no-pager 4 | --strict 5 | -------------------------------------------------------------------------------- /mpv/lua-settings/osc.conf: -------------------------------------------------------------------------------- 1 | layout=slimbox 2 | seekbarstyle=bar 3 | deadzonesize=0 4 | minmousemove=3 5 | -------------------------------------------------------------------------------- /nemo/actions/crop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in ${@}; do 4 | convert "${f}" -trim "${f}" 5 | done 6 | -------------------------------------------------------------------------------- /urxvt/rxvt-unicode-9.31.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gcmt/dotfiles/HEAD/urxvt/rxvt-unicode-9.31.tar.bz2 -------------------------------------------------------------------------------- /i3/i3-msg-dialog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i3-msg "$(echo | eval "rofi "-dmenu -p 'i3-msg' -theme 'i3-input')" >/dev/null 4 | -------------------------------------------------------------------------------- /bin/updates-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | out=$(checkupdates) 4 | echo "${out}" | tee "$HOME/.local/share/updates-check.state" 5 | -------------------------------------------------------------------------------- /i3/i3-focus-last-window: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | id="$(i3-history -print | tail -2 | head -1)" 4 | [[ "$id" ]] && i3-focus -id "$id" 5 | -------------------------------------------------------------------------------- /nemo/actions/mpv_append_condition.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -e /tmp/mpv.fifo ] 4 | then 5 | exit 0 6 | else 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /nemo/actions/tojpg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in "$@"; do 4 | convert "$f" -background white -flatten -alpha off "${f%.*}.jpg" 5 | done 6 | -------------------------------------------------------------------------------- /systemd/user/sync.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Sync to cloud 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=%h/.local/bin/sync-cloud 7 | -------------------------------------------------------------------------------- /i3/i3-slop-resize: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | read -r X Y W H < <(slop -f "%x %y %w %h") 4 | i3-msg -q "floating enable, move position $X $Y, resize set $W $H" 5 | -------------------------------------------------------------------------------- /vifm/scripts/vifm-default-viewer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$(file -bL --mime-type "$1")" =~ ^text/ ]]; then 4 | head -1000 "$1" 5 | else 6 | echo "Preview unavailable" 7 | fi 8 | -------------------------------------------------------------------------------- /bin/kbset: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | layout=us 4 | variant=altgr-intl 5 | 6 | setxkbmap -layout $layout -variant $variant 7 | 8 | xmodmap ~/.Xmodmap 9 | 10 | xset r rate 150 30 11 | -------------------------------------------------------------------------------- /nvim/snippets/ledger.snippets: -------------------------------------------------------------------------------- 1 | # Ledger 2 | snippet ent 3 | `strftime("%Y/%m/%d")` ${1:transaction} 4 | ${2:account} ${3:value} 5 | ${0:account} 6 | -------------------------------------------------------------------------------- /bin/polybar-toggle: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | id=$(xdo id -N Polybar) 4 | if xprop -id $id | grep -q "window state: Normal"; then 5 | xdo hide -N Polybar 6 | else 7 | xdo show -N Polybar 8 | fi 9 | -------------------------------------------------------------------------------- /nemo/actions/mpv_append.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | fifo=/tmp/mpv.fifo 4 | 5 | for f in "$@"; do 6 | echo "{\"command\": [\"loadfile\", \"${f}\", \"append\"]}" | socat - "$fifo" 7 | done 8 | -------------------------------------------------------------------------------- /systemd/user/mbsync.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mailbox synchronization service 3 | OnFailure=notify-fail@%N.service 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=/usr/bin/mbsync -Va 8 | -------------------------------------------------------------------------------- /x/Xresources: -------------------------------------------------------------------------------- 1 | 2 | #include ".Xresources.d/colors" 3 | #include ".Xresources.d/urxvt" 4 | #include ".Xresources.d/calc" 5 | #include ".Xresources.d/x11-askpass" 6 | 7 | Xcursor.size: 16 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | gtk-3.0/bookmarks 3 | vifminfo 4 | vifm-help.txt 5 | .DS_Store 6 | .netrwhist 7 | .zcompdump 8 | *.old 9 | *.pyc 10 | *.bak 11 | tags 12 | vifm/vifminfo.json 13 | -------------------------------------------------------------------------------- /systemd/user/lib.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Lib check 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=%h/.local/bin/lib -q -s 7 | ExecStartPre=/bin/sleep 60 8 | SuccessExitStatus=SIGUSR1 9 | -------------------------------------------------------------------------------- /systemd/user/notify-fail@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Notify service failure 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/usr/bin/notify-send -u critical "Systemd" "Service %i failed" 7 | -------------------------------------------------------------------------------- /systemd/user/updates-check.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Check for updates 3 | OnFailure=notify-fail@%N.service 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=%h/.local/bin/updates-check 8 | -------------------------------------------------------------------------------- /bin/colors: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in {0..255} ; do 4 | printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" 5 | if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then 6 | printf "\n"; 7 | fi 8 | done 9 | -------------------------------------------------------------------------------- /vifm/scripts/vifm-default-opener: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$(file -bL --mime-type "$1")" =~ ^text/ ]]; then 4 | vifm --server-name "$VIFM_SERVER" --remote +"edit" 5 | else 6 | xdg-open "$1" 7 | fi 8 | -------------------------------------------------------------------------------- /i3/i3-swap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | target="$(xwininfo | grep 'Window id:' | grep -o '0x[a-fA-F0-9]\+')" 4 | if [[ -n "${target}" ]]; then 5 | i3-msg -q "swap container with id ${target}" 2>/dev/null 6 | fi 7 | -------------------------------------------------------------------------------- /systemd/gpu-od.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=GPU overclock/undervolt 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/home/gcmt/.local/bin/gpu -set 7 | 8 | [Install] 9 | WantedBy=graphical.target 10 | -------------------------------------------------------------------------------- /bin/autolock: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pkill -x xautolock 4 | while pgrep -x xautolock >/dev/null; do sleep 1; done 5 | 6 | xautolock \ 7 | -cornerdelay 5 -corners "----" \ 8 | -time 30 -locker "lock -blank 300" & 9 | -------------------------------------------------------------------------------- /nemo/actions/convert-to-pdf.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=true 3 | Name=Convert to PDF 4 | Comment=Convert to PDF 5 | Exec= 6 | Selection=notnone 7 | Extensions=nodirs 8 | Quote=double 9 | -------------------------------------------------------------------------------- /nemo/actions/copy-path-to-clipboard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IFS=$'\n' 4 | echo -n "$*" | xclip -sel clipboard 5 | 6 | (( $# > 1 )) && s=s || s= 7 | notify-send "Nemo" "$# path$s copied to the system clipboard" 8 | -------------------------------------------------------------------------------- /systemd/user/sync-check.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Check if something needs to be synced 3 | OnFailure=notify-fail@%N.service 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=%h/.local/bin/sync-cloud -check 8 | -------------------------------------------------------------------------------- /cmus/cmus.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=Cmus 5 | GenericName=Console Music Player 6 | Exec=cmus-tmux 7 | Terminal=true 8 | StartupNotify=true 9 | Icon=audio-x-generic 10 | -------------------------------------------------------------------------------- /nvim/snippets/snippets.snippets: -------------------------------------------------------------------------------- 1 | # snippets for making snippets :) 2 | snippet snip 3 | snippet ${1:trigger} "${2:description}" 4 | ${0:${VISUAL}} 5 | snippet v 6 | {VISUAL} 7 | snippet $ 8 | ${${1:1}:${0:text}} 9 | -------------------------------------------------------------------------------- /systemd/user/mbsync.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mailbox synchronization timer 3 | 4 | [Timer] 5 | OnBootSec=30m 6 | OnUnitActiveSec=3h 7 | Unit=mbsync.service 8 | 9 | [Install] 10 | WantedBy=timers.target 11 | -------------------------------------------------------------------------------- /systemd/user/updates-check.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Check regularly for updates 3 | 4 | [Timer] 5 | OnBootSec=20m 6 | OnUnitActiveSec=1h 7 | Unit=updates-check.service 8 | 9 | [Install] 10 | WantedBy=timers.target 11 | -------------------------------------------------------------------------------- /systemd/user/lib.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Lib check 3 | After=network-online.target 4 | 5 | [Timer] 6 | OnCalendar=*-*-* 09:00:00 7 | Persistent=true 8 | Unit=lib.service 9 | 10 | [Install] 11 | WantedBy=timers.target 12 | -------------------------------------------------------------------------------- /systemd/user/sync-check.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Check if something needs to be synced 3 | 4 | [Timer] 5 | OnBootSec=20m 6 | OnUnitActiveSec=1h 7 | Unit=sync-check.service 8 | 9 | [Install] 10 | WantedBy=timers.target 11 | -------------------------------------------------------------------------------- /bin/xprop-notify: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | id="$(xwininfo | grep -Pio '(?<=window id: )0x[a-z0-9]+')" 4 | props=$(xprop -id "$id" WM_WINDOW_ROLE WM_CLASS WM_NAME | sed 's/(STRING)//') 5 | notify-send -t 15000 "xprop" "ID = $id ($(( id )))\\n$props" 6 | -------------------------------------------------------------------------------- /nemo/actions/mpv_append.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=true 3 | Name=Add to Mpv 4 | Comment=Add to Active Mpv Instance 5 | Conditions=exec ; 6 | Exec= 7 | Selection=notnone 8 | Extensions=mp3 9 | -------------------------------------------------------------------------------- /redshift/redshift.conf: -------------------------------------------------------------------------------- 1 | [redshift] 2 | 3 | fade=1 4 | adjustment-method=randr 5 | 6 | temp-day=6000 7 | temp-night=3500 8 | 9 | brightness-day=1.0 10 | brightness-night=0.9 11 | 12 | dawn-time=06:00-8:00 13 | dusk-time=19:00-21:00 14 | -------------------------------------------------------------------------------- /i3/i3-titlebar-menu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | entries="kill window\\nmove to scratchpad" 4 | choice="$(echo -e "$entries" | mouse-menu -format d)" 5 | 6 | case "$choice" in 7 | 1) i3-msg kill window ;; 8 | 2) i3-scratch -push ;; 9 | esac 10 | -------------------------------------------------------------------------------- /nvim/stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 100 2 | line_endings = "Unix" 3 | indent_type = "Tabs" 4 | quote_style = "AutoPreferDouble" 5 | call_parentheses = "Always" 6 | collapse_simple_statement = "Never" 7 | 8 | [sort_requires] 9 | enabled = true 10 | -------------------------------------------------------------------------------- /rofi/ranger-menu.rasi: -------------------------------------------------------------------------------- 1 | 2 | @import "term-dark" 3 | 4 | * { 5 | font: "Noto Mono patched 10"; 6 | } 7 | 8 | listview { 9 | fixed-height: false; 10 | scrollbar: false; 11 | } 12 | 13 | element, inputbar { 14 | padding: 2px 6px; 15 | } 16 | -------------------------------------------------------------------------------- /bin/text-pixel-size: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if (( $# != 2 )); then 4 | echo "Usage: text-pixel-size FONT FONTSIZE" >&2 5 | exit 1 6 | fi 7 | 8 | convert -font "$1" -pointsize "$2" pango:"$(cat -)" jpeg:- \ 9 | | identify -ping -format '%w %h' - 10 | -------------------------------------------------------------------------------- /nemo/actions/copy-path-to-clipboard.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=true 3 | Name=Copy Path 4 | Comment=Copy Path to Clipboard 5 | Icon-Name=folder 6 | Exec= 7 | Selection=any 8 | Extensions=any 9 | Quote=double 10 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | 2 | setl keywordprg=:help 3 | call setbufvar(bufnr('%'), '&cms', '" %s') 4 | 5 | nnoremap - call search#do('\v^\s*\zsfun', #{ 6 | \ show_match: 0, 7 | \ post_jump_cmd: "norm! zt10\" 8 | \ }) 9 | -------------------------------------------------------------------------------- /nemo/actions/vidir.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=true 3 | Name=Rename With Vidir 4 | Comment=Rename files with Vidir 5 | Dependencies=vidir 6 | Icon-Name=format-text-bold 7 | Exec= 8 | Selection=any 9 | Extensions=any 10 | Quote=double 11 | -------------------------------------------------------------------------------- /pacman/hooks/orphans-check.hook: -------------------------------------------------------------------------------- 1 | [Trigger] 2 | Type = Package 3 | Operation = Remove 4 | Operation = Upgrade 5 | Target = * 6 | 7 | [Action] 8 | Description = Check for orphaned packages 9 | When = PostTransaction 10 | Exec = /home/gcmt/.local/bin/orphans-check 11 | -------------------------------------------------------------------------------- /pacman/hooks/updates-check.hook: -------------------------------------------------------------------------------- 1 | [Trigger] 2 | Type = Package 3 | Operation = Upgrade 4 | Target = * 5 | 6 | [Action] 7 | Description = Notify polybar module 8 | When = PostTransaction 9 | Exec = /usr/bin/truncate -s0 "/home/gcmt/.local/share/updates-check.state" 10 | -------------------------------------------------------------------------------- /gtk-2.0/gtkfilechooser.ini: -------------------------------------------------------------------------------- 1 | [Filechooser Settings] 2 | LocationMode=path-bar 3 | ShowHidden=true 4 | ShowSizeColumn=true 5 | GeometryX=860 6 | GeometryY=440 7 | GeometryWidth=840 8 | GeometryHeight=705 9 | SortColumn=name 10 | SortOrder=ascending 11 | StartupMode=recent 12 | -------------------------------------------------------------------------------- /urxvt/urxvt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=URxvt 4 | GenericName=Terminal Emulator 5 | Comment=An unicode capable rxvt clone 6 | Exec=urxvt 7 | Icon=utilities-terminal 8 | Terminal=false 9 | Type=Application 10 | Categories=System;TerminalEmulator; 11 | -------------------------------------------------------------------------------- /bin/gpu-info: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | info="/sys/kernel/debug/dri/1/amdgpu_pm_info" 4 | 5 | if [[ "$*" =~ -v($| ) ]]; then 6 | sudo cat "$info" 7 | else 8 | sudo cat "$info" 2>/dev/null | awk '/GFX Clocks and Power:/,/^$/' | tail -n +2 | grep -v '^$' | sed 's/^\s\+//' 9 | fi 10 | -------------------------------------------------------------------------------- /pacman/hooks/kbd-repeat.hook: -------------------------------------------------------------------------------- 1 | [Trigger] 2 | Type = Package 3 | Operation = Upgrade 4 | Operation = Install 5 | Operation = Remove 6 | Target = * 7 | 8 | [Action] 9 | Description = Set keyboard repeat rate 10 | When = PostTransaction 11 | Exec = /bin/bash -c "xset r rate 150 30" 12 | -------------------------------------------------------------------------------- /pacman/hooks/trim-cache.hook: -------------------------------------------------------------------------------- 1 | [Trigger] 2 | Type = Package 3 | Operation = Remove 4 | Operation = Install 5 | Operation = Upgrade 6 | Target = * 7 | 8 | [Action] 9 | Description = Trim packages cache 10 | When = PostTransaction 11 | Exec = /bin/bash -c 'paccache -rvuk0 && paccache -rvk3' 12 | -------------------------------------------------------------------------------- /nemo/actions/resize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | size=$(zenity --entry --title "Scale images" --text "Enter the size in pixel" --entry-text "1000") 4 | 5 | if [[ -z ${size} ]]; then 6 | exit 1 7 | fi 8 | 9 | for f in ${@}; do 10 | convert -resize ${size}x${size} "${f}" "${f}" 11 | done 12 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/python.vim: -------------------------------------------------------------------------------- 1 | 2 | setl textwidth=88 3 | 4 | " Outline python module 5 | nnoremap - call search#do('\v^\s*\zs(class\|def)>', #{ 6 | \ show_match: 0, 7 | \ transform_cb: {l -> trim(l, ':')}, 8 | \ post_jump_cmd: "norm! zt10\" 9 | \ }) 10 | -------------------------------------------------------------------------------- /nvim/snippets/dosini.snippets: -------------------------------------------------------------------------------- 1 | snippet ec 2 | ; http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = ${1:space_or_tab} 8 | indent_size = ${2:indent_size} 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | -------------------------------------------------------------------------------- /systemd/suspend-workaround.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Workaround for motherboard sleep/wakeup bug 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/bin/sh -c "echo GPP0 > /proc/acpi/wakeup" 7 | ExecStart=/bin/sh -c "echo PTXH > /proc/acpi/wakeup" 8 | 9 | [Install] 10 | WantedBy = multi-user.target 11 | -------------------------------------------------------------------------------- /zsh/.zprofile: -------------------------------------------------------------------------------- 1 | 2 | export PATH="$HOME/.local/bin:$PATH" 3 | export PATH="$HOME/.local/lib/node_modules/bin:$PATH" 4 | export PATH="$HOME/.local/go/bin:$PATH" 5 | export npm_config_prefix=~/.local/lib/node_modules 6 | 7 | if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]] 8 | then 9 | exec startx 10 | exit 0 11 | fi 12 | -------------------------------------------------------------------------------- /nemo/actions/size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | size=$(zenity --entry --title "Resize images" --text "Enter the size in pixel" --entry-text "800") 4 | 5 | if [[ -z ${size} ]]; then 6 | exit 1 7 | fi 8 | 9 | for f in ${@}; do 10 | convert -size ${size}x${size} xc:white "${f}" -gravity center -composite "${f}" 11 | done 12 | -------------------------------------------------------------------------------- /nemo/actions/square.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in ${@}; do 4 | read -r W H < <(identify -format "%w %h" "${f}") 5 | max=$(printf "${W}\n${H}" | sort -n | tail -1) 6 | dunstify -r "${ID}" "SXIV" "convert -size ${max}x${max}" 7 | convert -size ${max}x${max} xc:white "${f}" -gravity center -composite "${f}" 8 | done 9 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/lua.vim: -------------------------------------------------------------------------------- 1 | 2 | setl noexpandtab 3 | setl tabstop=3 4 | 5 | nnoremap - call search#do('\v^([a-zA-Z_.]+ \= \|local )?function', #{ 6 | \ show_match: 0, 7 | \ post_jump_cmd: "norm! zt10\", 8 | \ matchadd: #{ 9 | \ Keyword: '\' 10 | \ } 11 | \ }) 12 | -------------------------------------------------------------------------------- /x/xinitrc: -------------------------------------------------------------------------------- 1 | 2 | export MONITOR_PRIMARY="$(xrandr | grep -w "connected" | grep -o "^[^ ]\+")" 3 | 4 | export QT_QPA_PLATFORMTHEME=qt5ct 5 | export GTK2_RC_FILES=~/.gtk-2.0/gtkrc 6 | 7 | setxkbmap -layout us -variant altgr-intl 8 | 9 | xrdb -load ~/.Xresources 10 | 11 | xset s off dpms 0 0 0 12 | 13 | ~/.fehbg & 14 | 15 | exec i3 16 | -------------------------------------------------------------------------------- /dunst/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killall -qw dunst 4 | dunst & 5 | 6 | if [[ "$1" == "-test" ]]; then 7 | notify-send -h int:value:25 -u critical "Title" "Critical urgency message" 8 | notify-send -h int:value:50 -u normal "Title" "Normal urgency message" 9 | notify-send -h int:value:75 -u low "Title" "Low urgency message" 10 | fi 11 | -------------------------------------------------------------------------------- /bin/cheatsheet: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tmp_img="$(mktemp --suffix '.png')" 4 | 5 | convert \ 6 | -trim -font "Noto Mono" -pointsize 10 \ 7 | -fill "#444444" -background white -bordercolor white -border 25 \ 8 | pango:"$(cat -)" "$tmp_img" 9 | 10 | trap "_exit" 0 11 | 12 | _exit() { 13 | rm "$tmp_img" 14 | } 15 | 16 | feh -x --title "Cheatsheet" "$tmp_img" 17 | -------------------------------------------------------------------------------- /i3/i3-new-workspace: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | num=1 4 | workspaces="$(i3-msg -t get_workspaces | grep -Po '(?<="num":)[0-9]+')" 5 | 6 | while (( num < 10 )); do 7 | if ! grep -q "$num" <<< "$workspaces"; then 8 | if [[ "$*" =~ -dry($| ) ]]; then 9 | echo "$num" 10 | else 11 | i3-msg -q "workspace number $num" 12 | fi 13 | break 14 | fi 15 | (( num += 1 )) 16 | done 17 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/go.vim: -------------------------------------------------------------------------------- 1 | 2 | nmap } call search('\V\({\\|}\)', 'Wz') 3 | nmap { call search('\V\({\\|}\)', 'Wbz') 4 | 5 | " Outline file 6 | nnoremap - call search#do('\v^\zs(func\|type) ', #{ 7 | \ show_match: 0, 8 | \ transform_cb: {l -> trim(l, '{')}, 9 | \ post_jump_cmd: "norm! zt10\" 10 | \ }) 11 | -------------------------------------------------------------------------------- /polybar/modules/eth: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if="${1:-eth0}" 4 | 5 | state_up() { 6 | ip addr | grep -q ": $if:.* state UP " 7 | } 8 | 9 | ip_addr() { 10 | ip addr | grep -A3 ": $if:" | grep -Po "(?<=inet )[0-9.]+" 11 | } 12 | 13 | draw_block() { 14 | local addr="$(ip_addr)" 15 | if [[ -n "$addr" ]]; then 16 | echo " $addr" 17 | fi 18 | } 19 | 20 | state_up && draw_block 21 | -------------------------------------------------------------------------------- /bin/fzf-preview: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -d "$1" ]]; then 4 | tree "$1" -L 1 5 | exit 6 | fi 7 | 8 | case "${1#*.}" in 9 | avi|mp4|wmv|mkv|mpg|mpeg|webm|m4v|flv|wav|mp3|flac|m4a|wma|mov) 10 | mediainfo "$1" 11 | ;; 12 | json) 13 | jq . "$1" 14 | ;; 15 | *) 16 | if [[ "$(file -bL --mime-type "$1")" =~ ^text/ ]]; then 17 | head -100 "$1" 18 | fi 19 | ;; 20 | esac 21 | -------------------------------------------------------------------------------- /bin/calc-tmux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Keep calculator running in a tmux session so that state is preserved. 3 | 4 | session=calc 5 | 6 | if ! tmux has -t "$session" 2> /dev/null; then 7 | tmux new -ds "$session" bc -ql 8 | tmux set -t "$session" set-titles on 9 | tmux set -t "$session" set-titles-string 'Calculator' 10 | tmux set -t "$session" status off 11 | fi 12 | 13 | exec t "$session" 14 | -------------------------------------------------------------------------------- /bin/nemo-term: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # gsettings set org.cinnamon.desktop.default-applications.terminal exec nemo-term 4 | 5 | tmux new-session -d -s "scratch" 2>/dev/null 6 | n="$(tmux list-windows -t "scratch" -F "#W" | grep -c '^nemo\b')" 7 | (( n == 0 )) && suffix= || suffix="-$(( n + 1 ))" 8 | tmux new-window -t "scratch" -n "nemo${suffix}" -c "$PWD" 9 | 10 | exec i3-t -move "scratch" 11 | -------------------------------------------------------------------------------- /firefox/chrome/userChrome.css: -------------------------------------------------------------------------------- 1 | /* Hide Tab bar with only one Tab - [110] */ 2 | #tabbrowser-tabs .tabbrowser-tab:only-of-type, 3 | #tabbrowser-tabs .tabbrowser-tab:only-of-type + #tabbrowser-arrowscrollbox-periphery{ 4 | display:none !important; 5 | } 6 | #tabbrowser-tabs, #tabbrowser-arrowscrollbox {min-height:0!important;} 7 | /* #TabsToolbar:not(:hover) */ #alltabs-button {display:none !important;} 8 | -------------------------------------------------------------------------------- /nvim/syntax/ledger.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | end 4 | 5 | syn match ledgerDate '\v^\d\d\d\d/\d\d/\d\d' 6 | syn region ledgerCommentBlock start=/^comment/ end=/^end comment/ 7 | syn match ledgerComment /^\s*[;#].*$/ 8 | 9 | hi def link ledgerDate Bold 10 | hi def link ledgerComment Comment 11 | hi def link ledgerCommentBlock Comment 12 | 13 | let b:current_syntax = "ledger" 14 | -------------------------------------------------------------------------------- /osx/DefaultKeyBinding.dict: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Move to ~/Library/KeyBindings 4 | http://osxnotes.net/keybindings.html 5 | 6 | "^f" = "moveWordForward:"; 7 | "^b" = "moveWordBackward:"; 8 | "^d" = "deleteWordForward:"; 9 | "^t" = ("insertText:", "~"); 10 | "^b" = ("insertText:", "`"); 11 | */ 12 | 13 | "^w" = "deleteWordBackward:"; 14 | } 15 | -------------------------------------------------------------------------------- /polybar/modules/wlan: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if="${1:-wlan0}" 4 | 5 | state_up() { 6 | ip addr | grep -q ": $if:.* state UP " 7 | } 8 | 9 | ip_addr() { 10 | ip addr | grep -A2 ": $if:" | grep -Po "(?<=inet )[0-9.]+" 11 | } 12 | 13 | ssid() { 14 | iw dev "$if" link 2>/dev/null | grep -Po "(?<=SSID: ).*" 15 | } 16 | 17 | draw_block() { 18 | echo " $(ssid)" 19 | } 20 | 21 | state_up && draw_block 22 | -------------------------------------------------------------------------------- /vim/syntax/ledger.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | end 4 | 5 | syn match ledgerDate '\v^\d\d\d\d/\d\d/\d\d' 6 | syn region ledgerCommentBlock start=/^comment/ end=/^end comment/ 7 | syn match ledgerComment /^\s*[;#].*$/ 8 | 9 | hi def link ledgerDate Bold 10 | hi def link ledgerComment Comment 11 | hi def link ledgerCommentBlock Comment 12 | 13 | let b:current_syntax = "ledger" 14 | -------------------------------------------------------------------------------- /i3/i3-only: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import i3pie 4 | 5 | 6 | def main(i3): 7 | tree = i3.get_tree() 8 | focused = tree.focused_window() 9 | windows = tree.current_workspace().windows() 10 | windows = filter(lambda w: w.id != focused.id, windows) 11 | i3.command("kill", *windows) 12 | 13 | 14 | if __name__ == "__main__": 15 | with i3pie.Connection() as i3: 16 | main(i3) 17 | -------------------------------------------------------------------------------- /vifm/scripts/vifm-root: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | markers="$(IFS=$'\n'; echo "$*")" 4 | 5 | find_root() { 6 | if [[ "$1" == '/' || -z "$1" ]]; then 7 | return 1 8 | fi 9 | cd "$1" || return 1 10 | if ls -Ap | grep -Fxq -f <(echo "$markers"); then 11 | vifm --server-name "$VIFM_SERVER" --remote +"cd \"$1\"" 12 | return $? 13 | fi 14 | find_root "$(dirname "$1")" 15 | } 16 | 17 | find_root "$PWD" 18 | exit $? 19 | -------------------------------------------------------------------------------- /rofi/i3-input.rasi: -------------------------------------------------------------------------------- 1 | 2 | @import "main-light" 3 | 4 | window { 5 | width: 25%; 6 | } 7 | 8 | listview { 9 | enabled: false; 10 | } 11 | 12 | case-indicator { 13 | enabled: false; 14 | } 15 | 16 | inputbar { 17 | padding: 0; 18 | } 19 | 20 | entry { 21 | padding: 12; 22 | } 23 | 24 | prompt { 25 | enabled: true; 26 | padding: 12; 27 | color: @prompt-color; 28 | background-color: @prompt-background; 29 | } 30 | -------------------------------------------------------------------------------- /bin/tmux-notes: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | session=notes 4 | 5 | if ! tmux has -t "$session" 2>/dev/null; then 6 | tmux new -ds "$session" -c ~/Notes nvim Wall.md -c "comm! Q call system('i3-msg kill')" 7 | tmux set -t "$session" set-titles on 8 | tmux set -t "$session" set-titles-string 'Notes' 9 | tmux set -t "$session" status off 10 | tmux set -t "$session" pane-border-status off 11 | fi 12 | 13 | exec t "$session" 14 | -------------------------------------------------------------------------------- /systemd/lock@gcmt.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Lock screen 3 | Before=sleep.target 4 | 5 | [Service] 6 | Type=forking 7 | User=gcmt 8 | Environment=DISPLAY=:0 9 | Environment=PATH=/home/gcmt/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin: 10 | Environment=XDG_RUNTIME_DIR=/run/user/1000 11 | ExecStart=/home/gcmt/.local/bin/lock -force 12 | ExecStartPost=/usr/bin/sleep 1 13 | 14 | [Install] 15 | WantedBy=sleep.target 16 | -------------------------------------------------------------------------------- /gtk-3.0/gtk.css: -------------------------------------------------------------------------------- 1 | 2 | /* Temite padding */ 3 | VteTerminal, vte-terminal { 4 | padding: 4px 4px 0px 6px; 5 | } 6 | 7 | /* Fix GVim right and bottom white borders */ 8 | window#vim-main-window { 9 | background-color: #1e222b; 10 | } 11 | 12 | @binding-set DeleteWordBackwards 13 | { 14 | bind "w" { "delete-from-cursor" (word-ends, -1) } 15 | } 16 | 17 | entry 18 | { 19 | -gtk-key-bindings: DeleteWordBackwards; 20 | } 21 | -------------------------------------------------------------------------------- /nemo/actions/tojpg.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=false 3 | Name=Convert to Jpeg 4 | Comment=Convert files to Jpg 5 | Dependencies=convert 6 | Exec= 7 | Selection=any 8 | Quote=double 9 | Mimetypes=image/bmp;image/gif;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; 10 | -------------------------------------------------------------------------------- /nvim/snippets/javascript-requirejs.snippets: -------------------------------------------------------------------------------- 1 | snippet def 2 | define(["${1:#dependencies1}"], function (${2:#dependencies2}) { 3 | return ${0:TARGET}; 4 | }); 5 | 6 | snippet defn 7 | define("${1:#name}", ["${2:#dependencies1}"], function (${3:#dependencies2}) { 8 | return ${0:TARGET}; 9 | }); 10 | 11 | snippet reqjs 12 | require(["${1:#dependencies1}"], function (${2:#dependencies2}) { 13 | return ${0:TARGET}; 14 | }); 15 | -------------------------------------------------------------------------------- /nemo/actions/size_delta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | delta=$(zenity --entry --title "Resize images" --text "Enter the size change in pixel" --entry-text "100") 4 | 5 | if [[ -z ${delta} ]]; then 6 | exit 1 7 | fi 8 | 9 | for f in ${@}; do 10 | read -r W H < <(identify -format "%w %h" "${f}") 11 | (( W += delta )) 12 | (( H += delta )) 13 | convert -size ${W}x${H} xc:white "${f}" -gravity center -composite "${f}" 14 | done 15 | -------------------------------------------------------------------------------- /nemo/actions/crop.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=false 3 | Name=Crop Image 4 | Comment=Crop Image 5 | Dependencies=convert 6 | Exec= 7 | Selection=any 8 | Quote=double 9 | Mimetypes=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; 10 | -------------------------------------------------------------------------------- /nemo/actions/resize.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=false 3 | Name=Scale Image 4 | Comment=Scale Image 5 | Dependencies=convert 6 | Exec= 7 | Selection=any 8 | Quote=double 9 | Mimetypes=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; 10 | -------------------------------------------------------------------------------- /nemo/actions/size.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=false 3 | Name=Resize Image 4 | Comment=Resize Image 5 | Dependencies=convert 6 | Exec= 7 | Selection=any 8 | Quote=double 9 | Mimetypes=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; 10 | -------------------------------------------------------------------------------- /nemo/actions/square.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=false 3 | Name=Square Image 4 | Comment=Square Image 5 | Dependencies=convert 6 | Exec= 7 | Selection=any 8 | Quote=double 9 | Mimetypes=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; 10 | -------------------------------------------------------------------------------- /nvim/snippets/bash.snippets: -------------------------------------------------------------------------------- 1 | extends sh 2 | 3 | # Shebang 4 | snippet #! 5 | #!/usr/bin/env bash 6 | 7 | snippet s#! 8 | #!/usr/bin/env bash 9 | set -eu 10 | 11 | snippet if 12 | if [[ $1 ]]; then 13 | ${0:${VISUAL}} 14 | fi 15 | snippet elif 16 | elif [[ $1 ]]; then 17 | ${0:${VISUAL}} 18 | snippet wh 19 | while [[ $1 ]]; do 20 | ${0:${VISUAL}} 21 | done 22 | snippet until 23 | until [[ $1 ]]; do 24 | ${0:${VISUAL}} 25 | done 26 | -------------------------------------------------------------------------------- /urxvt/perl-5.38.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs 2 | index 25b1144b..f664f397 100644 3 | --- a/src/rxvtperl.xs 4 | +++ b/src/rxvtperl.xs 5 | @@ -399,7 +399,7 @@ rxvt_perl_interp::init () 6 | { 7 | if (!perl) 8 | { 9 | - rxvt_push_locale (""); // perl init destroys current locale 10 | + rxvt_push_locale ("C"); // perl init destroys current locale 11 | 12 | { 13 | perl_environ = rxvt_environ; 14 | -------------------------------------------------------------------------------- /nemo/actions/size_delta.nemo_action: -------------------------------------------------------------------------------- 1 | [Nemo Action] 2 | Active=false 3 | Name=Resize Image +/- 4 | Comment=Resize Image +/- 5 | Dependencies=convert 6 | Exec= 7 | Selection=any 8 | Quote=double 9 | Mimetypes=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; 10 | -------------------------------------------------------------------------------- /i3/i3-t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | move= 4 | target= 5 | 6 | while (( $# )); do 7 | if [[ "$1" == "-move" ]]; then 8 | move="$1" 9 | elif [[ ! "$1" =~ ^- ]]; then 10 | target="$1" 11 | else 12 | echo "Bad argument: $1" >&2 13 | exit 1 14 | fi 15 | shift 16 | done 17 | 18 | session=$(t -d "$target") 19 | 20 | if [[ -z "$session" ]]; then 21 | exit 1 22 | fi 23 | 24 | exec i3-focus -c "org.wezfurlong.wezterm" -t "^$session - Tmux$" $move -fallback "wezterm -e t $session" 25 | -------------------------------------------------------------------------------- /gtk-3.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-button-images=1 3 | gtk-cursor-theme-name=Adwaita 4 | gtk-cursor-theme-size=0 5 | gtk-enable-event-sounds=1 6 | gtk-enable-input-feedback-sounds=1 7 | gtk-font-name=Noto Sans 11 8 | gtk-icon-theme-name=Arc 9 | gtk-menu-images=1 10 | gtk-theme-name=Arc 11 | gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR 12 | gtk-toolbar-style=GTK_TOOLBAR_BOTH 13 | gtk-xft-antialias=1 14 | gtk-xft-hinting=1 15 | gtk-xft-hintstyle=hintmedium 16 | gtk-xft-rgba=rgb 17 | -------------------------------------------------------------------------------- /nemo/actions/vidir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # current_dir is empty when using vidir from a search result 4 | current_dir="$1" 5 | paths=( "${@:2}" ) 6 | 7 | if [[ -d "${current_dir}" ]]; then 8 | cd "${current_dir}" || exit 1 9 | if [[ "${current_dir}" == "${paths[0]}" ]]; then 10 | paths=( "." ) 11 | fi 12 | # for i in "${!paths[@]}"; do 13 | # paths[$i]=".${paths[i]#$(pwd)}" 14 | # done 15 | fi 16 | 17 | exec wezterm start --class wez-floating -e vidir "${paths[@]}" 18 | -------------------------------------------------------------------------------- /bin/vim-xdotool: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | tempfile=$(mktemp --suffix ".vim-xdotool") 6 | 7 | trap "_exit" 0 8 | 9 | _exit() { 10 | rm "${tempfile}" 11 | } 12 | 13 | wezterm start --class "wez-floating" nvim -c startinsert "${tempfile}" 14 | 15 | # remove latest newline 16 | text=$(head -c -1 "${tempfile}") 17 | if [[ -n "${text}" ]]; then 18 | cp "${tempfile}" /tmp/latest.vim-xdotool 19 | sleep 0.1 20 | echo -n "${text}" | tr "\n" "\r" | xdotool type --clearmodifiers --delay 0 --file - 21 | fi 22 | -------------------------------------------------------------------------------- /bin/toseconds: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | total=0 4 | 5 | for arg in "$@"; do 6 | if [[ ! "$arg" =~ ^([0-9]+)([smhd])?$ ]]; then 7 | echo "Skipping invalid argument: $arg" >&2 8 | continue 9 | fi 10 | case ${BASH_REMATCH[2]} in 11 | s|"") total=$(( $total + ${BASH_REMATCH[1]} )) ;; 12 | m) total=$(( $total + ${BASH_REMATCH[1]} "*" 60 )) ;; 13 | h) total=$(( $total + ${BASH_REMATCH[1]} "*" 60 "*" 60 )) ;; 14 | d) total=$(( $total + ${BASH_REMATCH[1]} "*" 60 "*" 60 "*" 24 )) ;; 15 | esac 16 | done 17 | 18 | echo "$total" 19 | -------------------------------------------------------------------------------- /sxiv/exec/image-info: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Example for ~/.config/sxiv/exec/image-info 4 | # Called by sxiv(1) whenever an image gets loaded, 5 | # with the name of the image file as its first argument. 6 | # The output is displayed in sxiv's status bar. 7 | 8 | s=" | " # field separator 9 | 10 | filename=$(basename "$1") 11 | filesize=$(du -Hh "$1" | cut -f 1) 12 | 13 | # The '[0]' stands for the first frame of a multi-frame file, e.g. gif. 14 | geometry=$(identify -format '%wx%h' "$1[0]") 15 | 16 | echo "${filesize}${s}${geometry}${s}${filename}" 17 | -------------------------------------------------------------------------------- /firefox/userChrome.notabbar.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Hide tab bar with only one tab open 3 | * Credits: https://gist.github.com/BenoitAverty/af633ee20e27f48f9ba7178451432206 4 | */ 5 | 6 | #tabbrowser-tabs, #tabbrowser-tabs > .tabbrowser-arrowscrollbox { 7 | min-height: 0 !important; 8 | } 9 | 10 | #tabbrowser-tabs tab[first-visible-tab="true"][last-visible-tab="true"] { 11 | visibility: collapse; 12 | } 13 | 14 | #tabbrowser-tabs .tabs-newtab-button { 15 | visibility: collapse !important; 16 | } 17 | 18 | #tabbrowser-tabs tab { 19 | min-height: var(--tab-min-height) 20 | } 21 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/text.vim: -------------------------------------------------------------------------------- 1 | setl wrap 2 | setl textwidth=0 3 | setl linebreak 4 | setl nolist 5 | setl nonumber 6 | setl norelativenumber 7 | setl foldcolumn=1 8 | 9 | " break undo sequence 10 | inoremap . .u 11 | inoremap ? ?u 12 | inoremap ! !u 13 | inoremap , ,u 14 | 15 | nnoremap j call util#smooth_scroll(1, 2) 16 | nnoremap k call util#smooth_scroll(-1, 2) 17 | 18 | nnoremap J call util#smooth_scroll(1, 4, 3) 19 | nnoremap K call util#smooth_scroll(-1, 4, 3) 20 | -------------------------------------------------------------------------------- /i3/i3-mark: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o noglob 4 | 5 | opts="-dmenu -p 'Mark' -theme 'i3-input'" 6 | opts+=" -kb-custom-1 'Control+a,Control+Return'" 7 | 8 | marks="$(echo | eval "rofi ${opts}")" 9 | rofi_exit=$? 10 | 11 | if (( rofi_exit == 1 )); then 12 | exit 1 13 | fi 14 | 15 | if (( rofi_exit != 10 )); then 16 | i3-msg "[con_id=\"__focused__\"] unmark" >/dev/null 17 | fi 18 | 19 | IFS=',' 20 | marks=(${marks}) 21 | for mark in "${marks[@]}"; do 22 | mark="$(sed 's/\(\s\+$\|^\s\+\)//g' <<< "${mark}")" 23 | i3-msg "mark --add \"${mark}\"" >/dev/null 24 | echo "mark ${mark}" 25 | done 26 | -------------------------------------------------------------------------------- /x/Xresources.d/x11-askpass: -------------------------------------------------------------------------------- 1 | 2 | x11-ssh-askpass*Dialog.title: SSH Passphrase 3 | x11-ssh-askpass*Dialog.font: xft:Noto Sans:size=16 4 | 5 | x11-ssh-askpass*Indicator.height: 5 6 | x11-ssh-askpass*Indicator.width: 20 7 | x11-ssh-askpass*Indicator.horizontalSpacing: 10 8 | x11-ssh-askpass*Indicator.verticalSpacing: 5 9 | 10 | x11-ssh-askpass*background: #e7e8eb 11 | x11-ssh-askpass*borderColor: #e7e8eb 12 | x11-ssh-askpass*borderWidth: 0 13 | x11-ssh-askpass*minimumCount: 20 14 | 15 | x11-ssh-askpass*shadowThickness: 1 16 | x11-ssh-askpass*horizontalSpacing: 5 17 | x11-ssh-askpass*verticalSpacing: 5 18 | -------------------------------------------------------------------------------- /kitty/kitty.conf: -------------------------------------------------------------------------------- 1 | 2 | font_size 16 3 | 4 | modify_font cell_width 100% 5 | modify_font cell_height 5px 6 | 7 | window_padding_width 2 8 8 | confirm_os_window_close 0 9 | 10 | enable_audio_bell no 11 | 12 | box_drawing_scale 0.01, 0.5, 1, 1.5 13 | 14 | undercurl_style thin-dense 15 | 16 | # symbol_map U+f000-U+ffff Font Awesome 6 Free Solid 17 | symbol_map U+e000-U+e00a,U+ea60-U+ebeb,U+e0a0-U+e0c8,U+e0ca,U+e0cc-U+e0d7,U+e200-U+e2a9,U+e300-U+e3e3,U+e5fa-U+e6b1,U+e700-U+e7c5,U+ed00-U+efc1,U+f000-U+f2ff,U+f000-U+f2e0,U+f300-U+f372,U+f400-U+f533,U+f0001-U+f1af0 Symbols Nerd Font Mono 18 | 19 | include light.conf 20 | -------------------------------------------------------------------------------- /rofi/system-menu.rasi: -------------------------------------------------------------------------------- 1 | 2 | @import "main-light" 3 | 4 | window { 5 | font: "Noto Mono Regular 50"; 6 | width: 750px; 7 | children: [listview]; 8 | } 9 | 10 | element.normal.normal { 11 | background-color: @normal-background; 12 | text-color: @foreground-dim; 13 | } 14 | 15 | element.alternate.normal { 16 | background-color: @alternate-normal-background; 17 | text-color: @foreground-dim; 18 | } 19 | 20 | listview { 21 | flow: horizontal; 22 | columns: 4; 23 | scrollbar: false; 24 | lines: 1; 25 | border: 0; 26 | } 27 | 28 | element { 29 | padding: 50px 60px; 30 | margin: 0; 31 | } 32 | -------------------------------------------------------------------------------- /gtk-2.0/gtkrc: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT! This file will be overwritten by LXAppearance. 2 | # Any customization should be done in ~/.gtkrc-2.0.mine instead. 3 | 4 | include "/home/gcmt/.gtkrc-2.0.mine" 5 | gtk-theme-name="Arc" 6 | gtk-icon-theme-name="Arc-Dark" 7 | gtk-font-name="Noto Sans 11" 8 | gtk-cursor-theme-name="Adwaita" 9 | gtk-cursor-theme-size=0 10 | gtk-toolbar-style=GTK_TOOLBAR_BOTH 11 | gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR 12 | gtk-button-images=1 13 | gtk-menu-images=1 14 | gtk-enable-event-sounds=1 15 | gtk-enable-input-feedback-sounds=1 16 | gtk-xft-antialias=1 17 | gtk-xft-hinting=1 18 | gtk-xft-hintstyle="hintfull" 19 | gtk-xft-rgba="rgb" 20 | -------------------------------------------------------------------------------- /polybar/modules/volume: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | print_label() { 4 | local label 5 | local volume="$(amixer -D pulse sget Master | grep -Pom1 '[0-9]+(?=%)')" 6 | if amixer -D pulse sget Master | grep -q '\[off\]'; then 7 | label=" Mute" 8 | elif (( volume < 25 )); then 9 | label=" $volume%" 10 | elif (( volume < 50 )); then 11 | label=" $volume%" 12 | else 13 | label=" $volume%" 14 | fi 15 | echo "%{A4:volume up:}%{A5:volume down:}%{A1:volume toggle:}$label%{A}%{A}%{A}" 16 | } 17 | 18 | print_label 19 | pactl subscribe | while read -r _ event _ type _; do 20 | if [[ "$event" == "'change'" && "$type" == 'sink' ]]; then 21 | print_label 22 | fi 23 | done 24 | -------------------------------------------------------------------------------- /bin/cursor: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | if [ -n "$ITERM_PROFILE" ]; then 4 | # 0 -> block 5 | # 1 -> bar 6 | cursor_cmd="\e]50;CursorShape=0\007" 7 | cursor_ins="\e]50;CursorShape=1\007" 8 | fi 9 | 10 | if [ -n "$VTE_VERSION" ]; then 11 | # 0 -> blinking block 12 | # 1 -> blinking block 13 | # 2 -> steady block 14 | # 3 -> blinking underline 15 | # 4 -> steady underline 16 | # 5 -> blinking bar 17 | # 6 -> steady bar 18 | cursor_cmd="\e[2 q" 19 | cursor_ins="\e[6 q" 20 | fi 21 | 22 | if [ -n "$TMUX" ]; then 23 | cursor_cmd="\ePtmux;\e$cursor_cmd\e\\" 24 | cursor_ins="\ePtmux;\e$cursor_ins\e\\" 25 | fi 26 | 27 | case "$1" in 28 | -cmd) print -n $cursor_cmd;; 29 | -ins) print -n $cursor_ins;; 30 | esac 31 | -------------------------------------------------------------------------------- /osx/brew.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | brew update 4 | brew upgrade 5 | brew tap homebrew/dupes 6 | brew tap universal-ctags/universal-ctags 7 | 8 | brew install node 9 | brew install elixir 10 | brew install python 11 | brew install python3 12 | brew install go 13 | brew install coreutils 14 | brew install findutils 15 | brew install vim 16 | brew install macvim 17 | brew install grep 18 | brew install ripgrep 19 | brew install tmux 20 | brew install zsh 21 | brew install zsh-completions 22 | brew install zsh-autosuggestions 23 | brew install z 24 | brew install tree 25 | brew install wget 26 | brew install git 27 | brew install httpie 28 | brew install universal-ctags 29 | brew install ssh-copy-id 30 | brew install ansible 31 | -------------------------------------------------------------------------------- /imwheel/imwheelrc: -------------------------------------------------------------------------------- 1 | 2 | "^org.wezfurlong.wezterm$" 3 | None, Up, Button4, 1 4 | None, Down, Button5, 1 5 | 6 | "^kitty$" 7 | None, Up, Button4, 1 8 | None, Down, Button5, 1 9 | 10 | "^firefox$" 11 | None, Up, Button4, 2 12 | None, Down, Button5, 2 13 | Shift_L, Up, Shift_L|Button4, 2 14 | Shift_L, Down, Shift_L|Button5, 2 15 | Control_L, Up, Control_L|Button4 16 | Control_L, Down, Control_L|Button5 17 | 18 | "^Google-chrome$" 19 | None, Up, Button4, 2 20 | None, Down, Button5, 2 21 | Shift_L, Up, Shift_L|Button4, 2 22 | Shift_L, Down, Shift_L|Button5, 2 23 | Control_L, Up, Control_L|Button4 24 | Control_L, Down, Control_L|Button5 25 | 26 | "^.*$" 27 | None, Up, Button4, 4 28 | None, Down, Button5, 4 29 | -------------------------------------------------------------------------------- /vifm/plugins/mcd/init.lua: -------------------------------------------------------------------------------- 1 | local function mcd(info) 2 | local path = info.argv[1] 3 | 4 | if vifm.exists(path) then 5 | vifm.errordialog("mcd", "Directory already exists: " .. path) 6 | return 7 | end 8 | 9 | if not vifm.makepath(path) then 10 | vifm.errordialog("mcd", "Failed to create directory: " .. path) 11 | return 12 | end 13 | 14 | if not vifm.currview():cd(path) then 15 | vifm.errordialog("mcd", "Failed move into directory: " .. path) 16 | end 17 | end 18 | 19 | local added = vifm.cmds.add({ 20 | name = "Mcd", 21 | description = "create directory and enter it", 22 | handler = mcd, 23 | maxargs = 1, 24 | }) 25 | 26 | if not added then 27 | vifm.sb.error("Failed to register :mcd") 28 | end 29 | 30 | return {} 31 | -------------------------------------------------------------------------------- /bin/gpu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | POWER_CAP=/sys/class/drm/card1/device/hwmon/hwmon1/power1_cap 4 | OD_CLK_VOLTAGE=/sys/class/drm/card1/device/pp_od_clk_voltage 5 | PERF_LEVEL=/sys/class/drm/card1/device/power_dpm_force_performance_level 6 | 7 | case "$1" in 8 | -set) 9 | echo "manual" > ${PERF_LEVEL} 10 | echo "228000000" > ${POWER_CAP} 11 | echo "vo -100" > ${OD_CLK_VOLTAGE} 12 | echo "s 1 2600" > ${OD_CLK_VOLTAGE} 13 | echo "m 1 1219" > ${OD_CLK_VOLTAGE} 14 | echo "c" > ${OD_CLK_VOLTAGE} 15 | ;; 16 | -reset) 17 | echo "r" > ${OD_CLK_VOLTAGE} 18 | ;; 19 | esac 20 | 21 | echo "PERFORMANCE_LEVEL:" 22 | cat ${PERF_LEVEL} 23 | echo "POWER_CAP:" 24 | cat ${POWER_CAP} 25 | cat ${OD_CLK_VOLTAGE} 26 | -------------------------------------------------------------------------------- /vifm/scripts/vifm-fzf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | clear 4 | 5 | FZF_DEFAULT_OPTS+=" --multi" 6 | FZF_DEFAULT_OPTS+=" --pointer=''" 7 | FZF_DEFAULT_OPTS+=" --preview-window border-left" 8 | FZF_DEFAULT_OPTS+=" --color prompt:19,info:19,pointer:24,info:22" 9 | FZF_DEFAULT_OPTS+=" --bind TAB:down,SHIFT-TAB:up --bind CTRL-N:toggle+down,CTRL-L:toggle+down,CTRL-H:toggle+up,RIGHT:toggle+down,LEFT:toggle+up" 10 | 11 | if [[ "$1" == '-cd' ]]; then 12 | shift 13 | target="$(fd -td --hidden -E ".git/" "$@" | fzf 2>/dev/tty)" 14 | cmd="cd \"${target}\"" 15 | else 16 | target="$(rg --files --hidden --no-require-git "$@" | fzf 2>/dev/tty)" 17 | cmd="edit \"${target}\"" 18 | fi 19 | 20 | if [[ -n "${target}" ]]; then 21 | vifm --server-name "$VIFM_SERVER" --remote +"${cmd}" 22 | fi 23 | -------------------------------------------------------------------------------- /nvim/snippets/scss.snippets: -------------------------------------------------------------------------------- 1 | extends css 2 | 3 | snippet $ 4 | $${1:variable}: ${0:value}; 5 | snippet imp 6 | @import '${0}'; 7 | snippet mix 8 | @mixin ${1:name}(${2}) { 9 | ${0} 10 | } 11 | snippet inc 12 | @include ${1:mixin}(${2}); 13 | snippet ext 14 | @extend ${0}; 15 | snippet fun 16 | @function ${1:name}(${2:args}) { 17 | ${0} 18 | } 19 | snippet if 20 | @if $1 { 21 | ${0} 22 | } 23 | snippet ife 24 | @if $1 { 25 | ${2} 26 | } @else { 27 | ${0} 28 | } 29 | snippet eif 30 | @else if $1 { 31 | ${0} 32 | } 33 | snippet for 34 | @for ${1:$i} from ${2:1} through ${3:3} { 35 | ${0} 36 | } 37 | snippet each 38 | @each ${1:$item} in ${2:items} { 39 | ${0} 40 | } 41 | snippet while 42 | @while ${1:$i} ${2:>} ${3:0} { 43 | ${0} 44 | } 45 | -------------------------------------------------------------------------------- /vifm/scripts/vifm-fzf-filter: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | clear 4 | 5 | cwd="${PWD/#$HOME/\~}" 6 | header="$(tput bold)$(tput setaf 5)${cwd}$(tput sgr0)" 7 | FZF_DEFAULT_OPTS+=" --header='${header}'" 8 | 9 | FZF_DEFAULT_OPTS+=" --pointer=''" 10 | FZF_DEFAULT_OPTS+=" --preview-window border-left" 11 | FZF_DEFAULT_OPTS+=" --color prompt:19,info:19,pointer:24" 12 | FZF_DEFAULT_OPTS+=" --ansi --inline-info --no-bold --bind 'tab:down,shift-tab:up'" 13 | 14 | target="$(LC_COLLATE=C ls -A1p --color=always --group-directories-first "$@" | fzf 2>/dev/tty)" 15 | if [[ -n "${target}" ]]; then 16 | after= 17 | if [[ -d "${target}" ]]; then 18 | # after=fzfilter 19 | after= 20 | fi 21 | vifm --server-name "$VIFM_SERVER" --remote +"goto \"${target}\"" +"norm! l" +"${after}" 22 | fi 23 | -------------------------------------------------------------------------------- /nvim/plugins/vifm/plugin/vifm.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: fm.vim 3 | " Description: Vifm integration 4 | " Mantainer: github.com/gcmt 5 | " License: MIT 6 | " ============================================================================ 7 | 8 | if exists('g:fm_loaded') || &cp 9 | finish 10 | end 11 | let g:fm_loaded = 1 12 | 13 | command! -bang -nargs=* Vifm call vifm#open(, ) 14 | 15 | let s:options = { 16 | \ 'preview_treshold': 150, 17 | \ 'term_cmd': 'TMUX= wezterm start --class wez-floating', 18 | \ 'tmux_cmd': 'tmux display-popup -E -w 90% -h 90%', 19 | \ } 20 | 21 | for [s:option, s:default] in items(s:options) 22 | let g:fm_{s:option} = get(g:, 'fm_'.s:option, s:default) 23 | endfo 24 | -------------------------------------------------------------------------------- /zsh/.zshenv: -------------------------------------------------------------------------------- 1 | export XDG_DATA_HOME=$HOME/.local/share 2 | export XDG_STATE_HOME=$HOME/.local/share 3 | export XDG_CONFIG_HOME=$HOME/.config 4 | export XDG_CACHE_HOME=$HOME/.cache 5 | export XDG_DATA_DIRS=$HOME/.local/share/:/usr/local/share/:/usr/share/ 6 | 7 | export ZDOTDIR="$XDG_CONFIG_HOME/zsh" 8 | export ZDATADIR="$XDG_DATA_HOME/zsh" 9 | 10 | export GOPATH="$HOME/.local/go" 11 | 12 | export MANROFFOPT=-c # fixes bold styling when viewing manpages in vim 13 | export MANPAGER="/bin/sh -c \"col -b | nvim -c 'setl noma ft=man ts=8 nolist nonu nomod' -c 'nn q :q' -\"" 14 | 15 | export EDITOR=nvim 16 | export BROWSER=firefox 17 | export LANG=en_US.UTF-8 18 | 19 | export SSH_ASKPASS="/usr/lib/ssh/x11-ssh-askpass" 20 | export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" 21 | -------------------------------------------------------------------------------- /mpd/mpd.conf: -------------------------------------------------------------------------------- 1 | 2 | # Files and directories 3 | ############################################################################## 4 | 5 | music_directory "~/Music" 6 | playlist_directory "~/.local/share/mpd/playlists" 7 | db_file "~/.local/share/mpd/database" 8 | log_file "syslog" 9 | pid_file "~/.local/share/mpd/pid" 10 | state_file "~/.local/share/mpd/state" 11 | sticker_file "~/.local/share/mpd/sticker.sql" 12 | 13 | # Various options 14 | ############################################################################## 15 | 16 | auto_update "yes" 17 | 18 | # Audio Output 19 | ############################################################################## 20 | 21 | audio_output { 22 | type "pulse" 23 | name "Pulse Audio" 24 | } 25 | 26 | audio_output { 27 | type "fifo" 28 | name "Visualizer" 29 | path "/tmp/mpd.fifo" 30 | format "44100:16:2" 31 | } 32 | -------------------------------------------------------------------------------- /nvim/snippets/javascript-redux.snippets: -------------------------------------------------------------------------------- 1 | snippet ist 2 | import { createStore } from 'redux'; 3 | snippet con 4 | connect(${1:mapStateToProps}, ${2:mapDispatchToProps})(<${3:VISUAL}/>); 5 | snippet act 6 | const ${1:actionName} = (${2:arg}) => { 7 | return { 8 | type: ${3:VISUAL}, 9 | $2 10 | }; 11 | }; 12 | snippet rdc 13 | const ${1:reducerName} = (state={}, action) => { 14 | switch(action.type) { 15 | case ${1:action}: 16 | return { 17 | ...state, 18 | $2 19 | }; 20 | default: 21 | return state; 22 | }; 23 | }; 24 | snippet mstp 25 | const mapStateToProps = (state) => { 26 | return { 27 | ${1:propName}: state.$1, 28 | }; 29 | }; 30 | snippet mdtp 31 | const mapDispatchToProps = (dispatch) => { 32 | return { 33 | ${1:propName}: () => { 34 | dispatch(${2:actionName}()); 35 | }, 36 | }; 37 | }; 38 | -------------------------------------------------------------------------------- /nvim/after/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | setl wrap 2 | setl textwidth=0 3 | setl linebreak 4 | setl nolist 5 | setl nonumber 6 | setl norelativenumber 7 | setl foldcolumn=1 8 | setl conceallevel=0 9 | 10 | " break undo sequence 11 | inoremap . .u 12 | inoremap ? ?u 13 | inoremap ! !u 14 | inoremap , ,u 15 | 16 | nnoremap j call util#smooth_scroll(1, 2) 17 | nnoremap k call util#smooth_scroll(-1, 2) 18 | 19 | nnoremap J call util#smooth_scroll(1, 4, 3) 20 | nnoremap K call util#smooth_scroll(-1, 4, 3) 21 | 22 | " Outline file 23 | nnoremap - call search#do('\v^\zs(#+) ', #{ 24 | \ show_match: 0, 25 | \ transform_cb: {l -> l}, 26 | \ post_jump_cmd: "norm! zt10\" 27 | \ }) 28 | 29 | nnoremap m Glare 30 | -------------------------------------------------------------------------------- /urxvt/font-width.patch: -------------------------------------------------------------------------------- 1 | --- a/src/rxvtfont.C 2008-07-09 12:21:45.000000000 +0400 2 | +++ b/src/rxvtfont.C 2009-10-30 14:32:53.000000000 +0300 3 | @@ -1195,12 +1195,14 @@ 4 | XGlyphInfo g; 5 | XftTextExtents16 (disp, f, &ch, 1, &g); 6 | 7 | - g.width -= g.x; 8 | - 9 | +/* 10 | + * bukind: don't use g.width as a width of a character! 11 | + * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial 12 | + */ 13 | int wcw = WCWIDTH (ch); 14 | - if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; 15 | + if (wcw > 1) g.xOff = g.xOff / wcw; 16 | + if (width < g.xOff) width = g.xOff; 17 | 18 | - if (width < g.width ) width = g.width; 19 | if (height < g.height ) height = g.height; 20 | if (glheight < g.height - g.y) glheight = g.height - g.y; 21 | } -------------------------------------------------------------------------------- /nemo/actions/convert-to-pdf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | failed=() 4 | exists=() 5 | done=() 6 | 7 | for file in "$@"; do 8 | dest="${file%.*}.pdf" 9 | if [[ -e "${dest}" ]]; then 10 | exists+=("$(basename "${dest}")") 11 | continue 12 | fi 13 | convert "${file}" "${dest}" 14 | if (( $? != 0 )); then 15 | failed+=("$(basename "${file}")") 16 | else 17 | done+=("$(basename "${file}")") 18 | fi 19 | done 20 | 21 | if (( ${#exists[@]} )); then 22 | IFS=$'\n'; notify-send -u critical "The following files already exists" "${exists[*]}" 23 | fi 24 | 25 | if (( ${#failed[@]} )); then 26 | IFS=$'\n'; notify-send -u critical "Failed to convert the following files" "${failed[*]}" 27 | fi 28 | 29 | if (( ${#done[@]} )); then 30 | notify-send -t 5000 "Convert to PDF" "${#done[@]} files successfully converted" 31 | else 32 | exit 1 33 | fi 34 | -------------------------------------------------------------------------------- /polybar/modules/sync: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | STATE="$HOME/.local/share/sync-cloud.state" 4 | 5 | if [ ! -f "${STATE}" ]; then 6 | exit 1 7 | fi 8 | 9 | display_changes() { 10 | if grep -q "^Syncing$" "${STATE}"; then 11 | echo " Syncing" 12 | elif grep -q "^Error:" "${STATE}"; then 13 | echo "%{A1:systemctl --user start sync.service:}%{F#ce7d86}%{F-}%{A}" 14 | else 15 | local send=$(grep -c "^[<>ch]" "${STATE}") 16 | local del=$(grep -c '^\*deleting' "${STATE}") 17 | if (( send != 0 || del != 0 )); then 18 | echo "%{A1:systemctl --user start sync.service:}%{A3:wezterm start --class wez-floating -e nvim -R $STATE:} ${send}  ${del}%{A}%{A}" 19 | else 20 | echo 21 | fi 22 | fi 23 | } 24 | 25 | display_changes 26 | while inotifywait -q -e modify "${STATE}" >/dev/null; do 27 | display_changes 28 | done 29 | -------------------------------------------------------------------------------- /nvim/plugins/find/ftplugin/find.vim: -------------------------------------------------------------------------------- 1 | 2 | func! s:edit(cmd) abort 3 | let win = winnr() 4 | let path = get(b:find.table, line('.'), '') 5 | if !empty(path) 6 | wincmd p 7 | exec win.'wincmd c' 8 | let path = substitute(path, getcwd().'/', '', '') 9 | exec a:cmd fnameescape(path) 10 | end 11 | endf 12 | 13 | nnoremap q :close 14 | nnoremap :call edit('edit')zz 15 | nnoremap :call edit('edit')zz 16 | nnoremap l :call edit('edit')zz 17 | nnoremap o :call edit('edit')zz 18 | nnoremap e :call edit('edit')zz 19 | nnoremap t :call edit('tabedit')zz 20 | nnoremap s :call edit('split')zz 21 | nnoremap v :call edit('vsplit')zz 22 | -------------------------------------------------------------------------------- /nvim/snippets/sql.snippets: -------------------------------------------------------------------------------- 1 | snippet tbl 2 | create table ${1:table} ( 3 | ${0:columns} 4 | ); 5 | snippet col 6 | ${1:name} ${2:type} ${3:default ''} ${0:not null} 7 | snippet ccol 8 | ${1:name} varchar2(${2:size}) ${3:default ''} ${0:not null} 9 | snippet ncol 10 | ${1:name} number ${3:default 0} ${0:not null} 11 | snippet dcol 12 | ${1:name} date ${3:default sysdate} ${0:not null} 13 | snippet ind 14 | create index ${0:$1_$2} on ${1:table}(${2:column}); 15 | snippet uind 16 | create unique index ${1:name} on ${2:table}(${0:column}); 17 | snippet tblcom 18 | comment on table ${1:table} is '${0:comment}'; 19 | snippet colcom 20 | comment on column ${1:table}.${2:column} is '${0:comment}'; 21 | snippet addcol 22 | alter table ${1:table} add (${2:column} ${0:type}); 23 | snippet seq 24 | create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${0:1}; 25 | snippet s* 26 | select * from ${0:table} 27 | -------------------------------------------------------------------------------- /i3/i3-next-window: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import i3pie 4 | import argparse 5 | 6 | 7 | def parse_args(): 8 | parser = argparse.ArgumentParser(description="Improved i3 window cycling") 9 | group = parser.add_mutually_exclusive_group(required=True) 10 | group.add_argument("-next", action="store_true", help="focus next window") 11 | group.add_argument("-prev", action="store_true", help="focus previous window") 12 | return parser.parse_args() 13 | 14 | 15 | def main(i3): 16 | 17 | args = parse_args() 18 | 19 | tree = i3.get_tree() 20 | focused = tree.focused_window() 21 | windows = list(focused.workspace().windows()) 22 | ids = [w.id for w in windows] 23 | offset = +1 if args.next else -1 24 | next = windows[(ids.index(focused.id) + offset) % len(ids)] 25 | next.command("focus") 26 | 27 | 28 | if __name__ == "__main__": 29 | with i3pie.Connection() as i3: 30 | main(i3) 31 | -------------------------------------------------------------------------------- /urxvt/ext/focus: -------------------------------------------------------------------------------- 1 | 2 | use strict; 3 | use warnings; 4 | 5 | my $debug = 0; 6 | my $csi_focus_in = "\033[I"; 7 | my $csi_focus_out = "\033[O"; 8 | 9 | sub on_start { 10 | my ($self) = @_; 11 | $self->{focus_reporting} = 0; 12 | } 13 | 14 | sub on_osc_seq_perl { 15 | my ($self, $osc, $resp) = @_; 16 | return unless $osc =~ s/^focus;//; 17 | $self->{focus_reporting} = 1 if $osc eq 'on'; 18 | $self->{focus_reporting} = 0 if $osc eq 'off'; 19 | $self->cmd_parse("\e]777;message;2;0;focus: $self->{focus_reporting}\a") if $debug; 20 | } 21 | 22 | sub on_focus_in { 23 | my ($self) = @_; 24 | return unless $self->{focus_reporting}; 25 | $self->tt_write($csi_focus_in); 26 | $self->cmd_parse("\e]777;message;2;0;FocusIn\a") if $debug; 27 | } 28 | 29 | sub on_focus_out { 30 | my ($self) = @_; 31 | return unless $self->{focus_reporting}; 32 | $self->tt_write($csi_focus_out); 33 | $self->cmd_parse("\e]777;message;2;0;FocusOut\a") if $debug; 34 | } 35 | 36 | # vim: ft=perl 37 | -------------------------------------------------------------------------------- /urxvt/ext/message: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | # Usage: printf "\033]777;message;;;\007" 4 | 5 | sub on_osc_seq_perl { 6 | my ($self, $osc, $resp) = @_; 7 | return unless $osc =~ s/^message;//; 8 | 9 | my ($timeout, $padding, $text) = split(/;/, $osc); 10 | display_msg($self, $text, $timeout, $padding); 11 | 12 | return 1; 13 | } 14 | 15 | sub display_msg { 16 | my ($self, $text, $timeout, $padding) = @_; 17 | return unless $timeout > 0 && $padding > -1; 18 | my ($width, $height) = ($self->strwidth($text), 1); 19 | if ($padding) { 20 | ($width, $height, $text) = ($width+4, 3, " $text "); 21 | } 22 | my $rstyle = urxvt::SET_COLOR(urxvt::OVERLAY_RSTYLE, 1, 0); 23 | $self->{overlay} = $self->overlay(-1, 0, $width, $height, $rstyle, 0); 24 | $self->{overlay}->set(0, $padding ? 1 : 0, "$text"); 25 | $self->{timer} = urxvt::timer ->new ->start(urxvt::NOW + $timeout) 26 | ->cb(sub { 27 | delete $self->{overlay}; 28 | } 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /wezterm/wezterm.lua: -------------------------------------------------------------------------------- 1 | local wezterm = require("wezterm") 2 | local config = wezterm.config_builder() 3 | 4 | config.enable_tab_bar = true 5 | config.hide_tab_bar_if_only_one_tab = true 6 | config.window_close_confirmation = "NeverPrompt" 7 | 8 | config.font_size = 16 9 | config.line_height = 1.2 10 | config.cell_width = 1 11 | config.cursor_thickness = "2px" 12 | config.freetype_load_target = "Normal" 13 | config.freetype_load_flags = "NO_HINTING" 14 | config.front_end = "WebGpu" 15 | 16 | config.font = wezterm.font_with_fallback({ 17 | { family = "Inconsolata" }, 18 | { family = "Symbols Nerd Font Mono", scale = 0.8 }, 19 | }) 20 | 21 | local colorscheme = "light" 22 | 23 | if colorscheme == "dark" then 24 | config.font_rules = { 25 | { 26 | intensity = "Bold", 27 | font = wezterm.font("Inconsolata", { weight = "ExtraBold" }), 28 | }, 29 | } 30 | config.colors = require("dark") 31 | else 32 | config.colors = require("light") 33 | end 34 | 35 | return config 36 | -------------------------------------------------------------------------------- /firefox/user.js: -------------------------------------------------------------------------------- 1 | 2 | user_pref("general.warnOnAboutConfig", false); 3 | user_pref("browser.tabs.closeWindowWithLastTab", false); 4 | 5 | user_pref("permissions.default.desktop-notification", 2); 6 | 7 | user_pref("privacy.trackingprotection.enabled", true); 8 | user_pref("privacy.resistFingerprinting", true); 9 | 10 | user_pref("extensions.pocket.enabled", false); 11 | 12 | user_pref("browser.bookmarks.showMobileBookmarks", true); 13 | 14 | user_pref("browser.search.region", "US"); 15 | 16 | user_pref("browser.tabs.closeWindowWithLastTab", false); 17 | user_pref("browser.tabs.warnOnClose", false); 18 | 19 | user_pref("browser.urlbar.doubleClickSelectsAll", false); 20 | user_pref("browser.urlbar.oneOffSearches", false); 21 | 22 | user_pref("findbar.highlightAll", true); 23 | user_pref("findbar.modalHighlight", true); 24 | 25 | 26 | user_pref("media.ffmpeg.vaapi.enabled", true); 27 | 28 | // user_pref("mousewheel.acceleration.factor", 5); // 10 29 | // user_pref("mousewheel.acceleration.start", 1); // -1 30 | // user_pref("mousewheel.default.delta_multiplier_y", 200); // 100 31 | -------------------------------------------------------------------------------- /i3/i3-border: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Change the border of all open windows on the fly 3 | 4 | _print_help() { 5 | echo 1>&2 "Usage: i3-border [normal|pixel|toggle] [width]" 6 | } 7 | 8 | config="$HOME/.config/i3/config" 9 | 10 | cur_style=$(grep -Po "(?<=default_border )\\w+" "$config") 11 | cur_width=$(grep -Po "(?<=default_border $cur_style )\\w+" "$config") 12 | 13 | if [[ "$1" == "toggle" ]]; then 14 | case "$cur_style" in 15 | pixel) style=normal ;; 16 | normal) style=pixel ;; 17 | esac 18 | else 19 | if [[ ! "$1" =~ ^(normal|pixel)$ ]]; then 20 | _print_help 21 | exit 1 22 | fi 23 | style="$1" 24 | fi 25 | 26 | if [[ -z "$2" ]]; then 27 | width="$cur_width" 28 | else 29 | if [[ ! "$2" =~ ^[0-9]+$ ]]; then 30 | _print_help 31 | exit 1 32 | fi 33 | width="$2" 34 | fi 35 | 36 | ids=$(xprop -root | grep "^_NET_CLIENT_LIST(" | grep -io "0x[a-f0-9]\\+") 37 | echo "$ids" | while read -r id; do 38 | i3-msg "[id=$id] border $style $width" >/dev/null 39 | done 40 | 41 | sed -i "s/^default_border.*/default_border $style $width/" "$config" 42 | i3-msg reload >/dev/null 43 | -------------------------------------------------------------------------------- /polybar/modules/lib: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTPATH="$(realpath -s "$0")" 4 | 5 | trap 'clear_all' USR2 6 | clear_all() { 7 | lib -a -q 8 | echo 9 | } 10 | 11 | trap 'refresh' USR1 12 | refresh() { 13 | kill ${sleep_pid} 2>/dev/null 14 | } 15 | 16 | open_term() { 17 | wezterm -e /bin/bash -c "lib -i" 18 | kill -USR1 $(pgrep -f /polybar/modules/lib) 19 | } 20 | 21 | print_count() { 22 | local label="" 23 | local count=$(lib -c) 24 | if (( count > 0 )); then 25 | label+=" ${count}" 26 | fi 27 | lib -l 28 | local error=$? 29 | if (( error == 1 )); then 30 | label="%{F#ce7d86}${label}%{F-}" 31 | fi 32 | if (( count > 0 || error == 1 )); then 33 | echo "%{A1:${SCRIPTPATH} -view:}${label}%{A}" 34 | else 35 | echo 36 | fi 37 | } 38 | 39 | sleep_pid= 40 | main() { 41 | while true; do 42 | print_count 43 | sleep infinity & 44 | sleep_pid=$! 45 | wait $! 46 | done 47 | } 48 | 49 | case "$1" in 50 | "") main ;; 51 | -view) open_term & ;; 52 | *) exit 1 ;; 53 | esac 54 | -------------------------------------------------------------------------------- /bin/colorscheme: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$1" != 'dark' && "$1" != 'light' ]]; then 4 | echo >&2 "Usage: colorscheme (dark|light)" 5 | exit 1 6 | fi 7 | 8 | xrdb -load -D$(echo $1 | tr /a-z/ /A-Z/) ~/.Xresources 9 | 10 | i3_config="$HOME/.config/i3/config" 11 | kitty_config="$HOME/.config/kitty/kitty.conf" 12 | wez_config="$HOME/.config/wezterm/wezterm.lua" 13 | 14 | if [[ "$1" == 'light' ]]; then 15 | vim -E "${i3_config}" <<-EOF 16 | /=light colors=/+1;/\v^$/-1s/\v^#\s*// 17 | /=dark colors=/+1;\$s/\v^\ze\w/# / 18 | wq 19 | EOF 20 | sed -i 's\dark.conf\light.conf\g' "${kitty_config}" 21 | sed -i 's\colorscheme = "dark"\colorscheme = "light"\g' "${wez_config}" 22 | kill -SIGUSR1 $(pgrep kitty) 2>/dev/null 23 | else 24 | vim -E "${i3_config}" <<-EOF 25 | /=light colors=/+1;/\v^$/-1s/\v^\ze\w/# / 26 | /=dark colors=/+1;\$s/\v^#\s*// 27 | wq 28 | EOF 29 | sed -i 's\light.conf\dark.conf\g' "${kitty_config}" 30 | sed -i 's\colorscheme = "light"\colorscheme = "dark"\g' "${wez_config}" 31 | kill -SIGUSR1 $(pgrep kitty) 2>/dev/null 32 | fi 33 | 34 | 35 | clear 36 | 37 | i3-msg reload >/dev/null 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Giacomo Comitti 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /polybar/modules/battery: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if ! hash acpi 2>/dev/null; then 4 | exit 1 5 | fi 6 | 7 | _is_charging() { 8 | acpi -b | grep -q Charging 9 | } 10 | 11 | _get_charge() { 12 | acpi -b | grep -Po '[0-9]+(?=%)' 13 | } 14 | 15 | # Usage: _notify N message 16 | # Don't send notification if at least N seconds haven't passed since the last notification 17 | _notify() { 18 | _is_charging && return 19 | local elapsed="$(( $(date +'%s') - last_notification ))" 20 | if (( elapsed > $1 )); then 21 | last_notification="$(date +'%s')" 22 | notify-send -t 10000 "Battery low" "$2" 23 | fi 24 | } 25 | 26 | _print_label() { 27 | local icon charge 28 | charge="$(_get_charge)" 29 | if (( charge < 15 )); then 30 | _notify 120 "Remaining charge: $charge%" 31 | icon="" 32 | elif (( charge < 30 )); then 33 | _notify 240 "Remaining charge: $charge%" 34 | icon="" 35 | elif (( charge < 50 )); then 36 | icon="" 37 | elif (( charge < 75 )); then 38 | icon="" 39 | else 40 | icon="" 41 | fi 42 | echo "$icon $charge%" 43 | } 44 | 45 | last_notification=0 46 | 47 | while true; do 48 | _print_label 49 | sleep 30 50 | done 51 | -------------------------------------------------------------------------------- /x/Xresources.d/colors-dark: -------------------------------------------------------------------------------- 1 | 2 | #define _DARK_black #1e222b 3 | #define _DARK_red #945f65 4 | #define _DARK_green #768a78 5 | #define _DARK_yellow #a39465 6 | #define _DARK_blue #657b99 7 | #define _DARK_magenta #917086 8 | #define _DARK_cyan #739492 9 | #define _DARK_white #8e9299 10 | #define _DARK_orange #998068 11 | #define _DARK_fg_dim #6d717a 12 | #define _DARK_fg_very_dim #565a66 13 | #define _DARK_fg_super_dim #2f333d 14 | #define _DARK_bg_accent #252933 15 | #define _DARK_hl_color #a39465 16 | #define _DARK_select_color _DARK_fg_super_dim 17 | 18 | #define _DARK_black_bright _DARK_black 19 | #define _DARK_red_bright _DARK_red 20 | #define _DARK_green_bright _DARK_green 21 | #define _DARK_yellow_bright _DARK_yellow 22 | #define _DARK_blue_bright _DARK_blue 23 | #define _DARK_magenta_bright _DARK_magenta 24 | #define _DARK_cyan_bright _DARK_cyan 25 | #define _DARK_white_bright _DARK_white 26 | #define _DARK_orange_bright _DARK_orange 27 | 28 | #define _DARK_fg_color _DARK_white 29 | #define _DARK_bg_color _DARK_black 30 | #define _DARK_cursor_color _DARK_magenta 31 | -------------------------------------------------------------------------------- /x/Xresources.d/colors-light: -------------------------------------------------------------------------------- 1 | #define _LIGHT_black #2c3238 2 | #define _LIGHT_red #d43535 3 | #define _LIGHT_green #06803d 4 | #define _LIGHT_yellow #dbc172 5 | #define _LIGHT_blue #0862a8 6 | #define _LIGHT_magenta #9441a6 7 | #define _LIGHT_cyan #158cb0 8 | #define _LIGHT_white #ffffff 9 | #define _LIGHT_orange #c77408 10 | #define _LIGHT_fg_dim #78838f 11 | #define _LIGHT_fg_very_dim #a3adb8 12 | #define _LIGHT_fg_super_dim #e6e9ed 13 | #define _LIGHT_bg_accent #f5f6f7 14 | #define _LIGHT_hl_color #f7f71b 15 | #define _LIGHT_select_color #e4e4f7 16 | 17 | #define _LIGHT_black_bright _LIGHT_black 18 | #define _LIGHT_red_bright _LIGHT_red 19 | #define _LIGHT_green_bright _LIGHT_green 20 | #define _LIGHT_yellow_bright _LIGHT_yellow 21 | #define _LIGHT_blue_bright _LIGHT_blue 22 | #define _LIGHT_magenta_bright _LIGHT_magenta 23 | #define _LIGHT_cyan_bright _LIGHT_cyan 24 | #define _LIGHT_white_bright _LIGHT_white 25 | #define _LIGHT_orange_bright _LIGHT_orange 26 | 27 | #define _LIGHT_fg_color _LIGHT_black 28 | #define _LIGHT_bg_color _LIGHT_white 29 | #define _LIGHT_cursor_color _LIGHT_fg_dim 30 | -------------------------------------------------------------------------------- /bin/t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dry=0 4 | while getopts "d" OPT; do 5 | case $OPT in 6 | d) dry=1 ;; 7 | esac 8 | done 9 | shift $((OPTIND -1)) 10 | 11 | target=$1 12 | default="scratch" 13 | exclude=("$default" calc updates notes) 14 | 15 | # Find the last active session that is not $default or cmus 16 | last_active_session() { 17 | local session activity candidate delta last_delta 18 | while read -r activity candidate; do 19 | if (IFS=$'\n'; echo "${exclude[*]}") | grep -Fxq "$candidate"; then 20 | continue 21 | fi 22 | delta=$(( $(date '+%s') - activity )) 23 | if (( delta < ${last_delta:-$(date '+%s')} )); then 24 | session="$candidate" 25 | last_delta=$delta 26 | fi 27 | done < <(tmux ls -F '#{session_activity} #S' 2>/dev/null) 28 | echo "$session" 29 | } 30 | 31 | if [[ -z "$target" ]]; then 32 | target="$(last_active_session)" 33 | target="${target:-$default}" 34 | fi 35 | 36 | if (( $dry == 1 )); then 37 | echo "$target" 38 | exit 39 | fi 40 | 41 | if ! tmux has -t "=$target" 2>/dev/null; then 42 | tmux new -ds "$target" 43 | fi 44 | 45 | if [[ -z "$TMUX" ]]; then 46 | exec tmux attach -t "=$target" 47 | else 48 | tmux switchc -t "=$target" 49 | fi 50 | -------------------------------------------------------------------------------- /polybar/modules/backup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTPATH="$(realpath -s "$0")" 4 | STATE_FILE="${XDG_RUNTIME_DIR}/borg-backup.state" 5 | ERROR_FILE="${XDG_RUNTIME_DIR}/borg-backup.error" 6 | 7 | touch "${STATE_FILE}" 8 | touch "${ERROR_FILE}" 9 | 10 | clear_error() { 11 | truncate -s0 "${ERROR_FILE}" 12 | print_label 13 | } 14 | 15 | print_label() { 16 | local label= 17 | if [ -s "${STATE_FILE}" ]; then 18 | if grep -q "^Pruning" "${STATE_FILE}"; then 19 | label=" Pruning.." 20 | elif grep -q "^Compacting" "${STATE_FILE}"; then 21 | label=" Compacting.." 22 | else 23 | label=" Backup" 24 | fi 25 | fi 26 | if [ -s "${ERROR_FILE}" ]; then 27 | label="%{F#ce7d86} Backup%{F-}" 28 | fi 29 | if [ -n "${label}" ]; then 30 | echo "%{A3:${SCRIPTPATH} -clear:}${label}%{A}" 31 | else 32 | echo 33 | fi 34 | } 35 | 36 | main() { 37 | print_label 38 | while inotifywait -q -e modify "${STATE_FILE}" "${ERROR_FILE}" >/dev/null; do 39 | print_label 40 | done 41 | } 42 | 43 | case "$1" in 44 | "") main ;; 45 | -clear) clear_error & ;; 46 | *) exit 1 ;; 47 | esac 48 | -------------------------------------------------------------------------------- /i3lock/PKGBUILD: -------------------------------------------------------------------------------- 1 | _pkgname=i3lock 2 | pkgname=i3lock-patched 3 | pkgver=2.11.3.g0379727 4 | pkgrel=1 5 | pkgdesc="An improved screenlocker based upon XCB and PAM" 6 | arch=('i686' 'x86_64') 7 | url="https://i3wm.org/i3lock/" 8 | license=('MIT') 9 | provides=('i3lock') 10 | conflicts=('i3lock') 11 | depends=('xcb-util-image' 'libev' 'cairo' 'libxkbcommon-x11') 12 | backup=("etc/pam.d/i3lock") 13 | makedepends=('git') 14 | source=( 15 | "git+https://github.com/gcmt/i3lock#branch=custom-ui" 16 | ) 17 | sha1sums=('SKIP') 18 | 19 | pkgver() { 20 | cd "$srcdir/$_pkgname" 21 | git describe --tags | sed 's/-/./g' 22 | } 23 | 24 | build() { 25 | cd "$_pkgname" 26 | 27 | # Fix ticket FS#31544, sed line taken from gentoo 28 | sed -i -e 's:login:system-auth:' pam/i3lock 29 | 30 | autoreconf --force --install 31 | 32 | rm -rf build/ 33 | mkdir -p build && cd build/ 34 | 35 | ../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers 36 | 37 | make CPPFLAGS+="-U_FORTIFY_SOURCE" 38 | } 39 | 40 | 41 | package() { 42 | cd "$_pkgname" 43 | cd build/ 44 | 45 | make DESTDIR="$pkgdir/" install 46 | 47 | install -Dm644 ../LICENSE "$pkgdir/usr/share/licenses/$_pkgname/LICENSE" 48 | } 49 | -------------------------------------------------------------------------------- /zathura/zathurarc: -------------------------------------------------------------------------------- 1 | # zathurarc 2 | 3 | set selection-clipboard clipboard 4 | set incremental-search true 5 | set smooth-scroll true 6 | set adjust-open width 7 | 8 | set statusbar-basename true 9 | set statusbar-home-tilde true 10 | set window-title-home-tilde true 11 | 12 | set font "SF Mono Bold 11" 13 | set guioptions v 14 | 15 | set default-bg "#1e222b" 16 | set default-fg "#8e9299" 17 | 18 | set statusbar-fg "#636770" 19 | set statusbar-bg "#252933" 20 | 21 | set statusbar-h-padding 0 22 | set statusbar-v-padding 0 23 | 24 | set inputbar-bg "#1e222b" 25 | set inputbar-fg "#8e9299" 26 | 27 | set notification-bg "#1e222b" 28 | set notification-fg "#8e9299" 29 | 30 | set notification-error-bg "#1e222b" 31 | set notification-error-fg "#945F65" 32 | 33 | set notification-warning-bg "#1e222b" 34 | set notification-warning-fg "#A39465" 35 | 36 | set highlight-color "#ffff00" 37 | set highlight-active-color "#ff9632" 38 | 39 | set completion-group-fg "#636770" 40 | set completion-group-bg "#252933" 41 | 42 | set completion-highlight-fg "#8e9299" 43 | set completion-highlight-bg "#3a3e4a" 44 | 45 | set completion-bg "#1e222b" 46 | set completion-fg "#8e9299" 47 | 48 | # vim: cms=#\ %s 49 | -------------------------------------------------------------------------------- /wezterm/dark.lua: -------------------------------------------------------------------------------- 1 | local _black = "#1e222b" 2 | local _red = "#945f65" 3 | local _green = "#768a78" 4 | local _yellow = "#a39465" 5 | local _blue = "#657b99" 6 | local _magenta = "#917086" 7 | local _cyan = "#739492" 8 | local _white = "#9898a0" 9 | local _orange = "#998068" 10 | local _fg_dim = "#747982" 11 | local _fg_very_dim = "#626672" 12 | local _fg_super_dim = "#323640" 13 | local _bg_accent = "#252933" 14 | local _hl_color = "#a39465" 15 | local _fg = _white 16 | local _bg = _black 17 | local _cursor = _magenta 18 | local _select_bg = _fg_super_dim 19 | 20 | return { 21 | 22 | foreground = _fg, 23 | background = _bg, 24 | cursor_bg = _magenta, 25 | cursor_fg = _bg, 26 | selection_fg = _fg, 27 | selection_bg = _select_bg, 28 | 29 | ansi = { _black, _red, _green, _yellow, _blue, _magenta, _cyan, _white }, 30 | brights = { _black, _red, _green, _yellow, _blue, _magenta, _cyan, _white }, 31 | 32 | indexed = { 33 | [16] = _orange, 34 | [17] = _orange, 35 | [18] = _fg, 36 | [19] = _bg, 37 | [20] = _cursor, 38 | [21] = _fg_dim, 39 | [22] = _fg_very_dim, 40 | [23] = _fg_super_dim, 41 | [24] = _bg_accent, 42 | [25] = _hl_color, 43 | [26] = _select_bg, 44 | }, 45 | } 46 | -------------------------------------------------------------------------------- /wezterm/light.lua: -------------------------------------------------------------------------------- 1 | local _black = "#2c3238" 2 | local _red = "#ad2f3b" 3 | local _green = "#158045" 4 | local _yellow = "#d2b96c" 5 | local _blue = "#3179b2" 6 | local _magenta = "#9441a6" 7 | local _cyan = "#158cb0" 8 | local _white = "#ffffff" 9 | local _orange = "#c77408" 10 | local _fg_dim = "#6a737d" 11 | local _fg_very_dim = "#a1aab7" 12 | local _fg_super_dim = "#dde5ed" 13 | local _bg_accent = "#f5f6f7" 14 | local _hl_color = "#f7f71b" 15 | local _fg = _black 16 | local _bg = _white 17 | local _cursor = _magenta 18 | local _select_bg = _fg_super_dim 19 | 20 | return { 21 | 22 | foreground = _fg, 23 | background = _bg, 24 | cursor_bg = _cyan, 25 | cursor_fg = _bg, 26 | selection_fg = _fg, 27 | selection_bg = _select_bg, 28 | 29 | ansi = { _black, _red, _green, _yellow, _blue, _magenta, _cyan, _white }, 30 | brights = { _black, _red, _green, _yellow, _blue, _magenta, _cyan, _white }, 31 | 32 | indexed = { 33 | [16] = _orange, 34 | [17] = _orange, 35 | [18] = _fg, 36 | [19] = _bg, 37 | [20] = _cursor, 38 | [21] = _fg_dim, 39 | [22] = _fg_very_dim, 40 | [23] = _fg_super_dim, 41 | [24] = _bg_accent, 42 | [25] = _hl_color, 43 | [26] = _select_bg, 44 | }, 45 | } 46 | -------------------------------------------------------------------------------- /polybar/modules/updates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPTPATH="$(realpath -s "$0")" 4 | UPDATES_FILE="$HOME/.local/share/updates-check.state" 5 | touch "${UPDATES_FILE}" 6 | 7 | main() { 8 | display_updates 9 | while inotifywait -q -e modify "${UPDATES_FILE}" >/dev/null; do 10 | display_updates 11 | done 12 | } 13 | 14 | display_updates() { 15 | local count=$(grep -v "^$" "${UPDATES_FILE}" | wc -l) 16 | if (( count > 0 )); then 17 | echo "%{A1:$SCRIPTPATH -tmux:}%{A3:$SCRIPTPATH -menu:} ${count}%{A}%{A}" 18 | else 19 | echo 20 | fi 21 | } 22 | 23 | open_tmux() { 24 | local session=updates 25 | if ! tmux has -t "=${session}" 2>/dev/null; then 26 | tmux new -ds "${session}" 27 | fi 28 | wezterm start --class wez-floating -e t "${session}" 29 | } 30 | 31 | updates_menu() { 32 | local choice="$(sed 's;^\(\S\+\)\s\+\(.*\)$;\1 \2;' < "${UPDATES_FILE}" \ 33 | | mouse-menu -noselected -width auto -markup-rows -maxlines 40)" 34 | if [[ -n "${choice}" ]]; then 35 | open_tmux 36 | fi 37 | } 38 | 39 | case "$1" in 40 | "") main ;; 41 | -tmux) open_tmux & ;; 42 | -menu) updates_menu & ;; 43 | *) exit 1 ;; 44 | esac 45 | -------------------------------------------------------------------------------- /rofi/term-light.rasi: -------------------------------------------------------------------------------- 1 | 2 | * { 3 | 4 | background: rgba(231, 232, 235, 100%); 5 | foreground: rgba(82, 86, 94, 100%); 6 | 7 | separator-color: rgba(216, 217, 219, 100%); 8 | background-color: @background; 9 | scrollbar-color: @foreground; 10 | inputbar-background: @background; 11 | 12 | normal-foreground: @foreground; 13 | normal-background: @background; 14 | selected-normal-foreground: @foreground; 15 | selected-normal-background: rgba(216, 217, 219, 100%); 16 | alternate-normal-foreground: @foreground; 17 | alternate-normal-background: @background; 18 | 19 | active-foreground: rgba(181, 85, 95, 100%); 20 | active-background: @background; 21 | selected-active-foreground: rgba(181, 85, 95, 100%); 22 | selected-active-background: @selected-normal-background; 23 | alternate-active-foreground: @active-foreground; 24 | alternate-active-background: @background; 25 | 26 | urgent-foreground: rgba(181, 85, 95, 100%); 27 | urgent-background: @background; 28 | selected-urgent-foreground: rgba(181, 85, 95, 100%); 29 | selected-urgent-background: @background; 30 | alternate-urgent-foreground: @urgent-foreground; 31 | alternate-urgent-background: @background; 32 | 33 | } 34 | 35 | @import "term-base" 36 | -------------------------------------------------------------------------------- /nvim/plugins/grep/plugin/grep.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================= 2 | " File: grep.vim 3 | " Description: Grep wrapper 4 | " Author: github.com/gcmt 5 | " Licence: MIT 6 | " ============================================================================= 7 | 8 | if exists("g:loaded_grep") || &cp 9 | finish 10 | end 11 | let g:loaded_grep = 1 12 | 13 | if executable('rg') 14 | set grepprg=rg\ -S\ -H\ --no-heading\ --vimgrep\ $* 15 | set grepformat=%f:%l:%c:%m 16 | else 17 | set grepprg=grep\ -nrH\ $* 18 | set grepformat=%f:%l:%m 19 | end 20 | 21 | command! -nargs=* -bang Grep call grep#grep('grep', ) 22 | command! -nargs=* -bang Grepa call grep#grep('grepadd', ) 23 | command! -nargs=* -bang Vim call grep#grep('vimgrep', ) 24 | command! -nargs=* -bang Vima call grep#grep('vimgrepadd', ) 25 | command! -nargs=* -bang Vimb call grep#grep_buffer('vimgrep', , ) 26 | command! -nargs=* -bang Vimba call grep#grep_buffer('vimgrepadd', , ) 27 | command! -nargs=* -bang Greb call grep#grep_buffer('grep', , ) 28 | command! -nargs=* -bang Greba call grep#grep_buffer('grepadd', , ) 29 | -------------------------------------------------------------------------------- /nvim/plugins/objects/plugin/objects.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================= 2 | " File: objects.vim 3 | " Description: Vim text objects enhanced 4 | " Author: github.com/gcmt 5 | " Licence: MIT 6 | " ============================================================================= 7 | 8 | 9 | let g:objects_enabled = get(g:, 'objects_enabled', 1) 10 | let g:objects_options = get(g:, 'objects_options', {}) 11 | 12 | 13 | if objects#enabled('items#args') 14 | call objects#map('aa', 'objects#items#args') 15 | call objects#map('ia', 'objects#items#args', {'inner': 1}) 16 | end 17 | 18 | 19 | if objects#enabled('items#list') 20 | call objects#map('ai', 'objects#items#list') 21 | call objects#map('ii', 'objects#items#list', {'inner': 1}) 22 | end 23 | 24 | 25 | if objects#enabled('items#dict') 26 | call objects#map('ak', 'objects#items#dict') 27 | call objects#map('ik', 'objects#items#dict', {'inner': 1}) 28 | end 29 | 30 | if objects#enabled('comments') 31 | call objects#map('ac', 'objects#comments#select') 32 | call objects#map('ic', 'objects#comments#select', {'content': 1}) 33 | call objects#map('iC', 'objects#comments#select', {'inner': 1}) 34 | end 35 | -------------------------------------------------------------------------------- /rofi/term-dark.rasi: -------------------------------------------------------------------------------- 1 | 2 | * { 3 | 4 | background: rgba(37, 41, 51, 100%); 5 | foreground: rgba(142, 146, 153, 100%); 6 | 7 | separator-color: rgba(30, 34, 43, 100%); 8 | background-color: rgba(0, 0, 0, 0%); 9 | scrollbar-color: @foreground; 10 | inputbar-background: @background; 11 | 12 | normal-foreground: @foreground; 13 | normal-background: @background; 14 | selected-normal-foreground: @foreground; 15 | selected-normal-background: rgba(43, 47, 58, 100%); 16 | alternate-normal-foreground: @foreground; 17 | alternate-normal-background: @background; 18 | 19 | active-foreground: rgba(181, 85, 95, 100%); 20 | active-background: @background; 21 | selected-active-foreground: rgba(181, 85, 95, 100%); 22 | selected-active-background: @selected-normal-background; 23 | alternate-active-foreground: @active-foreground; 24 | alternate-active-background: @background; 25 | 26 | urgent-foreground: rgba(181, 85, 95, 100%); 27 | urgent-background: @background; 28 | selected-urgent-foreground: rgba(181, 85, 95, 100%); 29 | selected-urgent-background: @selected-normal-background; 30 | alternate-urgent-foreground: @urgent-foreground; 31 | alternate-urgent-background: @background; 32 | 33 | } 34 | 35 | @import "term-base" 36 | -------------------------------------------------------------------------------- /git/config: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Giacomo Comitti 3 | email = dev@gcomit.com 4 | [core] 5 | editor = nvim 6 | [diff] 7 | tool = vimdiff 8 | [difftool] 9 | prompt = false 10 | [url "https://github.com/"] 11 | insteadOf = "gh:" 12 | [url "https://aur.archlinux.org/"] 13 | insteadOf = "aur:" 14 | [alias] 15 | aa = add --all 16 | ap = add --patch 17 | co = commit 18 | ck = checkout 19 | ss = status 20 | amend = commit --amend --reuse-message=HEAD 21 | ll = log --graph --pretty=format:'%C(magenta)%h%Creset -%C(blue)%d%Creset %s (%cr) <%an>' --abbrev-commit --date=relative 22 | [color] 23 | ui = auto 24 | [color "branch"] 25 | current = magenta 26 | local = cyan 27 | remote = blue 28 | [color "decorate"] 29 | head = cyan 30 | branch = green 31 | [color "diff"] 32 | meta = blue 33 | frag = yellow 34 | old = red 35 | new = green 36 | [color "status"] 37 | added = green 38 | changed = yellow 39 | untracked = white 40 | [cola] 41 | spellcheck = true 42 | tabwidth = 4 43 | [gui] 44 | editor = wezterm -e nvim 45 | [credential] 46 | provider = generic 47 | [filter "lfs"] 48 | smudge = git-lfs smudge -- %f 49 | process = git-lfs filter-process 50 | required = true 51 | clean = git-lfs clean -- %f 52 | [init] 53 | defaultBranch = main 54 | -------------------------------------------------------------------------------- /bin/rofi-tmux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | common=" -theme-str 'window { width: 25%; }'" 4 | common+=" -theme-str 'listview { fixed-height: false; scrollbar: false; }'" 5 | common+=" -theme-str 'case-indicator { enabled: false; }'" 6 | 7 | opts="-dmenu -theme 'main-light' $common" 8 | opts+=" -kb-custom-1 'Control+BackSpace' -kb-custom-2 'Control+n'" 9 | 10 | sessions=$(tmux ls -F '#{session_name}' 2>/dev/null | grep -v "cmus\\|calc") 11 | session=$(echo "$sessions" | eval "rofi $opts") 12 | rofi_exit=$? 13 | 14 | if [[ $rofi_exit == 1 || -z "$session" ]]; then 15 | exit 1 16 | fi 17 | 18 | case $rofi_exit in 19 | 10) 20 | opts="-dmenu -p 'Kill session \"$session\" ? ' -theme 'main-light' $common" 21 | opts+=" -theme-str 'prompt { enabled: true; }'" 22 | choice=$(printf "yes\nno" | eval "rofi $opts") 23 | if [[ $choice == yes ]]; then 24 | tmux kill-session -t "=$session" 25 | fi 26 | exec "$0" 27 | ;; 28 | 11) 29 | # open a new client linked to the current session in a different terminal window 30 | wezterm -e tmux new -t "$session" \; set destroy-unattached 31 | ;; 32 | *) 33 | # If the tmux session is already opened, switch to it 34 | exec i3-focus -c "org.wezfurlong.wezterm" -t "^$session - Tmux$" -fallback "wezterm -e t $session" 35 | ;; 36 | esac 37 | -------------------------------------------------------------------------------- /x/Xresources.d/calc: -------------------------------------------------------------------------------- 1 | 2 | calc*font: xft:Noto Mono Patched:size=10 3 | calc*letterSpace: 4 4 | calc*lineSpace: 4 5 | 6 | calc*internalBorder: 4 7 | 8 | calc*cursorUnderline: true 9 | 10 | calc*foreground: _LIGHT_fg_dim 11 | calc*background: _LIGHT_bg_color 12 | calc*borderColor: _LIGHT_bg_color 13 | calc*cursorColor: _LIGHT_fg_super_dim 14 | calc*highlightColor: _LIGHT_fg_super_dim 15 | 16 | calc*color0: _LIGHT_black 17 | calc*color1: _LIGHT_red 18 | calc*color2: _LIGHT_green 19 | calc*color3: _LIGHT_yellow 20 | calc*color4: _LIGHT_blue 21 | calc*color5: _LIGHT_magenta 22 | calc*color6: _LIGHT_cyan 23 | calc*color7: _LIGHT_white 24 | 25 | calc*color8: _LIGHT_black_bright 26 | calc*color9: _LIGHT_red_bright 27 | calc*color10: _LIGHT_green_bright 28 | calc*color11: _LIGHT_yellow_bright 29 | calc*color12: _LIGHT_blue_bright 30 | calc*color13: _LIGHT_magenta_bright 31 | calc*color14: _LIGHT_cyan_bright 32 | calc*color15: _LIGHT_white_bright 33 | 34 | calc*color16: _LIGHT_orange 35 | calc*color17: _LIGHT_orange_bright 36 | 37 | calc*color18: _LIGHT_fg_color 38 | calc*color19: _LIGHT_bg_color 39 | calc*color20: _LIGHT_cursor_color 40 | 41 | calc*color21: _LIGHT_bg_accent 42 | calc*color22: _LIGHT_fg_dim 43 | calc*color23: _LIGHT_fg_very_dim 44 | calc*color24: _LIGHT_fg_super_dim 45 | -------------------------------------------------------------------------------- /nvim/snippets/javascript.node.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env node 3 | # module exports 4 | snippet ex 5 | module.exports = ${1}; 6 | # require 7 | snippet re 8 | const ${1} = require('${2:module_name}'); 9 | # EventEmitter 10 | snippet on 11 | on('${1:event_name}', function(${2:stream}) { 12 | ${3} 13 | }); 14 | snippet emit 15 | emit('${1:event_name}', ${2:args}); 16 | snippet once 17 | once('${1:event_name}', function(${2:stream}) { 18 | ${3} 19 | }); 20 | # http. User js function snippet as handler 21 | snippet http 22 | http.createServer(${1:handler}).listen(${2:port_number}); 23 | # net 24 | snippet net 25 | net.createServer(function(${1:socket}){ 26 | ${1}.on('data', function('data'){ 27 | ${2} 28 | ]}); 29 | ${1}.on('end', function(){ 30 | ${3} 31 | }); 32 | }).listen(${4:8124}); 33 | # Stream snippets 34 | snippet pipe 35 | pipe(${1:stream})${2} 36 | # Express snippets 37 | snippet eget 38 | ${1:app}.get('${2:route}', ${3:handler}); 39 | snippet epost 40 | ${1:app}.post('${2:route}', ${3:handler}); 41 | snippet eput 42 | ${1:app}.put('${2:route}', ${3:handler}); 43 | snippet edel 44 | ${1:app}.delete('${2:route}', ${3:handler}); 45 | # process snippets 46 | snippet stdin 47 | process.stdin 48 | snippet stdout 49 | process.stdout 50 | snippet stderr 51 | process.stderr 52 | -------------------------------------------------------------------------------- /sxiv/exec/key-handler: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ID=9900 4 | delta=100 5 | 6 | while read file; do 7 | fullpath="$(realpath -P "$file")" 8 | case "$1" in 9 | "C-s") 10 | read -r W H < <(identify -format "%w %h" "${file}") 11 | max=$(printf "${W}\n${H}" | sort -n | tail -1) 12 | dunstify -r "${ID}" "SXIV" "convert -size ${max}x${max}" 13 | convert -size ${max}x${max} xc:white "${file}" -gravity center -composite "${file}" 14 | ;; 15 | "C-p") 16 | read -r W H < <(identify -format "%w %h" "${file}") 17 | (( W += delta )) 18 | (( H += delta )) 19 | dunstify -r "${ID}" "SXIV" "convert -size +${delta}" 20 | convert -size ${W}x${H} xc:white "${file}" -gravity center -composite "${file}" 21 | ;; 22 | "C-o") 23 | read -r W H < <(identify -format "%w %h" "${file}") 24 | (( W -= delta )) 25 | (( H -= delta )) 26 | dunstify -r "${ID}" "SXIV" "convert -size -${delta}" 27 | convert -size ${W}x${H} xc:white "${file}" -gravity center -composite "${file}" 28 | ;; 29 | "C-c") 30 | convert "$file" -trim "$file" 31 | ;; 32 | "C-r") 33 | convert -rotate 90 "$file" "$file" 34 | ;; 35 | "C-w") 36 | feh --bg-scale "$fullpath" 37 | ;; 38 | esac 39 | done 40 | -------------------------------------------------------------------------------- /bin/volume: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | quiet=0 4 | while getopts "q" OPT; do 5 | case $OPT in 6 | q) quiet=1 ;; 7 | esac 8 | done 9 | shift $((OPTIND -1)) 10 | 11 | id=4224 12 | timeout=1000 13 | header="Volume" 14 | 15 | polybar_visible() { 16 | xprop -id "$(xdo id -N Polybar)" | grep -q "window state: Normal" 17 | } 18 | 19 | is_mute() { 20 | amixer get Master | grep -q '\[off\]' 21 | } 22 | 23 | notify_volume() { 24 | polybar_visible || (( quiet == 1 )) && return 25 | dunstify -h int:value:"$1" -t $timeout -r $id "$header $1%" 26 | } 27 | 28 | notify_mute() { 29 | polybar_visible || (( quiet == 1 )) && return 30 | dunstify -t $timeout -r $id "$header" "Muted" 31 | } 32 | 33 | case "$1" in 34 | up) 35 | volume=$(amixer -D pulse sset Master unmute 3%+ | grep -Pom1 '[0-9]+(?=%)') 36 | notify_volume "$volume" 37 | ;; 38 | down) 39 | volume=$(amixer -D pulse sset Master unmute 3%- | grep -Pom1 '[0-9]+(?=%)') 40 | notify_volume "$volume" 41 | ;; 42 | toggle) 43 | volume=$(amixer -D pulse sset Master toggle | grep -Pom1 '[0-9]+(?=%)') 44 | is_mute && notify_mute || notify_volume "$volume" 45 | ;; 46 | mute) 47 | amixer -D pulse sset Master mute > /dev/null 48 | is_mute && notify_mute 49 | ;; 50 | unmute) 51 | volume=$(amixer -D pulse sset Master unmute | grep -Pom1 '[0-9]+(?=%)') 52 | notify_volume "$volume" 53 | ;; 54 | esac 55 | -------------------------------------------------------------------------------- /bin/scan: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | resp=$(yad \ 6 | --title 'Scan' \ 7 | --borders 10 \ 8 | --separator $'\t' \ 9 | --item-separator="," \ 10 | --width 500 \ 11 | --text-align fill \ 12 | --form \ 13 | --field "File Name" \ 14 | --field "Mode":CB \ 15 | --field "Resolution" \ 16 | --field "Format":CB \ 17 | --button="Cancel":1 \ 18 | --button="Scan":0 \ 19 | "Scan_$(date +%Y-%m-%d-%T).png" "Black & White,Gray,True Gray,24bit Color" "300" "png,jpeg,tiff,pnm" \ 20 | ) 21 | 22 | IFS=$'\t' read -ra fields <<< "${resp}" 23 | 24 | _fname="${fields[0]}" 25 | _mode="${fields[1]}" 26 | _resolution="${fields[2]}" 27 | _format="${fields[3]}" 28 | 29 | _dest="${HOME}/Downloads/${_fname}" 30 | 31 | echo "Scanning..." 32 | _notify_id=$(dunstify -t 60000 -p "Scanning..." "Writing to '${_fname}'") 33 | 34 | echo "Output:" "${_dest}" 35 | echo "Mode:" "${_mode}" 36 | echo "Resolution:" "${_resolution}" 37 | echo "Format:" "${_format}" 38 | 39 | scanimage -pv --mode "${_mode}" --resolution "${_resolution}" --format "${_format}" -o "${_dest}" 40 | exitcode=$? 41 | if (( exitcode != 0 )); then 42 | dunstify -r "${_notify_id}" -u critical "Scan Failed" "Scanimage failed with error code $exitcode" 43 | exit $exitcode 44 | fi 45 | 46 | dunstify -r "${_notify_id}" "Scan Successful" "Successfully written to '${_fname}'" 47 | -------------------------------------------------------------------------------- /nvim/snippets/lua.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env lua 3 | $1 4 | snippet local 5 | local ${1:x} = ${0:1} 6 | snippet fun 7 | function ${1:fname}(${2:...}) 8 | $0 9 | end 10 | snippet for 11 | for ${1:i}=${2:1},${3:10} do 12 | ${0:print(i)} 13 | end 14 | snippet forp 15 | for ${1:i},${2:v} in pairs(${3:table_name}) do 16 | $0 17 | end 18 | snippet fori 19 | for ${1:i},${2:v} in ipairs(${3:table_name}) do 20 | $0 21 | end 22 | snippet if 23 | if $1 then 24 | $2 25 | end 26 | snippet ife 27 | if $1 then 28 | ${2:-- if condition} 29 | else 30 | ${0:-- else} 31 | end 32 | snippet elif 33 | elseif $1 then 34 | $0 35 | snippet repeat 36 | repeat 37 | $1 38 | until $0 39 | snippet while 40 | while $1 do 41 | $0 42 | end 43 | snippet wh 44 | while ${1:true} do 45 | ${0} 46 | end 47 | snippet wht 48 | while true do 49 | ${0} 50 | end 51 | snippet print 52 | print("${1:string}") 53 | snippet pr 54 | print($0) 55 | snippet prs 56 | print("$0") 57 | snippet prf 58 | print(string.format("${1:%s}"$0)) 59 | snippet wr 60 | io.write($0) 61 | snippet wrs 62 | io.write("$0") 63 | snippet wrf 64 | io.write(string.format("${1:%s}"$0)) 65 | snippet fwr 66 | io.${1:stderr}:write($0) 67 | snippet fwrs 68 | io.${1:stderr}:write("$0") 69 | snippet fwrf 70 | io.${1:stderr}:write(string.format("${2:%s}"$0)) 71 | snippet req 72 | require('${1:mod}') 73 | -------------------------------------------------------------------------------- /bin/rofi-edit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | opts="-dmenu -format i -theme 'main-light'" 4 | opts+=" -theme-str 'window { width: 25%; }'" 5 | opts+=" -theme-str 'listview { fixed-height: false; scrollbar: false; }'" 6 | opts+=" -theme-str 'case-indicator { enabled: false; }'" 7 | 8 | if [[ ! "$*" =~ -inputbar($| ) ]]; then 9 | opts+=" -theme-str 'mainbox { children: [listview]; }'" 10 | opts+=" -kb-row-up 'Up,Control+k,k' -kb-row-down 'Down,Control+j,Super+Tab,j'" 11 | opts+=" -kb-accept-entry 'l,Return,Control+d' -kb-cancel 'Escape,q'" 12 | fi 13 | 14 | entries=(notes logbook logs todo) 15 | files=( 16 | "$HOME/Documents/notes/wall.md" 17 | "$HOME/Documents/logbook/$(date '+%Y-%m-%d').txt" 18 | "logs" 19 | "$HOME/Documents/todo.md" 20 | ) 21 | 22 | idx=$(IFS=$'\n'; echo "${entries[*]}" | eval "rofi $opts") 23 | if [[ -z "$idx" ]]; then 24 | exit 1 25 | fi 26 | 27 | if [[ "${files[$idx]}" == "logs" ]]; then 28 | 29 | entries=() 30 | files=() 31 | 32 | while read -r file; do 33 | files+=("$file") 34 | done < <(find ~/Documents/logs/ -type f -name '[^_]*') 35 | 36 | for file in "${files[@]}"; do 37 | entries+=("$(basename "${file%.*}")") 38 | done 39 | 40 | idx=$(IFS=$'\n'; echo "${entries[*]}" | eval "rofi $opts") 41 | if [[ -z "$idx" ]]; then 42 | exec "$0" 43 | fi 44 | 45 | fi 46 | 47 | exec urxvt -name floating -e nvim "${files[$idx]}" +'cd %:p:h' 48 | -------------------------------------------------------------------------------- /zsh/ext/rofi.zsh: -------------------------------------------------------------------------------- 1 | 2 | rofi_options() { 3 | colorscheme=$(xrdb -query all | grep colorscheme | grep -o '\w\+$') 4 | echo -n "-dmenu -monitor -2 -i -theme 'term-${colorscheme:-dark}' -width '$(rofi_width)'" 5 | } 6 | 7 | rofi_width() { 8 | (($COLUMNS < 70)) && echo 90 && return 9 | (($COLUMNS < 85)) && echo 80 && return 10 | (($COLUMNS < 100)) && echo 70 && return 11 | (($COLUMNS < 120)) && echo 60 && return 12 | echo 50 13 | } 14 | 15 | rofi-find() { 16 | local cmd='rg --files \ 17 | -g "!*/node_modules/*" -g "!*/venv/*" -g "!dist/*" -g "!build/*"' 18 | local options="$(rofi_options) -p 'vim '" 19 | local file=$(eval "$cmd" | eval "rofi $options") 20 | if [[ -z "$file" ]]; then 21 | return 0 22 | fi 23 | BUFFER="vim '$file'" 24 | zle accept-line 25 | } 26 | zle -N rofi-find 27 | 28 | rofi-cd() { 29 | local cmd='fd -td -E "!node_modules/*" -E "!venv/*" -E "!dist/*" -E "!build/*"' 30 | local options="$(rofi_options) -p 'cd '" 31 | local dir=$(eval "$cmd" | eval "rofi $options") 32 | if [[ -z "$dir" ]]; then 33 | return 0 34 | fi 35 | cd "$dir" 36 | zle reset-prompt 37 | } 38 | zle -N rofi-cd 39 | 40 | rofi-history() { 41 | local options="$(rofi_options) -filter '$BUFFER' -p '$ '" 42 | local entry=$(fc -rnl 1 | eval "rofi $options") 43 | if [ -z "$entry" ]; then 44 | return 0 45 | fi 46 | BUFFER="$entry" 47 | zle vi-end-of-line 48 | } 49 | zle -N rofi-history 50 | -------------------------------------------------------------------------------- /i3/i3-history: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | scriptname="$(basename "$0")" 4 | pidfile="/run/user/$UID/$scriptname.pid" 5 | out="/run/user/$UID/i3-history" 6 | 7 | print_help() { 8 | echo "Usage: $scriptname -print|-monitor" 9 | } 10 | 11 | if [[ ! "$1" =~ ^(-monitor|-print)$ ]]; then 12 | print_help 13 | exit 1 14 | fi 15 | 16 | if [[ "$1" == "-print" ]]; then 17 | cat "$out" 2>/dev/null 18 | exit 0 19 | fi 20 | 21 | exec 200>"$pidfile" 22 | if ! flock -n 200; then 23 | echo "$scriptname: already running" 2>&1 24 | exit 1 25 | fi 26 | 27 | echo $$ >&200 28 | truncate -s0 "$out" 29 | 30 | cleanup() { 31 | rm -f "$out" "$pidfile" 32 | } 33 | 34 | trap cleanup 0 35 | 36 | hist_add() { 37 | hist_remove "$1" 38 | hist+=("$1") 39 | } 40 | 41 | hist_remove() { 42 | local new=() 43 | for id in "${hist[@]}"; do 44 | [[ "$id" != "$1" ]] && new+=("$id") 45 | done 46 | hist=("${new[@]}") 47 | } 48 | 49 | hist_prune() { 50 | for id in "${hist[@]}"; do 51 | if ! xprop -id "$id" >/dev/null 2>&1; then 52 | hist_remove "$id" 53 | fi 54 | done 55 | } 56 | 57 | hist_write() { 58 | IFS=$'\n'; echo "${hist[*]}" > "$1" 59 | } 60 | 61 | hist=() 62 | 63 | xprop -root -spy _NET_ACTIVE_WINDOW | while read -r line; do 64 | id="$(grep -io "0x[a-f0-9]\\+" <<< "$line")" 65 | if [[ "$id" == "0x0" ]]; then 66 | continue 67 | fi 68 | hist_add "$id" 69 | hist_prune 70 | hist_write "$out" 71 | done 72 | -------------------------------------------------------------------------------- /rofi/main-light.rasi: -------------------------------------------------------------------------------- 1 | 2 | * { 3 | 4 | background: rgba(237, 238, 242, 100%); 5 | foreground: rgba(82, 86, 94, 100%); 6 | foreground-dim: rgba(82, 86, 94, 60%); 7 | 8 | background-color: @background; 9 | 10 | scrollbar-color: rgba(103, 107, 114, 100%); 11 | separator-color: rgba(225, 228, 232, 100%); 12 | 13 | prompt-background: rgba(225, 228, 232, 100%); 14 | prompt-color: rgba(103, 107, 114, 100%); 15 | text-color: rgba(103, 107, 114, 100%); 16 | 17 | normal-foreground: @foreground; 18 | normal-background: @background; 19 | selected-normal-foreground: @foreground; 20 | selected-normal-background: rgba(225, 228, 232, 100%); 21 | alternate-normal-foreground: @foreground; 22 | alternate-normal-background: @background; 23 | 24 | active-foreground: rgba(181, 85, 95, 100%); 25 | active-background: @background; 26 | selected-active-foreground: rgba(181, 85, 95, 100%); 27 | selected-active-background: @selected-normal-background; 28 | alternate-active-foreground: @active-foreground; 29 | alternate-active-background: @background; 30 | 31 | urgent-foreground: rgba(181, 85, 95, 100%); 32 | urgent-background: @background; 33 | selected-urgent-foreground: rgba(181, 85, 95, 100%); 34 | selected-urgent-background: @selected-normal-background; 35 | alternate-urgent-foreground: @urgent-foreground; 36 | alternate-urgent-background: @alternate-normal-background; 37 | 38 | } 39 | 40 | @import "main-base" 41 | -------------------------------------------------------------------------------- /i3/i3-rotate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import i3pie 4 | import argparse 5 | from collections import deque 6 | 7 | 8 | def parse_args(): 9 | 10 | parser = argparse.ArgumentParser(description="i3 window rotation") 11 | parser.add_argument('-follow', action='store_true', help="follow current window") 12 | group = parser.add_mutually_exclusive_group(required=True) 13 | group.add_argument('-next', action='store_true', help="focus next window") 14 | group.add_argument('-prev', action='store_true', help="focus previous window") 15 | 16 | return parser.parse_args() 17 | 18 | 19 | def main(i3): 20 | 21 | args = parse_args() 22 | 23 | tree = i3.get_tree() 24 | focused = tree.focused_window() 25 | workspace = tree.current_workspace() 26 | 27 | ids = [w.id for w in reversed(list(workspace.windows()))] 28 | curpos = ids.index(focused.id) 29 | 30 | rotated = deque(ids) 31 | rotated.rotate(-1 if args.next else 1) 32 | 33 | for i in range(len(ids)): 34 | if ids[i] == rotated[i]: 35 | continue 36 | i3.command(f'[con_id="{ids[i]}"] swap container with con_id {rotated[i]}') 37 | k = ids.index(rotated[i]) 38 | ids[i], ids[k] = ids[k], ids[i] 39 | 40 | if not args.follow: 41 | i3.command(f'[con_id="{rotated[curpos]}"] focus') 42 | 43 | 44 | if __name__ == '__main__': 45 | with i3pie.Connection() as i3: 46 | main(i3) 47 | -------------------------------------------------------------------------------- /vifm/colors/main.vifm: -------------------------------------------------------------------------------- 1 | 2 | highlight clear 3 | 4 | highlight Win cterm=none ctermfg=18 ctermbg=none 5 | highlight OtherWin cterm=none ctermfg=none ctermbg=none 6 | highlight StatusLine cterm=none ctermfg=21 ctermbg=24 7 | highlight CmdLine cterm=none ctermfg=18 ctermbg=none 8 | highlight TopLine cterm=bold ctermfg=21 ctermbg=none 9 | highlight TopLineSel cterm=bold ctermfg=magenta ctermbg=none 10 | highlight Selected cterm=none ctermfg=none ctermbg=26 11 | highlight CurrLine cterm=none ctermfg=none ctermbg=24 12 | highlight Border cterm=none ctermfg=24 ctermbg=none 13 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=none 14 | highlight TabLine cterm=none ctermfg=21 ctermbg=23 15 | highlight TabLineSel cterm=bold ctermfg=18 ctermbg=19 16 | highlight WildMenu cterm=none ctermfg=18 ctermbg=23 17 | highlight JobLine cterm=reverse ctermfg=18 ctermbg=default 18 | highlight SuggestBox cterm=none ctermfg=default ctermbg=default 19 | highlight CmpMismatch cterm=none ctermfg=19 ctermbg=red 20 | highlight AuxWin cterm=none ctermfg=none ctermbg=none 21 | 22 | highlight Directory cterm=none ctermfg=blue ctermbg=none 23 | highlight Socket cterm=none ctermfg=green ctermbg=none 24 | highlight Executable cterm=none ctermfg=red ctermbg=none 25 | highlight Fifo cterm=none ctermfg=magenta ctermbg=none 26 | highlight Link cterm=none ctermfg=cyan ctermbg=none 27 | highlight BrokenLink cterm=none ctermfg=22 ctermbg=none 28 | highlight Device cterm=none ctermfg=21 ctermbg=none 29 | 30 | " vim: ft=vim 31 | -------------------------------------------------------------------------------- /bin/play: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | fifo= 5 | if grep -q ".mp3" <<< "$@"; then 6 | for i in {1..100}; do 7 | candidate="/tmp/mpv_${i}.fifo" 8 | if [[ -e "${candidate}" ]]; then 9 | playlist=$(echo '{"command": ["get_property", "playlist"]}' | socat - "${candidate}") 10 | if grep -qF "$(dirname "$1")" <<< "${playlist}"; then 11 | counter=0 12 | for f in "${@:1}"; do 13 | if ! grep -qF "$f" <<< "${playlist}"; then 14 | echo "{\"command\": [\"loadfile\", \"${f}\", \"append\"]}" | socat - "${candidate}" 15 | (( counter += 1 )) 16 | fi 17 | done 18 | if (( counter > 0 )); then 19 | notify-send "Mpv" "Added ${counter} files to instance ${candidate}" 20 | fi 21 | #echo 'set playlist-pos-1 ${playlist-count}' | socat - "${candidate}" 22 | exit 0 23 | fi 24 | else 25 | fifo=$candidate 26 | break 27 | fi 28 | done 29 | fi 30 | 31 | if [[ -z "${fifo}" ]]; then 32 | fifo="/tmp/mpv.fifo" 33 | fi 34 | 35 | _exit() { 36 | rm -f "$fifo" 37 | } 38 | 39 | trap "_exit" 0 40 | 41 | osc_visibility= 42 | if grep -q ".mp3" <<< "$@"; then 43 | osc_visibility="--script-opts=osc-visibility=always" 44 | fi 45 | 46 | mpv --input-ipc-server="$fifo" --player-operation-mode=pseudo-gui $osc_visibility "$@" 47 | -------------------------------------------------------------------------------- /i3/i3-rename-workspace: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | current_workspace_name() { 4 | i3-msg -t get_workspaces \ 5 | | jq '.[] | select(.focused==true).name' \ 6 | | cut -d "\"" -f 2 7 | } 8 | 9 | main() { 10 | 11 | # add a trailing space if the worksapce name is just a number 12 | local current 13 | current=$(current_workspace_name) 14 | if [[ "${current}" =~ ^[0-9]+$ ]]; then 15 | current="${current} " 16 | fi 17 | 18 | local opts name 19 | name="$(grep -o "^[0-9]\\+" <<< "${current}")" 20 | 21 | if (( reset == 1 )); then 22 | if [[ -z "${name}" ]]; then 23 | name="$(i3-new-workspace -dry)" 24 | fi 25 | elif (( menu == 1 )); then 26 | opts="-dmenu -p 'Name' -filter '${current}' -theme 'i3-input'" 27 | name="$(echo | eval "rofi ${opts}")" 28 | name="$(sed 's/\(\s\+$\|^\s\+\)//g' <<< "${name}")" 29 | fi 30 | 31 | if [[ -z "${name}" ]]; then 32 | exit 1 33 | fi 34 | 35 | i3-msg -q "rename workspace to \"${name}\"" >/dev/null 36 | 37 | } 38 | 39 | print_help() { 40 | echo "Usage: " 41 | echo " i3-rename-workspace [-menu|-reset]" 42 | echo 43 | } 44 | 45 | parse_args() { 46 | while (( $# )); do 47 | if [[ "$1" == "-reset" ]]; then 48 | reset=1 49 | elif [[ "$1" == "-menu" ]]; then 50 | menu=1 51 | elif [[ "$1" == "-help" ]]; then 52 | print_help 53 | exit 0 54 | else 55 | echo "Unknown option: $1" 1>&2 56 | print_help 57 | exit 1 58 | fi 59 | shift 60 | done 61 | } 62 | 63 | reset=0 64 | menu=0 65 | 66 | parse_args "$@" 67 | 68 | main 69 | -------------------------------------------------------------------------------- /bin/sensors-notify: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | _err() { 4 | echo "$scriptname: $1" 1>&2 5 | exit 1 6 | } 7 | 8 | _parse_args() { 9 | while (( $# )); do 10 | if [[ "$1" == "-i" || "$1" == "-interval" ]]; then 11 | if [[ "$2" =~ ^[0-9.]+$ ]]; then 12 | interval="$2" 13 | shift 14 | else 15 | _err "Option -interval requires an argument" 16 | fi 17 | elif [[ "$1" == "-t" || "$1" == "-timeout" ]]; then 18 | if [[ "$2" =~ ^[0-9]+$ ]]; then 19 | timeout="$2" 20 | shift 21 | else 22 | _err "Option -timeout requires an argument" 23 | fi 24 | elif [[ "$1" == "-pin" || "$1" == "-pinned" ]]; then 25 | pinned=1 26 | else 27 | _err "Unknown option: $1" 28 | fi 29 | shift 30 | done 31 | } 32 | 33 | _get_info() { 34 | #local info gpu_info 35 | #gpu_info="$(gpu-info)" 36 | #if (( $? == 0 )); then 37 | #info+=$'amdgpu_pm_info\n' 38 | #info+="$gpu_info" 39 | #info+=$'\n\n' 40 | #fi 41 | info+="$(sensors -A 'k10temp-*' 'amdgpu-*' | tr -s " " | sed "s; (.*;;" | grep -v "^$" | tr -s " " | sed "s;.\+-.\+;&;")" 42 | echo "$info" 43 | } 44 | 45 | scriptname="$(basename "$0")" 46 | 47 | id=1010 48 | timeout=5000 49 | verbose=0 50 | interval="0.5" 51 | pinned=0 52 | 53 | _parse_args "$@" 54 | 55 | if (( $(pgrep -c sensors-notify) > 1 )); then 56 | dunstify -C $id 57 | killall sensors-notify 58 | fi 59 | 60 | while true; do 61 | dunstify -t $timeout -r $id "Sensors" "$(_get_info)" 62 | (( pinned == 0 )) && break 63 | sleep "$interval" 64 | done 65 | -------------------------------------------------------------------------------- /ranger/commands.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | import subprocess 4 | 5 | import ranger 6 | from ranger.api.commands import Command 7 | 8 | 9 | class vidir(Command): 10 | """:vidir 11 | 12 | Rename all files in the current directory or marked files if any. 13 | """ 14 | 15 | def execute(self): 16 | 17 | if not self.fm.thisdir: 18 | self.fm.notify("Nothing to rename!", bad=True) 19 | return 20 | 21 | if self.fm.thisdir.marked_items: 22 | files = self.fm.thisdir.get_selection() 23 | else: 24 | files = [] 25 | 26 | args = [f.relative_path for f in files] 27 | self.fm.execute_command(['vidir', *args]) 28 | 29 | for f in files: 30 | self.fm.thisdir.mark_item(f, False) 31 | 32 | 33 | class cd_root(Command): 34 | """:cd_root 35 | 36 | Cd into the current project root. 37 | """ 38 | 39 | def execute(self): 40 | root_markers = set(['.gitignore', 'node_modules']) 41 | path = self.find_root(self.fm.thisdir.path, root_markers) 42 | if not path: 43 | self.fm.notify("Root cannot be located", bad=True) 44 | else: 45 | self.fm.cd(path) 46 | self.fm.notify("cd " + path) 47 | 48 | def find_root(self, path, markers): 49 | if not path or path == '/': 50 | return '' 51 | if set(os.listdir(path)) & markers: 52 | return path 53 | return self.find_root(os.path.dirname(path), markers) 54 | -------------------------------------------------------------------------------- /x/Xresources.d/xterm: -------------------------------------------------------------------------------- 1 | 2 | #ifdef LIGHT 3 | XTerm*foreground: _LIGHT_fg_dim 4 | XTerm*background: _LIGHT_bg_color 5 | XTerm*cursorColor: _LIGHT_cursor_color 6 | XTerm*borderColor: _LIGTH_bg_color 7 | XTerm*highlightColor: _LIGHT_fg_super_dim 8 | #else 9 | XTerm*foreground: _DARK_fg_dim 10 | XTerm*background: _DARK_bg_color 11 | XTerm*cursorColor: _DARK_cursor_color 12 | XTerm*borderColor: _DARK_bg_color 13 | XTerm*highlightColor: _DARK_fg_super_dim 14 | #endif 15 | 16 | XTerm*termName: xterm-256color 17 | XTerm*loginShell: false 18 | XTerm*saveLines: 8192 19 | XTerm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48 20 | XTerm*eightBitInput: false 21 | XTerm*dynamicColors: true 22 | XTerm*scrollBar: false 23 | XTerm*altSendsEscape: true 24 | XTerm*vt100.backarrowKey: false 25 | XTerm*ttyModes: erase ^? 26 | 27 | XTerm*VT100.internalBorder: 4 28 | XTerm*borderWidth: 0 29 | 30 | XTerm*utf8: true 31 | XTerm*utf8Title: true 32 | 33 | XTerm*faceName: xft:Noto Mono Patched:size=10:antialias=true 34 | XTerm*allowBoldFonts: false 35 | XTerm*allowFontOps: true 36 | 37 | XTerm*VT100.translations: #override \ 38 | Ctrl minus: smaller-vt-font() \n\ 39 | Ctrl plus: larger-vt-font() \n\ 40 | Ctrl Shift A: dabbrev-expand() \n\ 41 | Ctrl Shift C: copy-selection(CLIPBOARD) \n\ 42 | Ctrl Shift V: insert-selection(CLIPBOARD) \n\ 43 | Ctrl Shift J: exec-selectable("XTerm-move down", word) \n\ 44 | Ctrl Shift K: exec-selectable("XTerm-move up", word) \n\ 45 | Ctrl Shift O: exec-formatted("firefox '%t'", PRIMARY) \n\ 46 | -------------------------------------------------------------------------------- /nvim/plugins/fzf/plugin/fzf.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: fzf.vim 3 | " Description: Simple fzf integration 4 | " Mantainer: github.com/gcmt 5 | " License: MIT 6 | " ============================================================================ 7 | 8 | if exists('g:fzf_loaded') || !executable('fzf') || &cp 9 | finish 10 | end 11 | let g:fzf_loaded = 1 12 | 13 | command! -bang -nargs=* Files call fzf#files(, !empty()) 14 | 15 | let s:options = { 16 | \ 'expect': { 17 | \ 'ctrl-t': 'tab split', 18 | \ 'ctrl-s': 'split', 19 | \ 'ctrl-v': 'vsplit', 20 | \ }, 21 | \ 'options': [ 22 | \ "-e", 23 | \ "--multi", 24 | \ "--reverse", 25 | \ "--preview-window", "border-left", 26 | \ "--bind", "TAB:down,SHIFT-TAB:up", 27 | \ "--bind", "CTRL-N:toggle+down,CTRL-L:toggle+down,CTRL-H:toggle+up,RIGHT:toggle+down,LEFT:toggle+up", 28 | \ "--color", "fg+:18,bg+:24,hl+:1,hl:1,prompt:-1,pointer:-1,info:23,gutter:-1,border:22", 29 | \ ], 30 | \ 'preview_treshold': 150, 31 | \ 'preview_cmd': 'head -100 {}', 32 | \ 'term_cmd': 'TMUX= wezterm start --class wez-floating', 33 | \ 'tmux_cmd': 'tmux display-popup -E -w 90% -h 90% -y -1', 34 | \ 'files_cmd': "rg --files --hidden --no-require-git", 35 | \ 'files_cmd_bang': "rg --files --hidden --no-ignore" 36 | \ } 37 | 38 | for [s:option, s:default] in items(s:options) 39 | let g:fzf_{s:option} = get(g:, 'fzf_'.s:option, s:default) 40 | endfo 41 | -------------------------------------------------------------------------------- /nvim/plugins/vifm/autoload/vifm.vim: -------------------------------------------------------------------------------- 1 | 2 | " Open the given file/directory 3 | " When using a bang, vifm will be started in fzf mode 4 | func! vifm#open(target, bang) 5 | 6 | let curwin = winnr() 7 | let out_file = tempname() 8 | 9 | let cmd = ['vifm'] 10 | let cmd += ['--choose-files='.out_file] 11 | 12 | if filereadable(a:target) 13 | let cmd += ['--select='.shellescape(a:target)] 14 | else 15 | let cmd += [fnamemodify(a:target, ':p:h')] 16 | end 17 | 18 | if !empty(a:bang) 19 | let cmd += ["+fzf"] 20 | end 21 | 22 | if !empty($TMUX) 23 | let cmd = join([g:fm_tmux_cmd] + cmd) 24 | else 25 | let cmd = join([g:fm_term_cmd] + ['-e'] + cmd) 26 | end 27 | 28 | sil call system(cmd) 29 | if v:shell_error != 0 || !filereadable(out_file) 30 | return 31 | end 32 | 33 | exec curwin . 'wincmd w' 34 | call s:handle_selection(readfile(out_file)) 35 | call delete(out_file) 36 | endf 37 | 38 | " Handle files selection 39 | func! s:handle_selection(lines) 40 | if empty(a:lines) 41 | return 42 | end 43 | call map(a:lines, {i, v -> fnameescape(v)}) 44 | if len(a:lines) > 1 45 | exec 'argadd' join(a:lines) 46 | end 47 | if expand('%:p') != a:lines[0] 48 | " Otherwise autocommands don't get fired 49 | exec 'edit' a:lines[0] 50 | end 51 | redraw! 52 | endf 53 | 54 | " Display a error message. 55 | func! s:err(fmt, ...) 56 | echohl WarningMsg | echom call('printf', [a:fmt] + a:000) | echohl None 57 | endf 58 | -------------------------------------------------------------------------------- /nvim/plugins/quickfix/after/ftplugin/qf.vim: -------------------------------------------------------------------------------- 1 | 2 | setl nonumber 3 | setl norelativenumber 4 | setl cursorline 5 | 6 | fun! _quickfix_title() 7 | let title = get(w:, 'quickfix_title', '') 8 | let title = substitute(title, &grepprg, get(split(&grepprg), 0, '') . ' ', '') 9 | return substitute(title, $HOME, '~', 'g') 10 | endf 11 | 12 | setl stl=%t\ %{_quickfix_title()} 13 | 14 | func! s:set_height(percentage) 15 | if &buftype == 'quickfix' 16 | exec 'resize' float2nr(&lines * a:percentage / 100) 17 | if line('$') <= winheight(0) 18 | exec 'resize' line('$') 19 | end 20 | end 21 | endf 22 | 23 | call s:set_height(get(g:, 'quickfix_height', 25)) 24 | 25 | call matchadd('LineNr', '\v\|\d+ col \d+( \w+)?\|', -1, -1, {}) 26 | 27 | nnoremap q c 28 | nnoremap c 29 | 30 | " don't close the quickfix window 31 | nnoremap l zz 32 | nnoremap L :exec winnr('#').'wincmd c'zz 33 | nnoremap <2-LeftMouse> :exec winnr('#').'wincmd c'zz 34 | 35 | vnoremap d :call quickfix#remove_entries(mode()) 36 | nnoremap d :set opfunc=quickfix#remove_entriesg@ 37 | nnoremap dd :set opfunc=quickfix#remove_entriesexec 'norm!' v:count1.'g@_' 38 | nnoremap u :call quickfix#undo() 39 | 40 | command! -buffer -bang -nargs=1 Cfilter call quickfix#filter(, ) 41 | command! -buffer -bang -nargs=1 Cffilter call quickfix#ffilter(, ) 42 | -------------------------------------------------------------------------------- /nvim/snippets/typescript.snippets: -------------------------------------------------------------------------------- 1 | extends javascript 2 | 3 | snippet tconst "ts const" 4 | const ${1}: ${2:any} = ${3}; 5 | ${0} 6 | snippet tlet "ts let" 7 | let ${1}: ${2:any} = ${3}; 8 | ${0} 9 | snippet tvar "ts var" 10 | var ${1}: ${2:any} = ${3}; 11 | ${0} 12 | snippet + "ts create field" 13 | ${1}: ${0:any} 14 | snippet #+ "ts create private field using #" 15 | #${1}: ${0:any} 16 | snippet tpfi "ts create public field" 17 | public ${1}: ${0:any} 18 | snippet tprfi "ts create private field" 19 | private ${1}: ${0:any} 20 | snippet tprofi "ts create protected field" 21 | protected ${1}: ${0:any} 22 | snippet int "interface" 23 | interface ${1} { 24 | ${2}: ${3:any}; 25 | ${0} 26 | } 27 | snippet intx "interface extends" 28 | interface ${1} extends ${2} { 29 | ${3}: ${4:any}; 30 | ${0} 31 | } 32 | snippet tfun "ts function" 33 | function ${1}(${2}): ${3:any} { 34 | ${0} 35 | } 36 | snippet tpmet "ts public method" 37 | public ${1}(${2}): ${3:any} { 38 | ${0} 39 | } 40 | snippet tpsmet "ts public static method" 41 | public static ${1}(${2}): ${3:any} { 42 | ${0} 43 | } 44 | snippet tprmet "ts private method" 45 | private ${1}(${2}): ${3:any} { 46 | ${0} 47 | } 48 | snippet tpromet "ts protected method" 49 | protected ${1}(${2}): ${3:any} { 50 | ${0} 51 | } 52 | snippet tcla "ts class" 53 | class ${1} { 54 | ${2} 55 | constructor(public ${3}: ${4: any}) { 56 | ${5} 57 | } 58 | ${0} 59 | } 60 | snippet tclax "ts class extends" 61 | class ${1} extends ${2} { 62 | ${3} 63 | constructor(public ${4}: ${5: any}) { 64 | ${6} 65 | } 66 | ${0} 67 | } 68 | -------------------------------------------------------------------------------- /i3/i3-scratch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import i3pie 5 | import argparse 6 | 7 | 8 | def parse_args(): 9 | parser = argparse.ArgumentParser(description="Custom i3 scratchpad") 10 | group = parser.add_mutually_exclusive_group(required=True) 11 | group.add_argument('-push', action='store_true', help="Push the current window to the scratchpad") 12 | group.add_argument('-pop', action='store_true', help="Pop the last pushed window from the scratchpad") 13 | group.add_argument('-focus', action='store_true', help="Move to the scratchpad container") 14 | return parser.parse_args() 15 | 16 | 17 | def main(i3): 18 | 19 | args = parse_args() 20 | tree = i3.get_tree() 21 | focused = tree.focused_window() 22 | workspace = tree.current_workspace() 23 | scratchpad = tree.find_workspace(fn=lambda con: con.name == '_scratch') 24 | 25 | if args.push: 26 | 27 | if not focused: 28 | sys.exit(1) 29 | 30 | focused.command('move to workspace _scratch') 31 | 32 | elif args.pop: 33 | 34 | if not scratchpad: 35 | sys.exit(1) 36 | 37 | windows = list(scratchpad.windows()) 38 | if not windows: 39 | sys.exit(1) 40 | 41 | windows[-1].command('move to workspace current, focus') 42 | 43 | elif args.focus: 44 | 45 | if workspace is scratchpad: 46 | i3.command('workspace back_and_forth') 47 | else: 48 | i3.command('workspace _scratch') 49 | 50 | 51 | if __name__ == '__main__': 52 | with i3pie.Connection() as i3: 53 | main(i3) 54 | -------------------------------------------------------------------------------- /kitty/light.conf: -------------------------------------------------------------------------------- 1 | 2 | # font_family Roboto Mono 3 | # bold_font Roboto Mono Bold 4 | 5 | font_family Inconsolata 6 | bold_font Inconsolata SemiBold 7 | 8 | # LIGHT colorscheme 9 | 10 | # black #2c3238 11 | # red #ad2f3b 12 | # green #158045 13 | # yellow #d2b96c 14 | # blue #3179b2 15 | # magenta #9441a6 16 | # cyan #158cb0 17 | # white #ffffff 18 | # orange #c77408 19 | # fg_dim #6a737d 20 | # fg_very_dim #a1aab7 21 | # fg_super_dim #dde5ed 22 | # bg_accent #f5f6f7 23 | # hl_color #f7f71b 24 | 25 | cursor #158cb0 26 | cursor_text_color #ffffff 27 | foreground #2c3238 28 | background #ffffff 29 | selection_foreground #2c3238 30 | selection_background #e7e7fd 31 | 32 | # black 33 | color0 #2c3238 34 | color8 #2c3238 35 | 36 | # red 37 | color1 #ad2f3b 38 | color9 #ad2f3b 39 | 40 | # green 41 | color2 #158045 42 | color10 #158045 43 | 44 | # yellow 45 | color3 #d2b96c 46 | color11 #d2b96c 47 | 48 | # blue 49 | color4 #3179b2 50 | color12 #3179b2 51 | 52 | # magenta 53 | color5 #9441a6 54 | color13 #9441a6 55 | 56 | # cyan 57 | color6 #158cb0 58 | color14 #158cb0 59 | 60 | # white 61 | color7 #ffffff 62 | color15 #ffffff 63 | 64 | # orange 65 | color16 #c77408 66 | color17 #c77408 67 | 68 | # fg 69 | color18 #2c3238 70 | 71 | # bg 72 | color19 #ffffff 73 | 74 | # cursor 75 | color20 #158cb0 76 | 77 | # fg_dim 78 | color21 #6a737d 79 | 80 | # fg_very_dim 81 | color22 #a1aab7 82 | 83 | # fg_super_dim 84 | color23 #dde5ed 85 | 86 | # bg_accent 87 | color24 #f5f6f7 88 | 89 | # highlight 90 | color25 #f7f71b 91 | 92 | # selection 93 | color26 #e7e7fd 94 | -------------------------------------------------------------------------------- /ranger/colorschemes/main.py: -------------------------------------------------------------------------------- 1 | 2 | from ranger.colorschemes.default import Default 3 | from ranger.gui.color import black, blue, cyan, green, magenta, red, white, yellow, default 4 | from ranger.gui.color import normal, bold, reverse, underline, invisible 5 | from ranger.gui.color import default_colors 6 | 7 | orange = 16 8 | 9 | foreground = 18 10 | background = 19 11 | cursor = 20 12 | 13 | fg_dim = 21 14 | fg_very_dim = 22 15 | fg_super_dim = 23 16 | bg_accent = 24 17 | 18 | 19 | class Scheme(Default): 20 | 21 | def use(self, context): 22 | 23 | fg, bg, attr = Default.use(self, context) 24 | 25 | if context.border: 26 | fg = fg_super_dim 27 | 28 | elif context.in_browser: 29 | attr = normal 30 | if context.empty or context.error: 31 | fg = fg_very_dim 32 | bg = default 33 | if context.file: 34 | fg = foreground 35 | if context.marked: 36 | fg = foreground 37 | bg = fg_super_dim 38 | if context.selected: 39 | if context.marked: 40 | bg = fg_very_dim 41 | else: 42 | bg = bg_accent 43 | 44 | elif context.in_titlebar: 45 | 46 | if context.hostname: 47 | fg = red if context.bad else foreground 48 | elif context.directory: 49 | fg = foreground 50 | 51 | attr = normal 52 | 53 | elif context.in_taskview: 54 | pass 55 | 56 | elif context.in_statusbar: 57 | pass 58 | 59 | return fg, bg, attr 60 | -------------------------------------------------------------------------------- /ctags/ctags: -------------------------------------------------------------------------------- 1 | --verbose=no 2 | --recurse=yes 3 | --tag-relative=never 4 | --excmd=number 5 | 6 | --exclude=.git 7 | --exclude=venv 8 | --exclude=node_modules 9 | --exclude=migrations 10 | --exclude=build 11 | --exclude=dist 12 | --exclude=Makefile 13 | 14 | --languages=-html,css,json 15 | --python-kinds=-iv 16 | 17 | --langdef=Elixir 18 | --langmap=Elixir:.ex.exs 19 | --regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/ 20 | --regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/ 21 | --regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/ 22 | --regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/ 23 | --regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/ 24 | --regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/ 25 | --regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/ 26 | --regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/ 27 | --regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/ 28 | --regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/ 29 | --regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/ 30 | -------------------------------------------------------------------------------- /kitty/dark.conf: -------------------------------------------------------------------------------- 1 | 2 | # font_family Roboto Mono Light 3 | # bold_font Roboto Mono Bold 4 | 5 | font_family Inconsolata Light 6 | bold_font Inconsolata SemiBold 7 | 8 | # DARK colorscheme 9 | 10 | # black #1e222b 11 | # red #945f65 12 | # green #768a78 13 | # yellow #a39465 14 | # blue #657b99 15 | # magenta #917086 16 | # cyan #739492 17 | # white #9898a0 18 | # orange #998068 19 | # fg_dim #747982 20 | # fg_very_dim #626672 21 | # fg_super_dim #323640 22 | # bg_accent #252933 23 | # hl_color #a39465 24 | 25 | cursor #917086 26 | cursor_text_color #1e222b 27 | foreground #9898a0 28 | background #1e222b 29 | selection_foreground #9898a0 30 | selection_background #323640 31 | 32 | # black 33 | color0 #1e222b 34 | color8 #1e222b 35 | 36 | # red 37 | color1 #945f65 38 | color9 #945f65 39 | 40 | # green 41 | color2 #768a78 42 | color10 #768a78 43 | 44 | # yellow 45 | color3 #a39465 46 | color11 #a39465 47 | 48 | # blue 49 | color4 #657b99 50 | color12 #657b99 51 | 52 | # magenta 53 | color5 #917086 54 | color13 #917086 55 | 56 | # cyan 57 | color6 #739492 58 | color14 #739492 59 | 60 | # white 61 | color7 #9898a0 62 | color15 #9898a0 63 | 64 | # orange 65 | color16 #998068 66 | color17 #998068 67 | 68 | # fg 69 | color18 #9898a0 70 | 71 | # bg 72 | color19 #1e222b 73 | 74 | # cursor 75 | color20 #917086 76 | 77 | # fg_dim 78 | color21 #747982 79 | 80 | # fg_very_dim 81 | color22 #626672 82 | 83 | # fg_super_dim 84 | color23 #323640 85 | 86 | # bg_accent 87 | color24 #252933 88 | 89 | # highlight 90 | color25 #a39465 91 | 92 | # selection 93 | color26 #323640 94 | -------------------------------------------------------------------------------- /nvim/plugins/bookmarks/plugin/bookmarks.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================= 2 | " File: bookmarks.vim 3 | " Description: File marks for quick navigation 4 | " Author: github.com/gcmt 5 | " Licence: MIT 6 | " ============================================================================= 7 | 8 | if exists("g:loaded_bookmarks") || &cp 9 | finish 10 | end 11 | let g:loaded_bookmarks = 1 12 | 13 | let s:options = #{ 14 | \ file: "$XDG_DATA_HOME/nvim/bookmarks.json", 15 | \ marks: "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()_+-=[]{};:\",./<>?\|`~'", 16 | \ popup: 1, 17 | \ popup_border: 'single', 18 | \ width_popup: "70%", 19 | \ height_popup: "80%", 20 | \ height_window: "50%", 21 | \ cursorline: 1, 22 | \ explorer_cmd: 'Explorer %f', 23 | \ mappings_jump: ['l', ''], 24 | \ mappings_unset: ['dd'], 25 | \ mappings_change: ['c'], 26 | \ mappings_close: ['q', ''], 27 | \ mappings_toggle_global: ['a'], 28 | \ hl_title: 'Magenta', 29 | \ hl_mark: 'Magenta', 30 | \ hl_file: 'Fg', 31 | \ hl_dir: 'Blue', 32 | \ hl_dim: 'Comment', 33 | \ } 34 | 35 | for [s:option, s:default] in items(s:options) 36 | let g:bookmarks_{s:option} = get(g:, 'bookmarks_'.s:option, s:default) 37 | endfor 38 | 39 | command! -nargs=1 Jump call bookmarks#jump() 40 | command! -bang -nargs=0 Bookmarks call bookmarks#view(!empty()) 41 | command! -bang -nargs=0 QuickJump call bookmarks#quickjump(!empty()) 42 | command! -nargs=1 MarkFile call bookmarks#set(, expand("%:p")) 43 | command! -nargs=1 MarkDir call bookmarks#set(, expand("%:p:h")) 44 | -------------------------------------------------------------------------------- /cmus/dark.theme: -------------------------------------------------------------------------------- 1 | 2 | # Command line. 3 | set color_cmdline_bg=default 4 | set color_cmdline_fg=default 5 | set color_cmdline_attr=default 6 | 7 | # Error messages displayed on the command line. 8 | set color_error=1 9 | 10 | # Informational messages displayed on the command line. 11 | set color_info=3 12 | 13 | # Separator line between windows. 14 | set color_separator=22 15 | 16 | # Status line at the bottom 17 | set color_statusline_bg=24 18 | set color_statusline_fg=18 19 | set color_statusline_attr=default 20 | 21 | # Sticky line at the bottom displaying the currently playing track. 22 | set color_titleline_bg=22 23 | set color_titleline_fg=19 24 | set color_titleline_attr=default 25 | 26 | # Window bg/fg colors. 27 | set color_win_bg=default 28 | set color_win_fg=default 29 | set color_win_attr=default 30 | 31 | # Currently playing track. 32 | set color_win_cur=1 33 | 34 | # Selected row which is also the currently playing track in active window. 35 | set color_win_cur_sel_bg=23 36 | set color_win_cur_sel_fg=1 37 | set color_win_cur_sel_attr=default 38 | 39 | # Selected row which is also the currently playing track in inactive window. 40 | set color_win_inactive_cur_sel_bg=23 41 | set color_win_inactive_cur_sel_fg=1 42 | set color_win_inactive_cur_sel_attr=default 43 | 44 | # Selected row in the inactive window. 45 | set color_win_inactive_sel_bg=24 46 | set color_win_inactive_sel_fg=18 47 | set color_win_inactive_sel_attr=default 48 | 49 | # Selected row in active window. 50 | set color_win_sel_bg=23 51 | set color_win_sel_fg=18 52 | set color_win_sel_attr=default 53 | 54 | # Window titles. 55 | set color_win_title_bg=24 56 | set color_win_title_fg=18 57 | set color_win_title_attr=default 58 | 59 | # Color of directories in browser. 60 | set color_win_dir=4 61 | -------------------------------------------------------------------------------- /i3/i3-next-workspace: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import i3pie 4 | import argparse 5 | 6 | 7 | def parse_args(): 8 | parser = argparse.ArgumentParser(description="Cycle i3 workspaces") 9 | parser.add_argument("-dry", action="store_true", help="print next workspace without actually moving") 10 | group = parser.add_mutually_exclusive_group(required=True) 11 | group.add_argument("-next", action="store_true", help="focus next workspace") 12 | group.add_argument("-prev", action="store_true", help="focus previous workspace") 13 | return parser.parse_args() 14 | 15 | 16 | def is_hidden(w): 17 | return w.name.startswith("_") or w.name.endswith("_") 18 | 19 | 20 | def main(i3): 21 | 22 | args = parse_args() 23 | tree = i3.get_tree() 24 | 25 | numbered = [] 26 | labeled = [] 27 | 28 | for w in tree.workspaces(): 29 | if is_hidden(w): 30 | continue 31 | elif w.name[0].isdigit(): 32 | numbered.append(w) 33 | else: 34 | labeled.append(w) 35 | 36 | # workspace order mimics the same order used in the 37 | # i3 polybar module 38 | by_name = lambda w: w.name 39 | workspaces = sorted(labeled, key=by_name) + sorted(numbered, key=by_name) 40 | focused = tree.current_workspace() 41 | 42 | if is_hidden(focused): 43 | w = workspaces[0] if args.next else workspaces[-1] 44 | else: 45 | offset = 1 if args.next else -1 46 | i = workspaces.index(focused) + offset 47 | w = workspaces[i % len(workspaces)] 48 | 49 | if args.dry: 50 | print(w.name) 51 | else: 52 | i3.command(f'workspace "{w.name}"') 53 | 54 | 55 | if __name__ == "__main__": 56 | with i3pie.Connection() as i3: 57 | main(i3) 58 | -------------------------------------------------------------------------------- /i3/i3-sys-menu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | display_menu() { 4 | for entry in "$@"; do 5 | echo "${entry}" 6 | done | rofi -dmenu -markup-rows -format d -theme "system-menu" -theme-str "${theme_override}" 7 | } 8 | 9 | system_menu() { 10 | local suspend="" 11 | local lock="" 12 | local reboot="" 13 | local poweroff="" 14 | local icons=("${suspend}" "${lock}" "${reboot}" "${poweroff}") 15 | local choice=$(display_menu "${icons[@]}") 16 | case "${choice}" in 17 | 1) systemctl suspend ;; 18 | 2) lock -force -blank 2 ;; 19 | 3) systemctl reboot ;; 20 | 4) systemctl poweroff ;; 21 | *) exit 1 ;; 22 | esac 23 | } 24 | 25 | i3_menu() { 26 | local reload="" 27 | local restart="" 28 | local exit="" 29 | local config="" 30 | local redshift="" 31 | local icons=("${config}" "${reload}" "${restart}" "${exit}" "${redshift}") 32 | local choice=$(display_menu "${icons[@]}") 33 | case "${choice}" in 34 | 1) wezterm start --class wez-floating -e nvim ~/.config/i3/config ;; 35 | 2) i3-msg reload >/dev/null ;; 36 | 3) i3-msg restart >/dev/null ;; 37 | 4) i3-msg exit >/dev/null ;; 38 | 5) wezterm start --class wez-floating -e nvim ~/.config/redshift/redshift.conf ;; 39 | *) exit 1 ;; 40 | esac 41 | } 42 | 43 | print_usage() { 44 | echo >&2 "Usage: i3-sys-menu [-sys|-i3]" 45 | } 46 | 47 | case "$1" in 48 | -i3) 49 | theme_override="window { width: 950px; } listview { columns: 5; }" 50 | i3_menu 51 | ;; 52 | -sys) 53 | theme_override="window { width: 750px; } listview { columns: 4; }" 54 | system_menu 55 | ;; 56 | *) print_usage && exit 1 ;; 57 | esac 58 | -------------------------------------------------------------------------------- /nvim/plugins/search/plugin/search.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: search.vim 3 | " Description: View all search matches at once 4 | " Mantainer: github.com/gcmt 5 | " License: MIT 6 | " ============================================================================ 7 | 8 | if exists('g:search_loaded') || &cp 9 | finish 10 | end 11 | let g:search_loaded = 1 12 | 13 | func s:search(bang, pattern) 14 | let options = empty(a:bang) ? {} : {'exclude_syntax': []} 15 | call search#do(a:pattern, options) 16 | endf 17 | 18 | command -bang -nargs=? Search call search(, ) 19 | 20 | let s:options = #{ 21 | \ popup: 1, 22 | \ popup_border: 'single', 23 | \ width_popup: "80%", 24 | \ max_height_popup: "90%", 25 | \ max_height_window: "50%", 26 | \ exclude_syntax: ['comment', 'string'], 27 | \ smartcase: &smartcase, 28 | \ set_search_register: 1, 29 | \ add_to_search_history: 1, 30 | \ show_line_numbers: 1, 31 | \ goto_closest_match: 1, 32 | \ left_padding: " ", 33 | \ show_match: 1, 34 | \ match_hl: "SearchUnderline", 35 | \ linenr_hl: "LineNr", 36 | \ transform_cb: v:null, 37 | \ filter_cb: v:null, 38 | \ post_jump_cmd: 'norm! zz', 39 | \ mappings_jump: ['l', '', '<2-LeftMouse>'], 40 | \ mappings_close: ['q', ''], 41 | \ mappings_context: ['c'], 42 | \ mappings_toggle_numbers: ['a'], 43 | \ } 44 | 45 | func! _search_global_options() 46 | let globals = {} 47 | for option in keys(s:options) 48 | let globals[option] = get(g:, 'search_' . option) 49 | endfor 50 | return globals 51 | endf 52 | 53 | for [s:option, s:default] in items(s:options) 54 | let g:search_{s:option} = get(g:, 'search_'.s:option, s:default) 55 | endfo 56 | -------------------------------------------------------------------------------- /fontconfig/fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | hintfull 10 | 11 | 12 | 13 | 14 | rgb 15 | 16 | 17 | 18 | 19 | lcddefault 20 | 21 | 22 | 23 | 24 | 25 | false 26 | 27 | 28 | 29 | 30 | Noto Sans 31 | 32 | 33 | serif 34 | Noto Serif 35 | 36 | 37 | sans-serif 38 | Noto Sans 39 | 40 | 41 | monospace 42 | Inconsolata 43 | 44 | 45 | 46 | 47 | Inconsolata 48 | 49 | 50 | 100 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /x/Xresources.d/colors: -------------------------------------------------------------------------------- 1 | 2 | #include "colors-dark" 3 | #include "colors-light" 4 | 5 | #ifdef LIGHT 6 | 7 | colorscheme.name: light 8 | 9 | *color0: _LIGHT_black 10 | *color1: _LIGHT_red 11 | *color2: _LIGHT_green 12 | *color3: _LIGHT_yellow 13 | *color4: _LIGHT_blue 14 | *color5: _LIGHT_magenta 15 | *color6: _LIGHT_cyan 16 | *color7: _LIGHT_white 17 | 18 | *color8: _LIGHT_black_bright 19 | *color9: _LIGHT_red_bright 20 | *color10: _LIGHT_green_bright 21 | *color11: _LIGHT_yellow_bright 22 | *color12: _LIGHT_blue_bright 23 | *color13: _LIGHT_magenta_bright 24 | *color14: _LIGHT_cyan_bright 25 | *color15: _LIGHT_white_bright 26 | 27 | *color16: _LIGHT_orange 28 | *color17: _LIGHT_orange_bright 29 | 30 | *color18: _LIGHT_fg_color 31 | *color19: _LIGHT_bg_color 32 | *color20: _LIGHT_cursor_color 33 | 34 | *color21: _LIGHT_fg_dim 35 | *color22: _LIGHT_fg_very_dim 36 | *color23: _LIGHT_fg_super_dim 37 | *color24: _LIGHT_bg_accent 38 | 39 | *color25: _LIGHT_hl_color 40 | *color26: _LIGHT_select_color 41 | 42 | #else 43 | 44 | colorscheme.name: dark 45 | 46 | *color0: _DARK_black 47 | *color1: _DARK_red 48 | *color2: _DARK_green 49 | *color3: _DARK_yellow 50 | *color4: _DARK_blue 51 | *color5: _DARK_magenta 52 | *color6: _DARK_cyan 53 | *color7: _DARK_white 54 | 55 | *color8: _DARK_black_bright 56 | *color9: _DARK_red_bright 57 | *color10: _DARK_green_bright 58 | *color11: _DARK_yellow_bright 59 | *color12: _DARK_blue_bright 60 | *color13: _DARK_magenta_bright 61 | *color14: _DARK_cyan_bright 62 | *color15: _DARK_white_bright 63 | 64 | *color16: _DARK_orange 65 | *color17: _DARK_orange_bright 66 | 67 | *color18: _DARK_fg_color 68 | *color19: _DARK_bg_color 69 | *color20: _DARK_cursor_color 70 | 71 | *color21: _DARK_fg_dim 72 | *color22: _DARK_fg_very_dim 73 | *color23: _DARK_fg_super_dim 74 | *color24: _DARK_bg_accent 75 | 76 | *color25: _DARK_hl_color 77 | *color26: _DARK_select_color 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /git/gitk: -------------------------------------------------------------------------------- 1 | set mainfont {{Lucida Grande} 9} 2 | set textfont {Monaco 9} 3 | set uifont {{Lucida Grande} 9 bold} 4 | set tabstop 8 5 | set findmergefiles 0 6 | set maxgraphpct 50 7 | set maxwidth 16 8 | set cmitmode patch 9 | set wrapcomment none 10 | set autoselect 1 11 | set autosellen 40 12 | set showneartags 1 13 | set maxrefs 20 14 | set visiblerefs {"master"} 15 | set hideremotes 0 16 | set showlocalchanges 1 17 | set datetimeformat {%Y-%m-%d %H:%M:%S} 18 | set limitdiffs 1 19 | set uicolor grey85 20 | set want_ttk 1 21 | set bgcolor white 22 | set fgcolor black 23 | set uifgcolor black 24 | set uifgdisabledcolor #999 25 | set colors {"#00ff00" red blue magenta darkgrey brown orange} 26 | set diffcolors {red "#00a000" blue} 27 | set mergecolors {red blue "#00ff00" purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"} 28 | set markbgcolor #e0e0ff 29 | set diffcontext 3 30 | set selectbgcolor gray85 31 | set foundbgcolor yellow 32 | set currentsearchhitbgcolor orange 33 | set extdifftool opendiff 34 | set perfile_attrs 0 35 | set headbgcolor #00ff00 36 | set headfgcolor black 37 | set headoutlinecolor black 38 | set remotebgcolor #ffddaa 39 | set tagbgcolor yellow 40 | set tagfgcolor black 41 | set tagoutlinecolor black 42 | set reflinecolor black 43 | set filesepbgcolor #aaaaaa 44 | set filesepfgcolor black 45 | set linehoverbgcolor #ffff80 46 | set linehoverfgcolor black 47 | set linehoveroutlinecolor black 48 | set mainheadcirclecolor yellow 49 | set workingfilescirclecolor red 50 | set indexcirclecolor #00ff00 51 | set circlecolors {white blue gray blue blue} 52 | set linkfgcolor blue 53 | set circleoutlinecolor black 54 | set geometry(main) 1276x755+4+23 55 | set geometry(state) zoomed 56 | set geometry(topwidth) 1276 57 | set geometry(topheight) 165 58 | set geometry(pwsash0) "366 1" 59 | set geometry(pwsash1) "550 1" 60 | set geometry(botwidth) 457 61 | set geometry(botheight) 585 62 | set permviews {} 63 | -------------------------------------------------------------------------------- /nvim/plugins/find/plugin/find.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: find.vim 3 | " Description: Find files in the current working directory 4 | " Mantainer: github.com/gcmt 5 | " License: MIT 6 | " ============================================================================ 7 | 8 | if exists('g:find_loaded') || &cp 9 | finish 10 | end 11 | let g:find_loaded = 1 12 | 13 | " Search for files that match the given pattern. 14 | " Without arguments, the last search results are shown. 15 | command! -bang -nargs=* -complete=custom,find_preview Find call find(, ) 16 | 17 | " Search for files that contain the given pattern. 18 | command! -bang -nargs=* -complete=custom,findg_preview Findg call findg(, ) 19 | 20 | func s:find(bang, args) 21 | let args = join(split(a:args), '.*') 22 | let path = empty(a:bang) ? getcwd() : expand('%:p:h') 23 | call find#find(path, args) 24 | endf 25 | 26 | func s:findg(bang, args) 27 | let path = empty(a:bang) ? getcwd() : expand('%:p:h') 28 | call find#findg(path, a:args) 29 | endf 30 | 31 | func s:find_preview(ArgLead, CmdLine, CursorPos) 32 | let cmd = split(a:CmdLine) 33 | let bang = matchstr(cmd[0], '\v!$') 34 | call s:find(bang, join(cmd[1:])) 35 | redraw | return '' 36 | endf 37 | 38 | func s:findg_preview(ArgLead, CmdLine, CursorPos) 39 | let cmd = split(a:CmdLine) 40 | let bang = matchstr(cmd[0], '\v!$') 41 | call s:findg(bang, join(cmd[1:])) 42 | redraw | return '' 43 | endf 44 | 45 | let s:options = { 46 | \ 'max_winsize': 50, 47 | \ 'max_results': 100, 48 | \ } 49 | 50 | for [s:option, s:default] in items(s:options) 51 | let g:find_{s:option} = get(g:, 'find_'.s:option, s:default) 52 | endfor 53 | 54 | func s:setup_colors() 55 | hi default link FindDim Comment 56 | endf 57 | 58 | call s:setup_colors() 59 | 60 | aug _find 61 | au BufWritePost .vimrc call setup_colors() 62 | au Colorscheme * call setup_colors() 63 | aug END 64 | -------------------------------------------------------------------------------- /nvim/snippets/rst.snippets: -------------------------------------------------------------------------------- 1 | # rst 2 | 3 | snippet : 4 | :${1:field name}: $0 5 | snippet * 6 | *${1:Emphasis}* ${0} 7 | snippet ** 8 | **${1:Strong emphasis}** ${0} 9 | snippet _ 10 | \`${1:hyperlink-name}\`_ 11 | .. _\`$1\`: ${0:link-block} 12 | snippet = 13 | ${1:Title} 14 | =====${2:=} 15 | ${0} 16 | snippet - 17 | ${1:Title} 18 | -----${2:-} 19 | ${0} 20 | #some directive 21 | snippet img: 22 | .. |${1:alias}| image:: ${0:img} 23 | snippet fig: 24 | .. figure:: ${1:img} 25 | :alt: ${2:alter text} 26 | 27 | $0 28 | snippet con: 29 | .. contents:: ${1:Table of Contents} 30 | 31 | ${0:content} 32 | snippet cod: 33 | .. code:: ${1:type} 34 | 35 | ${0:write some code} 36 | snippet tip: 37 | .. tip:: 38 | ${0:my tips} 39 | snippet not: 40 | .. note:: 41 | ${0:my notes} 42 | snippet war: 43 | .. warning:: 44 | ${0:attention!} 45 | snippet imp: 46 | .. important:: 47 | ${0:this is importatnt} 48 | snippet att: 49 | .. attention:: 50 | ${0:hey!} 51 | snippet dan: 52 | .. danger:: 53 | ${0:ah!} 54 | snippet err: 55 | .. error:: 56 | ${0:Error occur} 57 | snippet cau: 58 | .. caution:: 59 | ${0:Watch out!} 60 | #Sphinx only 61 | snippet sid: 62 | .. sidebar:: ${1:Title} 63 | 64 | ${0} 65 | snippet tod: 66 | .. todo:: 67 | ${0} 68 | snippet lis: 69 | .. list-table:: ${1:Title} 70 | :header-rows: 1 71 | :stub-columns: 0 72 | 73 | * - ${0:R1C1} 74 | - R1C2 75 | * - R2C1 76 | - R2C2 77 | snippet csv: 78 | .. csv-table:: ${1:Title} 79 | :header-rows: 1 80 | :stub-columns: 0 81 | 82 | ${0:R1C1}, R1C2 83 | R2C1, R2C2 84 | snippet toc: 85 | .. toctree:: 86 | :maxdepth: 2 87 | 88 | ${0} 89 | snippet dow: 90 | :download:\`${1:text} <${0:path}>\` 91 | snippet ref: 92 | :ref:\`${1:text} <${0:path}>\` 93 | snippet doc: 94 | :doc:\`${1:text} <${0:path}>\` 95 | # CJK optimize, CJK has no space between charaters 96 | snippet *c 97 | \ *${1:Emphasis}*\ ${0} 98 | snippet **c 99 | \ **${1:Strong emphasis}**\ ${0} 100 | 101 | # vim:set list noet sts=0 sw=4 ts=4: 102 | -------------------------------------------------------------------------------- /polybar/modules/timer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TIMER_START_TIME=0 4 | TIMER_STATE_FILE="$HOME/.cache/polybar-timer.state" 5 | TIMERS=(60 45 30 25 20 15 10 5 4 3 2 1) 6 | 7 | CURRENT_TIMER="$(cat "${TIMER_STATE_FILE}" 2>/dev/null)" 8 | if [ -z "${CURRENT_TIMER}" ]; then 9 | CURRENT_TIMER="30" 10 | fi 11 | 12 | format_time() { 13 | local sign out 14 | (( $1 >= 0 )) && sign="" || sign="-" 15 | local t=${1#-} 16 | local d=$(( t / 60 / 60 / 24 )) 17 | local h=$(( t / 60 / 60 % 24 )) 18 | local m=$(( t / 60 % 60 )) 19 | local s=$(( t % 60 )) 20 | (( s > 0 || m > 0 )) && out="${s}s" 21 | (( m > 0 || h > 0 )) && out="${m}m ${out}" 22 | (( h > 0 || d > 0 )) && out="${h}h ${out}" 23 | (( d > 0 )) && out="${d}d ${out}" 24 | (( s == 0 && m == 0 && h == 0 && d == 0 )) && out="0s" 25 | echo "${sign}${out}" 26 | } 27 | 28 | print_label() { 29 | local label remaining_time formatted_time 30 | case "${TIMER_START_TIME}" in 31 | 0) 32 | label=" timer" 33 | ;; 34 | *) 35 | remaining_time=$(( TIMER_START_TIME + CURRENT_TIMER * 60 - $(date +%s) )) 36 | formatted_time="$(format_time ${remaining_time})" 37 | if (( remaining_time > 0 )); then 38 | label=" ${formatted_time}" 39 | else 40 | label="%{F#ce7d86} ${formatted_time}%{F-}" 41 | fi 42 | ;; 43 | esac 44 | echo "%{A1:kill -USR1 $$:}%{A3:kill -USR2 $$:}${label}%{A}%{A}" 45 | } 46 | 47 | trap 'toggle_timer' USR1 48 | toggle_timer() { 49 | case "${TIMER_START_TIME}" in 50 | 0) TIMER_START_TIME=$(date +%s) ;; 51 | *) TIMER_START_TIME=0 ;; 52 | esac 53 | } 54 | 55 | trap 'choose_timer' USR2 56 | choose_timer() { 57 | local choice 58 | choice="$(IFS=$'\n'; echo "${TIMERS[*]}" | mouse-menu -width auto 2>/dev/null)" 59 | if [[ -n "${choice}" ]]; then 60 | CURRENT_TIMER="${choice}" 61 | TIMER_START_TIME=$(date +%s) 62 | echo -n "${CURRENT_TIMER}" > "${TIMER_STATE_FILE}" 63 | fi 64 | } 65 | 66 | main() { 67 | while true; do 68 | print_label 69 | sleep 1s & 70 | wait $! 71 | done 72 | } 73 | 74 | main 75 | -------------------------------------------------------------------------------- /x/Xresources.d/urxvt: -------------------------------------------------------------------------------- 1 | 2 | #ifdef LIGHT 3 | URxvt.foreground: _LIGHT_fg_color 4 | URxvt.background: _LIGHT_bg_color 5 | URxvt.borderColor: _LIGHT_bg_color 6 | URxvt.cursorColor: _LIGHT_cursor_color 7 | URxvt.highlightColor: _LIGHT_fg_super_dim 8 | #else 9 | URxvt.foreground: _DARK_fg_color 10 | URxvt.background: _DARK_bg_color 11 | URxvt.borderColor: _DARK_bg_color 12 | URxvt.cursorColor: _DARK_cursor_color 13 | URxvt.highlightColor: _DARK_fg_super_dim 14 | #endif 15 | 16 | URxvt.perl-ext-common: default,matcher,font-manager,message,focus 17 | 18 | URxvt.termName: xterm-256color 19 | URxvt.internalBorder: 10 20 | URxvt.scrollBar: false 21 | URxvt.saveLines: 8192 22 | URxvt.iso14755: false 23 | URxvt.pointerBlank: true 24 | 25 | ;URxvt.keysym.Shift-ISO_Left_Tab: eval:system('tmux select-window -t +') 26 | ;URxvt.keysym.Shift-Control-ISO_Left_Tab: eval:system('tmux select-window -t -') 27 | 28 | URxvt.keysym.Shift-Control-H: eval:system('tmux select-window -t -') 29 | URxvt.keysym.Shift-Control-L: eval:system('tmux select-window -t +') 30 | URxvt.keysym.Shift-Control-O: eval:system('tmux select-pane -t +') 31 | 32 | URxvt.keysym.Shift-Control-V: eval:paste_clipboard 33 | URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard 34 | URxvt.keysym.Shift-Control-K: eval:scroll_up_pages 1 35 | URxvt.keysym.Shift-Control-J: eval:scroll_down_pages 1 36 | 37 | URxvt.url-launcher: /usr/bin/xdg-open 38 | URxvt.matcher.button: S 1 39 | URxvt.matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-] 40 | URxvt.keysym.Shift-Control-S: matcher:select 41 | URxvt.keysym.Shift-Control-M: matcher:list 42 | 43 | URxvt.font: xft:Roboto Mono:size=12 44 | URxvt.boldFont: xft:Roboto Mono:size=12:style=bold 45 | URxvt.letterSpace: 2 46 | URxvt.lineSpace: 3 47 | 48 | URxvt.keysym.Control-equal: font-manager:reset 49 | URxvt.keysym.Control-underscore: font-manager:smaller 50 | URxvt.keysym.Control-plus: font-manager:larger 51 | URxvt.keysym.Control-parenleft: font-manager:prev 52 | URxvt.keysym.Control-parenright: font-manager:next 53 | 54 | URxvt.font-manager.font.1: xft:Roboto Mono:size=10 55 | URxvt.font-manager.font.2: xft:SF Mono:size=10 56 | URxvt.font-manager.font.3: xft:DejaVu Sans Mono:size=10 57 | URxvt.font-manager.font.4: xft:Source Code Variable:size=10 58 | -------------------------------------------------------------------------------- /i3/i3-choose-workspace: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import i3pie 6 | from html import escape 7 | from subprocess import run, PIPE 8 | 9 | 10 | CW_NORM = 8 # character width in px for mono fonts size 10 11 | CW_BOLD = 9 # character width in px for bold mono fonts size 10 12 | 13 | 14 | # Try to estimate the correct width of a string in pixels. 15 | # Since the listview does not adapt to its content when elements are stacked 16 | # horizontally, we need to manually estimate the correct window width. 17 | def pixels(s, bold=False): 18 | px = CW_BOLD if bold else CW_NORM 19 | return len(s) * px 20 | 21 | 22 | def rofi(workspaces, current): 23 | 24 | width = 1 25 | lines = [] 26 | selected = 0 27 | hpadding = 40 28 | vpadding = 20 29 | 30 | for i, workspace in enumerate(workspaces): 31 | if workspace is current: 32 | selected = i 33 | width += hpadding * 2 + pixels(workspace.name) 34 | lines.append(escape(workspace.name)) 35 | 36 | style = ['-theme', 'main-light'] 37 | style += ['-theme-str', f'window {{ width: {width}px; }}'] 38 | style += ['-theme-str', 'mainbox { children: [ listview ]; }'] 39 | style += ['-theme-str', 'listview { layout: horizontal; }'] 40 | style += ['-theme-str', f'element {{ font: "Noto Mono 10"; padding: {vpadding} {hpadding}; }}'] 41 | 42 | options = ['-dmenu', '-format', 'i', '-no-custom'] 43 | options += ['-markup-rows', '-selected-row', str(selected)] 44 | options += ['-kb-row-up', 'h', '-kb-row-down', 'l,m,Super+i'] 45 | options += ['-kb-accept-entry', 'j,k,Down,Up,Return', '-kb-cancel', 'Escape,q'] 46 | 47 | input = "\n".join(lines) 48 | cmd = ['rofi'] + options + style 49 | proc = run(cmd, input=input, stdout=PIPE, encoding='utf8') 50 | 51 | return proc.stdout.strip(), proc.returncode 52 | 53 | 54 | def main(i3): 55 | 56 | tree = i3.get_tree() 57 | workspaces = list(tree.workspaces()) 58 | current = tree.current_workspace() 59 | 60 | choice, _ = rofi(workspaces, current) 61 | if not choice: 62 | sys.exit(0) 63 | 64 | workspaces[int(choice)].command('focus') 65 | 66 | 67 | if __name__ == '__main__': 68 | with i3pie.Connection() as i3: 69 | main(i3) 70 | -------------------------------------------------------------------------------- /ranger/plugins/choose.py: -------------------------------------------------------------------------------- 1 | 2 | import ranger 3 | from ranger.api.commands import Command 4 | 5 | 6 | HOOK_INIT_OLD = ranger.api.hook_init 7 | 8 | 9 | class choose(Command): 10 | """:choose 11 | 12 | This command mimicks the behavior of the command 'move right=1', but 13 | it overrides the normal --choosefile[s] behavior to also write additional meta 14 | information to the given file. 15 | 16 | To be used in conjuntion with the ranger vim plugin and the --choosefile[s] option. 17 | This command is supposed to be called from a mapping. 18 | 19 | Meta line format: #meta 20 | """ 21 | 22 | def execute(self): 23 | 24 | if not ranger.args.choosefiles and not ranger.args.choosefile: 25 | self.fm.notify('Ranger was expected to be run with the --choosefile[s] option', bad=True) 26 | return 27 | 28 | if self.fm.thisfile.is_directory: 29 | self.fm.thistab.enter_dir(self.fm.thisfile) 30 | return 31 | 32 | data = self.rest(1) 33 | meta = "#meta " + data + "\n" if data else "" 34 | 35 | if ranger.args.choosefile: 36 | 37 | with open(ranger.args.choosefile, 'w') as f: 38 | f.write(meta + self.fm.thisfile.path) 39 | 40 | if ranger.args.choosefiles: 41 | 42 | # thistab.get_selection() returns the file under cursor if there is no 43 | # marked file. When there are marked files, in the current directory or 44 | # elsewhere, we don't want to return it unless it's marked as well. 45 | 46 | paths = set(f.path for hist in self.fm.thistab.history for f in hist.files if f.marked) 47 | if self.fm.thisdir.marked_items: 48 | paths.update(f.path for f in self.fm.thistab.get_selection()) 49 | 50 | if not paths: 51 | paths.add(self.fm.thisfile.path) 52 | 53 | with open(ranger.args.choosefiles, 'w') as f: 54 | f.write(meta + '\n'.join(paths)) 55 | 56 | raise SystemExit 57 | 58 | 59 | def hook_init(fm): 60 | if not ranger.args.choosefiles and not ranger.args.choosefile: 61 | del fm.commands.commands['choose'] 62 | return HOOK_INIT_OLD(fm) 63 | 64 | 65 | ranger.api.hook_init = hook_init 66 | -------------------------------------------------------------------------------- /rofi/config.rasi: -------------------------------------------------------------------------------- 1 | configuration { 2 | show-icons: false; 3 | terminal: "wezterm"; 4 | ssh-client: "ssh"; 5 | ssh-command: "wezterm -e {ssh-client} {host}"; 6 | run-command: "{cmd}"; 7 | run-list-command: ""; 8 | run-shell-command: "wezterm -e {cmd}"; 9 | drun-match-fields: "name"; 10 | disable-history: false; 11 | case-sensitive: false; 12 | cycle: true; 13 | hover-select: false; 14 | auto-select: false; 15 | parse-hosts: false; 16 | parse-known-hosts: true; 17 | matching: "normal"; 18 | tokenize: true; 19 | filter: ""; 20 | dpi: -1; 21 | threads: 0; 22 | scroll-method: 0; 23 | click-to-exit: true; 24 | pid: "/run/user/1000/rofi.pid"; 25 | display-run: ""; 26 | display-ssh: "ssh"; 27 | display-drun: ""; 28 | kb-primary-paste: ""; 29 | kb-secondary-paste: "Control+V"; 30 | kb-clear-line: "Control+u"; 31 | kb-move-front: ""; 32 | kb-move-end: ""; 33 | kb-move-word-back: ""; 34 | kb-move-word-forward: ""; 35 | kb-move-char-back: "Left"; 36 | kb-move-char-forward: "Right"; 37 | kb-remove-word-back: "Control+w"; 38 | kb-remove-word-forward: ""; 39 | kb-remove-char-forward: ""; 40 | kb-remove-char-back: "BackSpace,Control+h"; 41 | kb-remove-to-eol: ""; 42 | kb-remove-to-sol: ""; 43 | kb-accept-entry: "Control+d,Return"; 44 | kb-accept-custom: "Shift+Return"; 45 | kb-accept-alt: ""; 46 | kb-delete-entry: ""; 47 | kb-mode-next: ""; 48 | kb-mode-previous: ""; 49 | kb-row-left: ""; 50 | kb-row-right: ""; 51 | kb-row-up: "Up,Control+k"; 52 | kb-row-down: "Down,Control+j"; 53 | kb-page-prev: ""; 54 | kb-page-next: ""; 55 | kb-row-first: ""; 56 | kb-row-last: ""; 57 | kb-row-select: "Control+f"; 58 | kb-screenshot: ""; 59 | kb-toggle-case-sensitivity: ""; 60 | kb-toggle-sort: ""; 61 | kb-cancel: "Escape,Control+c"; 62 | kb-custom-1: "Alt+1"; 63 | kb-custom-2: "Alt+2"; 64 | kb-custom-3: "Alt+3"; 65 | kb-custom-4: "Alt+4"; 66 | kb-custom-5: "Alt+5"; 67 | kb-custom-6: "Alt+6"; 68 | kb-custom-7: "Alt+7"; 69 | kb-custom-8: "Alt+8"; 70 | kb-custom-9: "Alt+9"; 71 | kb-custom-10: "Alt+0"; 72 | kb-custom-11: "Alt+exclam"; 73 | kb-custom-12: "Alt+at"; 74 | kb-custom-13: "Alt+numbersign"; 75 | kb-custom-14: "Alt+dollar"; 76 | kb-custom-15: "Alt+percent"; 77 | kb-custom-16: "Alt+dead_circumflex"; 78 | kb-custom-17: "Alt+ampersand"; 79 | kb-custom-18: "Alt+asterisk"; 80 | kb-custom-19: "Alt+parenleft"; 81 | me-select-entry: ""; 82 | me-accept-entry: "MousePrimary"; 83 | } 84 | 85 | @theme "main-light" 86 | -------------------------------------------------------------------------------- /nvim/snippets/vim.snippets: -------------------------------------------------------------------------------- 1 | snippet header standard Vim script file header 2 | " File: ${1:`expand('%:t')`} 3 | " Author: ${2:`g:snips_author`} 4 | " Description: ${3} 5 | ${0:" Last Modified: `strftime("%B %d, %Y")`} 6 | snippet guard script reload guard 7 | if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} 8 | finish 9 | endif 10 | let $1 = 1${0} 11 | snippet f function 12 | fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) 13 | ${0} 14 | endf 15 | snippet t try ... catch statement 16 | try 17 | ${1:${VISUAL}} 18 | catch ${2} 19 | ${0} 20 | endtry 21 | snippet for for ... in loop 22 | for ${1} in ${2} 23 | ${0:${VISUAL}} 24 | endfor 25 | snippet forkv for [key, value] in loop 26 | for [${1},${2}] in items(${3}) 27 | ${0} 28 | unlet $1 $2 29 | endfor 30 | snippet wh while loop 31 | while ${1} 32 | ${0:${VISUAL}} 33 | endw 34 | snippet if if statement 35 | if ${1} 36 | ${0:${VISUAL}} 37 | endif 38 | snippet ife if ... else statement 39 | if ${1} 40 | ${2:${VISUAL}} 41 | else 42 | ${0} 43 | endif 44 | snippet au augroup ... autocmd block 45 | augroup ${1:AU_NAME} 46 | autocmd! 47 | autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} 48 | augroup END 49 | snippet auv augroupvisual ... autocmd block with visual placeholder 50 | augroup ${1:AU_NAME} 51 | autocmd! 52 | ${0:${VISUAL}} 53 | augroup END 54 | snippet bun Vundle.vim Plugin definition 55 | Plugin '${0}' 56 | snippet plug vim-plug Plugin definition 57 | Plug '${0}' 58 | snippet plugdo vim-plug Plugin definition with { 'do': '' } 59 | Plug '${1}', { 'do': '${0}' } 60 | snippet plugon vim-plug Plugin definition with { 'on': '' } 61 | Plug '${1}', { 'on': '${0}' } 62 | snippet plugfor vim-plug Plugin definition with { 'for': '' } 63 | Plug '${1}', { 'for': '${0}' } 64 | snippet plugbr vim-plug Plugin definition with { 'branch': '' } 65 | Plug '${1}', { 'branch': '${0}' } 66 | snippet plugtag vim-plug Plugin definition with { 'tag': '' } 67 | Plug '${1}', { 'tag': '${0}' } 68 | snippet let 69 | let ${1:variable} = ${0: value} 70 | snippet se 71 | set ${1:setting}; 72 | snippet set 73 | set ${1:setting} = ${0:value} 74 | snippet nn 75 | nnoremap ${1} ${2} 76 | snippet no 77 | noremap ${1} ${2} 78 | snippet vm 79 | vmap ${1} ${2} 80 | snippet im 81 | imap ${1} ${2} 82 | snippet exe 83 | execute ${1} 84 | snippet filename 85 | `Filename()` 86 | -------------------------------------------------------------------------------- /polybar/modules/datetime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TIMER_START_TIME=0 4 | DATETIME_STATE_FILE="$HOME/.cache/polybar-datetime.state" 5 | FORMATS=(def sec utc est pst) 6 | 7 | CURRENT_FMT="$(cat "${DATETIME_STATE_FILE}" 2>/dev/null)" 8 | if [ -z "${CURRENT_FMT}" ]; then 9 | CURRENT_FMT="${FORMATS[0]}" 10 | fi 11 | 12 | format_time() { 13 | local sign out 14 | (( $1 >= 0 )) && sign="" || sign="-" 15 | local t=${1#-} 16 | local d=$(( t / 60 / 60 / 24 )) 17 | local h=$(( t / 60 / 60 % 24 )) 18 | local m=$(( t / 60 % 60 )) 19 | local s=$(( t % 60 )) 20 | (( s > 0 || m > 0 )) && out="${s}s" 21 | (( m > 0 || h > 0 )) && out="${m}m ${out}" 22 | (( h > 0 || d > 0 )) && out="${h}h ${out}" 23 | (( d > 0 )) && out="${d}d ${out}" 24 | (( s == 0 && m == 0 && h == 0 && d == 0 )) && out="0s" 25 | echo "${sign}${out}" 26 | } 27 | 28 | print_label() { 29 | local label_time label_timer elapsed_time 30 | case "${CURRENT_FMT}" in 31 | def) label_time=$(date +"%a %d %H:%M") ;; 32 | sec) label_time=$(date +"%a %d %H:%M:%S") ;; 33 | utc) label_time=$(date -u +"%a %d %H:%M UTC") ;; 34 | est) label_time=$(TZ=America/New_York date +"%a %d %H:%M EST") ;; 35 | pst) label_time=$(TZ=America/Los_Angeles date +"%a %d %H:%M PST") ;; 36 | *) label_time="unknown format" ;; 37 | esac 38 | case "${TIMER_START_TIME}" in 39 | 0) 40 | label_timer="" 41 | ;; 42 | *) 43 | elapsed_time="$(format_time $(( $(date +%s) - TIMER_START_TIME )))" 44 | label_timer=" %{F#999}|%{F-}  ${elapsed_time}" 45 | ;; 46 | esac 47 | echo "%{A1:kill -USR1 $$:}%{A3:kill -USR2 $$:}${label_time}${label_timer}%{A}%{A}" 48 | } 49 | 50 | trap 'toggle_timer' USR2 51 | toggle_timer() { 52 | case "${TIMER_START_TIME}" in 53 | 0) TIMER_START_TIME=$(date +%s) ;; 54 | *) TIMER_START_TIME=0 ;; 55 | esac 56 | } 57 | 58 | trap 'next_format' USR1 59 | next_format() { 60 | local len=${#FORMATS[@]} 61 | for i in "${!FORMATS[@]}"; do 62 | if [[ "${FORMATS[$i]}" == "${CURRENT_FMT}" ]]; then 63 | CURRENT_FMT="${FORMATS[$(((i + 1) % len))]}" 64 | break 65 | fi 66 | done 67 | } 68 | 69 | trap 'save_state' 0 70 | save_state() { 71 | echo -n "${CURRENT_FMT}" > "${DATETIME_STATE_FILE}" 72 | } 73 | 74 | main() { 75 | while true; do 76 | print_label 77 | sleep 1s & 78 | wait $! 79 | done 80 | } 81 | 82 | main 83 | -------------------------------------------------------------------------------- /nvim/plugins/grep/autoload/grep.vim: -------------------------------------------------------------------------------- 1 | 2 | func! s:run(cmd, args) 3 | 4 | " https://github.com/mileszs/ack.vim/issues/18 5 | let t_ti_save = &t_ti 6 | let t_te_save = &t_te 7 | set t_ti= t_te= 8 | let sp_save = &shellpipe 9 | set shellpipe=> 10 | 11 | sil! exec a:cmd a:args 12 | 13 | let &shellpipe = sp_save 14 | let &t_ti = t_ti_save 15 | let &t_te = t_te_save 16 | 17 | endf 18 | 19 | func! grep#grep(grepcmd, args) abort 20 | 21 | call s:run(a:grepcmd, a:args) 22 | 23 | if len(getqflist()) == 0 24 | call s:err("Nothing found") 25 | cclose 26 | else 27 | copen 28 | end 29 | 30 | endf 31 | 32 | func! grep#grep_buffer(grepcmd, bang, args) abort 33 | 34 | let args = a:grepcmd =~ 'vim' ? '/'.a:args.'/' : a:args 35 | let args .= ' ' . expand((&filetype == 'qf' ? '#' : '%').':p') 36 | call s:run(a:grepcmd, args) 37 | 38 | if !empty(a:bang) 39 | " remove matches in comments or strings 40 | let qf = getqflist({'all': 1}) 41 | let Fn = {i, entry -> s:synat(entry['lnum'], entry['col']) !~ '\v(String|Comment)'} 42 | call filter(qf.items, Fn) 43 | call setqflist([], 'r', qf) 44 | end 45 | 46 | if len(getqflist()) == 0 47 | call s:err("Nothing found") 48 | cclose 49 | else 50 | call setqflist([], 'a', {'context': {'prettify': 1}}) 51 | copen 52 | end 53 | 54 | endf 55 | 56 | func! s:prettify(...) abort 57 | let context = getqflist({'context': 1}).context 58 | if type(context) != v:t_dict || !get(context, 'prettify', 0) 59 | return 60 | end 61 | syn clear 62 | setl nolist modifiable 63 | let qf = getqflist() 64 | let width = len(max(map(copy(qf), 'v:val["lnum"]'))) 65 | let b:grep_numbers = a:0 > 0 ? a:1 : get(b:, 'grep_numbers', 1) 66 | for i in range(len(qf)) 67 | let num = printf("%".width."s ", qf[i].lnum) 68 | let line = (b:grep_numbers ? num : "") . qf[i].text 69 | call setline(i+1, line) 70 | endfor 71 | setl nomodifiable nomodified 72 | call matchadd('LineNr', '\v^\s*\d+') 73 | nnoremap a :call prettify(1-b:grep_numbers) 74 | endf 75 | 76 | func! s:synat(line, col) 77 | return synIDattr(synIDtrans(synID(a:line, a:col, 0)), 'name') 78 | endf 79 | 80 | func! s:err(msg) 81 | echohl WarningMsg | echo a:msg | echohl None 82 | endf 83 | 84 | aug _grep 85 | au! 86 | au BufWinEnter quickfix call s:prettify() 87 | au User QuickFixEditPost call s:prettify() 88 | aug END 89 | -------------------------------------------------------------------------------- /urxvt/ext/font-manager: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use warnings; 4 | 5 | sub on_action { 6 | my ($term, $cmd) = @_; 7 | 8 | if ($cmd eq "show") { 9 | show_msg($term, $term->resource('font')); 10 | } 11 | elsif ($cmd eq "reset") { 12 | reset_font_size($term); 13 | } 14 | elsif ($cmd eq "smaller") { 15 | change_font_size($term, -0.5); 16 | } 17 | elsif ($cmd eq "larger") { 18 | change_font_size($term, +0.5); 19 | } 20 | elsif ($cmd eq "next" || $cmd eq "prev") { 21 | next_font($term, $cmd); 22 | } 23 | 24 | return () 25 | } 26 | 27 | sub next_font { 28 | my ($term, $direction) = @_; 29 | my $step = $direction eq 'next' ? 1 : -1; 30 | my $current_font = $term->resource('font'); 31 | my $current_font_name = $current_font =~ m/xft:([^:]+)/ && $1; 32 | my $current_font_size = $current_font =~ m/size=([0-9.]+)/ && $1; 33 | my @fonts = get_font_list($term); 34 | for my $i (0 .. $#fonts) { 35 | my $font_name = $fonts[$i] =~ m/xft:([^:]+)/ && $1; 36 | if ($font_name eq $current_font_name) { 37 | my $new_font = $fonts[($i+$step) % @fonts]; 38 | $new_font =~ s/size=([0-9.]+)/'size='.$current_font_size/e; 39 | set_font($term, $new_font); 40 | last; 41 | } 42 | } 43 | } 44 | 45 | sub reset_font_size { 46 | my ($term) = @_; 47 | my $current_font = $term->resource('font'); 48 | my $current_font_name = $current_font =~ m/xft:([^:]+)/ && $1; 49 | for my $font (get_font_list($term)) { 50 | my $font_name = $font =~ m/xft:([^:]+)/ && $1; 51 | if ($font_name eq $current_font_name) { 52 | my $default_size = $font =~ m/size=([0-9.]+)/ && $1; 53 | $current_font =~ s/size=([0-9.]+)/'size='.$default_size/e; 54 | set_font($term, $current_font); 55 | last; 56 | } 57 | } 58 | } 59 | 60 | sub change_font_size { 61 | my ($term, $delta) = @_; 62 | my $font = $term->resource('font'); 63 | $font =~ s/size=([0-9.]+)/'size=' . ($1+$delta >= 5 ? $1+$delta : $1)/e; 64 | set_font($term, $font); 65 | } 66 | 67 | sub set_font { 68 | my ($term, $font) = @_; 69 | display_font($term, $font); 70 | $term->resource('font', $font); 71 | $term->cmd_parse("\e]710;$font\a\e]711;$font:style=bold\a"); 72 | } 73 | 74 | sub get_font_list { 75 | my ($term) = @_; 76 | my @fonts = ($term->x_resource('font')); 77 | for (my $i = 1; defined(my $res = $term->x_resource("%.font.$i")); $i++) { 78 | push(@fonts, $res); 79 | } 80 | return @fonts; 81 | } 82 | 83 | sub display_font { 84 | my ($term, $font) = @_; 85 | my $font_name = $font =~ m/xft:([^:]+)/ && $1; 86 | my $font_size = $font =~ m/size=([0-9.]+)/ && $1; 87 | $term->cmd_parse("\e]777;message;2;0;$font_name $font_size\a"); 88 | } 89 | 90 | # vim: ft=perl 91 | -------------------------------------------------------------------------------- /nvim/snippets/sh.snippets: -------------------------------------------------------------------------------- 1 | # Shebang 2 | snippet #! 3 | #!/bin/sh 4 | 5 | snippet s#! 6 | #!/bin/sh 7 | set -eu 8 | 9 | snippet safe 10 | set -eu 11 | 12 | snippet bash 13 | #!/usr/bin/env bash 14 | 15 | snippet sbash 16 | #!/usr/bin/env bash 17 | set -euo pipefail 18 | IFS=$'\n\t' 19 | 20 | snippet if 21 | if [ $1 ]; then 22 | ${0:${VISUAL}} 23 | fi 24 | snippet elif 25 | elif [ $1 ]; then 26 | ${0:${VISUAL}} 27 | snippet for 28 | for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do 29 | ${0:${VISUAL}} 30 | done 31 | snippet fori 32 | for ${1:needle} in ${2:haystack} ; do 33 | ${0:${VISUAL}} 34 | done 35 | snippet wh 36 | while [ $1 ]; do 37 | ${0:${VISUAL}} 38 | done 39 | snippet wht 40 | while true; do 41 | ${0:${VISUAL}} 42 | done 43 | snippet until 44 | until [ $1 ]; do 45 | ${0:${VISUAL}} 46 | done 47 | snippet case 48 | case ${1:word} in 49 | ${2:pattern}) 50 | ${0};; 51 | esac 52 | snippet go 53 | while getopts '${1:o}' ${2:opts} 54 | do 55 | case $$2 in 56 | ${3:o0}) 57 | ${0:#staments};; 58 | esac 59 | done 60 | # Set SCRIPT_DIR variable to directory script is located. 61 | snippet sdir 62 | SCRIPT_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )" 63 | # getopt 64 | snippet getopt 65 | __ScriptVersion="${1:version}" 66 | 67 | #=== FUNCTION ================================================================ 68 | # NAME: usage 69 | # DESCRIPTION: Display usage information. 70 | #=============================================================================== 71 | function usage () 72 | { 73 | echo "Usage : \$${0:0} [options] [--] 74 | 75 | Options: 76 | -h|help Display this message 77 | -v|version Display script version" 78 | 79 | } # ---------- end of function usage ---------- 80 | 81 | #----------------------------------------------------------------------- 82 | # Handle command line arguments 83 | #----------------------------------------------------------------------- 84 | 85 | while getopts ":hv" opt 86 | do 87 | case \$opt in 88 | 89 | h|help ) usage; exit 0 ;; 90 | 91 | v|version ) echo "\$${0:0} -- Version \$__ScriptVersion"; exit 0 ;; 92 | 93 | * ) echo -e "\\n Option does not exist : \$OPTARG\\n" 94 | usage; exit 1 ;; 95 | 96 | esac # --- end of case --- 97 | done 98 | shift \$(($OPTIND-1)) 99 | snippet root 100 | if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi 101 | 102 | snippet fun-sh 103 | ${1:function_name}() { 104 | $0 105 | } 106 | 107 | snippet fun 108 | function ${1:function_name}() { 109 | $0 110 | } 111 | -------------------------------------------------------------------------------- /rofi/term-base.rasi: -------------------------------------------------------------------------------- 1 | 2 | * { 3 | font: "Noto Mono Patched 10"; 4 | } 5 | 6 | /* Containers 7 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8 | 9 | window { 10 | location: center; 11 | anchor: center; 12 | width: 40%; 13 | } 14 | 15 | 16 | mainbox { 17 | background-color: @background; 18 | } 19 | 20 | /* Input bar 21 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 22 | 23 | inputbar { 24 | text-color: @normal-foreground; 25 | background-color: @inputbar-background; 26 | padding: 12 12; 27 | } 28 | 29 | prompt { 30 | text-color: @normal-foreground; 31 | } 32 | 33 | entry { 34 | text-color: @normal-foreground; 35 | } 36 | 37 | case-indicator { 38 | text-color: @normal-foreground; 39 | } 40 | 41 | /* Message 42 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 43 | 44 | message { 45 | padding: 6 12; 46 | } 47 | 48 | textbox { 49 | text-color: @foreground; 50 | } 51 | 52 | /* Scrollbar 53 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 54 | 55 | scrollbar { 56 | width: 4; 57 | handle-color: @scrollbar-color; 58 | handle-width: 2; 59 | } 60 | 61 | /* Listview 62 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 63 | 64 | listview { 65 | lines: 8; 66 | fixed-height: false; 67 | scrollbar: true; 68 | spacing: 0; 69 | } 70 | 71 | element { 72 | border: 0px 0px 0px solid; 73 | border-color: @separator-color; 74 | padding: 6 12; 75 | } 76 | 77 | element.normal.normal { 78 | background-color: @normal-background; 79 | text-color: @normal-foreground; 80 | } 81 | 82 | element.normal.urgent { 83 | background-color: @urgent-background; 84 | text-color: @urgent-foreground; 85 | } 86 | 87 | element.normal.active { 88 | background-color: @active-background; 89 | text-color: @active-foreground; 90 | } 91 | 92 | element.selected.normal { 93 | background-color: @selected-normal-background; 94 | text-color: @selected-normal-foreground; 95 | } 96 | 97 | element.selected.urgent { 98 | background-color: @selected-urgent-background; 99 | text-color: @selected-urgent-foreground; 100 | } 101 | 102 | element.selected.active { 103 | background-color: @selected-active-background; 104 | text-color: @selected-active-foreground; 105 | } 106 | 107 | element.alternate.normal { 108 | background-color: @alternate-normal-background; 109 | text-color: @alternate-normal-foreground; 110 | } 111 | 112 | element.alternate.urgent { 113 | background-color: @alternate-urgent-background; 114 | text-color: @alternate-urgent-foreground; 115 | } 116 | 117 | element.alternate.active { 118 | background-color: @alternate-active-background; 119 | text-color: @alternate-active-foreground; 120 | } 121 | -------------------------------------------------------------------------------- /cmus/rc: -------------------------------------------------------------------------------- 1 | 2 | set aaa_mode=all 3 | set altformat_current= %F 4 | set altformat_playlist= %f%= %d 5 | set altformat_title=%f 6 | set altformat_trackwin= %f%= %d 7 | set auto_expand_albums_follow=true 8 | set auto_expand_albums_search=true 9 | set auto_expand_albums_selcur=true 10 | set auto_reshuffle=true 11 | set buffer_seconds=10 12 | set confirm_run=true 13 | set continue=true 14 | set device=/dev/cdrom 15 | set display_artist_sort_name=false 16 | set dsp.alsa.device= 17 | set dsp.jack.resampling_quality=2 18 | set dsp.jack.server_name= 19 | set dsp.oss.device= 20 | set follow=false 21 | set format_current= %a - %l -%3n. %t%= %y 22 | set format_playlist= %-21%a %3n. %t%= %y %d %{?X!=0?%3X ? } 23 | set format_playlist_va= %-21%A %3n. %t (%a)%= %y %d %{?X!=0?%3X ? } 24 | set format_statusline= %{status} %{?show_playback_position?%{position} %{?duration?/ %{duration} }?%{?duration?%{duration} }}- %{total} %{?stream?buf: %{buffer} }%{?show_current_bitrate & bitrate>=0? %{bitrate} kbps }%=%{?repeat_current?repeat current?%{?play_library?%{playlist_mode} from %{?play_sorted?sorted }library?playlist}} | %1{continue}%1{follow}%1{repeat}%1{shuffle} 25 | set format_title=%a - %l - %t (%y) 26 | set format_trackwin=%3n. %t%= %y %d 27 | set format_trackwin_album= %l 28 | set format_trackwin_va=%3n. %t (%a)%= %y %d 29 | set format_treewin= %l 30 | set format_treewin_artist=%a 31 | set icecast_default_charset=ISO-8859-1 32 | set id3_default_charset=ISO-8859-1 33 | set lib_sort=albumartist date album title filename 34 | set mixer.alsa.channel= 35 | set mixer.alsa.device= 36 | set mixer.oss.channel=PCM 37 | set mixer.oss.device= 38 | set mixer.pulse.restore_volume=1 39 | set mouse=false 40 | set output_plugin=pulse 41 | set passwd= 42 | set pl_sort= 43 | set play_library=true 44 | set play_sorted=false 45 | set repeat=false 46 | set repeat_current=false 47 | set replaygain=disabled 48 | set replaygain_limit=true 49 | set replaygain_preamp=0.000000 50 | set resume=false 51 | set rewind_offset=5 52 | set scroll_offset=1 53 | set set_term_title=true 54 | set show_all_tracks=true 55 | set show_current_bitrate=false 56 | set show_hidden=false 57 | set show_playback_position=true 58 | set show_remaining_time=false 59 | set shuffle=false 60 | set skip_track_info=false 61 | set smart_artist_sort=true 62 | set softvol=false 63 | set softvol_state=0 0 64 | set status_display_program= 65 | set wrap_search=true 66 | 67 | colorscheme dark 68 | 69 | bind -f common K win-up 3 70 | bind -f common J win-down 3 71 | bind -f common Q quit 72 | bind -f common q shell tmux detach -s cmus 73 | bind -f common B shell tmux neww 'vim /usr/share/cmus/rc' 74 | 75 | fset 90s=date>=1990&date<2000 76 | fset classical=genre="Classical" 77 | fset missing-tag=!stream&(artist=""|album=""|title=""|tracknumber=-1|date=-1) 78 | fset mp3=filename="*.mp3" 79 | fset ogg=filename="*.ogg" 80 | fset ogg-or-mp3=ogg|mp3 81 | fset unheard=play_count=0 82 | -------------------------------------------------------------------------------- /urxvt/PKGBUILD: -------------------------------------------------------------------------------- 1 | _pkgname=rxvt-unicode 2 | pkgname=rxvt-unicode-patched 3 | pkgver=9.31 4 | pkgrel=1 5 | arch=('x86_64') 6 | url="http://software.schmorp.de/pkg/rxvt-unicode.html" 7 | license=('GPL') 8 | provides=(rxvt-unicode) 9 | conflicts=(rxvt-unicode) 10 | makedepends=( 11 | 'libxft' 12 | 'libxt' 13 | 'libxext' 14 | 'libxmu' 15 | 'perl' 16 | 'startup-notification' 17 | 'libnsl' 18 | 'libptytty' 19 | 'signify' 20 | ) 21 | source=( 22 | $_pkgname-$pkgver.tar.bz2 23 | 'urxvt.desktop' 24 | '256-colors.patch' 25 | 'font-width.patch' 26 | 'perl-5.38.patch' 27 | ) 28 | sha256sums=('aaa13fcbc149fe0f3f391f933279580f74a96fd312d6ed06b8ff03c2d46672e8' 29 | '195ef9c2babc7e9bcaffaceb9951406c01b7c27a19e43b4dfbd8441ad89f00d0' 30 | '2ec6d769b7d71861e5efbc6fb9cbf1e48374dea376bca82d2e7dc9867cb8d4a3' 31 | '66480b448271f28fde29861bb16c513c20d138a2dd19c68835141d9eb7a2dd22' 32 | '4bec0bf559a2eb6649e077b220fe25f532a8bc3da98ac519bc72a39b223e2cc4') 33 | 34 | prepare() { 35 | patch -d "${_pkgname}-${pkgver}" -p1 -i "${srcdir}/256-colors.patch" 36 | patch -d "${_pkgname}-${pkgver}" -p1 -i "${srcdir}/font-width.patch" 37 | patch -d "${_pkgname}-${pkgver}" -p1 -i "${srcdir}/perl-5.38.patch" 38 | } 39 | 40 | build() { 41 | cd "${_pkgname}-${pkgver}" 42 | # workaround ncurses --disable-root-access (FS#79143) 43 | export TIC="/usr/bin/tic -o${srcdir}/terminfo" 44 | ./configure \ 45 | --prefix=/usr \ 46 | --enable-256-color \ 47 | --enable-combining \ 48 | --enable-fading \ 49 | --enable-font-styles \ 50 | --enable-keepscrolling \ 51 | --enable-lastlog \ 52 | --enable-mousewheel \ 53 | --enable-next-scroll \ 54 | --enable-perl \ 55 | --enable-pointer-blank \ 56 | --enable-rxvt-scroll \ 57 | --enable-selectionscrolling \ 58 | --enable-slipwheeling \ 59 | --enable-startup-notification \ 60 | --enable-unicode3 \ 61 | --enable-utmp \ 62 | --enable-wtmp \ 63 | --enable-xft \ 64 | --enable-xim \ 65 | --enable-pixbuf \ 66 | --enable-frills \ 67 | --enable-xterm-scroll \ 68 | --disable-transparency \ 69 | --disable-smart-resize \ 70 | --disable-iso14755 \ 71 | make 72 | } 73 | 74 | package_rxvt-unicode-patched() { 75 | pkgdesc="Unicode enabled rxvt-clone terminal emulator (urxvt)" 76 | depends=( 77 | 'rxvt-unicode-terminfo' 78 | 'libxft' 79 | 'perl' 80 | 'startup-notification' 81 | 'libnsl' 82 | 'libptytty' 83 | 'libxext' 84 | 'libxmu' 85 | ) 86 | install -Dm 644 "urxvt.desktop" "${pkgdir}/usr/share/applications/urxvt.desktop" 87 | cd ${_pkgname}-${pkgver} 88 | make DESTDIR="${pkgdir}" install 89 | } 90 | 91 | 92 | package_rxvt-unicode-terminfo() { 93 | pkgdesc='Terminfo files for urxvt' 94 | conflict=('rxvt-unicode<=9.18-6') 95 | install -dm 755 "${pkgdir}/usr/share/" 96 | mv terminfo "${pkgdir}/usr/share/" 97 | } 98 | -------------------------------------------------------------------------------- /rofi/main-base.rasi: -------------------------------------------------------------------------------- 1 | 2 | /* Containers 3 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 4 | 5 | * { 6 | highlight: none; 7 | } 8 | 9 | window { 10 | font: "Noto Sans Regular 11"; 11 | location: center; 12 | anchor: center; 13 | width: 40%; 14 | border: 1px 1px 0 solid; 15 | border-color: @separator-color; 16 | } 17 | 18 | mainbox { 19 | } 20 | 21 | /* Message 22 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 23 | 24 | message { 25 | padding: 0 12 6; 26 | } 27 | 28 | textbox { 29 | text-color: @foreground; 30 | } 31 | 32 | /* Input bar 33 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 34 | 35 | inputbar { 36 | text-color: @foreground; 37 | padding: 12 12 6; 38 | } 39 | 40 | prompt { 41 | text-color: @foreground; 42 | enabled: false; 43 | } 44 | 45 | entry { 46 | text-color: @foreground; 47 | } 48 | 49 | case-indicator { 50 | text-color: @foreground; 51 | } 52 | 53 | /* Scrollbar 54 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 55 | 56 | scrollbar { 57 | handle-color: @scrollbar-color; 58 | handle-width: 2; 59 | } 60 | 61 | /* Listview 62 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 63 | 64 | listview { 65 | lines: 8; 66 | fixed-height: true; 67 | spacing: 0; 68 | scrollbar: true; 69 | } 70 | 71 | element { 72 | border: 0 0 1px solid; 73 | border-color: @separator-color; 74 | padding: 6 12; 75 | } 76 | 77 | element.normal.normal { 78 | background-color: @normal-background; 79 | text-color: @normal-foreground; 80 | } 81 | 82 | element.normal.urgent { 83 | background-color: @urgent-background; 84 | text-color: @urgent-foreground; 85 | } 86 | 87 | element.normal.active { 88 | background-color: @active-background; 89 | text-color: @active-foreground; 90 | } 91 | 92 | element.selected.normal { 93 | background-color: @selected-normal-background; 94 | text-color: @selected-normal-foreground; 95 | } 96 | 97 | element.selected.urgent { 98 | background-color: @selected-urgent-background; 99 | text-color: @selected-urgent-foreground; 100 | } 101 | 102 | element.selected.active { 103 | background-color: @selected-active-background; 104 | text-color: @selected-active-foreground; 105 | } 106 | 107 | element.alternate.normal { 108 | background-color: @alternate-normal-background; 109 | text-color: @alternate-normal-foreground; 110 | } 111 | 112 | element.alternate.urgent { 113 | background-color: @alternate-urgent-background; 114 | text-color: @alternate-urgent-foreground; 115 | } 116 | 117 | element.alternate.active { 118 | background-color: @alternate-active-background; 119 | text-color: @alternate-active-foreground; 120 | } 121 | 122 | element-text { 123 | background-color: inherit; 124 | text-color: inherit; 125 | } 126 | -------------------------------------------------------------------------------- /polybar/modules/kb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -u 2 | import argparse 3 | import hashlib 4 | import os 5 | from pathlib import Path 6 | from subprocess import PIPE, run 7 | 8 | DUNSTIFY_ID = "6688" 9 | DUNSTIFY_TIMEOUT = "5000" 10 | 11 | BIN = "kbset" 12 | BIN_PATH = os.path.expanduser("~") / Path(f".local/bin/{BIN}") 13 | SCRIPT_PATH = Path(os.path.realpath(__file__)) 14 | 15 | 16 | def print_settings(settings): 17 | print( 18 | f'%{{A3:{SCRIPT_PATH} -refresh:}}%{{A1:{SCRIPT_PATH} -edit-raw:}} {settings["layout"]}%{{A}}%{{A}}' 19 | ) 20 | 21 | 22 | def parse_args(): 23 | parser = argparse.ArgumentParser(description="Polybar KB module") 24 | parser.add_argument("-refresh", action="store_true", help="set kb settings") 25 | parser.add_argument("-edit-raw", action="store_true", help="edit settings with vim") 26 | return parser.parse_args() 27 | 28 | 29 | def _dunstify_cmd(): 30 | return ["dunstify", "-t", DUNSTIFY_TIMEOUT] 31 | 32 | 33 | def notify_settings(settings): 34 | settings = "\n".join(f"{setting}: {value}" for setting, value in settings.items()) 35 | cmd = _dunstify_cmd() + ["Keyboard settings", settings] 36 | run(cmd) 37 | 38 | 39 | def notify(msg, urgency="normal"): 40 | cmd = _dunstify_cmd() + ["-u", urgency, "Keyboard settings", msg] 41 | run(cmd) 42 | 43 | 44 | def edit_with_vim(path): 45 | old_hash = file_hash(path) 46 | cmd = ["wezterm", "start", "--class", "wez-floating", "-e", "nvim", path] 47 | run(cmd, stdout=PIPE, stderr=PIPE) 48 | new_hash = file_hash(path) 49 | return old_hash != new_hash 50 | 51 | 52 | def execute(bin): 53 | proc = run([bin], stderr=PIPE, stdout=PIPE, encoding="utf-8") 54 | if proc.returncode != 0: 55 | raise RuntimeError(proc.stderr.strip()) 56 | return proc.stdout.strip() 57 | 58 | 59 | def file_hash(path): 60 | with path.open("r") as f: 61 | return hashlib.md5(f.read().encode("utf-8")).hexdigest() 62 | 63 | 64 | def get_settings(): 65 | cmd = ["setxkbmap", "-query"] 66 | stdout = run(cmd, stdout=PIPE, encoding="utf8").stdout.strip() 67 | settings = {} 68 | for line in stdout.split("\n"): 69 | setting, value = line.split(": ") 70 | settings[setting.strip()] = value.strip() 71 | return settings 72 | 73 | 74 | def kbset(): 75 | try: 76 | stdout = execute(BIN) 77 | except RuntimeError as e: 78 | notify(str(e), urgency="critical") 79 | else: 80 | notify_settings(get_settings()) 81 | if stdout: 82 | notify(stdout) 83 | 84 | 85 | def main(): 86 | args = parse_args() 87 | 88 | if args.edit_raw: 89 | if edit_with_vim(BIN_PATH): 90 | kbset() 91 | 92 | elif args.refresh: 93 | kbset() 94 | 95 | print_settings(get_settings()) 96 | 97 | 98 | if __name__ == "__main__": 99 | main() 100 | -------------------------------------------------------------------------------- /i3/i3-move-to-workspace: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | ask_for_workspace() { 5 | 6 | local opts 7 | opts="-dmenu -p 'Move to' -theme 'i3-input'" 8 | opts+=" -kb-custom-1 'Control+Return'" 9 | 10 | local name rofi_exit 11 | name="$(echo | eval "rofi ${opts}")" 12 | rofi_exit=$? 13 | 14 | # strip whitespaces 15 | name="$(sed 's/\(\s\+$\|^\s\+\)//g' <<< "${name}")" 16 | 17 | if (( rofi_exit == 1 )); then 18 | exit 1 19 | fi 20 | 21 | if [[ -z "${name}" ]]; then 22 | # automatically pick a workspace when no name is given 23 | case ${rofi_exit} in 24 | 10) i3-move-to-workspace -auto -nofollow ;; 25 | *) i3-move-to-workspace -auto ;; 26 | esac 27 | else 28 | local follow=1 29 | if [[ "${name}" =~ ^_scratch$ || ${rofi_exit} == 10 ]]; then 30 | follow=0 31 | fi 32 | move_to_workspace "$name" "$follow" 33 | fi 34 | 35 | } 36 | 37 | 38 | move_to_workspace() { 39 | local target="$1" follow="$2" 40 | local cmd num 41 | if [[ "${target}" =~ ^[0-9]+$ ]]; then 42 | num="number" 43 | fi 44 | cmd="move to workspace ${num} \"${target}\"" 45 | if (( follow == 1 )); then 46 | cmd="${cmd}; workspace ${num} \"${target}\"" 47 | fi 48 | i3-msg "${cmd}" >/dev/null 49 | } 50 | 51 | 52 | first_available_workspace() { 53 | local num=1 54 | local workspaces="$(i3-msg -t get_workspaces | jq '.[] | .num')" 55 | while (( num < 10 )); do 56 | if ! grep -q "${num}" <<< "${workspaces}"; then 57 | echo "${num}" 58 | break 59 | fi 60 | (( num += 1 )) 61 | done 62 | } 63 | 64 | 65 | print_usage() { 66 | echo "Usage: $(basename "$0") [-ask] [-auto] [-nofollow] [WORKSPACE]" >&2 67 | } 68 | 69 | if (( $# == 0 )); then 70 | print_usage && exit 1 71 | fi 72 | 73 | ask=0 74 | auto=0 75 | next=0 76 | prev=0 77 | follow=1 78 | target= 79 | 80 | while (( $# )); do 81 | if [[ "$1" == "-nofollow" ]]; then 82 | follow=0 83 | elif [[ "$1" == "-auto" ]]; then 84 | auto=1 85 | elif [[ "$1" == "-ask" ]]; then 86 | ask=1 87 | elif [[ "$1" == "-next" ]]; then 88 | next=1 89 | elif [[ "$1" == "-prev" ]]; then 90 | prev=1 91 | elif [[ "$1" =~ ^[^-] ]]; then 92 | target="$1" 93 | elif [[ "$1" == "-help" ]]; then 94 | print_usage && exit 0 95 | else 96 | echo "Unknown option: $1" 1>&2 97 | print_usage && exit 1 98 | fi 99 | shift 100 | done 101 | 102 | if (( ask == 1 )); then 103 | ask_for_workspace 104 | else 105 | wsnum="$(i3-msg -t get_workspaces | jq -r '.[] | .name' | grep -cv '^_')" 106 | if (( auto == 1 )); then 107 | target="$(first_available_workspace)" 108 | elif (( wsnum == 1 && (next == 1 || prev == 1) )); then 109 | target="$(first_available_workspace)" 110 | elif (( next == 1 )); then 111 | target="$(i3-next-workspace -next -dry)" 112 | elif (( prev == 1 )); then 113 | target="$(i3-next-workspace -prev -dry)" 114 | fi 115 | if [[ -z "$target" ]]; then 116 | exit 1 117 | fi 118 | move_to_workspace "$target" "$follow" 119 | fi 120 | -------------------------------------------------------------------------------- /nvim/snippets/elm.snippets: -------------------------------------------------------------------------------- 1 | snippet mod 2 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1}) 3 | ${0} 4 | snippet imp 5 | import ${0:Http} 6 | snippet impe 7 | import ${1:Html} exposing (${0:..}) 8 | snippet impae 9 | import ${1:Json.Encode} as ${2:Encode} exposing (${0:Value}) 10 | snippet fn 11 | ${1:fn} : ${2:a} -> ${3:a} 12 | $1 ${4} = 13 | ${0} 14 | snippet fn1 15 | ${1:fn} : ${2:a} -> ${3:a} 16 | $1 ${4} = 17 | ${0} 18 | snippet fn2 19 | ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} 20 | $1 ${5} = 21 | ${0} 22 | snippet fn3 23 | ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} 24 | $1 ${6} = 25 | ${0} 26 | snippet fn0 27 | ${1:fn} : ${2:a} 28 | $1 = 29 | ${0} 30 | snippet case 31 | case ${1} of 32 | ${2} -> 33 | ${0} 34 | snippet - 35 | ${1} -> 36 | ${0} 37 | snippet let 38 | let 39 | ${1} = 40 | ${2} 41 | in 42 | ${0} 43 | snippet if 44 | if ${1} then 45 | ${2:${VISUAL}} 46 | else 47 | ${0} 48 | snippet ty 49 | type ${1:Msg} 50 | = ${0} 51 | snippet tya 52 | type alias ${1:Model} = 53 | ${0} 54 | snippet test 55 | test "${1}" <| \_ -> $0 56 | snippet desc 57 | describe "${1}" [ $0 ] 58 | snippet doc 59 | {-| ${0} 60 | -} 61 | snippet p 62 | |> ${0} 63 | snippet program Elm 0.18 program 64 | import Html exposing (Html) 65 | 66 | 67 | type alias Model = 68 | {} 69 | 70 | 71 | type Msg 72 | = Noop 73 | 74 | 75 | main : Program Never Model Msg 76 | main = 77 | Html.program 78 | { init = init 79 | , view = view 80 | , update = update 81 | , subscriptions = subscriptions 82 | } 83 | 84 | 85 | init : ( Model, Cmd Msg ) 86 | init = 87 | {} ! [] 88 | 89 | 90 | update : Msg -> Model -> ( Model, Cmd Msg ) 91 | update msg model = 92 | case msg of 93 | Noop -> 94 | model ! [] 95 | 96 | 97 | subscriptions : Model -> Sub Msg 98 | subscriptions model = 99 | Sub.none 100 | 101 | 102 | view : Model -> Html Msg 103 | view model = 104 | Html.text "Hello, sailor!" 105 | snippet element 106 | module Main exposing (Model, Msg(..), init, main, subscriptions, update, view) 107 | 108 | import Browser 109 | import Html exposing (..) 110 | import Json.Encode 111 | 112 | 113 | main : Program Flags Model Msg 114 | main = 115 | Browser.element 116 | { init = init 117 | , update = update 118 | , subscriptions = subscriptions 119 | , view = view 120 | } 121 | 122 | 123 | type alias Model = 124 | {} 125 | 126 | 127 | type alias Flags = 128 | Json.Encode.Value 129 | 130 | 131 | init : Flags -> ( Model, Cmd Msg ) 132 | init flags_ = 133 | ( {} 134 | , Cmd.none 135 | ) 136 | 137 | 138 | type Msg 139 | = Noop 140 | 141 | 142 | update : Msg -> Model -> ( Model, Cmd Msg ) 143 | update msg model = 144 | case msg of 145 | Noop -> 146 | ( model 147 | , Cmd.none 148 | ) 149 | 150 | 151 | subscriptions : Model -> Sub Msg 152 | subscriptions model = 153 | Sub.none 154 | 155 | 156 | view : Model -> Html Msg 157 | view model = 158 | h1 [] [ text "Hello, world!" ] 159 | -------------------------------------------------------------------------------- /bin/lock: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | print_help() { 4 | echo "Usage: " 5 | echo " lock [-force] [-blank [delay]]" 6 | echo 7 | echo "Options: " 8 | echo " -force Force screen locking when fullscreen is on and regardless of ignored classes (${excluded[*]})" 9 | echo " -blank [delay] Turn off the screen after $delay seconds" 10 | echo 11 | } 12 | 13 | delay=0 14 | force=0 15 | blank=0 16 | 17 | excluded=(mpv) 18 | 19 | scriptname="$(basename "$0")" 20 | pidfile="/run/user/$UID/$scriptname.pid" 21 | lockfile="/run/user/$UID/$scriptname.lock" 22 | caffeine="/run/user/$UID/caffeine" 23 | 24 | while (( $# )); do 25 | if [[ "$1" == "-force" ]]; then 26 | force=1 27 | elif [[ "$1" == "-blank" ]]; then 28 | blank=1 29 | if [[ "$2" =~ ^[0-9]+$ ]]; then 30 | delay="$2" 31 | shift 32 | fi 33 | elif [[ "$1" == "-help" ]]; then 34 | print_help 35 | exit 0 36 | else 37 | echo "Unknown option: $1" 1>&2 38 | print_help 39 | exit 1 40 | fi 41 | shift 42 | done 43 | 44 | if (( force == 0 )); then 45 | 46 | if [[ -f "$caffeine" ]]; then 47 | echo "cannot lock screen: caffeine" 1>&2 48 | exit 1 49 | fi 50 | 51 | id=$(xdotool getwindowfocus) 52 | 53 | # Do not lock the screen when fullscreen is active 54 | wm_state=$(xprop -id "$id" | grep _NET_WM_STATE) 55 | if echo "$wm_state" | grep -q FULLSCREEN; then 56 | echo "cannot lock screen: fullscreen on" 1>&2 57 | exit 1 58 | fi 59 | 60 | # Do not lock the screen when certain windows are focused 61 | wm_class=$(xprop -id "$id" 2> /dev/null | grep WM_CLASS) 62 | class=$(echo "$wm_class" | grep -Po '(?<=")\w+(?=")' | tail -n1) 63 | if (IFS=$'\n'; echo "${excluded[*]}") | grep -Fxiq "$class"; then 64 | echo "cannot lock screen: focused window class is '$class'" 1>&2 65 | exit 1 66 | fi 67 | 68 | fi 69 | 70 | exec 200>"$lockfile" 71 | if ! flock -n 200; then 72 | echo "$scriptname: already running" 2>&1 73 | exit 1 74 | fi 75 | 76 | volume_state=1 77 | if amixer -D pulse get Master | grep -q '\[off\]$'; then 78 | volume_state=0 79 | fi 80 | 81 | if (( force == 1 )); then 82 | 83 | if (( volume_state == 1 )); then 84 | volume -q mute 85 | fi 86 | 87 | if hash "mpc" 2>/dev/null; then 88 | mpc pause >/dev/null 2>&1 89 | fi 90 | 91 | fi 92 | 93 | 94 | ( 95 | 96 | cleanup() { 97 | rm -f "$lockfile" 98 | if [[ -f "$pidfile" ]]; then 99 | kill "$(cat "$pidfile")" 100 | fi 101 | if (( force == 1 && volume_state == 1 )); then 102 | volume -q unmute 103 | fi 104 | } 105 | 106 | trap "cleanup" 0 107 | 108 | if [[ -f "$HOME/.fehbg" ]]; then 109 | bg="$(grep '^feh' ~/.fehbg | grep -Po "${HOME}[^']+")" 110 | elif [[ -f "$HOME/.config/nitrogen/bg-saved.cfg" ]]; then 111 | bg="$(grep -Po "(?<=file\=).+" "$HOME/.config/nitrogen/bg-saved.cfg")" 112 | fi 113 | 114 | i3lock -ne -i "$bg" 115 | 116 | ) & 117 | 118 | if (( blank == 0 )); then 119 | exit 120 | fi 121 | 122 | ( 123 | cleanup() { 124 | rm -f "$pidfile" 125 | } 126 | 127 | trap "cleanup" 0 128 | 129 | sleep "$delay" & 130 | echo $! > "$pidfile" 131 | wait $! && xset dpms force off 132 | 133 | ) & 134 | -------------------------------------------------------------------------------- /nvim/snippets/jinja.snippets: -------------------------------------------------------------------------------- 1 | # Generic tags 2 | 3 | extends html 4 | 5 | snippet % 6 | {% ${1} %} 7 | snippet %% 8 | {% ${1:tag_name} %} 9 | ${0} 10 | {% end$1 %} 11 | snippet { 12 | {{ ${1} }} 13 | # Template Tags 14 | 15 | snippet autoescape 16 | {% autoescape ${1:off} %} 17 | ${0} 18 | {% endautoescape %} 19 | snippet block 20 | {% block ${1} %} 21 | ${0} 22 | {% endblock %} 23 | snippet # 24 | {# ${0:comment} #} 25 | snippet comment 26 | {% comment %} 27 | ${0} 28 | {% endcomment %} 29 | snippet cycle 30 | {% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} 31 | snippet debug 32 | {% debug %} 33 | snippet extends 34 | {% extends "${0:base.html}" %} 35 | snippet filter 36 | {% filter ${1} %} 37 | ${0} 38 | {% endfilter %} 39 | snippet firstof 40 | {% firstof ${1} %} 41 | snippet for 42 | {% for ${1} in ${2} %} 43 | ${0} 44 | {% endfor %} 45 | snippet empty 46 | {% empty %} 47 | ${0} 48 | snippet if 49 | {% if ${1} %} 50 | ${0} 51 | {% endif %} 52 | snippet el 53 | {% else %} 54 | ${1} 55 | snippet eif 56 | {% elif ${1} %} 57 | ${0} 58 | snippet ifchanged 59 | {% ifchanged %}${1}{% endifchanged %} 60 | snippet ifequal 61 | {% ifequal ${1} ${2} %} 62 | ${0} 63 | {% endifequal %} 64 | snippet ifnotequal 65 | {% ifnotequal ${1} ${2} %} 66 | ${0} 67 | {% endifnotequal %} 68 | snippet include 69 | {% include "${0}" %} 70 | snippet load 71 | {% load ${0} %} 72 | snippet now 73 | {% now "${0:jS F Y H:i}" %} 74 | snippet regroup 75 | {% regroup ${1} by ${2} as ${0} %} 76 | snippet spaceless 77 | {% spaceless %}${0}{% endspaceless %} 78 | snippet ssi 79 | {% ssi ${0} %} 80 | snippet trans 81 | {% trans %}${0}{% endtrans %} 82 | snippet url 83 | {% url ${1} as ${0} %} 84 | snippet widthratio 85 | {% widthratio ${1:this_value} ${2:max_value} ${0:100} %} 86 | snippet with 87 | {% with ${1} as ${2} %} 88 | ${0} 89 | {% endwith %} 90 | 91 | # Template Filters 92 | 93 | # Note: Since SnipMate can't determine which template filter you are 94 | # expanding without the "|" character, these do not add the "|" 95 | # character. These save a few keystrokes still. 96 | 97 | # Note: Template tags that take no arguments are not implemented. 98 | 99 | snippet add 100 | add:"${0}" 101 | snippet center 102 | center:"${0}" 103 | snippet cut 104 | cut:"${0}" 105 | snippet date 106 | date:"${0}" 107 | snippet default 108 | default:"${0}" 109 | snippet defaultifnone 110 | default_if_none:"${0}" 111 | snippet dictsort 112 | dictsort:"${0}" 113 | snippet dictsortrev 114 | dictsortreversed:"${0}" 115 | snippet divisibleby 116 | divisibleby:"${0}" 117 | snippet floatformat 118 | floatformat:"${0}" 119 | snippet getdigit 120 | get_digit:"${0}" 121 | snippet join 122 | join:"${0}" 123 | snippet lengthis 124 | length_is:"${0}" 125 | snippet pluralize 126 | pluralize:"${0}" 127 | snippet removetags 128 | removetags:"${0}" 129 | snippet slice 130 | slice:"${0}" 131 | snippet stringformat 132 | stringformat:"${0}" 133 | snippet time 134 | time:"${0}" 135 | snippet truncatewords 136 | truncatewords:${0} 137 | snippet truncatewordshtml 138 | truncatewords_html:${0} 139 | snippet urlizetrunc 140 | urlizetrunc:${0} 141 | snippet wordwrap 142 | wordwrap:${0} 143 | -------------------------------------------------------------------------------- /nvim/snippets/htmldjango.snippets: -------------------------------------------------------------------------------- 1 | # Generic tags 2 | 3 | extends html 4 | 5 | snippet % 6 | {% ${1} %} 7 | snippet %% 8 | {% ${1:tag_name} %} 9 | ${0} 10 | {% end$1 %} 11 | snippet { 12 | {{ ${1} }} 13 | # Template Tags 14 | 15 | snippet autoescape 16 | {% autoescape ${1:off} %} 17 | ${0} 18 | {% endautoescape %} 19 | snippet block 20 | {% block ${1} %} 21 | ${0} 22 | {% endblock %} 23 | snippet # 24 | {# ${0:comment} #} 25 | snippet comment 26 | {% comment %} 27 | ${0} 28 | {% endcomment %} 29 | snippet cycle 30 | {% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} 31 | snippet debug 32 | {% debug %} 33 | snippet extends 34 | {% extends "${0:base.html}" %} 35 | snippet filter 36 | {% filter ${1} %} 37 | ${0} 38 | {% endfilter %} 39 | snippet firstof 40 | {% firstof ${1} %} 41 | snippet for 42 | {% for ${1} in ${2} %} 43 | ${0} 44 | {% endfor %} 45 | snippet empty 46 | {% empty %} 47 | ${0} 48 | snippet if 49 | {% if ${1} %} 50 | ${0} 51 | {% endif %} 52 | snippet el 53 | {% else %} 54 | ${1} 55 | snippet eif 56 | {% elif ${1} %} 57 | ${0} 58 | snippet ifchanged 59 | {% ifchanged %}${1}{% endifchanged %} 60 | snippet ifequal 61 | {% ifequal ${1} ${2} %} 62 | ${0} 63 | {% endifequal %} 64 | snippet ifnotequal 65 | {% ifnotequal ${1} ${2} %} 66 | ${0} 67 | {% endifnotequal %} 68 | snippet include 69 | {% include "${0}" %} 70 | snippet load 71 | {% load ${0} %} 72 | snippet now 73 | {% now "${0:jS F Y H:i}" %} 74 | snippet regroup 75 | {% regroup ${1} by ${2} as ${0} %} 76 | snippet spaceless 77 | {% spaceless %}${0}{% endspaceless %} 78 | snippet ssi 79 | {% ssi ${0} %} 80 | snippet trans 81 | {% trans "${0:string}" %} 82 | snippet url 83 | {% url ${1} as ${0} %} 84 | snippet widthratio 85 | {% widthratio ${1:this_value} ${2:max_value} ${0:100} %} 86 | snippet with 87 | {% with ${1} as ${2} %} 88 | ${0} 89 | {% endwith %} 90 | 91 | # Template Filters 92 | 93 | # Note: Since SnipMate can't determine which template filter you are 94 | # expanding without the "|" character, these do not add the "|" 95 | # character. These save a few keystrokes still. 96 | 97 | # Note: Template tags that take no arguments are not implemented. 98 | 99 | snippet add 100 | add:"${0}" 101 | snippet center 102 | center:"${0}" 103 | snippet cut 104 | cut:"${0}" 105 | snippet date 106 | date:"${0}" 107 | snippet default 108 | default:"${0}" 109 | snippet defaultifnone 110 | default_if_none:"${0}" 111 | snippet dictsort 112 | dictsort:"${0}" 113 | snippet dictsortrev 114 | dictsortreversed:"${0}" 115 | snippet divisibleby 116 | divisibleby:"${0}" 117 | snippet floatformat 118 | floatformat:"${0}" 119 | snippet getdigit 120 | get_digit:"${0}" 121 | snippet join 122 | join:"${0}" 123 | snippet lengthis 124 | length_is:"${0}" 125 | snippet pluralize 126 | pluralize:"${0}" 127 | snippet removetags 128 | removetags:"${0}" 129 | snippet slice 130 | slice:"${0}" 131 | snippet stringformat 132 | stringformat:"${0}" 133 | snippet time 134 | time:"${0}" 135 | snippet truncatewords 136 | truncatewords:${0} 137 | snippet truncatewordshtml 138 | truncatewords_html:${0} 139 | snippet urlizetrunc 140 | urlizetrunc:${0} 141 | snippet wordwrap 142 | wordwrap:${0} 143 | -------------------------------------------------------------------------------- /pudb/midnight-theme.py: -------------------------------------------------------------------------------- 1 | # midnight theme 2 | 3 | palette.update({ 4 | "variables": ("white", "default"), 5 | 6 | "var label": ("light blue", "default"), 7 | "var value": ("white", "default"), 8 | 9 | "stack": ("white", "default"), 10 | 11 | "frame name": ("white", "default"), 12 | "frame class": ("dark blue", "default"), 13 | "frame location": ("light cyan", "default"), 14 | 15 | "current frame name": (add_setting("white", "bold"), "default"), 16 | "current frame class": ("dark blue", "default"), 17 | "current frame location": ("light cyan", "default"), 18 | 19 | "focused frame name": ("black", "dark green"), 20 | "focused frame class": (add_setting("white", "bold"), "dark green"), 21 | "focused frame location": ("dark blue", "dark green"), 22 | 23 | "focused current frame name": ("black", "dark green"), 24 | "focused current frame class": ( add_setting("white", "bold"), "dark green"), 25 | "focused current frame location": ("dark blue", "dark green"), 26 | 27 | "search box": ("default", "default"), 28 | 29 | "breakpoint": ("white", "default"), 30 | "disabled breakpoint": ("dark gray", "default"), 31 | "focused breakpoint": ("black", "dark green"), 32 | "focused disabled breakpoint": ("dark gray", "dark green"), 33 | "current breakpoint": (add_setting("white", "bold"), "default"), 34 | "disabled current breakpoint": ( add_setting("dark gray", "bold"), "default"), 35 | "focused current breakpoint": ( add_setting("white", "bold"), "dark green", "bold"), 36 | "focused disabled current breakpoint": ( add_setting("dark gray", "bold"), "dark green", "bold"), 37 | 38 | "source": ("white", "default"), 39 | "highlighted source": ("white", "light cyan"), 40 | "current source": ("white", "light gray"), 41 | "current focused source": ("white", "dark blue"), 42 | 43 | "line number": ("h17", "default"), 44 | "keyword": ("dark magenta", "default"), 45 | "name": ("white", "default"), 46 | "literal": ("dark cyan", "default"), 47 | "string": ("dark red", "default"), 48 | "doublestring": ("dark red", "default"), 49 | "singlestring": ("light blue", "default"), 50 | "docstring": ("light red", "default"), 51 | "backtick": ("light green", "default"), 52 | "punctuation": ("white", "default"), 53 | "comment": ("h17", "default"), 54 | "classname": ("dark cyan", "default"), 55 | "funcname": ("white", "default"), 56 | 57 | "breakpoint marker": ("dark red", "default"), 58 | 59 | # {{{ shell 60 | 61 | "command line edit": ("white", "default"), 62 | "command line prompt": (add_setting("white", "bold"), "default"), 63 | 64 | "command line output": (add_setting("white", "bold"), "default"), 65 | "command line input": (add_setting("white", "bold"), "default"), 66 | "command line error": (add_setting("light red", "bold"), "default"), 67 | 68 | "focused command line output": ("black", "dark green"), 69 | "focused command line input": ( add_setting("white", "bold"), "dark green"), 70 | "focused command line error": ("black", "dark green"), 71 | 72 | "command line clear button": (add_setting("white", "bold"), "default"), 73 | "command line focused button": ("black", "light gray"), # White 74 | # doesn't work in curses mode 75 | 76 | # }}} 77 | 78 | }) 79 | -------------------------------------------------------------------------------- /nvim/plugins/explorer/plugin/explorer.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: explorer.vim 3 | " Description: Minimal file explorer 4 | " Mantainer: github.com/gcmt 5 | " License: MIT 6 | " ============================================================================ 7 | 8 | if exists('g:explorer_loaded') || &cp 9 | finish 10 | end 11 | let g:explorer_loaded = 1 12 | 13 | command! -bang -nargs=? Explorer call explorer#open(, ) 14 | 15 | let s:options = #{ 16 | \ popup: 1, 17 | \ popup_border: 'single', 18 | \ width_popup: "80%", 19 | \ height_popup: "80%", 20 | \ height_window: "50%", 21 | \ hidden_files: 1, 22 | \ filters: [], 23 | \ filters_active: 1, 24 | \ expand_depth: 3, 25 | \ } 26 | 27 | for [s:option, s:default] in items(s:options) 28 | let g:explorer_{s:option} = get(g:, 'explorer_'.s:option, s:default) 29 | endfo 30 | 31 | let s:mappings = #{ 32 | \ enter_or_edit: [['l', ''], "Enter directory or edit file under cursor"], 33 | \ close: [['q', ''], "Close this window"], 34 | \ info: [['i'], "Show file or directory info"], 35 | \ preview: [['p'], "Preview file under cursor"], 36 | \ auto_expand: [['x'], "Auto expand directories"], 37 | \ close_dir: [['h'], "Close current directory"], 38 | \ set_root: [['L'], "Set current directory as root"], 39 | \ up_root: [['H'], "Set the parent directory as root"], 40 | \ set_cwd: [['w'], "Set working directory"], 41 | \ toggle_hidden_files: [['a'], "Toggle hidden files"], 42 | \ toggle_filters: [['f'], "Toggle filters"], 43 | \ create_file: [['%'], "Create new file"], 44 | \ create_dir: [['c'], "Create new directory"], 45 | \ rename: [['r'], "Rename file or directory under cursor"], 46 | \ delete: [['d'], "Delete file or directory under cursor"], 47 | \ set_bookmark: [['m'], "Set bookmark for the file or directory under cursor"], 48 | \ del_bookmark: [['M'], "Delete bookmark for the file or directory under cursor"], 49 | \ help: [['?'], "Show help"], 50 | \ } 51 | 52 | for [s:action, s:default] in items(s:mappings) 53 | let g:explorer_map_{s:action} = get(g:, 'explorer_map_'.s:action, s:default[0]) 54 | endfo 55 | 56 | let s:colors = #{ 57 | \ title: 'Magenta', 58 | \ pipe: 'Comment', 59 | \ dir: 'Blue', 60 | \ link: 'Cyan', 61 | \ exec: 'Green', 62 | \ mark: 'Comment', 63 | \ } 64 | 65 | for [s:hl, s:hlgroup] in items(s:colors) 66 | let g:explorer_hl_{s:hl} = get(g:, 'explorer_hl_'.s:hl, s:hlgroup) 67 | endfo 68 | 69 | " Returns all mappings with their help message 70 | func! __explorer_mappings_help() 71 | let help = [] 72 | for [action, default] in items(s:mappings) 73 | let mappings = get(g:, 'explorer_map_' . action) 74 | let help_msg = default[1] 75 | call add(help, [mappings, help_msg]) 76 | endfo 77 | return help 78 | endf 79 | 80 | " Returns all mappings 81 | func! __explorer_mappings() 82 | let mappings = {} 83 | for action in keys(s:mappings) 84 | let mappings[action] = get(g:, 'explorer_map_' . action) 85 | endfor 86 | return mappings 87 | endf 88 | -------------------------------------------------------------------------------- /nvim/plugins/quickfix/autoload/quickfix.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================= 2 | " File: quickfix.vim 3 | " Description: Quickfix enhancements 4 | " Author: github.com/gcmt 5 | " License: MIT 6 | " ============================================================================= 7 | 8 | " quickfix#remove_entries({type:string}) -> 0 9 | " Remove entries from the quickfix list. 10 | func quickfix#remove_entries(type) abort range 11 | let start = a:type == 'line' ? line("'[") : a:firstline 12 | let end = a:type == 'line' ? line("']") : a:lastline 13 | let qf = getqflist({'all': 1}) 14 | if empty(qf.items) 15 | return 16 | end 17 | let view = winsaveview() 18 | call s:snapshot(qf) 19 | call remove(qf.items, start - 1, end - 1) 20 | call setqflist([], 'r', qf) 21 | call winrestview(view) 22 | doau User QuickFixEditPost 23 | endf 24 | 25 | " quickfix#undo() -> 0 26 | " Undo the last v:count1 deletions. 27 | func quickfix#undo() 28 | let qf = getqflist({'all': 1}) 29 | if type(qf.context) != v:t_dict || !has_key(qf.context, 'snapshots') 30 | return 31 | end 32 | let snapshots = qf.context.snapshots 33 | if empty(snapshots) 34 | return 35 | end 36 | let view = winsaveview() 37 | let qf.items = [] 38 | for i in range(min([v:count1, len(snapshots)])) 39 | let qf.items = remove(snapshots, -1) 40 | endfo 41 | call setqflist([], 'r', qf) 42 | call winrestview(view) 43 | doau User QuickFixEditPost 44 | endf 45 | 46 | " quickfix#filter({bang:string}, {pattern:string}) -> 0 47 | " Filter quickfix entries by the text attribute. Unless a {bang} is used, keep 48 | " only quickfix entries for which the 'text' attribute contains {pattern}. If 49 | " a {bang} is used, those entries are removed instead. 50 | func quickfix#filter(bang, pattern) 51 | call s:qfilter(a:pattern, {->v:val['text']}, a:bang == '!') 52 | endf 53 | 54 | " quickfix#ffilter({bang:string}, {pattern:string}) -> 0 55 | " Same as quickfix#filter but filter by matching against file names. 56 | func quickfix#ffilter(bang, pattern) 57 | call s:qfilter(a:pattern, {-> fnamemodify(bufname(v:val['bufnr']), ':p')}, a:bang == '!') 58 | endf 59 | 60 | " s:qfilter({pattern:string}, {val:funcref}[, {inverse:number}]) -> 0 61 | " Filter quickfix entries. Unless {inverse} is given and it's 1, keep only 62 | " quickfix entries for which the value returned by the {val} function contains 63 | " {pattern}. If {inverse} is given and it's 1, those entries are removed instead. 64 | func! s:qfilter(pattern, val, inverse) 65 | let qf = getqflist({'all': 1}) 66 | call s:snapshot(qf) 67 | let Match = a:inverse ? {v, p -> v !~ p} : {v, p -> v =~ p} 68 | call filter(qf.items, {i, entry -> Match(a:val(entry), a:pattern)}) 69 | if qf.size != len(qf.items) 70 | call setqflist([], 'r', qf) 71 | doau User QuickFixEditPost 72 | end 73 | endf 74 | 75 | " s:snapshot({qf:dict}) -> 0 76 | " Create a snapshot of the given quickfix by storing a copy of all items 77 | " in the quickfix context. 78 | " {qf} is expected to be the value returned by getqflist({'all': 1}) 79 | func s:snapshot(qf) 80 | if type(a:qf.context) != v:t_dict 81 | let a:qf.context = {} 82 | end 83 | let a:qf.context.snapshots = get(a:qf.context, 'snapshots', []) + [copy(a:qf.items)] 84 | endf 85 | --------------------------------------------------------------------------------