dgy
/
hexagons
Archived
1
0
Fork 0

scripts para multihead, deadwiki, tiros lio y cosha golda. cerrame la POSIX, que AWKward todo.

This commit is contained in:
deadguy 2020-05-26 23:31:42 -03:00
parent 3382daa6c3
commit 2cb4f0a919
Signed by: dgy
GPG Key ID: 37CA55B52CF63730
62 changed files with 562 additions and 605 deletions

View File

@ -3,7 +3,7 @@ set -euf -o pipefail
bspc rule -r "*"
moni &
monis &
bspc config border_width 1
bspc config window_gap 6
@ -21,6 +21,7 @@ bspc config ignore_ewmh_focus true
bspc config remove_unplugged_monitors false
bspc config remove_disabled_monitors false
bspc config honor_size_hints false
bspc config pointer_follows_focus true
bspc config directional_focus_tightness low
bspc config automatic_scheme longest_side
bspc config initial_polarity second_child
@ -57,7 +58,6 @@ bspc rule -a Display state=floating
# Otros
bspc rule -a Zathura state=tiled
bspc rule -a Firefox:Navigator state=tiled, desktop='^2'
bspc rule -a Alacritty:multi desktop='^1'
stx &

View File

@ -24,14 +24,12 @@
# screen width minus the width defined in within the geometry option.
geometry = "600x8-10+31"
title = Dunst # Define window title
class = Dunst # Define window class
shrink = yes # Shrink window, or set to 0
transparency = 0 # Needs compton or similar
idle_threshold = 120 # Keep messages for how long
monitor = 0 # what monitor to use
follow = none
stack_duplicates = true # Merge multiple similar notifications
title = Dunst # Define window title
class = Dunst # Define window class
shrink = yes # Shrink window, or set to 0
idle_threshold = 120 # Keep messages for how long
follow = mouse # Where to display notifications
stack_duplicates = true # Merge multiple similar notifications
hide_duplicate_count = true
sticky_history = no
history_length = 16
@ -47,7 +45,7 @@
notification_height = 0
separator_height = 0
padding = 12 # Padding between text and separator.
padding = 12 # Padding between text and separator.
horizontal_padding = 10
# Define a color for the separator.
@ -60,11 +58,11 @@
startup_notification = false
dmenu = /usr/bin/dmenu -p dunst:
browser = /usr/bin/firefox -new-tab
icon_position = right # Align icons left/right/off
icon_position = right # Align icons left/right/off
max_icon_size = 0
# Paths to default icons.
icon_path = /home/deadguy/.local/share/icons/ArchLabs-Light/32x32/apps /home/deadguy/.local/share/icons/ArchLabs-Light/32x32/devices /home/deadguy/.local/share/icons/ArchLabs-Light/32x32/status
icon_path = /home/deadguy/.local/share/icons/Marwaita-Light/32x32/apps /home/deadguy/.local/share/icons/Marwaita-Light/32x32/devices /home/deadguy/.local/share/icons/Marwaita-Light/32x32/status
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
@ -97,6 +95,6 @@
[mail]
appname = neomutt
new_icon = "/home/deadguy/Pictures/rand/message.svg"
new_icon = "/home/deadguy/img/.icn/correo.png"
# vim: ft=cfg

View File

@ -1 +1 @@
autocmd BufRead,BufNewFile *.wiki setfiletype vimwiki
autocmd BufRead,BufNewFile *.wiki setlocal filetype=markdown.vimwiki

View File

@ -4,9 +4,6 @@ setlocal tabstop=2 expandtab softtabstop=2 linebreak
setlocal autoindent noruler colorcolumn=80
setlocal spell spelllang=es,en_us,cjk
nnoremap <buffer> <F2> :Vimwiki2HTML<CR>
nnoremap <buffer> <F5> :VimwikiMakeDiaryNote<CR>
nnoremap <buffer> <F6> :VimwikiDiaryGenerateLinks<CR>
nnoremap <buffer> <F7> [s
nnoremap <buffer> <F8> ]s
nnoremap <buffer> <F9> z=

View File

@ -45,13 +45,6 @@ set selectmode=key " Shift + arrow keys for selecting text
set keymodel=startsel " This one complements the one above it
set signcolumn=yes " Gutter for diagnostics and git status
set modeline " Vim customized by text files commands
set tabstop=8 " Number of spaces a <Tab> equals
set shiftwidth=4 " Number of spaces to use in auto(indent)
set softtabstop=4 " While performing editing operations
set shiftround " Round indent to multiple of 'shiftwidth'
set breakindent " Keep indentation
set expandtab " Use spaces instead of tabs. Mostly for linting reasons
set nosmarttab " Don't mix tabs and spaces and do weird stuff
set title
set redrawtime=500
set ttimeoutlen=10
@ -67,6 +60,13 @@ set fillchars+=vert:\
set conceallevel=1
set diffopt+=algorithm:histogram,indent-heuristic
set pastetoggle=<F12>
setlocal tabstop=8 " Number of spaces a <Tab> equals
setlocal shiftwidth=4 " Number of spaces to use in auto(indent)
setlocal softtabstop=4 " While performing editing operations
setlocal shiftround " Round indent to multiple of 'shiftwidth'
setlocal breakindent " Keep indentation
setlocal expandtab " Use spaces instead of tabs. Mostly for linting reasons
setlocal nosmarttab " Don't mix tabs and spaces and do weird stuff
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
if &diff
@ -151,7 +151,8 @@ if !exists('autocommands_loaded') && has('autocmd')
au FileType make setlocal noexpandtab
au FileType gitcommit,gitrebase,gitconfig set bufhidden=delete
au BufNewFile,BufRead requirements*.txt set syntax=python
au BufRead,BufNewFile /tmp/neomutt* set FileType mail
au BufRead,BufNewFile /tmp/neomutt* set filetype mail
au BufNewFile ~/doc/blog/*.wiki :silent 0r !diario.py %
aug END
aug statusline
@ -239,10 +240,8 @@ nnoremap <silent><F2> :<C-u>CocList -S --ignore-case files<CR>
nnoremap <silent><F3> :<C-u>CocList --normal buffers<CR>
nnoremap <silent><F4> :<C-u>CocList windows<CR>
nnoremap <silent><F9> :<C-u>CocList snippets<CR>
" Explorer
nnoremap <silent><F5> :CocCommand explorer<CR>
" Config
nnoremap <silent><F6> :CocConfig<CR>
@ -283,17 +282,6 @@ endfunction
" Symbol renaming.
nnoremap <leader>rn <Plug>(coc-rename)
"}}}
" Wiki {{{
let g:vimwiki_list = [
\{'path': '~/doc/notas', 'auto_toc': 1, 'auto_tags': 1},
\{'path': '~/doc/blog', 'auto_toc': 1, 'auto_tags': 1, 'auto_diary_index': 1, 'diary_rel_path': '.', 'diary_index': 'blog', 'diary_header': 'Dailies' }]
let g:vimwiki_valid_html_tags = 'b,i,s,u,sub,sup,kbd,br,hr,iframe,a'
let g:vimwiki_global_ext = 0
let g:vimwiki_hl_headers = 1
let g:vimwiki_hl_cb_checked = 1
let g:vimwiki_listsyms = '✗○◐●✓'
let g:vimwiki_listsym_rejected = '✗'
"}}}
"{{{ Polyglot
let g:polyglot_disabled = ['javascript', 'python']
let g:vim_markdown_toc_autofit = 1
@ -321,7 +309,6 @@ Plug 'sheerun/vim-polyglot'
Plug 'tmsvg/pear-tree'
Plug 'tpope/vim-commentary'
Plug 'lambdalisue/gina.vim'
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
Plug 'srcery-colors/srcery-vim'
call plug#end()
" }}}
@ -476,7 +463,7 @@ function! Tabline()
let s .= '%' . tab . 'T'
let s .= (tab == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#')
let s .= ' ' . tab .':'
let s .= (bufname !=? '' ? fnamemodify(bufname, ':t') . ' ' : '[No Name] ')
let s .= (bufname !=? '' ? fnamemodify(bufname, ':t') . ' ' : '[Untitled] ')
if bufmodified
let s .= ' + '

View File

@ -1,7 +1,4 @@
# BSPWM Hotkeys
ctrl + alt + {q,r}
bspc {quit,wm --restart && notify-send 'Window Manager restarted'}
super + {_,shift} + w
bspc node -{c,k}
@ -18,7 +15,7 @@ super + shift + {1-9,0}
bspc node -d {1-9,10}
super + {_,shift} + ntilde
whid {hide,dmenu}
minve {hide,dmenu}
super + {equal, plus, minus}
bspc node -l {normal, above, below}
@ -36,23 +33,23 @@ super + {_,shift,ctrl} + u
bspc node {@/ -B,@brother -B,@/ -E}
# Run Applications
super + {b,q,m,s,v,n,p,t}
{$BROWSER,powermenu,monisel,dswitcher,pavucontrol,notas,pom,tutos}
super + {b,q,m,s,v,n,p,t,g,r}
{$BROWSER,powermenu,monis,vent,pavucontrol,notas,pom,tutos,grabar,ref}
super + shift + {x,m,g}
{tmenux,unimon,corte}
super + ctrl + m
espejo
super + {a,x,i,z,c}
alacritty {_,--class=flota,--class=flota -e connman-ncurses,--class=multi -e termux,class=flota -e neomutt +'inoremap <C-Space> <Esc>:Snippets<CR>' +Mail +1bw +startinsert"}
super + shift + x
tmenux
super + space
j4-dmenu-desktop --dmenu="dmenu -i -w 250" --no-generic
j4-dmenu-desktop --dmenu="dmenu -i -w 250 -p ' ' " --no-generic
super + r
dmenu_run -p "Run "
super + {_,shift} + g
{grabar,corte}
super + e
dmenu_run -p " "
super + {F1,F2,F3,F4}
{fecha,tapa,notifocus,touchpad}

View File

@ -63,14 +63,15 @@ foreach programa (
foreach extra (
lf-icons.zsh
teclas.zsh
up.plugin.zsh
zsh-autopair/autopair.plugin.zsh
zsh-system-clipboard/zsh-system-clipboard.plugin.zsh
git-extras-completion.zsh
autocompletar.zsh
aliases.zsh
zmarks.zsh
zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
teclas.zsh
) {
source $ZDOTDIR/$extra
}
@ -87,6 +88,7 @@ function precmd() {
}
PS1="%(?..%{%F{red}%}(%?%)%{%f%} )%{%F{blue}%}%2~ %{%f%}%(!:#:) "
SPROMPT="zsh: correct %F{red}'%R'%f to %F{green}'%r'%f [%B%Uy%u%bes, %B%Un%u%bo, %B%Ue%u%bdit, %B%Ua%u%bbort]? "
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||

View File

@ -20,9 +20,10 @@ else
fi
unset _comp_files
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]}' '+m:{[:upper:]}={[:lower:]}' '+m:{_-}={-_}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle -e ':completion:*' special-dirs '[[ $PREFIX = (../)#(..) ]] && reply=(..)'
zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path "$XDG_CACHE_HOME/zcompcache"
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*:options' description 'yes'
@ -32,7 +33,6 @@ zstyle ':completion:*:descriptions' format '%F{yellow}%d %f'
zstyle ':completion:*:messages' format '%F{purple}%d %f'
zstyle ':completion:*:warnings' format '%F{red}no matches found %f'
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*' format '%F{yellow}%d %f'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' verbose yes
zstyle ':completion:*' completer _complete _match _approximate
@ -42,7 +42,7 @@ zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFF
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))'
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories
zstyle ':completion:*:complete:(cd|pushd):*' tag-order 'local-directories named-directories'
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand'
zstyle ':completion:*' squeeze-slashes true

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
cd ~/.local/bin
cd ~/.local/bin || exit
fd -c always -t f -d 1 | fzf -m --cycle --preview='bat --color=always {}' --height='45%' | xargs -r "$EDITOR"

View File

@ -1,42 +1,41 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
size=${2:-'10'}
dir=$1
# Find current window mode
is_tiled() {
bspc query -T -n | grep -q '"state":"tiled"'
bspc query -T -n | grep -q '"state":"tiled"'
}
# If the window is floating, move it
if ! is_tiled; then
#only parse input if window is floating,tiled windows accept input as is
case "$dir" in
west) switch="-w"
sign="-"
;;
east) switch="-w"
sign="+"
;;
north) switch="-h"
sign="-"
;;
south) switch="-h"
sign="+"
;;
esac
xdo resize ${switch} ${sign}"${size}"
case "$dir" in
west) switch="-w"
sign="-"
;;
east) switch="-w"
sign="+"
;;
north) switch="-h"
sign="-"
;;
south) switch="-h"
sign="+"
;;
esac
xdo resize ${switch} ${sign}"${size}"
# Otherwise, window is tiled: switch with window in given direction
else
case "$dir" in
west) bspc node @west -r -"$size" || bspc node @east -r -"${size}"
;;
east) bspc node @west -r +"$size" || bspc node @east -r +"${size}"
;;
north) bspc node @south -r -"$size" || bspc node @north -r -"${size}"
;;
south) bspc node @south -r +"$size" || bspc node @north -r +"${size}"
;;
esac
case "$dir" in
west) bspc node @west -r -"$size" || bspc node @east -r -"${size}"
;;
east) bspc node @west -r +"$size" || bspc node @east -r +"${size}"
;;
north) bspc node @south -r -"$size" || bspc node @north -r -"${size}"
;;
south) bspc node @south -r +"$size" || bspc node @north -r +"${size}"
;;
esac
fi

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
youtube-dl --add-metadata -icx --no-cache-dir --no-call-home --audio-format mp3 --audio-quality 0 --prefer-ffmpeg --no-post-overwrites --geo-bypass -o "/mnt/remote/%(artist)s/%(album)s/%(artist)s - %(album)s - %(track_number)d %(track)s.%(ext)s" "$1"

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
function send_notification {
send_notification() {
icon="$HOME/.local/share/icons/Marwaita-Dark/24x24/actions/contrast.svg"
dunstify -i "$icon" -r 5555 -u low " $(printf %.0f%% "$(xbacklight -get)")"
}

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
notify-send -u critical -i ~/img/.icn/control.png "Tres meses han pasado..." "Es hora de limpiar el cache" &
sleep 10s

View File

@ -1,8 +1,7 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
case $1 in
on) simple-mtpfs --device 1 /mnt/cel/ ;;
off) fusermount -u /mnt/cel/ ;;
*) echo "Can't help you with that" ;;
on) simple-mtpfs --device 1 /mnt/cel/ && sleep 5 && simple-mtpfs --device 1 /mnt/cel/;;
off) fusermount -u /mnt/cel/ ;;
*) echo "Can't help you with that" ;;
esac

View File

@ -1,6 +1,5 @@
#!/usr/bin/env zsh
function () {
# Bookmarks
local -A bookmarks=(

View File

@ -1,15 +1,14 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
FOLDER="$HOME/.local/bin"
FILE="$FOLDER/$1"
if [[ -f $FILE ]]; then
echo -e "Already exists. Press ENTER to edit or CTRL+C to cancel"
read -r
$EDITOR "$FILE"
if [ -f "$FILE" ]; then
printf "Already exists. Press ENTER to edit or CTRL+C to cancel"
read -r
$EDITOR "$FILE"
else
echo -e "#!/usr/bin/env bash\\nset -euf -o pipefail\\n" > "$FILE"
chmod +x "$FILE"
$EDITOR "$FILE"
printf "#!/bin/sh\\n\\n" > "$FILE"
chmod +x "$FILE"
$EDITOR "$FILE"
fi

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Showing off during live shows

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
mpv --cdrom-device=/dev/sr0 cdda://

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
echo "╓───── m o u n t . p o i n t s"; echo "╙────────────────────────────────────── ─ ─"; lsblk -a; echo ""; echo "╓───── d i s k . u s a g e"; echo "╙────────────────────────────────────── ─ ─ "; dfc -ds;

25
.local/bin/espejo Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
screens=$(xrandr -q | awk '/ connected/ {print $1}')
grae() {
external=$(echo "$screens" | dmenu -i -w 320 -p "Optimize resolution for: ")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | tail -n 1 | awk '{print $1}')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 --output "$internal" --auto --same-as "$external" --scale "$scale_x"x"$scale_y"
bspc monitor -d 1 2 3 4 5 6 7 8 9 10
bspc rule -a Firefox:Navigator state=tiled, desktop='^2'
}
grae

View File

@ -1,6 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
dunst() {
pkill -0 --exact dunst || return 0

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
notify-send -u low -t 5000 -i ~/img/.icn/calendar.png "$(date +'%A %d de %B %H:%M')"

View File

@ -1,18 +1,15 @@
#!/usr/bin/env dash
# todo: handle interop between floating and tiled better
# Shamelessly stolen from https://github.com/neeasade/dotfiles/tree/master/wm/.wm/scripts/interact
#!/bin/sh
dir=$1
if bspc query -N -n .focused.local.fullscreen; then
bspc monitor -f $dir
bspc monitor -f "$dir"
exit
fi
if ! bspc node -f $dir.local; then
if ! bspc node -f "$dir".local; then
bspc query -T -d | jq .layout
if ! bspc monitor -f $dir && [ "$(bspc query -T -d | jq -r .layout)" = "monocle" ]; then
if ! bspc monitor -f "$dir" && [ "$(bspc query -T -d | jq -r .layout)" = "monocle" ]; then
# assume we went up or down and failed and monocle, shuffle through style
[ "$dir" = "north" ] && bspc node -f next.local
[ "$dir" = "south" ] && bspc node -f prev.local

View File

@ -1,105 +1,95 @@
#!/bin/sh
# Usage:
# `$0`: Ask for recording type via dmenu
# `$0 screencast`: Record both audio and screen
# `$0 video`: Record only screen
# `$0 audio`: Record only audio
# `$0 kill`: Kill existing recording
#
# If there is already a running instance, user will be prompted to end it.
killrecording() {
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
}
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
}
screencast() { \
ffmpeg -y \
-thread_queue_size 4096 \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i "$DISPLAY" \
-f alsa -ac 2 -i pulse \
-r 30 \
-c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \
"$HOME/vid/Screen/$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
}
ffmpeg -y \
-thread_queue_size 4096 \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i "$DISPLAY" \
-f alsa -ac 2 -i pulse \
-r 30 \
-c:v libx264rgb -crf 0 -preset ultrafast -c:a libfdk_aac \
"$HOME/vid/Screen/$(date -I).mkv" &
echo $! > /tmp/recordingpid
}
jacka() { \
ffmpeg -y \
-thread_queue_size 4096 \
-f jack -i jack_out.monitor \
-ac 2 -channel_layout stereo -async 1 \
-c:a flac "$HOME/snd/Tape/$(date '+%y%m%d-%H%M-%S').flac"
echo $! > /tmp/recordingpid
ffmpeg -y \
-thread_queue_size 4096 \
-f jack -i jack_out.monitor \
-ac 2 -channel_layout stereo -async 1 \
-c:a libopus "$HOME/snd/Tape/$(date -I).opus"
echo $! > /tmp/recordingpid
}
jackv() {
ffmpeg -y \
-thread_queue_size 4096 \
-f jack -i ffmpeg \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i "$DISPLAY" \
-r 30 \
-c:v libx264 -qp 0 -r 30 -c:a flac \
"$HOME/vid/Screen/$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
ffmpeg -y \
-thread_queue_size 4096 \
-f jack -i ffmpeg \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i "$DISPLAY" \
-r 30 \
-c:v libx264 -qp 0 -r 30 -c:a libfdk_aac \
"$HOME/vid/Screen/$(date -I).mkv" &
echo $! > /tmp/recordingpid
}
mute() {
ffmpeg -y \
-f x11grab \
-thread_queue_size 4096 \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/vid/$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
}
ffmpeg -y \
-f x11grab \
-thread_queue_size 4096 \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/vid/$(date -I).mkv" &
echo $! > /tmp/recordingpid
}
audio() { \
ffmpeg -y \
-thread_queue_size 4096 \
-f pulse -i default \
-ac 2 -channel_layout stereo -async 1 \
-c:a flac \
"$HOME/snd/Tape/$(date '+%y%m%d-%H%M-%S').mp3" &
echo $! > /tmp/recordingpid
}
ffmpeg -y \
-thread_queue_size 4096 \
-f pulse -i default \
-ac 2 -channel_layout stereo -async 1 \
-c:a flac \
"$HOME/snd/tape/$(date -I).mp3" &
echo $! > /tmp/recordingpid
}
askrecording() { \
choice=$(printf "screencast\\nvideo\\naudio\\njack video\\njack audio" | dmenu -i -w 200 -p "Record ")
case "$choice" in
screencast) screencast;;
video) mute;;
audio) audio;;
"jack video") jackv;;
"jack audio") jacka;;
esac
}
choice=$(printf "Screencast\\nVideo only\\nAudio\\nJack Screencast\\nJack Audio" | dmenu -i -w 200 -p " ")
case "$choice" in
"Screencast") screencast;;
"Video only") mute;;
"Audio") audio;;
"Jack Screencast") jackv;;
"Jack Audio") jacka;;
esac
}
asktoend() { \
response=$(printf "No\\nYes" | dmenu -i -w 300 -p "End recording? ") &&
[ "$response" = "Yes" ] && killrecording
}
response=$(printf "No\\nYes" | dmenu -i -w 220 -p "End recording? ") &&
[ "$response" = "Yes" ] && killrecording
}
case "$1" in
screencast) screencast;;
video) mute;;
audio) audio;;
"jack video") jackv;;
"jack audio") jacka;;
kill) killrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
"Screencast") screencast;;
"Video only") mute;;
"Audio") audio;;
"Jack Screencast") jackv;;
"Jack Audio") jacka;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Dotfiles on Git
# Instructions here https://news.ycombinator.com/item?id=11070797
@ -7,5 +7,5 @@
h() { git --git-dir="$HOME/.local/share/hexagons/" --work-tree="$HOME" "$@"; }
case $1 in
*) h "$@" ;;
esac
*) h "$@" ;;
esac

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -C -f -u
#IFS=$'\n'
@ -28,78 +28,79 @@ HIGHLIGHT_TABWIDTH=8
HIGHLIGHT_STYLE='pablo'
handle_extension() {
case "${FILE_EXTENSION_LOWER}" in
# Archive
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
atool --list -- "${FILE_PATH}"
bsdtar --list --file "${FILE_PATH}"
exit 1;;
rar)
# Avoid password prompt by providing empty password
unrar lt -p- -- "${FILE_PATH}"
exit 1;;
7z)
# Avoid password prompt by providing empty password
7z l -p -- "${FILE_PATH}"
exit 1;;
case "${FILE_EXTENSION_LOWER}" in
# Archive
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
atool --list -- "${FILE_PATH}"
bsdtar --list --file "${FILE_PATH}"
exit 1;;
rar)
# Avoid password prompt by providing empty password
unrar lt -p- -- "${FILE_PATH}"
exit 1;;
7z)
# Avoid password prompt by providing empty password
7z l -p -- "${FILE_PATH}"
exit 1;;
# PDF
pdf)
# Preview as text conversion
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" -
exiftool "${FILE_PATH}"
exit 1;;
# PDF
pdf)
# Preview as text conversion
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" -
exiftool "${FILE_PATH}"
exit 1;;
# BitTorrent
torrent)
transmission-show -- "${FILE_PATH}"
exit 1;;
# BitTorrent
torrent)
transmission-show -- "${FILE_PATH}"
exit 1;;
# HTML
htm|html|xhtml)
# Preview as text conversion
lynx -dump -- "${FILE_PATH}"
elinks -dump "${FILE_PATH}"
;; # Continue with next handler on failure
# HTML
htm|html|xhtml)
# Preview as text conversion
lynx -dump -- "${FILE_PATH}"
elinks -dump "${FILE_PATH}"
;; # Continue with next handler on failure
# JSON
json)
jq --color-output . "${FILE_PATH}" && exit 5
python -m json.tool -- "${FILE_PATH}" && exit 5
;;
conf) bat "${FILE_PATH}" && exit 0 ;;
esac
# JSON
json)
jq --color-output . "${FILE_PATH}" && exit 5
python -m json.tool -- "${FILE_PATH}" && exit 5
;;
conf) bat "${FILE_PATH}" && exit 0 ;;
esac
}
handle_mime() {
local mimetype="${1}"
case "${mimetype}" in
text/html) lynx -dump "${FILE_PATH}" ;;
text/troff) man ./ "${FILE_PATH}" | col -b ;;
text/* | */xml)
# Syntax highlight
if [ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]; then
exit 2
fi
if [ "$( tput colors )" -ge 256 ]; then
local highlight_format='xterm256'
else
local highlight_format='ansi'
fi
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}"
exit 2;;
application/zip) atool --list -- "${FILE_PATH}" ;;
image/*) mediainfo "${FILE_PATH}" || exit 1;;
video/* | audio/*|application/octet-stream) mediainfo "${FILE_PATH}" || exit 1;;
*/pdf) pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - ;;
esac
local mimetype="${1}"
case "${mimetype}" in
text/html) lynx -dump "${FILE_PATH}" ;;
text/troff) man ./ "${FILE_PATH}" | col -b ;;
text/* | */xml)
# Syntax highlight
if [ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]; then
exit 2
fi
if [ "$( tput colors )" -ge 256 ]; then
local highlight_format='xterm256'
else
local highlight_format='ansi'
fi
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}"
exit 2;;
application/zip) atool --list -- "${FILE_PATH}" ;;
image/*) mediainfo "${FILE_PATH}" || exit 1;;
video/* | audio/*|application/octet-stream) mediainfo "${FILE_PATH}" || exit 1;;
*/pdf) pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - ;;
esac
}
handle_fallback() {
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}"
exit 1
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}"
exit 1
}
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"

33
.local/bin/minve Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
file="/tmp/.minimized"
touch "$file"
lines=$(awk 'END{print NR}' "$file")
icon="$XDG_DATA_HOME/icons/Marwaita-Dark/24x24/categories/preferences-system-windows.svg"
case $1 in
hide)
if [ "$lines" -ge 15 ]; then
notify-send "15 windows are already hidden" "You should consider closing some before hiding even more."
else
focusedNode=$(bspc query -N -n .focused)
focusedID=$(bspc query -D -d --names)
focusedName=$(xprop -id "$focusedNode" WM_NAME | cut -d\" -f2)
echo "$focusedNode $focusedID $focusedName" >> "$file"
xdo hide "$focusedNode"
notiflines="$((lines +1))"
notify-send -i "$icon" "${notiflines} hidden windows." "$focusedName"
fi
;;
dmenu)
[ -z "$file" ] && exit
lineNumber=$(awk '{print $2,$3}' "$file" | dmenu -i -p ' ')
selectedID=$(awk -v pat="$lineNumber" '$0~pat {print $1}' "$file")
selectedDesktop=$(awk -v pat="$lineNumber" '$0~pat {print $2}' "$file")
bspc desktop -f "$selectedDesktop"
xdo show "$selectedID"
sed -i "/${lineNumber}/d" "$file"
;;
esac

View File

@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -euf -o pipefail
I=1
M=$(bspc query -M | wc -l)
if [[ "$M" == 1 ]]; then
bspc monitor -d 1 2 3 4 5 6 7 8 9 10
elif [[ "$M" == 2 ]]; then
bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3 4 5
bspc monitor "$(bspc query -M | awk NR==2)" -d 6 7 8 9 10
elif [[ "$M" == 3 ]]; then
bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3 4
bspc monitor "$(bspc query -M | awk NR==2)" -d 5 6 7
bspc monitor "$(bspc query -M | awk NR==3)" -d 8 9 10
elif [[ "$M" == 4 ]]; then
bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3
bspc monitor "$(bspc query -M | awk NR==2)" -d 4 5 6
bspc monitor "$(bspc query -M | awk NR==3)" -d 7 8
bspc monitor "$(bspc query -M | awk NR==4)" -d 9 10
elif [[ "$M" == 5 ]]; then
bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2
bspc monitor "$(bspc query -M | awk NR==2)" -d 3 4
bspc monitor "$(bspc query -M | awk NR==3)" -d 5 6
bspc monitor "$(bspc query -M | awk NR==4)" -d 7 8
bspc monitor "$(bspc query -M | awk NR==5)" -d 9 10
else
for monitor in $(bspc query -M); do
bspc monitor "$monitor" \
-n "$I" \
-d $I/{a,b,c}
(( I++ ))
done
fi

19
.local/bin/monis Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
M=$(xrandr -q | awk '/ connected/ {print $1}')
NUM=$(echo "$M" | wc -l)
ettin() {
sec=$(echo "$M" | awk NR==2)
xrandr --output LVDS1 --primary --auto --scale 1.0x1.0 --output "$sec" --right-of LVDS1 --auto --scale 1.0x1.0
setbg
bspc monitor LVDS1 -d 1 2 3 4 5
bspc monitor "$sec" -d 6 7 8 9 10
bspc rule -a Firefox:Navigator state=tiled, desktop='^6'
}
if [ "$NUM" = 1 ]; then
unimon
elif [ "$NUM" = 2 ]; then
ettin
fi

View File

@ -1,12 +1,11 @@
#!/bin/sh
twoscreen() { # If there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -w 500 -p "Mirror displays? ")
mirror=$(printf "no\\nyes" | dmenu -i -w 300 -p "Mirror displays? ")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -w 500 -p "Optimize resolution for: ")
external=$(echo "$screens" | dmenu -i -w 320 -p "Optimize resolution for: ")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
@ -26,8 +25,7 @@ twoscreen() { # If there are two screens.
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -i -w 500 -p "Select primary display: ")
primary=$(echo "$screens" | dmenu -i -w 320 -p "Select primary display: ")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -w 500 -p "What side of $primary should $secondary be on? ")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
@ -35,10 +33,10 @@ twoscreen() { # If there are two screens.
}
morescreen() { # If there are more than two screens.
primary=$(echo "$screens" | dmenu -i -w 500 -p "Select primary display: ")
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -w 500 -p "Select secondary display: ")
primary=$(echo "$screens" | dmenu -i -w 320 -p "Select primary display: ")
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -w 320 -p "Select secondary display: ")
direction=$(printf "left\\nright" | dmenu -i -w 500 -p "What side of $primary should $secondary be on? ")
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -w 500 -p "Select third display: ")
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -w 320 -p "Select third display: ")
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
}
@ -50,14 +48,12 @@ multimon() { # Multi-monitor handler.
postrun() {
setbg
{ killall dunst ; setsid dunst & } >/dev/null 2>&1
bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3 4 5
bspc monitor "$(bspc query -M | awk NR==2)" -d 6 7 8 9 10
}
# Get all possible displays
allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
screens=$(xrandr -q | awk '/ connected/ {print $1}')
multimon

View File

@ -1,85 +1,83 @@
#!/bin/bash
#!/bin/sh
# Originally by https://github.com/windelicato/
size=${2:-'20'}
dir=$1
transplanter() {
bspc node "${dir}" -p south && bspc node -n "${dir}"
bspc node "${dir}" -p south && bspc node -n "${dir}"
}
northplanter() {
bspc node north -p north && bspc node -n north
bspc node north -p north && bspc node -n north
}
rootplanter() {
bspc node @/ -p "${dir}" && bspc node -n @/ || bspc node -s next.local && bspc node -n @/
bspc node @/ -p cancel
bspc node @/ -p "${dir}" && bspc node -n @/ || bspc node -s next.local && bspc node -n @/
bspc node @/ -p cancel
}
bspc config pointer_follows_focus true
# Find current window mode
is_floating() {
bspc query -T -n | grep -q '"state":"floating"'
bspc query -T -n | grep -q '"state":"floating"'
}
# If the window is floating, move it
if is_floating; then
#only parse input if window is floating,tiled windows accept input as is
case "$dir" in
west) switch="-x"
sign="-"
;;
east) switch="-x"
sign="+"
;;
north) switch="-y"
sign="-"
;;
*) switch="-y"
sign="+"
;;
esac
xdo move "${switch}" "${sign}${size}"
case "$dir" in
west) switch="-x"
sign="-"
;;
east) switch="-x"
sign="+"
;;
north) switch="-y"
sign="-"
;;
*) switch="-y"
sign="+"
;;
esac
xdo move "${switch}" "${sign}${size}"
# Otherwise, window is tiled: switch with window in given direction
else
if [[ $(bspc query -N -n .local.\!floating | wc -l) != 2 ]]; then
case "$dir" in
north) northplanter || rootplanter
;;
*) transplanter || rootplanter
;;
esac
else
case "$dir" in
east) bspc node -s east || bspc query -N -n west.local || \
if bspc query -N -n south.local ; then
bspc node @/ -R 90
else
bspc node @/ -R 270
fi
;;
west) bspc node -s west || bspc query -N -n east.local || \
if bspc query -N -n north.local ; then
bspc node @/ -R 90
else
bspc node @/ -R 270
fi
;;
south) bspc node -s south || bspc query -N -n north.local || \
if bspc query -N -n west.local ; then
bspc node @/ -R 90
else
bspc node @/ -R 270
fi
;;
*) bspc node -s north || bspc query -N -n south.local || \
if bspc query -N -n west.local ; then
bspc node @/ -R 270
else
bspc node @/ -R 90
fi
;;
esac
fi
if [ "$(bspc query -N -n .local.\!floating | wc -l)" != 2 ]; then
case "$dir" in
north) northplanter || rootplanter;;
*) transplanter || rootplanter;;
esac
else
case "$dir" in
east) bspc node -s east || bspc query -N -n west.local || \
if bspc query -N -n south.local ; then
bspc node @/ -R 90
else
bspc node @/ -R 270
fi
;;
west) bspc node -s west || bspc query -N -n east.local || \
if bspc query -N -n north.local ; then
bspc node @/ -R 90
else
bspc node @/ -R 270
fi
;;
south) bspc node -s south || bspc query -N -n north.local || \
if bspc query -N -n west.local ; then
bspc node @/ -R 90
else
bspc node @/ -R 270
fi
;;
*) bspc node -s north || bspc query -N -n south.local || \
if bspc query -N -n west.local ; then
bspc node @/ -R 270
else
bspc node @/ -R 90
fi
;;
esac
fi
fi

View File

@ -1,22 +1,40 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
MAINDIR="$HOME/doc/"
NOTAS="notas"
DIARIO="blog"
diario() {
diario="$HOME/doc/blog"
menublog=$(printf "Hoy\\nMañana\\nArchivo" | dmenu -w 120 -p " ")
if [ "$menublog" = "Hoy" ]; then
alacritty --class=flota -e nvim "$diario/$(date -I)".wiki
elif [ "$menublog" = "Mañana" ]; then
alacritty --class=flota -e nvim "$diario/$(date --date='tomorrow' +%F)".wiki
else
cd "$diario" || exit
archivo
fi
}
DIRS=("$NOTAS" "$DIARIO")
SELPATH="$(printf '%s\n' "${DIRS[@]}" | dmenu -w 250 -p "Wiki ")"
notas() {
notas="$HOME/doc/notas"
menunota=$(printf "Nueva\\nArchivo" | dmenu -w 120 -p " ")
if [ "$menunota" = "Nueva" ]; then
alacritty --class=flota -e nvim "$notas/$(date -I)".wiki
else
cd "$notas" || exit
archivo
fi
}
cd "$MAINDIR/$SELPATH"
if command -v fd >/dev/null 2>&1; then
SEL=$(fd -d 1 -e wiki | dmenu -w 250 -p "File ")
else
SEL=$(find . -maxdepth 1 -type f -printf '%P\n' | sort -M | dmenu -w 250 -p "File ")
fi
if [[ $SEL == "" ]]; then
archivo(){
selarch=$(fd -d 1 -e wiki | sort -M | dmenu -w 200 -p " ")
if [ "$selarch" = "" ]; then
exit 0
else
alacritty --class=flota -e nvim "$SEL"
fi
else
alacritty --class=flota -e nvim "$selarch"
fi
}
MENU="$(printf "Blog\\nNotas" | dmenu -w 100 -p " ")"
case $MENU in
'Blog') diario;;
'Notas') notas;;
esac

View File

@ -1,5 +1,3 @@
#!/bin/bash
#!/bin/sh
desk=$(bspc query -T -d | jq '.name' | sed -r 's/("|")//g')
dunstify -a BSPWM -u low -r 5769 -t 1000 "$desk"
dunstify -a BSPWM -u low -r 5769 -t 1000 "$(bspc query -D -d --names)"

3
.local/bin/paclist Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
xbps-query -vm > ~/doc/xbpaketes

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
maim -u ~/img/scrot/"$(date +%s)".png && notify-send -u low -t 3000 -i ~/img/.icn/camera.png 'Screen captured'

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
TITLE="Tomatimer!"
ICON1="$HOME/img/.icn/tomate1.png"

View File

@ -1,20 +1,11 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
shutdown="Shutdown"
reboot="Reboot"
suspend="Suspend"
lock="Lock"
log_out="Log Out"
options="$shutdown\n$reboot\n$suspend\n$lock\n$log_out"
chosen="$(echo -e "$options" | dmenu -w 120 -i -p "⏻ ")"
chosen="$(printf "Shutdown\\nReboot\\nSuspend\\nLock\\nLog out" | dmenu -w 120 -i -p "⏻ ")"
case $chosen in
"$shutdown") sudo shutdown -h now;;
"$reboot") sudo reboot;;
"$suspend") sudo zzz;;
"$lock") xset s activate;;
"$log_out") bspc quit;;
*) exit 0;;
"Shutdown") loginctl poweroff;;
"Reboot") loginctl reboot;;
"Suspend") loginctl suspend;;
"Lock") xset s activate;;
"Log out") loginctl terminate-user "$(id -u "$USER")";;
*) exit 0;;
esac

View File

@ -1,11 +1,9 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
bgloc="/tmp/bg"
dir="$HOME/img/wallpaper"
[ -f "$dir" ] && ln -sf "$(readlink -f "$dir")" "$bgloc"
[ -d "$dir" ] && ln -sf "$(find "$(readlink -f "$dir")" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc"
hsetroot -fill "$bgloc" >/dev/null 2>&1

11
.local/bin/ref Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
MAINDIR="$HOME/doc/"
PIX="pixels"
PET="c64"
MENU="$(printf "Pixels\\nPetscii" | dmenu -w 150 -p " ")"
case $MENU in
'Pixels') sxiv-rifle "$MAINDIR/$PIX/ref" >/dev/null 2>&1 ;;
'Petscii') sxiv-rifle "$MAINDIR/$PET/ref" >/dev/null 2>&1;;
esac

View File

@ -1,13 +0,0 @@
#!/bin/sh
opt="bspwm mpd dunst picom fonts shell"
program="$(echo "$opt" | sed 's/ /\n/g' | fzf --height='45%')"
case $program in
bspwm) bspc wm -r;;
mpd) pkill mpd; mpd &;;
dunst) pkill dunst; dunst &;;
fonts) fc-cache -v -f;;
shell) . "$ZDOTDIR/.zshrc" ;;
*) exit
esac

View File

@ -1,3 +1,3 @@
#!/bin/sh
# Sets the background. If given an argument, will set file as background.
hsetroot -fill /tmp/bg >/dev/null 2>&1

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
sxiv -bpa "$@"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Compatible with ranger 1.6.*
#
# This script searches image files in a directory, opens them all with sxiv and
@ -24,7 +24,7 @@ if [ $# -eq 0 ]; then
exit
fi
[ "$1" == '--' ] && shift
[ "$1" = '--' ] && shift
abspath () {
case "$1" in

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
# CONFIG ----------------------------------------------------
# This NEEDS to be the same as in mpd.conf
@ -27,23 +26,19 @@ heading="$(mpc current -f "%album%" | sed "s:&:&amp;:g")"
message="$(mpc current -f "$form" | sed "s:&:&amp;:g" )"
# Is there music on?
[[ -z $song ]] && exit 1
[ -z "$song" ] && exit 1
# No cover if the folder isn't found
[[ -z "$songdir" ]] && exit 1
[ -z "$songdir" ] && exit 1
# But if it is found, look for only one of the specified files
cover="$(find "$songdir" -maxdepth 1 -type f -regextype egrep -regex "$img_reg" 2>/dev/null)"
# Resize the cover
if [[ -n $cover ]]; then
ffmpeg -hide_banner -loglevel panic -nostats -y -i "$cover" -vf scale="$cover_resize":-2 "$raw_cover"
cover="$raw_cover"
if [ -n "$cover" ]; then
ffmpeg -hide_banner -loglevel panic -nostats -y -i "$cover" -vf scale="$cover_resize":-2 "$raw_cover"
cover="$raw_cover"
fi
# Send the notification
notify-send -u low -t 8000 -i "$cover" "$heading" "$message"
# add a rule to make sxiv:albumcover floating
#sxiv "$cover" -N albumcover -g 250x250-10-10 -bpq > /dev/null 2>&1 & pid=$!
# { sleep 4; kill "$pid"; } &

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
if command -v tmux >/dev/null 2>&1; then
test -z "$TMUX" && (tmux new -A -s "Z" )

View File

@ -8,7 +8,7 @@ sessions="$(tmux ls 2> /dev/null | awk '! /attached/ { sub(":", "", $1); print $
choice=$(printf "%b" "$sessions" | dmenu -i -w 245 -p "Attach ")
[ ! "$choice" ] && exit
if [ "$choice" = "new" ]; then
$TERMINAL -e tmux
$TERMINAL -e tmux
else
$TERMINAL -e tmux a -t "$choice"
$TERMINAL -e tmux a -t "$choice"
fi

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
#
# enable/disable touchpad
# find your touchpad name:
@ -7,8 +7,8 @@
# Source: Xero's dotfiles on github
PAD='AlpsPS/2 ALPS GlidePoint'
A=`xinput list-props "$PAD" | sed -n -e 's/.*Device Enabled ([0-9][0-9]*):\t\(.*\)/\1/p' `
if [ $A -eq 1 ]; then
A=$(xinput list-props "$PAD" | sed -n -e 's/.*Device Enabled ([0-9][0-9]*):\t\(.*\)/\1/p' )
if [ "$A" -eq 1 ]; then
xinput set-int-prop "$PAD" "Device Enabled" 8 0
notify-send -t 5000 'touchpad disabled' -i /usr/share/icons/Papirus-Dark/24x24/devices/input-touchpad.svg
else

View File

@ -1,10 +1,5 @@
#!/usr/bin/env bash
set -euf -o pipefail
ps ax | grep -q "\stransmission-daemon$" || (transmission-daemon && notify-send "Starting transmission daemon")
#!/bin/sh
pgrep "\stransmission-daemon$" || (transmission-daemon && notify-send "Starting transmission daemon")
sleep 8
transmission-remote -a "$@" && notify-send "Torrent added."

View File

@ -1,18 +1,17 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
TRANS_PID=$(pidof transmission-daemon)
if [[ $TRANS_PID ]]; then
echo "$(tput setaf 1) Stopping Transmission Daemon"
killall transmission-daemon 2> /dev/null ;
echo "$(tput setaf 3) Updating Blocklist"
tblock
echo "$(tput setaf 2) Restarting Transmission Daemon"
tsd
if [ "$TRANS_PID" ]; then
echo "$(tput setaf 1) Stopping Transmission Daemon"
killall transmission-daemon 2> /dev/null ;
echo "$(tput setaf 3) Updating Blocklist"
tblock
echo "$(tput setaf 2) Restarting Transmission Daemon"
tsd
fi
if [[ ! $TRANS_PID ]]; then
echo "$(tput setaf 3) Updating Blocklist"
tblock
if [ ! "$TRANS_PID" ]; then
echo "$(tput setaf 3) Updating Blocklist"
tblock
fi

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
transmission-remote -l | grep 100% | grep Done | awk '{print $1}' | xargs -n 1 -I % transmission-remote -t % -r

View File

@ -1,13 +1,12 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
MAINDIR="$HOME/vid/Learning/"
cd "$MAINDIR"
SEL=$(fd -d 1 'ztm' | dmenu -p "Tuto ")
cd "$MAINDIR/$SEL"
PLAY=$(fd -d 1 | dmenu -p "Play ")
if [[ $PLAY == "" ]]; then
cd "$MAINDIR" || exit
SEL=$(fd -d 1 'ztm' | dmenu -p " ")
cd "$MAINDIR/$SEL" || exit
PLAY=$(fd -d 1 | sort -d | dmenu -p " ")
if [ "$PLAY" = "" ]; then
exit 0
else
mpv "$PLAY"

View File

@ -1,31 +1,30 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
HEART='\uf21e'
WIFI='\ufaa8'
HEART=''
WIFI=''
if [ -d /sys/class/power_supply/BAT0 ]; then
battery_info="$(head -n 1 /sys/class/power_supply/BAT0/capacity)%"
current_charge=$(echo "$battery_info" | grep -o '[0-9]\+%' | awk '{sub (/%/, "", $1); print $1}')
battery_info="$(head -n 1 /sys/class/power_supply/BAT0/capacity)%"
current_charge=$(echo "$battery_info" | grep -o '[0-9]\+%' | awk '{sub (/%/, "", $1); print $1}')
if [[ $current_charge -lt 11 ]]; then
echo -n '#[fg=colour9]'
elif [[ $current_charge -lt 31 ]]; then
echo -n '#[fg=colour126]'
elif [[ $current_charge -lt 51 ]]; then
echo -n '#[fg=colour201]'
elif [[ $current_charge -lt 71 ]]; then
echo -n '#[fg=colour178]'
elif [[ $current_charge -lt 90 ]]; then
echo -n '#[fg=colour11]'
else
echo -n '#[fg=colour123]'
fi
echo -ne "$HEART $current_charge"
if [ "$current_charge" -lt 11 ]; then
printf '#[fg=colour9]'
elif [ "$current_charge" -lt 31 ]; then
printf '#[fg=colour126]'
elif [ "$current_charge" -lt 51 ]; then
printf '#[fg=colour201]'
elif [ "$current_charge" -lt 71 ]; then
printf '#[fg=colour178]'
elif [ "$current_charge" -lt 90 ]; then
printf '#[fg=colour11]'
else
printf '#[fg=colour123]'
fi
printf "%s\n $HEART $current_charge"
fi
if ping -q -w 1 -c 1 "$(ip r | grep -m 1 default | cut -d ' ' -f 3)" >/dev/null
then
net="$(awk 'NR == 3 { print substr($3, 1, length($3) - 1) }' /proc/net/wireless)"
echo -ne " #[fg=colour177]$WIFI${net} "
net="$(awk 'NR == 3 { print substr($3, 1, length($3) - 1) }' /proc/net/wireless)"
printf "%s\n #[fg=colour177]$WIFI${net} "
fi

11
.local/bin/unimon Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
M=$(xrandr -q | awk '/ connected/ {print $1}')
cyclops() {
xrandr --output LVDS1 --primary --auto --scale 1.0x1.0 "$(echo "$M" | awk '! /LVDS1/ {print "--output", $1, "--off"}' | paste -sd ' ')"
bspc monitor -d 1 2 3 4 5 6 7 8 9 10
bspc rule -a Firefox:Navigator state=tiled, desktop='^2'
}
cyclops

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
sudo xbps-install -Su
echo "Actualizando db..."
@ -7,5 +6,5 @@ sudo updatedb
echo "Actualizando manpages..."
sudo makewhatis /usr/share/man
echo "Actualizando la lista de paquetes..."
xbps-query -vm > ~/doc/xbpaketes
paclist
echo "Listo."

18
.local/bin/vent Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
switch=""
titles=""
wids="$(bspc query -N -n .window)"
nl='
'
for wid in $wids; do
title="$(xprop -id "$wid" WM_NAME | cut -d\" -f2)"
titles="$titles${titles:+$nl}${title}"
switch="$switch '$(echo "${title}" | sed "s#'#\'\\\'\'#g")') bspc node -f $wid;;"
done
switch="$switch *) ;;"
selection="$(printf '%s' "$titles" | dmenu -p " " "$@")"
eval "case \"$selection\" in $switch esac"

View File

@ -1,51 +0,0 @@
#!/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
lines=$(wc -l < $file)
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="dmenu -i -l $linesDisplayed -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

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
xprop | grep WM_CLASS

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -euf -o pipefail
#!/bin/sh
youtube-dl --add-metadata --youtube-skip-dash-manifest -ic --no-call-home --no-cache-dir --geo-bypass -o "$HOME/vid/%(title)s.%(ext)s" "$@"
youtube-dl --add-metadata --youtube-skip-dash-manifest -ic --no-call-home --no-cache-dir --geo-bypass -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o "$HOME/vid/%(title)s.%(ext)s" "$@"

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Description: download all videos from a playlist in a separate directory.
set -euf -o pipefail
youtube-dl -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' "$@"

View File

@ -8,22 +8,22 @@ cd "$directory" || exit
[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
if [ -f "$archive" ] ; then
case "$archive" in
*.tar.bz2|*.tbz2) tar xvjf "$archive" ;;
*.tar.xz) tar -xf "$archive" ;;
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
*.lzma) unlzma "$archive" ;;
*.bz2) bunzip2 "$archive" ;;
*.rar) unrar x -ad "$archive" ;;
*.gz) gunzip "$archive" ;;
*.tar) tar xvf "$archive" ;;
*.zip) unzip "$archive" ;;
*.Z) uncompress "$archive" ;;
*.7z) 7z x "$archive" ;;
*.xz) unxz "$archive" ;;
*.exe) cabextract "$archive" ;;
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
esac
case "$archive" in
*.tar.bz2|*.tbz2) tar xvjf "$archive" ;;
*.tar.xz) tar -xf "$archive" ;;
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
*.lzma) unlzma "$archive" ;;
*.bz2) bunzip2 "$archive" ;;
*.rar) unrar x -ad "$archive" ;;
*.gz) gunzip "$archive" ;;
*.tar) tar xvf "$archive" ;;
*.zip) unzip "$archive" ;;
*.Z) uncompress "$archive" ;;
*.7z) 7z x "$archive" ;;
*.xz) unxz "$archive" ;;
*.exe) cabextract "$archive" ;;
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
esac
else
printf "File \"%s\" not found.\\n" "$archive"
printf "File \"%s\" not found.\\n" "$archive"
fi

View File

@ -5,14 +5,6 @@ else
export EDITOR="nvim"
fi
if test -z "${XDG_RUNTIME_DIR}"; then
export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
if ! test -d "${XDG_RUNTIME_DIR}"; then
mkdir "${XDG_RUNTIME_DIR}"
chmod 0700 "${XDG_RUNTIME_DIR}"
fi
fi
export TERMINAL="alacritty"
export VISUAL="$EDITOR"
export GIT_EDITOR="$EDITOR"
@ -37,7 +29,6 @@ export BAT_THEME="TwoDark"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0"
export QT_QPA_PLATFORMTHEME="qt5ct"
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"

View File

@ -14,6 +14,7 @@ audacity-2.3.3_1
autopep8-1.5.2_1
base-system-0.113_2
bat-0.15.0_1
bc-1.07.1_5
bspwm-0.9.9_2
cadence-0.9.1_1
chrony-3.5_2
@ -24,9 +25,12 @@ ctags-5.8_7
delta-0.0.17_1
dfc-3.1.1_1
dunst-1.4.1_1
elogind-243.4_2
faac-1.30_1
fd-8.0.0_1
ffmpeg-4.2.2_3
fdk-aac-devel-2.0.1_1
fdkaac-1.0.0_2
ffmpeg-4.2.3_1
figlet-2.2.5_6
firefox-76.0_2
fzf-0.21.1_1
@ -48,6 +52,7 @@ hub-2.14.2_1
i3lock-color-2.12_2
intel-ucode-20200508_1
isync-1.3.1_2
jack-devel-1.9.14_1
jq-1.6_1
keychain-2.8.5_1
krita-4.2.9_2
@ -84,7 +89,6 @@ p7zip-16.02_5
pass-1.7.3_2
patch-2.7.6_4
pavucontrol-4.0_1
pd-0.50.2_1
perl-File-MimeInfo-0.29_1
pinentry-gtk-1.1.0_6
pinentry-tty-1.1.0_6
@ -93,6 +97,7 @@ polkit-0.116_3
powertop-2.12_1
pulseaudio-13.0_1
pulsemixer-1.5.1_1
pylint-2.4.4_2
python3-3.8.2_1
python3-BeautifulSoup4-4.8.2_1
python3-ipython-7.13.0_1
@ -100,10 +105,12 @@ python3-isort-4.3.21_2
python3-language-server-0.31.8_1
python3-lxml-4.4.3_1
python3-mccabe-0.6.1_3
python3-mypy-0.761_1
python3-pip-20.0.2_1
python3-pycodestyle-2.5.0_2
python3-pyflakes-2.1.1_2
python3-vint-0.3.19_3
python3-yapf-0.29.0_1
qt5ct-0.41_1
sc3-plugins-3.10.0_2
setxkbmap-1.3.2_1
@ -162,3 +169,5 @@ zita-ajbridge-0.8.4_1
zsh-5.8_1
zsh-completions-0.31.0_1
zsh-syntax-highlighting-0.7.1_1
cantarell-fonts-0.201_1
xtitle-0.4.4_1