diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json index e92830b..5daebaa 100644 --- a/.config/nvim/coc-settings.json +++ b/.config/nvim/coc-settings.json @@ -1,6 +1,7 @@ { "coc.preferences.currentFunctionSymbolAutoUpdate": true, "coc.preferences.extensionUpdateCheck": "never", + "coc.preferences.colorSupport": true, "diagnostic.displayByAle": true, "diagnostic.refreshOnInsertMode": true, "diagnostic.refreshAfterSave": true, diff --git a/.config/nvim/ftplugin/python.vim b/.config/nvim/ftplugin/python.vim index 43231f0..b893d87 100644 --- a/.config/nvim/ftplugin/python.vim +++ b/.config/nvim/ftplugin/python.vim @@ -1,3 +1,5 @@ +setlocal colorcolumn=79 + augroup pystuff autocmd! autocmd BufNewFile *.py 0r ~/.config/nvim/templates/py.skeleton diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 92eb29c..573af7a 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -31,7 +31,6 @@ set clipboard^=unnamedplus " system clipboard (requires +clipboard) set fileencoding=utf-8 " The encoding written to file. set shell=/bin/zsh " Setting shell to zsh set number " Line numbers on -set relativenumber " For easier line jumps set noshowmode " Always hide mode set showtabline=2 " Always Show tabline set pumheight=12 " Completion window max size @@ -525,6 +524,12 @@ nnoremap pu :PlugUpdate nnoremap ñ ; nnoremap Ñ , +" Rearrange Splits +nnoremap H +nnoremap L +nnoremap K +nnoremap J + " Resize splits nnoremap :vertical resize -2 nnoremap :vertical resize +2 @@ -555,8 +560,11 @@ nnoremap Q :qa! cnoremap jk " Fast beginning and end of document -nnoremap ¿ G nnoremap gg +nnoremap ¿ G + +" Fast message checking +nnoremap m :messsages " Splits nnoremap T :call LaunchTerminal() diff --git a/.config/ranger/devicons.py b/.config/ranger/devicons.py index db610a4..efb002d 100644 --- a/.config/ranger/devicons.py +++ b/.config/ranger/devicons.py @@ -3,234 +3,237 @@ # These glyphs, and the mapping of file extensions to glyphs # has been copied from the vimscript code that is present in # https://github.com/ryanoasis/vim-devicons -import re; -import os; +import os +import re -# all those glyphs will show as weird squares if you don't have the correct patched font +# all those glyphs will show as weird squares +# if you don't have the correct patched font # My advice is to use NerdFonts which can be found here: # https://github.com/ryanoasis/nerd-fonts file_node_extensions = { - '7z' : '', - 'ai' : '', - 'apk' : '', - 'avi' : '', - 'bat' : '', - 'bmp' : '', - 'bz2' : '', - 'c' : 'ﭰ', - 'c++' : 'ﭱ', - 'cab' : '', - 'cbr' : '', - 'cbz' : '', - 'cc' : 'ﭰ', - 'clj' : '', - 'cljc' : '', - 'cljs' : '', - 'coffee' : '', - 'conf' : '', - 'cp' : 'ﭰ', - 'cpio' : '', - 'cpp' : 'ﭱ', - 'css' : '', - 'cxx' : 'ﭰ', - 'd' : '', - 'dart' : '', - 'db' : '', - 'deb' : '', - 'diff' : '', - 'dump' : '', - 'edn' : '', - 'ejs' : '', - 'epub' : '', - 'erl' : '', - 'exe' : '', - 'f#' : '', - 'fish' : '', - 'flac' : '', - 'flv' : '', - 'fs' : '', - 'fsi' : '', - 'fsscript' : '', - 'fsx' : '', - 'gem' : '', - 'gif' : '', - 'go' : '', - 'gz' : '', - 'gzip' : '', - 'hbs' : '', - 'hrl' : '', - 'hs' : '', - 'htm' : '', - 'html' : '', - 'ico' : '', - 'ini' : '', - 'java' : '', - 'jl' : '', - 'jpeg' : '', - 'jpg' : '', - 'js' : '', - 'json' : '', - 'jsx' : '', - 'less' : '', - 'lha' : '', - 'lhs' : '', - 'log' : '', - 'lua' : '', - 'lzh' : '', - 'lzma' : '', - 'm4a' : '', - 'markdown' : '', - 'md' : '', - 'mkv' : '', - 'ml' : 'λ', - 'mli' : 'λ', - 'mov' : '', - 'mp3' : '', - 'mp4' : '', - 'mpeg' : '', - 'mpg' : '', - 'mustache' : '', - 'ogg' : '', - 'pdf' : '', - 'php' : '', - 'pl' : '', - 'pm' : '', - 'png' : '', - 'psb' : '', - 'psd' : '', - 'py' : '', - 'pyc' : '', - 'pyd' : '', - 'pyo' : '', - 'rar' : '', - 'rb' : '', - 'rc' : '', - 'rlib' : '', - 'rpm' : '', - 'rs' : '', - 'rss' : '', - 'scala' : '', - 'scss' : '', - 'sh' : '', - 'slim' : '', - 'sln' : '', - 'sql' : '', - 'styl' : '', - 'suo' : '', - 't' : '', - 'tar' : '', - 'tgz' : '', - 'ts' : '', - 'twig' : '', - 'vim' : '', - 'vimrc' : '', - 'wav' : '', - 'webm' : '', - 'xml' : '', - 'xul' : '', - 'xz' : '', - 'yml' : '', - 'zip' : '', - 'zsh' : '', - 'xcf' : '', - 'tex' : '', - 'txt' : '', - 'lock' : '', - 'h' : 'ﭰ', - 'o' : '', - 'blend' : '', - '1' : '', - 'jar' : '', - 'desktop' : '', - 'mk' : '', - 'torrent' : '', - 'added' : '', - 'pem' : '', - 'svg' : '', - 'scd' : '', - 'theme' : '', - 'iso' : '', - 'mid' : '', - 'url' : '', - 'part' : '', - 'nfo' : '', - 'pd' : '', - 'ttf' : '', - 'otf' : '', - 'bdf' : '', - 'pcf' : '', - + '7z': '', + 'ai': '', + 'apk': '', + 'avi': '', + 'bat': '', + 'bmp': '', + 'bz2': '', + 'c': 'ﭰ', + 'c++': 'ﭱ', + 'cab': '', + 'cbr': '', + 'cbz': '', + 'cc': 'ﭰ', + 'clj': '', + 'cljc': '', + 'cljs': '', + 'coffee': '', + 'conf': '', + 'cp': 'ﭰ', + 'cpio': '', + 'cpp': 'ﭱ', + 'css': '', + 'cxx': 'ﭰ', + 'd': '', + 'dart': '', + 'db': '', + 'deb': '', + 'diff': '', + 'dump': '', + 'edn': '', + 'ejs': '', + 'epub': '', + 'erl': '', + 'exe': '', + 'f#': '', + 'fish': '', + 'flac': '', + 'flv': '', + 'fs': '', + 'fsi': '', + 'fsscript': '', + 'fsx': '', + 'gem': '', + 'gif': '', + 'go': '', + 'gz': '', + 'gzip': '', + 'hbs': '', + 'hrl': '', + 'hs': '', + 'htm': '', + 'html': '', + 'ico': '', + 'ini': '', + 'java': '', + 'jl': '', + 'jpeg': '', + 'jpg': '', + 'js': '', + 'json': '', + 'jsx': '', + 'less': '', + 'lha': '', + 'lhs': '', + 'log': '', + 'lua': '', + 'lzh': '', + 'lzma': '', + 'm4a': '', + 'markdown': '', + 'md': '', + 'mkv': '', + 'ml': 'λ', + 'mli': 'λ', + 'mov': '', + 'mp3': '', + 'mp4': '', + 'mpeg': '', + 'mpg': '', + 'mustache': '', + 'ogg': '', + 'pdf': '', + 'php': '', + 'pl': '', + 'pm': '', + 'png': '', + 'psb': '', + 'psd': '', + 'py': '', + 'pyc': '', + 'pyd': '', + 'pyo': '', + 'rar': '', + 'rb': '', + 'rc': '', + 'rlib': '', + 'rpm': '', + 'rs': '', + 'rss': '', + 'scala': '', + 'scss': '', + 'sh': '', + 'slim': '', + 'sln': '', + 'sql': '', + 'styl': '', + 'suo': '', + 't': '', + 'tar': '', + 'tgz': '', + 'ts': '', + 'twig': '', + 'vim': '', + 'vimrc': '', + 'wav': '', + 'webm': '', + 'xml': '', + 'xul': '', + 'xz': '', + 'yml': '', + 'zip': '', + 'zsh': '', + 'xcf': '', + 'tex': '', + 'txt': '', + 'lock': '', + 'h': 'ﭰ', + 'o': '', + 'blend': '', + '1': '', + 'jar': '', + 'desktop': '', + 'mk': '', + 'torrent': '', + 'added': '', + 'pem': '', + 'svg': '', + 'scd': '', + 'theme': '', + 'iso': '', + 'mid': '', + 'url': '', + 'part': '', + 'nfo': '', + 'pd': '', + 'ttf': '', + 'otf': '', + 'bdf': '', + 'pcf': '', } dir_node_exact_matches = { -# English - '.git' : '', - 'Desktop' : '', - 'Documents' : '', - 'Downloads' : '', - 'Music' : '', - 'Pictures' : '', - 'Public' : '', - 'Templates' : '', - 'Videos' : '', - 'mail' : '', - '.mail' : '', - '.cache' : '', - '.config' : '', - 'trash' : '', - 'Trash' : '', - 'bin' : '', - 'hexagons' : 'ﯟ', + # English + '.git': '', + 'Desktop': '', + 'Documents': '', + 'Downloads': '', + 'Music': '', + 'Pictures': '', + 'Public': '', + 'Templates': '', + 'Videos': '', + 'mail': '', + '.mail': '', + '.cache': '', + '.config': '', + 'trash': '', + 'Trash': '', + 'bin': '', + 'hexagons': 'ﯟ', } file_node_exact_matches = { - '.Xdefaults' : '', - '.Xresources' : '', - '.bashprofile' : '', - '.zprofile' : '', - '.bashrc' : '', - '.zshrc' : '', - '.zshenv' : '', - '.dmrc' : '', - '.ds_store' : '', - '.fasd' : '', - '.gitconfig' : '', - '.gitignore' : '', - '.jack-settings' : '', - '.mime.types' : '', - '.nvidia-settings-rc' : '', - '.pam_environment' : '', - '.profile' : '', - '.recently-used' : '', - '.selected_editor' : '', - '.vimrc' : '', - '.xinputrc' : '', - '.xserverrc' : '', - 'config' : '', - 'dropbox' : '', - 'exact-match-case-sensitive-1.txt' : 'X1', - 'exact-match-case-sensitive-2' : 'X2', - 'favicon.ico' : '', - 'gruntfile.coffee' : '', - 'gruntfile.js' : '', - 'gruntfile.ls' : '', - 'gulpfile.coffee' : '', - 'gulpfile.js' : '', - 'gulpfile.ls' : '', - 'ini' : '', - 'ledger' : '', - 'license' : '', - 'mimeapps.list' : '', - 'node_modules' : '', - 'procfile' : '', - 'react.jsx' : '', - 'user-dirs.dirs' : '', - 'Makefile' : '', - 'TODO' : '', - 'LICENSE' : '', - 'COPYING' : '', + '.Xdefaults': '', + '.Xresources': '', + '.bashprofile': '', + '.zprofile': '', + '.bashrc': '', + '.zshrc': '', + '.zshenv': '', + '.dmrc': '', + '.ds_store': '', + '.fasd': '', + '.gitconfig': '', + '.gitignore': '', + '.jack-settings': '', + '.mime.types': '', + '.nvidia-settings-rc': '', + '.pam_environment': '', + '.profile': '', + '.recently-used': '', + '.selected_editor': '', + '.vimrc': '', + '.xinputrc': '', + '.xserverrc': '', + 'config': '', + 'dropbox': '', + 'exact-match-case-sensitive-1.txt': 'X1', + 'exact-match-case-sensitive-2': 'X2', + 'favicon.ico': '', + 'gruntfile.coffee': '', + 'gruntfile.js': '', + 'gruntfile.ls': '', + 'gulpfile.coffee': '', + 'gulpfile.js': '', + 'gulpfile.ls': '', + 'ini': '', + 'ledger': '', + 'license': '', + 'mimeapps.list': '', + 'node_modules': '', + 'procfile': '', + 'react.jsx': '', + 'user-dirs.dirs': '', + 'Makefile': '', + 'TODO': '', + 'LICENSE': '', + 'COPYING': '', } + def devicon(file): - if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '') - return file_node_exact_matches.get(file.relative_path, file_node_extensions.get(file.extension, '')) + if file.is_directory: + return dir_node_exact_matches.get(file.relative_path, '') + return file_node_exact_matches.get( + file.relative_path, file_node_extensions.get(file.extension, '')) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 0cf756c..8d82ccb 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -109,7 +109,7 @@ map : console map ! console shell%space map @ console -p6 shell %%s map # console shell -p%space -map x chain draw_possible_programs; console open_with%%space +map x chain draw_possible_programs; console open_with%space map fi console find%space map cd console cd%space diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index a45046d..c73d815 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -123,17 +123,14 @@ ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, f ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@" ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" -ext djvu, has zathura,X, flag f = zathura -- "$@" - ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@" -ext cbz|cbr, has zathura,X, flag f = zathura -- "$@" +ext djvu|cbz|cbr, has zathura,X, flag f = zathura -- "$@" #------------------------------------------- # Image Viewing: #------------------------------------------- mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" -mime ^image/svg, has display, X, flag f = display -- "$@" ext gif, has sxiv, X, flag f = sxiv-gif -- "$@" mime ^image, has sxiv, X, flag f = sxiv-rifle -- "$@" diff --git a/.config/rofi/config.rasi b/.config/rofi/config.rasi index d2e81c8..e73df18 100644 --- a/.config/rofi/config.rasi +++ b/.config/rofi/config.rasi @@ -1,7 +1,7 @@ configuration { modi: "run,drun,window"; combi-modi: "run,drun,window"; - theme: "customdark"; + theme: "customenu"; terminal: "termite"; run-command: "{cmd}"; run-shell-command: "termite --hold -e {cmd}"; diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index fc61872..e55ea65 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -29,21 +29,12 @@ alt + {_,shift} + Tab super + {comma,period} bspc node @/ -R {90,270} -super + {_,shift,ctrl} + ntilde - whid {hide,last,dmenu} - super + {Up,Down,Left,Right} bspc node -f @{parent,brother,first,second} super + {equal, plus, minus} bspc node -l {normal, above, below} -super + {_,shift,ctrl} + u - bspc node {@/ -B,@brother -B,@/ -E} - -super + alt + u - euclid_balancer - super + o bspc node @parent -B @@ -53,18 +44,30 @@ super + y super + {_,shift} + i {bspc node -i,for win in `bspc query -N -d -n .leaf.!window`; do bspc node $win -k; done} +super + {_,shift,ctrl} + u + bspc node {@/ -B,@brother -B,@/ -E} + +super + alt + u + euclid_balancer + +super + {_,shift} + ntilde + whid {hide,dmenu} + # Run Applications -super + {t,b,v,q,x,c} - {subl,$BROWSER,pavucontrol,powermenu,$TERMINAL,gsimplecal} +super + {t,b,v,q,c} + {subl,$BROWSER,pavucontrol,powermenu,gsimplecal} super + z termite --name=multi -e termux +super + x + termite --name=flota + super + {n,m} termite --name=flota -e {nmtui,brandr} super + {space,s,r} - rofi {-show drun,-theme customenu -show window,-theme dmenu2 -show run} + rofi {-theme customdark -show drun,-show window,-theme dmenu2 -show run} ctrl + alt + x xkill diff --git a/.config/termite/config b/.config/termite/config index 4a5a1ff..a1b41b1 100644 --- a/.config/termite/config +++ b/.config/termite/config @@ -1,6 +1,6 @@ [options] # font = NotoSansMono Nerd Font Regular 9.5 -font = JetBrains Mono Regular 10.5 +font = JetBrainsMono Nerd Font Regular 10.5 hyperlinks = true icon_name = terminal scroll_on_output = false diff --git a/.config/zsh/aliases.plugin.zsh b/.config/zsh/aliases.plugin.zsh index 71a17ca..b98ed64 100644 --- a/.config/zsh/aliases.plugin.zsh +++ b/.config/zsh/aliases.plugin.zsh @@ -17,7 +17,6 @@ alias surfraw='surfraw -browser=$BROWSER' alias bm='bashmount' alias kat='cat' alias nb='newsboat --quiet' -alias sxiv='sxiv-rifle -p -b -a -q' alias yt='mpsyt' alias pudb='python -m pudb.run' diff --git a/.local/share/applications/sxiv-gif.desktop b/.local/share/applications/sxiv-gif.desktop index 6cd4f59..aa9ca84 100755 --- a/.local/share/applications/sxiv-gif.desktop +++ b/.local/share/applications/sxiv-gif.desktop @@ -3,7 +3,7 @@ Encoding=UTF-8 Version=1.0 Type=Application NoDisplay=true -Exec=sxiv -p -b -a %f +Exec=sxiv -bpa %f Name=sxiv-gif Comment=Custom definition for sxiv MimeType=image/gif diff --git a/.tmux.conf b/.tmux.conf index 01f82ad..969b46e 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -5,18 +5,18 @@ set -ga terminal-overrides ",*col*:Tc" set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # Opciones basicas +setw -gq utf8 on set -g set-clipboard on set -g mouse on set -gq status-utf8 on -setw -gq utf8 on set -g escape-time 0 -set-option -g history-limit 102400 +set -g history-limit 102400 # Ventanas -set -g base-index 1 +setw -g automatic-rename on set -g renumber-windows on set -g allow-rename on -setw -g automatic-rename on +set -g base-index 1 # Panes setw -g pane-base-index 1 @@ -39,13 +39,13 @@ setw -g pane-border-format '─' setw -g automatic-rename-format "#{s/zsh//:pane_current_command}" setw -g pane-border-style 'fg=#080808' setw -g pane-active-border-style 'fg=#080808' +set -g set-titles on +set -g status-interval 10 set -g mode-style fg=black,bg=yellow set -g message-command-style bg=colour0,fg=colour13 set -g message-style bg=default,fg=default set -g status-style bg=default,fg=colour7 -set -g set-titles on set -g set-titles-string "#T" -set -g status-interval 1 set -g status-left '' set -g status-right '#(txbar) #[fg=colour134]%a %d #[fg=colour167]%R #[fg=colour10]#S:#[fg=colour14]#I.#P' set -g window-status-separator ' ' @@ -99,8 +99,8 @@ bind-key Z kill-session bind-key Q kill-server # Ventanas -bind-key C-h prev -bind-key C-l next +bind-key -r C-h prev +bind-key -r C-l next bind-key -n M-< swap-window -t -1 bind-key -n M-> swap-window -t +1 bind-key Enter new-window @@ -111,11 +111,14 @@ bind-key s choose-tree -Zw "swap-pane -t '%%'" bind-key m choose-tree -Zw "move-pane -t '%%'" # Copy/paste. Seleccionar texto con el mouse lo copia automaticamente al clipboard -bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i -p -b" -bind-key -n M-S-v run "xsel -o | tmux load-buffer - ; tmux paste-buffer" -bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer" bind-key [ copy-mode bind-key ] paste-buffer +bind-key b list-buffers +bind-key p paste-buffer +bind-key P choose-buffer +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i -p -b" +bind-key -n M-S-v run "xsel -o | tmux load-buffer - ; tmux paste-buffer" + # Prender y apagar statusbar bind-key & set-option -g status diff --git a/.zshrc b/.zshrc index fa3ac85..8680bed 100644 --- a/.zshrc +++ b/.zshrc @@ -48,13 +48,13 @@ setopt AUTO_CONTINUE # }}} # Autocompletar {{{ zstyle ':completion:*' list-colors $LS_COLORS +zstyle ':completion:*' menu select zstyle ':completion:*' group-name '' zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' verbose true zstyle ':completion:*' format $'\n %F{yellow}--- %d ---%f' zstyle ':completion:*' list-separator "--" zstyle ':completion:*' list-dirs-first true -zstyle ':completion:*:*:*:default' menu yes select search zstyle ':completion:*:default' list-prompt '%S%M matches%s' zstyle ':completion:*:default' select-prompt ' --- Match %M %P ---' zstyle ':completion:*:options' description 'yes' diff --git a/Documents/pacman/paketes.txt b/Documents/pacman/paketes.txt index b8715e9..52e8994 100644 --- a/Documents/pacman/paketes.txt +++ b/Documents/pacman/paketes.txt @@ -1,5 +1,4 @@ abook -advcp alsa-utils android-tools android-udev @@ -12,6 +11,7 @@ autopep8 bat bison blueman +brandr bspwm cadence chafa @@ -42,6 +42,7 @@ file-roller firefox flex gcc +ghex ghostscript gimp-plugin-gmic gimp-plugin-lqr @@ -134,10 +135,12 @@ pygmentize python-glfw python-language-server python-lxml -python-numpy +python-matplotlib python-opengl python-pdoc +python-pillow python-pip +python-pudb python-pydocstyle python-pylint python-pynvim @@ -180,7 +183,7 @@ texlive-science tidy tmux transmission-cli -ttf-ibm-plex +ttf-jetbrains-mono typescript udisks2 unace diff --git a/Documents/pacman/paurketos.txt b/Documents/pacman/paurketos.txt index 1c60e1c..9334e49 100644 --- a/Documents/pacman/paurketos.txt +++ b/Documents/pacman/paurketos.txt @@ -1,6 +1,7 @@ advcp bashmount bfs +cozette-otb create-react-app figlet-fonts gimp-paint-studio @@ -31,6 +32,7 @@ tcllib terminus-font-ll2-td1 toilet-fonts transmission-remote-cli-git +tweak-hexeditor unclutter-xfixes-git xcursor-alkano-default xf86-input-keyboard diff --git a/bin/sxiv-gif b/bin/sxiv-gif index a5088e1..fed8225 100755 --- a/bin/sxiv-gif +++ b/bin/sxiv-gif @@ -1,3 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash +set -euf -o pipefail -sxiv-rifle -p -q -b -a "$@" +sxiv -bpa "$@" diff --git a/bin/sxiv-rifle b/bin/sxiv-rifle index e9fbf49..f6ee8ac 100755 --- a/bin/sxiv-rifle +++ b/bin/sxiv-rifle @@ -42,7 +42,7 @@ target="$(abspath "$1")" count="$(listfiles | grep -a -m 1 -ZznF "$target" | cut -d: -f1)" if [ -n "$count" ]; then - listfiles | xargs -0 sxiv -p -b -n "$count" -- + listfiles | xargs -0 sxiv -bpn "$count" -- else - sxiv -p -b -q -- "$@" # fallback + sxiv -bpq -- "$@" # fallback fi diff --git a/bin/whid b/bin/whid new file mode 100755 index 0000000..ee85c76 --- /dev/null +++ b/bin/whid @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +file="/tmp/.minimized" +touch $file +# By https://github.com/tatou-tatou +lines=$(wc -l < $file) + +case $1 in +hide) + if [[ $lines -ge 10 ]]; then ## Fight against bad practices + notify-send "10 windows are already hidden" "You should consider closing some before hiding even more." -i warning + else + focusedDesktop=$(xdotool get_desktop) + focusedID=$(xdo id) + focusedName=$(xdotool getwindowname "$focusedID") + + notiflines=$((lines + 1)) + echo "$focusedID $focusedDesktop $focusedName" >> "$file" && xdo hide "$focusedID" && notify-send "${notiflines} hidden windows." "$focusedName" -i warning + fi + ;; +dmenu) + miniList=$(cat $file) + + # Dmenu cannot draw more than 30 lines + if [[ $lines -gt 30 ]] + then linesDisplayed=30 + else linesDisplayed=$lines + fi + + # If the list is empty + if [ -z "$miniList" ] + then + miniList=" Nothing is hidden!" + linesDisplayed=1 + fi + + dmenu_cmd="rofi -lines $linesDisplayed -dmenu -p Hidden:" + + # Launch dmenu + lineNumber=$(echo "$miniList" | cut -d " " -f 3- | nl -w 3 -n rn | sed -r 's/^([ 0-9]+)[ \t]*(.*)$/\1 - \2/' | $dmenu_cmd | cut -d '-' -f -1) + + # If you exited dmenu without selecting anything or if the list was empty + [ -z "$lineNumber" ] || [ "$miniList" = " Nothing is hidden!" ] && exit + + # Show the selected hidden window + selectedID=$(sed -n "$lineNumber p" $file | cut -d ' ' -f 1) + selectedDesktop=$(sed -n "$lineNumber p" $file | cut -d ' ' -f 2) + xdotool set_desktop "$selectedDesktop" + xdo show "$selectedID" && sed -i "${lineNumber}d" $file + ;; +esac