diff --git a/.bash_profile b/.bash_profile deleted file mode 100644 index 2d60fc26a..000000000 --- a/.bash_profile +++ /dev/null @@ -1,17 +0,0 @@ -### STARTING XSESSION -if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ] -then - startx -fi -export GST_VAAPI_ALL_DRIVERS=1 -export EDITOR="nvim" # $EDITOR use neovim -#export EDITOR="emacsclient -t -a ''" # $EDITOR use Emacs in terminal -#export VISUAL="emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode -export READER="zathura" -export TERMINAL="alacritty" -export BROWSER="qutebrowser" -export WM="dwm" -export XDG_DATA_HOME=${XDG_DATA_HOME:="$HOME/.local/share"} -export XDG_CACHE_HOME=${XDG_CACHE_HOME:="$HOME/.cache"} -export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"} -source $HOME/.bashrc diff --git a/.bashrc b/.bashrc deleted file mode 100644 index 60bf7539a..000000000 --- a/.bashrc +++ /dev/null @@ -1,255 +0,0 @@ -## ____ __ -## / __ \_________ _/ /_____ -## / / / / ___/ __ `/ //_/ _ \ -## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) -## /_____/_/ \__,_/_/|_|\___/ My custom bash config -## - -### EXPORT ### -export TERM="xterm-256color" # getting proper colors -export HISTCONTROL=ignoredups:erasedups # no duplicate entries - -# use bash-completion, if available -[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ - . /usr/share/bash-completion/bash_completion - -# if not running interactively, don't do anything -[[ $- != *i* ]] && return - -# use neovim for vim if present. -[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d" - -# use $XINITRC variable if file exists. -[ -f "$XINITRC" ] && alias startx="startx $XINITRC" - -### SET VI MODE ### -# Comment this line out to enable default emacs-like bindings -set -o vi -bind -m vi-command 'Control-l: clear-screen' -bind -m vi-insert 'Control-l: clear-screen' - -### PATH ### -if [ -d "$HOME/.bin" ] ; - then PATH="$HOME/.bin:$PATH" -fi - -if [ -d "$HOME/.local/bin" ] ; - then PATH="$HOME/.local/bin:$PATH" -fi - -if [ -d "$HOME/Applications" ] ; - then PATH="$HOME/Applications:$PATH" -fi - -### CHANGE TITLE OF TERMINALS ### -case ${TERM} in - xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*) - PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' - ;; - screen*) - PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' - ;; -esac - -### SHOPT ### -shopt -s autocd # change to named directory -shopt -s cdspell # autocorrects cd misspellings -shopt -s cmdhist # save multi-line commands in history as single line -shopt -s dotglob -shopt -s histappend # do not overwrite history -shopt -s expand_aliases # expand aliases -shopt -s checkwinsize # checks term size when bash regains control - -# ignore upper and lowercase when TAB completion -bind "set completion-ignore-case on" - -# sudo not required for some system commands -for command in mount umount poweroff reboot ; do - alias $command="sudo $command" -done; unset command - -### ARCHIVE EXTRACTION ### -# usage: ex -ex () -{ - if [ -f "$1" ] ; then - case $1 in - *.tar.bz2) tar xjf $1 ;; - *.tar.gz) tar xzf $1 ;; - *.bz2) bunzip2 $1 ;; - *.rar) unrar x $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar xf $1 ;; - *.tbz2) tar xjf $1 ;; - *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1;; - *.7z) 7z x $1 ;; - *.deb) ar x $1 ;; - *.tar.xz) tar xf $1 ;; - *.tar.zst) unzstd $1 ;; - *) echo "'$1' cannot be extracted via ex()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -### ALIASES ### -# navigation -up () { - local d="" - local limit="$1" - - # Default to limit of 1 - if [ -z "$limit" ] || [ "$limit" -le 0 ]; then - limit=1 - fi - - for ((i=1;i<=limit;i++)); do - d="../$d" - done - - # perform cd. Show error if cd fails - if ! cd "$d"; then - echo "Couldn't go up $limit dirs."; - fi -} - -# cd -alias \ - ..="cd .." \ - .2="cd ../.." \ - .3="cd ../../.." \ - .4="cd ../../../.." \ - .5="cd ../../../../.." - -# bat as cat -[ -x "$(command -v bat)" ] && alias cat="bat" - -# DOOM Emacs -[ -x "$(command -v emacs)" ] && alias \ - em="/usr/bin/emacs -nw" \ - emacs="emacsclient -c -a 'emacs'" \ - doomsync="~/.emacs.d/bin/doom sync" \ - doomdoctor="~/.emacs.d/bin/doom doctor" \ - doomupgrade="~/.emacs.d/bin/doom upgrade" \ - doompurge="~/.emacs.d/bin/doom purge" - -# Changing "ls" to "exa" -alias \ - ls="exa -al --color=always --group-directories-first" \ - la="exa -a --color=always --group-directories-first" \ - ll="exa -l --color=always --group-directories-first" \ - lt="exa -aT --color=always --group-directories-first" \ - l.='exa -a | egrep "^\."' - -# xbps -[ -x "$(command -v xbps-query)" ] && alias \ - xb-up="sudo xbps-install -Su && xcheckrestart" \ - xb-get="sudo xbps-install -S" \ - xb-rmv="sudo xbps-remove -R" \ - xb-rmv-sec="sudo xbps-remove" \ - xb-qry="sudo xbps-query" \ - xb-cln="sudo xbps-remove -o && sudo xbps-remove -O" - -# pacman -[ -x "$(command -v pacman)" ] && alias \ - pac-up="sudo pacman -Syyu" \ - pac-get="sudo pacman -S" \ - pac-rmv="sudo pacman -Rcns" \ - pac-rmv-sec="sudo pacman -Runs" \ - pac-qry="sudo pacman -Ss" \ - pac-cln="sudo pacman -Scc" - -# colorize grep output (good for log files) -alias \ - grep="grep --color=auto" \ - egrep="egrep --color=auto" \ - fgrep="fgrep --color=auto" - -# git -alias \ - addup="git add -u" \ - addall="git add ." \ - branch="git branch" \ - checkout="git checkout" \ - clone="git clone" \ - commit="git commit -m" \ - fetch="git fetch" \ - pull="git pull origin" \ - push="git push origin" \ - stat="git status" \ - tag="git tag" \ - newtag="git tag -a" - -# adding flags -alias \ - df="df -h" \ - free="free -m" \ - newsboat="newsboat -u ~/.config/newsboat/urls" - -# multimedia scripts -alias \ - fli="flix-cli" \ - ani="ani-cli" \ - aniq="ani-cli -q" - -# audio -alias \ - mx="pulsemixer" \ - amx="alsamixer" \ - mk="cmus" \ - ms="cmus" \ - music="cmus" - -# power management -alias \ - po="loginctl poweroff" \ - sp="loginctl suspend" \ - rb="loginctl reboot" - -# file management -alias \ - fm="./.config/vifm/scripts/vifmrun" \ - file="./.config/vifm/scripts/vifmrun" \ - flm="./.config/vifm/scripts/vifmrun" \ - vifm="./.config/vifm/scripts/vifmrun" \ - rm="rm -vI" \ - mv="mv -iv" \ - cp="cp -iv" \ - mkd="mkdir -pv" - -# ps -alias \ - psa="ps auxf" \ - psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" \ - psmem="ps auxf | sort -nr -k 4" \ - pscpu="ps auxf | sort -nr -k 3" - -# youtube -alias \ - yta-aac="yt-dlp --extract-audio --audio-format aac" \ - yta-best="yt-dlp --extract-audio --audio-format best" \ - yta-flac="yt-dlp --extract-audio --audio-format flac" \ - yta-m4a="yt-dlp --extract-audio --audio-format m4a" \ - yta-mp3="yt-dlp --extract-audio --audio-format mp3" \ - yta-opus="yt-dlp --extract-audio --audio-format opus" \ - yta-vorbis="yt-dlp --extract-audio --audio-format vorbis" \ - yta-wav="yt-dlp --extract-audio --audio-format wav" \ - ytv-best="yt-dlp -f bestvideo+bestaudio" \ - yt="ytfzf -f -t" \ - ytm="ytfzf -m" - -# network and bluetooth -alias \ - netstats="nmcli dev" \ - wfi="nmtui-connect" \ - wfi-scan="nmcli dev wifi list" \ - wfi-edit="nmtui-edit" \ - wfi-on="nmcli radio wifi on" \ - wfi-off="nmcli radio wifi off" \ - blt="bluetoothctl" - -### SETTING THE STARSHIP PROMPT ### -eval "$(starship init bash)" diff --git a/.config/fish/config.fish b/.config/fish/config.fish deleted file mode 100644 index b2407947f..000000000 --- a/.config/fish/config.fish +++ /dev/null @@ -1,235 +0,0 @@ -## ____ __ -## / __ \_________ _/ /_____ -## / / / / ___/ __ `/ //_/ _ \ -## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) -## /_____/_/ \__,_/_/|_|\___/ My custom fish config -## - -if status is-interactive - # Commands to run in interactive sessions can go here -end - -### EXPORT -set -U fish_greeting "" -set EDITOR "nvim" # $EDITOR use neovim -set READER "zathura" -set TERMINAL "alacritty" -set BROWSER "qutebrowser" -set WM "dwm" -set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" - -### ADDING TO THE PATH -# First line removes the path; second line sets it. Without the first line, -# your path gets massive and fish becomes very slow. -set -e fish_user_paths -set -U fish_user_paths $HOME/.local/bin $HOME/Applications $fish_user_paths - -# Vi mode -function fish_user_key_bindings - # fish_default_key_bindings - fish_vi_key_bindings -end - -### AUTOCOMPLETE AND HIGHLIGHT COLORS ### -set fish_color_normal brcyan -set fish_color_autosuggestion '#7d7d7d' -set fish_color_command brcyan -set fish_color_error '#ff6c6b' -set fish_color_param brcyan - -### FUNCTIONS -# Functions needed for !! and !$ -function __history_previous_command - switch (commandline -t) - case "!" - commandline -t $history[1]; commandline -f repaint - case "*" - commandline -i ! - end -end - -function __history_previous_command_arguments - switch (commandline -t) - case "!" - commandline -t "" - commandline -f history-token-search-backward - case "*" - commandline -i '$' - end -end -# The bindings for !! and !$ -if [ $fish_key_bindings = "fish_vi_key_bindings" ]; - bind -Minsert ! __history_previous_command - bind -Minsert '$' __history_previous_command_arguments -else - bind ! __history_previous_command - bind '$' __history_previous_command_arguments -end - -# Function for creating a backup file -# ex: backup file.txt -# result: copies file as file.txt.bak -function backup --argument filename - cp $filename $filename.bak -end - -# Function for copying files and directories, even recursively. -# ex: copy DIRNAME LOCATIONS -# result: copies the directory and all of its contents. -function copy - set count (count $argv | tr -d \n) - if test "$count" = 2; and test -d "$argv[1]" - set from (echo $argv[1] | trim-right /) - set to (echo $argv[2]) - command cp -r $from $to - else - command cp $argv - end -end - -# Function for printing a column (splits input on whitespace) -# ex: echo 1 2 3 | coln 3 -# output: 3 -function coln - while read -l input - echo $input | awk '{print $'$argv[1]'}' - end -end - -# Function for printing a row -# ex: seq 3 | rown 3 -# output: 3 -function rown --argument index - sed -n "$index p" -end - -# Function for ignoring the first 'n' lines -# ex: seq 10 | skip 5 -# results: prints everything but the first 5 lines -function skip --argument n - tail +(math 1 + $n) -end - -# Function for taking the first 'n' lines -# ex: seq 10 | take 5 -# results: prints only the first 5 lines -function take --argument number - head -$number -end - -### ALIASES -# navigation -alias ..='cd ..' -alias .2='cd ../..' -alias .3='cd ../../..' -alias .4='cd ../../../..' -alias .5='cd ../../../../..' - -# bat as cat -alias cat='bat' - -# editors -alias vim='nvim' - -# Changing "ls" to "exa" -alias ls='exa -al --color=always --group-directories-first' # my preferred listing -alias la='exa -a --color=always --group-directories-first' # all files and dirs -alias ll='exa -l --color=always --group-directories-first' # long format -alias lt='exa -aT --color=always --group-directories-first' # tree listing -alias l.='exa -a | egrep "^\."' - -# xbps -alias xb-up='sudo xbps-install -Su && xcheckrestart' # Refresh pkglist & update standard pkgs -alias xb-get='sudo xbps-install -S' # Install a package -alias xb-rmv='sudo xbps-remove -R' # Remove a package with all its dependencies -alias xb-rmv-sec='sudo xbps-remove' # Remove a package with all its dependencies (secure way) -alias xb-qry='sudo xbps-query' # Repo query -alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove orphaned packages - -# Colorize grep output (good for log files) -alias grep='grep --color=auto' -alias egrep='egrep --color=auto' -alias fgrep='fgrep --color=auto' - -# confirm before overwriting something -alias rm='rm -i' -alias mv='mv -i' -alias cp='cp -i' - -# git -alias addup='git add -u' -alias addall='git add .' -alias branch='git branch' -alias checkout='git checkout' -alias clone='git clone' -alias commit='git commit -m' -alias fetch='git fetch' -alias pull='git pull origin' -alias push='git push origin' -alias stat='git status' # 'status' is protected name so using 'stat' instead -alias tag='git tag' -alias newtag='git tag -a' - -# adding flags -alias df='df -h' # human-readable sizes -alias free='free -m' # show sizes in MB -alias newsboat='newsboat -u ~/.config/newsboat/urls' # start newsboat with my urls file - -# ani-cli -alias ani='ani-cli' -alias ani-q='ani-cli -q' # to select video quality - -# ytfzf -alias yt='ytfzf -f -t' - -# flix-cli -alias flix-cli='flix-cli' - -# mount and unmount drives -alias mnt='sudo mount' -alias umnt='sudo umount' - -# mixers -alias mx='pulsemixer' -alias amx='alsamixer' - -# music player -alias mk='cmus' - -# power management -alias po='loginctl poweroff' -alias sp='loginctl suspend' -alias rb='loginctl reboot' - -# file manager -alias fm='./.config/vifm/scripts/vifmrun' -alias vifm='./.config/vifm/scripts/vifmrun' - -# ps -alias psa="ps auxf" -alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" -alias psmem='ps auxf | sort -nr -k 4' -alias pscpu='ps auxf | sort -nr -k 3' - -# youtube-dl -alias yta-aac="yt-dlp --extract-audio --audio-format aac " -alias yta-best="yt-dlp --extract-audio --audio-format best " -alias yta-flac="yt-dlp --extract-audio --audio-format flac " -alias yta-m4a="yt-dlp --extract-audio --audio-format m4a " -alias yta-mp3="yt-dlp --extract-audio --audio-format mp3 " -alias yta-opus="yt-dlp --extract-audio --audio-format opus " -alias yta-vorbis="yt-dlp --extract-audio --audio-format vorbis " -alias yta-wav="yt-dlp --extract-audio --audio-format wav " -alias ytv-best="yt-dlp -f bestvideo+bestaudio " - -# Network Manager and bluetooth -alias netstats='nmcli dev' -alias wfi='nmtui-connect' -alias wfi-scan='nmcli dev wifi list' -alias wfi-edit='nmtui-edit' -alias wfi-on='nmcli radio wifi on' -alias wfi-off='nmcli radio wifi off' -alias blt='bluetoothctl' - -### SETTING THE STARSHIP PROMPT ### -eval "$(starship init bash)" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100644 index 1ed2cdae1..000000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,130 +0,0 @@ -let mapleader ="," - -if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) - echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim - autocmd VimEnter * PlugInstall -endif - -call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) -Plug 'tpope/vim-surround' -Plug 'preservim/nerdtree' -Plug 'junegunn/goyo.vim' -Plug 'jreybert/vimagit' -Plug 'lukesmithxyz/vimling' -Plug 'vimwiki/vimwiki' -Plug 'vim-airline/vim-airline' -Plug 'tpope/vim-commentary' -Plug 'ap/vim-css-color' -call plug#end() - -set title -set bg=light -set go=a -set mouse=a -set nohlsearch -set clipboard+=unnamedplus -set noshowmode -set noruler -set laststatus=0 -set noshowcmd - -" Some basics: - nnoremap c "_c - set nocompatible - filetype plugin on - syntax on - set encoding=utf-8 - set number relativenumber -" Enable autocompletion: - set wildmode=longest,list,full -" Disables automatic commenting on newline: - autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o -" Perform dot commands over visual blocks: - vnoremap . :normal . -" Goyo plugin makes text more readable when writing prose: - map f :Goyo \| set bg=light \| set linebreak -" Spell-check set to o, 'o' for 'orthography': - map o :setlocal spell! spelllang=en_us -" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. - set splitbelow splitright - -" Nerd tree - map n :NERDTreeToggle - autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - if has('nvim') - let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks' - else - let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks' - endif - -" vimling: - nm d :call ToggleDeadKeys() - imap d :call ToggleDeadKeys()a - nm i :call ToggleIPA() - imap i :call ToggleIPA()a - nm q :call ToggleProse() - -" Shortcutting split navigation, saving a keypress: - map h - map j - map k - map l - -" Replace ex mode with gq - map Q gq - -" Check file in shellcheck: - map s :!clear && shellcheck -x % - -" Replace all is aliased to S. - nnoremap S :%s//g - -" Compile document, be it groff/LaTeX/markdown/etc. - map c :w! \| !compiler "%" - -" Open corresponding .pdf/.html or preview - map p :!opout % - -" Ensure files are read as what I want: - let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} - map v :VimwikiIndex - let g:vimwiki_list = [{'path': '~/.local/share/nvim/vimwiki', 'syntax': 'markdown', 'ext': '.md'}] - autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown - autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff - autocmd BufRead,BufNewFile *.tex set filetype=tex - -" Save file as sudo on files that require root permission - cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! - -" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position - autocmd BufWritePre * let currPos = getpos(".") - autocmd BufWritePre * %s/\s\+$//e - autocmd BufWritePre * %s/\n\+\%$//e - autocmd BufWritePre *.[ch] %s/\%$/\r/e - autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) - -" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable. -if &diff - highlight! link DiffText MatchParen -endif - -" Function for toggling the bottom statusbar: -let s:hidden_all = 0 -function! ToggleHiddenAll() - if s:hidden_all == 0 - let s:hidden_all = 1 - set noshowmode - set noruler - set laststatus=0 - set noshowcmd - else - let s:hidden_all = 0 - set showmode - set ruler - set laststatus=2 - set showcmd - endif -endfunction -nnoremap h :call ToggleHiddenAll() diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 8b5b24965..000000000 --- a/.zshrc +++ /dev/null @@ -1,232 +0,0 @@ -## ____ __ -## / __ \_________ _/ /_____ -## / / / / ___/ __ `/ //_/ _ \ -## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) -## /_____/_/ \__,_/_/|_|\___/ My custom zsh config -## - -### EXPORT -export TERM="xterm-256color" # getting proper colors -export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)" -export EDITOR="nvim" # $EDITOR use neovim -export READER="zathura" -export TERMINAL="alacritty" -export BROWSER="qutebrowser" -export WM="dwm" -export MANPAGER="sh -c 'col -bx | bat -l man -p'" -export XDG_DATA_HOME=${XDG_DATA_HOME:="$HOME/.local/share"} -export XDG_CACHE_HOME=${XDG_CACHE_HOME:="$HOME/.cache"} -export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"} - -### SET MANPAGER -### "bat" as manpager -export MANPAGER="sh -c 'col -bx | bat -l man -p'" - -### SET VI MODE ### -# Comment this line out to enable default emacs-like bindings -bindkey -v - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -### PATH -if [ -d "$HOME/.bin" ] ; - then PATH="$HOME/.bin:$PATH" -fi - -if [ -d "$HOME/.local/bin" ] ; - then PATH="$HOME/.local/bin:$PATH" -fi - -if [ -d "$HOME/Applications" ] ; - then PATH="$HOME/Applications:$PATH" -fi - -### CHANGE TITLE OF TERMINALS -case ${TERM} in - xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*) - PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' - ;; - screen*) - PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' - ;; -esac - -### Function extract for common file formats ### -SAVEIFS=$IFS -IFS=$(echo -en "\n\b") - -function extract { - if [ -z "$1" ]; then - # display usage if no parameters given - echo "Usage: extract ." - echo " extract [path/file_name_2.ext] [path/file_name_3.ext]" - else - for n in "$@" - do - if [ -f "$n" ] ; then - case "${n%,}" in - *.cbt|*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar) - tar xvf "$n" ;; - *.lzma) unlzma ./"$n" ;; - *.bz2) bunzip2 ./"$n" ;; - *.cbr|*.rar) unrar x -ad ./"$n" ;; - *.gz) gunzip ./"$n" ;; - *.cbz|*.epub|*.zip) unzip ./"$n" ;; - *.z) uncompress ./"$n" ;; - *.7z|*.arj|*.cab|*.cb7|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.pkg|*.rpm|*.udf|*.wim|*.xar) - 7z x ./"$n" ;; - *.xz) unxz ./"$n" ;; - *.exe) cabextract ./"$n" ;; - *.cpio) cpio -id < ./"$n" ;; - *.cba|*.ace) unace x ./"$n" ;; - *) - echo "extract: '$n' - unknown archive method" - return 1 - ;; - esac - else - echo "'$n' - file does not exist" - return 1 - fi - done -fi -} - -IFS=$SAVEIFS - -### ALIASES ### - -# navigation -up () { - local d="" - local limit="$1" - - # Default to limit of 1 - if [ -z "$limit" ] || [ "$limit" -le 0 ]; then - limit=1 - fi - - for ((i=1;i<=limit;i++)); do - d="../$d" - done - - # perform cd. Show error if cd fails - if ! cd "$d"; then - echo "Couldn't go up $limit dirs."; - fi -} -alias ..='cd ..' -alias .2='cd ../..' -alias .3='cd ../../..' -alias .4='cd ../../../..' -alias .5='cd ../../../../..' - -# bat as cat -alias cat='bat' - -# editors -alias vim='nvim' - -# Changing "ls" to "exa" -alias ls='exa -al --color=always --group-directories-first' # my preferred listing -alias la='exa -a --color=always --group-directories-first' # all files and dirs -alias ll='exa -l --color=always --group-directories-first' # long format -alias lt='exa -aT --color=always --group-directories-first' # tree listing -alias l.='exa -a | egrep "^\."' - -# xbps -alias xb-up='sudo xbps-install -Su && xcheckrestart' # Refresh pkglist & update standard pkgs -alias xb-get='sudo xbps-install -S' # Install a package -alias xb-rmv='sudo xbps-remove -R' # Remove a package with all its dependencies -alias xb-rmv-sec='sudo xbps-remove' # Remove a package with all its dependencies (secure way) -alias xb-qry='sudo xbps-query' # Repo query -alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove orphaned packages - -# Colorize grep output (good for log files) -alias grep='grep --color=auto' -alias egrep='egrep --color=auto' -alias fgrep='fgrep --color=auto' - -# confirm before overwriting something -alias rm='rm -i' -alias mv='mv -i' -alias cp='cp -i' - -# git -alias addup='git add -u' -alias addall='git add .' -alias branch='git branch' -alias checkout='git checkout' -alias clone='git clone' -alias commit='git commit -m' -alias fetch='git fetch' -alias pull='git pull origin' -alias push='git push origin' -alias stat='git status' # 'status' is protected name so using 'stat' instead -alias tag='git tag' -alias newtag='git tag -a' - -# adding flags -alias df='df -h' # human-readable sizes -alias free='free -m' # show sizes in MB -alias newsboat='newsboat -u ~/.config/newsboat/urls' # start newsboat with my urls file - -# ani-cli -alias ani='ani-cli' -alias ani-q='ani-cli -q' # to select video quality - -# ytfzf -alias yt='ytfzf -f -t' - -# flix-cli -alias fli='flix-cli' - -# mount and unmount drives -alias mnt='sudo mount' -alias umnt='sudo umount' - -# mixers -alias mx='pulsemixer' -alias amx='alsamixer' - -# music player -alias mk='cmus' - -# power management -alias po='loginctl poweroff' -alias sp='loginctl suspend' -alias rb='loginctl reboot' - -# file manager -alias fm='./.config/vifm/scripts/vifmrun' -alias vifm='./.config/vifm/scripts/vifmrun' - -# ps -alias psa="ps auxf" -alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" -alias psmem='ps auxf | sort -nr -k 4' -alias pscpu='ps auxf | sort -nr -k 3' - -# youtube-dl -alias yta-aac="yt-dlp --extract-audio --audio-format aac " -alias yta-best="yt-dlp --extract-audio --audio-format best " -alias yta-flac="yt-dlp --extract-audio --audio-format flac " -alias yta-m4a="yt-dlp --extract-audio --audio-format m4a " -alias yta-mp3="yt-dlp --extract-audio --audio-format mp3 " -alias yta-opus="yt-dlp --extract-audio --audio-format opus " -alias yta-vorbis="yt-dlp --extract-audio --audio-format vorbis " -alias yta-wav="yt-dlp --extract-audio --audio-format wav " -alias ytv-best="yt-dlp -f bestvideo+bestaudio " - -# Network Manager and bluetooth -alias netstats='nmcli dev' -alias wfi='nmtui-connect' -alias wfi-scan='nmcli dev wifi list' -alias wfi-edit='nmtui-edit' -alias wfi-on='nmcli radio wifi on' -alias wfi-off='nmcli radio wifi off' -alias blt='bluetoothctl' - -### SETTING THE STARSHIP PROMPT ### -eval "$(starship init bash)" diff --git a/README.md b/README.md index c4f4de4dd..73f6485b4 100644 --- a/README.md +++ b/README.md @@ -7,16 +7,11 @@ This is just a personal repository where i store all my dotfiles, you're free cl # Dependencies If you want to get the full experience you need theese things: -* [my dwm build](https://github.com/d4r1us-drk/drk-dwm) -* [my dmenu build](https://github.com/d4r1us-drk/drk-dmenu) -* [my dwmblocks build](https://github.com/d4r1us-drk/drk-dwmblocks) * [my dmenu scripts](https://github.com/d4r1us-drk/drk-dmenu_scripts) * [gruvbox-dark-gtk](https://github.com/jmattheis/gruvbox-dark-gtk) * [gruvbox-dark-icons-gtk](https://github.com/jmattheis/gruvbox-dark-icons-gtk) * [volantes-cursors](https://github.com/varlesh/volantes-cursors) * mononoki Nerd Font -* xbacklight -* libinput & xf86-input-libinput * lxsession * picom * dunst diff --git a/screenshot1.png b/screenshot1.png index 5a233ac3a..470830f56 100644 Binary files a/screenshot1.png and b/screenshot1.png differ diff --git a/screenshot2.png b/screenshot2.png index bc2f1d1aa..35a58c01a 100644 Binary files a/screenshot2.png and b/screenshot2.png differ diff --git a/etc/X11/xorg.conf.d/40-libinput.conf b/system/etc/X11/xorg.conf.d/40-libinput.conf similarity index 100% rename from etc/X11/xorg.conf.d/40-libinput.conf rename to system/etc/X11/xorg.conf.d/40-libinput.conf diff --git a/etc/hosts b/system/etc/hosts similarity index 100% rename from etc/hosts rename to system/etc/hosts diff --git a/user/.bash_profile b/user/.bash_profile new file mode 100755 index 000000000..b26413b1d --- /dev/null +++ b/user/.bash_profile @@ -0,0 +1,25 @@ +#!/bin/sh +### STARTING XSESSION +if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ] +then + startx +fi + +### ENVIRONMENT VARIABLES +export GST_VAAPI_ALL_DRIVERS=1 +export EDITOR="emacsclient -t -a ''" # $EDITOR use Emacs in terminal +export VISUAL="emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode +export READER="zathura" # Zathura as the pdf viewer +export TERMINAL="alacritty" # Alacritty as the default terminal emulator +export BROWSER="qutebrowser" # Qutebrowser as the default web browser +export WM="awesome" # AwesomeWM as the default Window Manager +export XDG_DATA_HOME=${XDG_DATA_HOME:="$HOME/.local/share"} +export XDG_CACHE_HOME=${XDG_CACHE_HOME:="$HOME/.cache"} +export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"} +export QT_QPA_PLATFORMTHEME=gtk2 # Qt theeming stuff + +### AUTOSTART +/usr/bin/emacs --daemon & # Autostart the Emacs daemon + +### BASHRC +source "$HOME"/.bashrc # Load the bashrc diff --git a/user/.bashrc b/user/.bashrc new file mode 100644 index 000000000..1ded5e919 --- /dev/null +++ b/user/.bashrc @@ -0,0 +1,257 @@ +## ____ __ +## / __ \_________ _/ /_____ +## / / / / ___/ __ `/ //_/ _ \ +## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) +## /_____/_/ \__,_/_/|_|\___/ My custom bash config +## + +### EXPORT ### +export TERM="xterm-256color" # getting proper colors +export HISTCONTROL=ignoredups:erasedups # no duplicate entries + +# use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion + +# if not running interactively, don't do anything +[[ $- != *i* ]] && return + +# use neovim for vim if present. +[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d" + +# use $XINITRC variable if file exists. +[ -f "$XINITRC" ] && alias startx="startx $XINITRC" + +### SET VI MODE ### +# Comment this line out to enable default emacs-like bindings +set -o vi +bind -m vi-command 'Control-l: clear-screen' +bind -m vi-insert 'Control-l: clear-screen' + +### PATH ### +if [ -d "$HOME/.bin" ] ; + then PATH="$HOME/.bin:$PATH" +fi +if [ -d "$HOME/.local/bin" ] ; + then PATH="$HOME/.local/bin:$PATH" +fi +if [ -d "$HOME/Applications" ] ; + then PATH="$HOME/Applications:$PATH" +fi + +### CHANGE TITLE OF TERMINALS ### +case ${TERM} in + xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*) + PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' + ;; + screen*) + PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' + ;; +esac + +### SHOPT ### +shopt -s autocd # change to named directory +shopt -s cdspell # autocorrects cd misspellings +shopt -s cmdhist # save multi-line commands in history as single line +shopt -s dotglob +shopt -s histappend # do not overwrite history +shopt -s expand_aliases # expand aliases +shopt -s checkwinsize # checks term size when bash regains control + +# ignore upper and lowercase when TAB completion +bind "set completion-ignore-case on" + +# sudo not required for some system commands +for command in mount umount poweroff reboot ; do +alias $command="sudo $command" +done; unset command + +### ARCHIVE EXTRACTION ### +# usage: ex +ex () +{ + if [ -f "$1" ] ; then + case $1 in + *.tar.bz2) tar xjf "$1" ;; + *.tar.gz) tar xzf "$1" ;; + *.bz2) bunzip2 "$1" ;; + *.rar) unrar x "$1" ;; + *.gz) gunzip "$1" ;; + *.tar) tar xf "$1" ;; + *.tbz2) tar xjf "$1" ;; + *.tgz) tar xzf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1";; + *.7z) 7zz x "$1" ;; + *.deb) ar x "$1" ;; + *.tar.xz) tar xf "$1" ;; + *.tar.zst) unzstd "$1" ;; + *) echo "'$1' cannot be extracted via ex()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +### ALIASES ### +# navigation +up () { + local d="" + local limit="$1" + + # Default to limit of 1 + if [ -z "$limit" ] || [ "$limit" -le 0 ]; then + limit=1 + fi + + for ((i=1;i<=limit;i++)); do + d="../$d" + done + + # perform cd. Show error if cd fails + if ! cd "$d"; then + echo "Couldn't go up $limit dirs."; + fi +} + +# cd +alias \ + ..="cd .." \ + .2="cd ../.." \ + .3="cd ../../.." \ + .4="cd ../../../.." \ + .5="cd ../../../../.." + +# bat as cat +[ -x "$(command -v bat)" ] && alias cat="bat" + +# DOOM Emacs +[ -x "$(command -v emacs)" ] && alias \ + em="/usr/bin/emacs -nw" \ + emacs="emacsclient -c -a 'emacs'" \ + doomsync="~/.emacs.d/bin/doom sync" \ + doomdoctor="~/.emacs.d/bin/doom doctor" \ + doomupgrade="~/.emacs.d/bin/doom upgrade" \ + doompurge="~/.emacs.d/bin/doom purge" + +# Changing "ls" to "exa" +alias \ + ls="exa -al --color=always --group-directories-first" \ + la="exa -a --color=always --group-directories-first" \ + ll="exa -l --color=always --group-directories-first" \ + lt="exa -aT --color=always --group-directories-first" \ + l.='exa -a | egrep "^\."' + +# xbps +[ -x "$(command -v xbps-query)" ] && alias \ + xb-up="sudo xbps-install -Su && xcheckrestart" \ + xb-get="sudo xbps-install -S" \ + xb-rmv="sudo xbps-remove -R" \ + xb-rmv-sec="sudo xbps-remove" \ + xb-qry="sudo xbps-query" \ + xb-cln="sudo xbps-remove -o && sudo xbps-remove -O" + +# pacman +[ -x "$(command -v pacman)" ] && alias \ + pac-up="sudo pacman -Syyu" \ + pac-get="sudo pacman -S" \ + pac-rmv="sudo pacman -Rcns" \ + pac-rmv-sec="sudo pacman -Runs" \ + pac-qry="sudo pacman -Ss" \ + pac-cln="sudo pacman -Scc" + +# colorize grep output (good for log files) +alias \ + grep="grep --color=auto" \ + egrep="egrep --color=auto" \ + fgrep="fgrep --color=auto" + +# git +alias \ + addup="git add -u" \ + addall="git add ." \ + branch="git branch" \ + checkout="git checkout" \ + clone="git clone" \ + commit="git commit -m" \ + fetch="git fetch" \ + pull="git pull origin" \ + push="git push origin" \ + stat="git status" \ + tag="git tag" \ + newtag="git tag -a" + +# adding flags +alias \ + df="df -h" \ + free="free -m" \ + newsboat="newsboat -u ~/.config/newsboat/urls" + +# multimedia scripts +alias \ + fli="flix-cli" \ + ani="ani-cli" \ + aniq="ani-cli -q" + +# audio +alias \ + mx="pulsemixer" \ + amx="alsamixer" \ + mk="cmus" \ + ms="cmus" \ + music="cmus" + +# power management +[ -x "$(command -v xbps-query)" ] && alias \ + po="loginctl poweroff" \ + sp="loginctl suspend" \ + rb="loginctl reboot" +[ -x "$(command -v pacman)" ] && alias \ + po="systemctl poweroff" \ + sp="systemctl suspend" \ + rb="systemctl reboot" + +# file management +alias \ + fm="./.config/vifm/scripts/vifmrun" \ + file="./.config/vifm/scripts/vifmrun" \ + flm="./.config/vifm/scripts/vifmrun" \ + vifm="./.config/vifm/scripts/vifmrun" \ + rm="rm -vI" \ + mv="mv -iv" \ + cp="cp -iv" \ + mkd="mkdir -pv" + +# ps +alias \ + psa="ps auxf" \ + psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" \ + psmem="ps auxf | sort -nr -k 4" \ + pscpu="ps auxf | sort -nr -k 3" + +# youtube +alias \ + yta-aac="yt-dlp --extract-audio --audio-format aac" \ + yta-best="yt-dlp --extract-audio --audio-format best" \ + yta-flac="yt-dlp --extract-audio --audio-format flac" \ + yta-m4a="yt-dlp --extract-audio --audio-format m4a" \ + yta-mp3="yt-dlp --extract-audio --audio-format mp3" \ + yta-opus="yt-dlp --extract-audio --audio-format opus" \ + yta-vorbis="yt-dlp --extract-audio --audio-format vorbis" \ + yta-wav="yt-dlp --extract-audio --audio-format wav" \ + ytv-best="yt-dlp -f bestvideo+bestaudio" \ + yt="ytfzf -f -t" \ + ytm="ytfzf -m" + +# network and bluetooth +alias \ + netstats="nmcli dev" \ + wfi="nmtui-connect" \ + wfi-scan="nmcli dev wifi list" \ + wfi-edit="nmtui-edit" \ + wfi-on="nmcli radio wifi on" \ + wfi-off="nmcli radio wifi off" \ + blt="bluetoothctl" + +### SETTING THE STARSHIP PROMPT ### +eval "$(starship init bash)" diff --git a/.config/alacritty/alacritty.yml b/user/.config/alacritty/alacritty.yml similarity index 100% rename from .config/alacritty/alacritty.yml rename to user/.config/alacritty/alacritty.yml diff --git a/.config/awesome/lain/helpers.lua b/user/.config/awesome/lain/helpers.lua similarity index 100% rename from .config/awesome/lain/helpers.lua rename to user/.config/awesome/lain/helpers.lua diff --git a/.config/awesome/lain/icons/cal/black/1.png b/user/.config/awesome/lain/icons/cal/black/1.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/1.png rename to user/.config/awesome/lain/icons/cal/black/1.png diff --git a/.config/awesome/lain/icons/cal/black/10.png b/user/.config/awesome/lain/icons/cal/black/10.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/10.png rename to user/.config/awesome/lain/icons/cal/black/10.png diff --git a/.config/awesome/lain/icons/cal/black/11.png b/user/.config/awesome/lain/icons/cal/black/11.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/11.png rename to user/.config/awesome/lain/icons/cal/black/11.png diff --git a/.config/awesome/lain/icons/cal/black/12.png b/user/.config/awesome/lain/icons/cal/black/12.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/12.png rename to user/.config/awesome/lain/icons/cal/black/12.png diff --git a/.config/awesome/lain/icons/cal/black/13.png b/user/.config/awesome/lain/icons/cal/black/13.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/13.png rename to user/.config/awesome/lain/icons/cal/black/13.png diff --git a/.config/awesome/lain/icons/cal/black/14.png b/user/.config/awesome/lain/icons/cal/black/14.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/14.png rename to user/.config/awesome/lain/icons/cal/black/14.png diff --git a/.config/awesome/lain/icons/cal/black/15.png b/user/.config/awesome/lain/icons/cal/black/15.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/15.png rename to user/.config/awesome/lain/icons/cal/black/15.png diff --git a/.config/awesome/lain/icons/cal/black/16.png b/user/.config/awesome/lain/icons/cal/black/16.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/16.png rename to user/.config/awesome/lain/icons/cal/black/16.png diff --git a/.config/awesome/lain/icons/cal/black/17.png b/user/.config/awesome/lain/icons/cal/black/17.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/17.png rename to user/.config/awesome/lain/icons/cal/black/17.png diff --git a/.config/awesome/lain/icons/cal/black/18.png b/user/.config/awesome/lain/icons/cal/black/18.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/18.png rename to user/.config/awesome/lain/icons/cal/black/18.png diff --git a/.config/awesome/lain/icons/cal/black/19.png b/user/.config/awesome/lain/icons/cal/black/19.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/19.png rename to user/.config/awesome/lain/icons/cal/black/19.png diff --git a/.config/awesome/lain/icons/cal/black/2.png b/user/.config/awesome/lain/icons/cal/black/2.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/2.png rename to user/.config/awesome/lain/icons/cal/black/2.png diff --git a/.config/awesome/lain/icons/cal/black/20.png b/user/.config/awesome/lain/icons/cal/black/20.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/20.png rename to user/.config/awesome/lain/icons/cal/black/20.png diff --git a/.config/awesome/lain/icons/cal/black/21.png b/user/.config/awesome/lain/icons/cal/black/21.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/21.png rename to user/.config/awesome/lain/icons/cal/black/21.png diff --git a/.config/awesome/lain/icons/cal/black/22.png b/user/.config/awesome/lain/icons/cal/black/22.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/22.png rename to user/.config/awesome/lain/icons/cal/black/22.png diff --git a/.config/awesome/lain/icons/cal/black/23.png b/user/.config/awesome/lain/icons/cal/black/23.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/23.png rename to user/.config/awesome/lain/icons/cal/black/23.png diff --git a/.config/awesome/lain/icons/cal/black/24.png b/user/.config/awesome/lain/icons/cal/black/24.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/24.png rename to user/.config/awesome/lain/icons/cal/black/24.png diff --git a/.config/awesome/lain/icons/cal/black/25.png b/user/.config/awesome/lain/icons/cal/black/25.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/25.png rename to user/.config/awesome/lain/icons/cal/black/25.png diff --git a/.config/awesome/lain/icons/cal/black/26.png b/user/.config/awesome/lain/icons/cal/black/26.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/26.png rename to user/.config/awesome/lain/icons/cal/black/26.png diff --git a/.config/awesome/lain/icons/cal/black/27.png b/user/.config/awesome/lain/icons/cal/black/27.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/27.png rename to user/.config/awesome/lain/icons/cal/black/27.png diff --git a/.config/awesome/lain/icons/cal/black/28.png b/user/.config/awesome/lain/icons/cal/black/28.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/28.png rename to user/.config/awesome/lain/icons/cal/black/28.png diff --git a/.config/awesome/lain/icons/cal/black/29.png b/user/.config/awesome/lain/icons/cal/black/29.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/29.png rename to user/.config/awesome/lain/icons/cal/black/29.png diff --git a/.config/awesome/lain/icons/cal/black/3.png b/user/.config/awesome/lain/icons/cal/black/3.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/3.png rename to user/.config/awesome/lain/icons/cal/black/3.png diff --git a/.config/awesome/lain/icons/cal/black/30.png b/user/.config/awesome/lain/icons/cal/black/30.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/30.png rename to user/.config/awesome/lain/icons/cal/black/30.png diff --git a/.config/awesome/lain/icons/cal/black/31.png b/user/.config/awesome/lain/icons/cal/black/31.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/31.png rename to user/.config/awesome/lain/icons/cal/black/31.png diff --git a/.config/awesome/lain/icons/cal/black/4.png b/user/.config/awesome/lain/icons/cal/black/4.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/4.png rename to user/.config/awesome/lain/icons/cal/black/4.png diff --git a/.config/awesome/lain/icons/cal/black/5.png b/user/.config/awesome/lain/icons/cal/black/5.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/5.png rename to user/.config/awesome/lain/icons/cal/black/5.png diff --git a/.config/awesome/lain/icons/cal/black/6.png b/user/.config/awesome/lain/icons/cal/black/6.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/6.png rename to user/.config/awesome/lain/icons/cal/black/6.png diff --git a/.config/awesome/lain/icons/cal/black/7.png b/user/.config/awesome/lain/icons/cal/black/7.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/7.png rename to user/.config/awesome/lain/icons/cal/black/7.png diff --git a/.config/awesome/lain/icons/cal/black/8.png b/user/.config/awesome/lain/icons/cal/black/8.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/8.png rename to user/.config/awesome/lain/icons/cal/black/8.png diff --git a/.config/awesome/lain/icons/cal/black/9.png b/user/.config/awesome/lain/icons/cal/black/9.png similarity index 100% rename from .config/awesome/lain/icons/cal/black/9.png rename to user/.config/awesome/lain/icons/cal/black/9.png diff --git a/.config/awesome/lain/icons/cal/white/1.png b/user/.config/awesome/lain/icons/cal/white/1.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/1.png rename to user/.config/awesome/lain/icons/cal/white/1.png diff --git a/.config/awesome/lain/icons/cal/white/10.png b/user/.config/awesome/lain/icons/cal/white/10.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/10.png rename to user/.config/awesome/lain/icons/cal/white/10.png diff --git a/.config/awesome/lain/icons/cal/white/11.png b/user/.config/awesome/lain/icons/cal/white/11.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/11.png rename to user/.config/awesome/lain/icons/cal/white/11.png diff --git a/.config/awesome/lain/icons/cal/white/12.png b/user/.config/awesome/lain/icons/cal/white/12.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/12.png rename to user/.config/awesome/lain/icons/cal/white/12.png diff --git a/.config/awesome/lain/icons/cal/white/13.png b/user/.config/awesome/lain/icons/cal/white/13.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/13.png rename to user/.config/awesome/lain/icons/cal/white/13.png diff --git a/.config/awesome/lain/icons/cal/white/14.png b/user/.config/awesome/lain/icons/cal/white/14.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/14.png rename to user/.config/awesome/lain/icons/cal/white/14.png diff --git a/.config/awesome/lain/icons/cal/white/15.png b/user/.config/awesome/lain/icons/cal/white/15.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/15.png rename to user/.config/awesome/lain/icons/cal/white/15.png diff --git a/.config/awesome/lain/icons/cal/white/16.png b/user/.config/awesome/lain/icons/cal/white/16.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/16.png rename to user/.config/awesome/lain/icons/cal/white/16.png diff --git a/.config/awesome/lain/icons/cal/white/17.png b/user/.config/awesome/lain/icons/cal/white/17.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/17.png rename to user/.config/awesome/lain/icons/cal/white/17.png diff --git a/.config/awesome/lain/icons/cal/white/18.png b/user/.config/awesome/lain/icons/cal/white/18.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/18.png rename to user/.config/awesome/lain/icons/cal/white/18.png diff --git a/.config/awesome/lain/icons/cal/white/19.png b/user/.config/awesome/lain/icons/cal/white/19.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/19.png rename to user/.config/awesome/lain/icons/cal/white/19.png diff --git a/.config/awesome/lain/icons/cal/white/2.png b/user/.config/awesome/lain/icons/cal/white/2.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/2.png rename to user/.config/awesome/lain/icons/cal/white/2.png diff --git a/.config/awesome/lain/icons/cal/white/20.png b/user/.config/awesome/lain/icons/cal/white/20.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/20.png rename to user/.config/awesome/lain/icons/cal/white/20.png diff --git a/.config/awesome/lain/icons/cal/white/21.png b/user/.config/awesome/lain/icons/cal/white/21.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/21.png rename to user/.config/awesome/lain/icons/cal/white/21.png diff --git a/.config/awesome/lain/icons/cal/white/22.png b/user/.config/awesome/lain/icons/cal/white/22.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/22.png rename to user/.config/awesome/lain/icons/cal/white/22.png diff --git a/.config/awesome/lain/icons/cal/white/23.png b/user/.config/awesome/lain/icons/cal/white/23.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/23.png rename to user/.config/awesome/lain/icons/cal/white/23.png diff --git a/.config/awesome/lain/icons/cal/white/24.png b/user/.config/awesome/lain/icons/cal/white/24.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/24.png rename to user/.config/awesome/lain/icons/cal/white/24.png diff --git a/.config/awesome/lain/icons/cal/white/25.png b/user/.config/awesome/lain/icons/cal/white/25.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/25.png rename to user/.config/awesome/lain/icons/cal/white/25.png diff --git a/.config/awesome/lain/icons/cal/white/26.png b/user/.config/awesome/lain/icons/cal/white/26.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/26.png rename to user/.config/awesome/lain/icons/cal/white/26.png diff --git a/.config/awesome/lain/icons/cal/white/27.png b/user/.config/awesome/lain/icons/cal/white/27.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/27.png rename to user/.config/awesome/lain/icons/cal/white/27.png diff --git a/.config/awesome/lain/icons/cal/white/28.png b/user/.config/awesome/lain/icons/cal/white/28.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/28.png rename to user/.config/awesome/lain/icons/cal/white/28.png diff --git a/.config/awesome/lain/icons/cal/white/29.png b/user/.config/awesome/lain/icons/cal/white/29.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/29.png rename to user/.config/awesome/lain/icons/cal/white/29.png diff --git a/.config/awesome/lain/icons/cal/white/3.png b/user/.config/awesome/lain/icons/cal/white/3.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/3.png rename to user/.config/awesome/lain/icons/cal/white/3.png diff --git a/.config/awesome/lain/icons/cal/white/30.png b/user/.config/awesome/lain/icons/cal/white/30.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/30.png rename to user/.config/awesome/lain/icons/cal/white/30.png diff --git a/.config/awesome/lain/icons/cal/white/31.png b/user/.config/awesome/lain/icons/cal/white/31.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/31.png rename to user/.config/awesome/lain/icons/cal/white/31.png diff --git a/.config/awesome/lain/icons/cal/white/4.png b/user/.config/awesome/lain/icons/cal/white/4.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/4.png rename to user/.config/awesome/lain/icons/cal/white/4.png diff --git a/.config/awesome/lain/icons/cal/white/5.png b/user/.config/awesome/lain/icons/cal/white/5.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/5.png rename to user/.config/awesome/lain/icons/cal/white/5.png diff --git a/.config/awesome/lain/icons/cal/white/6.png b/user/.config/awesome/lain/icons/cal/white/6.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/6.png rename to user/.config/awesome/lain/icons/cal/white/6.png diff --git a/.config/awesome/lain/icons/cal/white/7.png b/user/.config/awesome/lain/icons/cal/white/7.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/7.png rename to user/.config/awesome/lain/icons/cal/white/7.png diff --git a/.config/awesome/lain/icons/cal/white/8.png b/user/.config/awesome/lain/icons/cal/white/8.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/8.png rename to user/.config/awesome/lain/icons/cal/white/8.png diff --git a/.config/awesome/lain/icons/cal/white/9.png b/user/.config/awesome/lain/icons/cal/white/9.png similarity index 100% rename from .config/awesome/lain/icons/cal/white/9.png rename to user/.config/awesome/lain/icons/cal/white/9.png diff --git a/.config/awesome/lain/icons/layout/default/cascade.png b/user/.config/awesome/lain/icons/layout/default/cascade.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/cascade.png rename to user/.config/awesome/lain/icons/layout/default/cascade.png diff --git a/.config/awesome/lain/icons/layout/default/cascadetile.png b/user/.config/awesome/lain/icons/layout/default/cascadetile.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/cascadetile.png rename to user/.config/awesome/lain/icons/layout/default/cascadetile.png diff --git a/.config/awesome/lain/icons/layout/default/cascadetilew.png b/user/.config/awesome/lain/icons/layout/default/cascadetilew.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/cascadetilew.png rename to user/.config/awesome/lain/icons/layout/default/cascadetilew.png diff --git a/.config/awesome/lain/icons/layout/default/cascadew.png b/user/.config/awesome/lain/icons/layout/default/cascadew.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/cascadew.png rename to user/.config/awesome/lain/icons/layout/default/cascadew.png diff --git a/.config/awesome/lain/icons/layout/default/centerfair.png b/user/.config/awesome/lain/icons/layout/default/centerfair.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/centerfair.png rename to user/.config/awesome/lain/icons/layout/default/centerfair.png diff --git a/.config/awesome/lain/icons/layout/default/centerfairw.png b/user/.config/awesome/lain/icons/layout/default/centerfairw.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/centerfairw.png rename to user/.config/awesome/lain/icons/layout/default/centerfairw.png diff --git a/.config/awesome/lain/icons/layout/default/centerwork.png b/user/.config/awesome/lain/icons/layout/default/centerwork.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/centerwork.png rename to user/.config/awesome/lain/icons/layout/default/centerwork.png diff --git a/.config/awesome/lain/icons/layout/default/centerworkh.png b/user/.config/awesome/lain/icons/layout/default/centerworkh.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/centerworkh.png rename to user/.config/awesome/lain/icons/layout/default/centerworkh.png diff --git a/.config/awesome/lain/icons/layout/default/centerworkhw.png b/user/.config/awesome/lain/icons/layout/default/centerworkhw.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/centerworkhw.png rename to user/.config/awesome/lain/icons/layout/default/centerworkhw.png diff --git a/.config/awesome/lain/icons/layout/default/centerworkw.png b/user/.config/awesome/lain/icons/layout/default/centerworkw.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/centerworkw.png rename to user/.config/awesome/lain/icons/layout/default/centerworkw.png diff --git a/.config/awesome/lain/icons/layout/default/termfair.png b/user/.config/awesome/lain/icons/layout/default/termfair.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/termfair.png rename to user/.config/awesome/lain/icons/layout/default/termfair.png diff --git a/.config/awesome/lain/icons/layout/default/termfairw.png b/user/.config/awesome/lain/icons/layout/default/termfairw.png similarity index 100% rename from .config/awesome/lain/icons/layout/default/termfairw.png rename to user/.config/awesome/lain/icons/layout/default/termfairw.png diff --git a/.config/awesome/lain/icons/layout/zenburn/cascade.png b/user/.config/awesome/lain/icons/layout/zenburn/cascade.png similarity index 100% rename from .config/awesome/lain/icons/layout/zenburn/cascade.png rename to user/.config/awesome/lain/icons/layout/zenburn/cascade.png diff --git a/.config/awesome/lain/icons/layout/zenburn/cascadetile.png b/user/.config/awesome/lain/icons/layout/zenburn/cascadetile.png similarity index 100% rename from .config/awesome/lain/icons/layout/zenburn/cascadetile.png rename to user/.config/awesome/lain/icons/layout/zenburn/cascadetile.png diff --git a/.config/awesome/lain/icons/layout/zenburn/centerfair.png b/user/.config/awesome/lain/icons/layout/zenburn/centerfair.png similarity index 100% rename from .config/awesome/lain/icons/layout/zenburn/centerfair.png rename to user/.config/awesome/lain/icons/layout/zenburn/centerfair.png diff --git a/.config/awesome/lain/icons/layout/zenburn/centerwork.png b/user/.config/awesome/lain/icons/layout/zenburn/centerwork.png similarity index 100% rename from .config/awesome/lain/icons/layout/zenburn/centerwork.png rename to user/.config/awesome/lain/icons/layout/zenburn/centerwork.png diff --git a/.config/awesome/lain/icons/layout/zenburn/centerworkh.png b/user/.config/awesome/lain/icons/layout/zenburn/centerworkh.png similarity index 100% rename from .config/awesome/lain/icons/layout/zenburn/centerworkh.png rename to user/.config/awesome/lain/icons/layout/zenburn/centerworkh.png diff --git a/.config/awesome/lain/icons/layout/zenburn/termfair.png b/user/.config/awesome/lain/icons/layout/zenburn/termfair.png similarity index 100% rename from .config/awesome/lain/icons/layout/zenburn/termfair.png rename to user/.config/awesome/lain/icons/layout/zenburn/termfair.png diff --git a/.config/awesome/lain/icons/mail.png b/user/.config/awesome/lain/icons/mail.png similarity index 100% rename from .config/awesome/lain/icons/mail.png rename to user/.config/awesome/lain/icons/mail.png diff --git a/.config/awesome/lain/icons/no_net.png b/user/.config/awesome/lain/icons/no_net.png similarity index 100% rename from .config/awesome/lain/icons/no_net.png rename to user/.config/awesome/lain/icons/no_net.png diff --git a/.config/awesome/lain/icons/openweathermap/01d.png b/user/.config/awesome/lain/icons/openweathermap/01d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/01d.png rename to user/.config/awesome/lain/icons/openweathermap/01d.png diff --git a/.config/awesome/lain/icons/openweathermap/01n.png b/user/.config/awesome/lain/icons/openweathermap/01n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/01n.png rename to user/.config/awesome/lain/icons/openweathermap/01n.png diff --git a/.config/awesome/lain/icons/openweathermap/02d.png b/user/.config/awesome/lain/icons/openweathermap/02d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/02d.png rename to user/.config/awesome/lain/icons/openweathermap/02d.png diff --git a/.config/awesome/lain/icons/openweathermap/02n.png b/user/.config/awesome/lain/icons/openweathermap/02n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/02n.png rename to user/.config/awesome/lain/icons/openweathermap/02n.png diff --git a/.config/awesome/lain/icons/openweathermap/03d.png b/user/.config/awesome/lain/icons/openweathermap/03d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/03d.png rename to user/.config/awesome/lain/icons/openweathermap/03d.png diff --git a/.config/awesome/lain/icons/openweathermap/03n.png b/user/.config/awesome/lain/icons/openweathermap/03n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/03n.png rename to user/.config/awesome/lain/icons/openweathermap/03n.png diff --git a/.config/awesome/lain/icons/openweathermap/04d.png b/user/.config/awesome/lain/icons/openweathermap/04d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/04d.png rename to user/.config/awesome/lain/icons/openweathermap/04d.png diff --git a/.config/awesome/lain/icons/openweathermap/04n.png b/user/.config/awesome/lain/icons/openweathermap/04n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/04n.png rename to user/.config/awesome/lain/icons/openweathermap/04n.png diff --git a/.config/awesome/lain/icons/openweathermap/09d.png b/user/.config/awesome/lain/icons/openweathermap/09d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/09d.png rename to user/.config/awesome/lain/icons/openweathermap/09d.png diff --git a/.config/awesome/lain/icons/openweathermap/09n.png b/user/.config/awesome/lain/icons/openweathermap/09n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/09n.png rename to user/.config/awesome/lain/icons/openweathermap/09n.png diff --git a/.config/awesome/lain/icons/openweathermap/10d.png b/user/.config/awesome/lain/icons/openweathermap/10d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/10d.png rename to user/.config/awesome/lain/icons/openweathermap/10d.png diff --git a/.config/awesome/lain/icons/openweathermap/10n.png b/user/.config/awesome/lain/icons/openweathermap/10n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/10n.png rename to user/.config/awesome/lain/icons/openweathermap/10n.png diff --git a/.config/awesome/lain/icons/openweathermap/11d.png b/user/.config/awesome/lain/icons/openweathermap/11d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/11d.png rename to user/.config/awesome/lain/icons/openweathermap/11d.png diff --git a/.config/awesome/lain/icons/openweathermap/11n.png b/user/.config/awesome/lain/icons/openweathermap/11n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/11n.png rename to user/.config/awesome/lain/icons/openweathermap/11n.png diff --git a/.config/awesome/lain/icons/openweathermap/13d.png b/user/.config/awesome/lain/icons/openweathermap/13d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/13d.png rename to user/.config/awesome/lain/icons/openweathermap/13d.png diff --git a/.config/awesome/lain/icons/openweathermap/13n.png b/user/.config/awesome/lain/icons/openweathermap/13n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/13n.png rename to user/.config/awesome/lain/icons/openweathermap/13n.png diff --git a/.config/awesome/lain/icons/openweathermap/50d.png b/user/.config/awesome/lain/icons/openweathermap/50d.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/50d.png rename to user/.config/awesome/lain/icons/openweathermap/50d.png diff --git a/.config/awesome/lain/icons/openweathermap/50n.png b/user/.config/awesome/lain/icons/openweathermap/50n.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/50n.png rename to user/.config/awesome/lain/icons/openweathermap/50n.png diff --git a/.config/awesome/lain/icons/openweathermap/README.md b/user/.config/awesome/lain/icons/openweathermap/README.md similarity index 100% rename from .config/awesome/lain/icons/openweathermap/README.md rename to user/.config/awesome/lain/icons/openweathermap/README.md diff --git a/.config/awesome/lain/icons/openweathermap/na.png b/user/.config/awesome/lain/icons/openweathermap/na.png similarity index 100% rename from .config/awesome/lain/icons/openweathermap/na.png rename to user/.config/awesome/lain/icons/openweathermap/na.png diff --git a/.config/awesome/lain/icons/taskwarrior.png b/user/.config/awesome/lain/icons/taskwarrior.png similarity index 100% rename from .config/awesome/lain/icons/taskwarrior.png rename to user/.config/awesome/lain/icons/taskwarrior.png diff --git a/.config/awesome/lain/init.lua b/user/.config/awesome/lain/init.lua similarity index 100% rename from .config/awesome/lain/init.lua rename to user/.config/awesome/lain/init.lua diff --git a/.config/awesome/lain/lain-scm-1.rockspec b/user/.config/awesome/lain/lain-scm-1.rockspec similarity index 100% rename from .config/awesome/lain/lain-scm-1.rockspec rename to user/.config/awesome/lain/lain-scm-1.rockspec diff --git a/.config/awesome/lain/layout/cascade.lua b/user/.config/awesome/lain/layout/cascade.lua similarity index 100% rename from .config/awesome/lain/layout/cascade.lua rename to user/.config/awesome/lain/layout/cascade.lua diff --git a/.config/awesome/lain/layout/centerwork.lua b/user/.config/awesome/lain/layout/centerwork.lua similarity index 100% rename from .config/awesome/lain/layout/centerwork.lua rename to user/.config/awesome/lain/layout/centerwork.lua diff --git a/.config/awesome/lain/layout/init.lua b/user/.config/awesome/lain/layout/init.lua similarity index 100% rename from .config/awesome/lain/layout/init.lua rename to user/.config/awesome/lain/layout/init.lua diff --git a/.config/awesome/lain/layout/termfair.lua b/user/.config/awesome/lain/layout/termfair.lua similarity index 100% rename from .config/awesome/lain/layout/termfair.lua rename to user/.config/awesome/lain/layout/termfair.lua diff --git a/.config/awesome/lain/util/dkjson.lua b/user/.config/awesome/lain/util/dkjson.lua similarity index 100% rename from .config/awesome/lain/util/dkjson.lua rename to user/.config/awesome/lain/util/dkjson.lua diff --git a/.config/awesome/lain/util/init.lua b/user/.config/awesome/lain/util/init.lua similarity index 100% rename from .config/awesome/lain/util/init.lua rename to user/.config/awesome/lain/util/init.lua diff --git a/.config/awesome/lain/util/markup.lua b/user/.config/awesome/lain/util/markup.lua similarity index 100% rename from .config/awesome/lain/util/markup.lua rename to user/.config/awesome/lain/util/markup.lua diff --git a/.config/awesome/lain/util/menu_iterator.lua b/user/.config/awesome/lain/util/menu_iterator.lua similarity index 100% rename from .config/awesome/lain/util/menu_iterator.lua rename to user/.config/awesome/lain/util/menu_iterator.lua diff --git a/.config/awesome/lain/util/quake.lua b/user/.config/awesome/lain/util/quake.lua similarity index 100% rename from .config/awesome/lain/util/quake.lua rename to user/.config/awesome/lain/util/quake.lua diff --git a/.config/awesome/lain/util/separators.lua b/user/.config/awesome/lain/util/separators.lua similarity index 100% rename from .config/awesome/lain/util/separators.lua rename to user/.config/awesome/lain/util/separators.lua diff --git a/.config/awesome/lain/widget/alsa.lua b/user/.config/awesome/lain/widget/alsa.lua similarity index 100% rename from .config/awesome/lain/widget/alsa.lua rename to user/.config/awesome/lain/widget/alsa.lua diff --git a/.config/awesome/lain/widget/alsabar.lua b/user/.config/awesome/lain/widget/alsabar.lua similarity index 100% rename from .config/awesome/lain/widget/alsabar.lua rename to user/.config/awesome/lain/widget/alsabar.lua diff --git a/.config/awesome/lain/widget/bat.lua b/user/.config/awesome/lain/widget/bat.lua similarity index 100% rename from .config/awesome/lain/widget/bat.lua rename to user/.config/awesome/lain/widget/bat.lua diff --git a/.config/awesome/lain/widget/cal.lua b/user/.config/awesome/lain/widget/cal.lua similarity index 100% rename from .config/awesome/lain/widget/cal.lua rename to user/.config/awesome/lain/widget/cal.lua diff --git a/.config/awesome/lain/widget/contrib/init.lua b/user/.config/awesome/lain/widget/contrib/init.lua similarity index 100% rename from .config/awesome/lain/widget/contrib/init.lua rename to user/.config/awesome/lain/widget/contrib/init.lua diff --git a/.config/awesome/lain/widget/contrib/moc.lua b/user/.config/awesome/lain/widget/contrib/moc.lua similarity index 100% rename from .config/awesome/lain/widget/contrib/moc.lua rename to user/.config/awesome/lain/widget/contrib/moc.lua diff --git a/.config/awesome/lain/widget/contrib/redshift.lua b/user/.config/awesome/lain/widget/contrib/redshift.lua similarity index 100% rename from .config/awesome/lain/widget/contrib/redshift.lua rename to user/.config/awesome/lain/widget/contrib/redshift.lua diff --git a/.config/awesome/lain/widget/contrib/task.lua b/user/.config/awesome/lain/widget/contrib/task.lua similarity index 100% rename from .config/awesome/lain/widget/contrib/task.lua rename to user/.config/awesome/lain/widget/contrib/task.lua diff --git a/.config/awesome/lain/widget/contrib/tp_smapi.lua b/user/.config/awesome/lain/widget/contrib/tp_smapi.lua similarity index 100% rename from .config/awesome/lain/widget/contrib/tp_smapi.lua rename to user/.config/awesome/lain/widget/contrib/tp_smapi.lua diff --git a/.config/awesome/lain/widget/cpu.lua b/user/.config/awesome/lain/widget/cpu.lua similarity index 100% rename from .config/awesome/lain/widget/cpu.lua rename to user/.config/awesome/lain/widget/cpu.lua diff --git a/.config/awesome/lain/widget/fs.lua b/user/.config/awesome/lain/widget/fs.lua similarity index 100% rename from .config/awesome/lain/widget/fs.lua rename to user/.config/awesome/lain/widget/fs.lua diff --git a/.config/awesome/lain/widget/imap.lua b/user/.config/awesome/lain/widget/imap.lua similarity index 100% rename from .config/awesome/lain/widget/imap.lua rename to user/.config/awesome/lain/widget/imap.lua diff --git a/.config/awesome/lain/widget/init.lua b/user/.config/awesome/lain/widget/init.lua similarity index 100% rename from .config/awesome/lain/widget/init.lua rename to user/.config/awesome/lain/widget/init.lua diff --git a/.config/awesome/lain/widget/mem.lua b/user/.config/awesome/lain/widget/mem.lua similarity index 100% rename from .config/awesome/lain/widget/mem.lua rename to user/.config/awesome/lain/widget/mem.lua diff --git a/.config/awesome/lain/widget/mpd.lua b/user/.config/awesome/lain/widget/mpd.lua similarity index 100% rename from .config/awesome/lain/widget/mpd.lua rename to user/.config/awesome/lain/widget/mpd.lua diff --git a/.config/awesome/lain/widget/net.lua b/user/.config/awesome/lain/widget/net.lua similarity index 100% rename from .config/awesome/lain/widget/net.lua rename to user/.config/awesome/lain/widget/net.lua diff --git a/.config/awesome/lain/widget/pulse.lua b/user/.config/awesome/lain/widget/pulse.lua similarity index 100% rename from .config/awesome/lain/widget/pulse.lua rename to user/.config/awesome/lain/widget/pulse.lua diff --git a/.config/awesome/lain/widget/pulsebar.lua b/user/.config/awesome/lain/widget/pulsebar.lua similarity index 100% rename from .config/awesome/lain/widget/pulsebar.lua rename to user/.config/awesome/lain/widget/pulsebar.lua diff --git a/.config/awesome/lain/widget/sysload.lua b/user/.config/awesome/lain/widget/sysload.lua similarity index 100% rename from .config/awesome/lain/widget/sysload.lua rename to user/.config/awesome/lain/widget/sysload.lua diff --git a/.config/awesome/lain/widget/temp.lua b/user/.config/awesome/lain/widget/temp.lua similarity index 100% rename from .config/awesome/lain/widget/temp.lua rename to user/.config/awesome/lain/widget/temp.lua diff --git a/.config/awesome/lain/widget/weather.lua b/user/.config/awesome/lain/widget/weather.lua similarity index 100% rename from .config/awesome/lain/widget/weather.lua rename to user/.config/awesome/lain/widget/weather.lua diff --git a/.config/awesome/lain/wiki/Home.md b/user/.config/awesome/lain/wiki/Home.md similarity index 100% rename from .config/awesome/lain/wiki/Home.md rename to user/.config/awesome/lain/wiki/Home.md diff --git a/.config/awesome/lain/wiki/Layouts.md b/user/.config/awesome/lain/wiki/Layouts.md similarity index 100% rename from .config/awesome/lain/wiki/Layouts.md rename to user/.config/awesome/lain/wiki/Layouts.md diff --git a/.config/awesome/lain/wiki/Utilities.md b/user/.config/awesome/lain/wiki/Utilities.md similarity index 100% rename from .config/awesome/lain/wiki/Utilities.md rename to user/.config/awesome/lain/wiki/Utilities.md diff --git a/.config/awesome/lain/wiki/Widgets.md b/user/.config/awesome/lain/wiki/Widgets.md similarity index 100% rename from .config/awesome/lain/wiki/Widgets.md rename to user/.config/awesome/lain/wiki/Widgets.md diff --git a/.config/awesome/lain/wiki/_Footer.md b/user/.config/awesome/lain/wiki/_Footer.md similarity index 100% rename from .config/awesome/lain/wiki/_Footer.md rename to user/.config/awesome/lain/wiki/_Footer.md diff --git a/.config/awesome/lain/wiki/_Sidebar.md b/user/.config/awesome/lain/wiki/_Sidebar.md similarity index 100% rename from .config/awesome/lain/wiki/_Sidebar.md rename to user/.config/awesome/lain/wiki/_Sidebar.md diff --git a/.config/awesome/lain/wiki/alsa.md b/user/.config/awesome/lain/wiki/alsa.md similarity index 100% rename from .config/awesome/lain/wiki/alsa.md rename to user/.config/awesome/lain/wiki/alsa.md diff --git a/.config/awesome/lain/wiki/alsabar.md b/user/.config/awesome/lain/wiki/alsabar.md similarity index 100% rename from .config/awesome/lain/wiki/alsabar.md rename to user/.config/awesome/lain/wiki/alsabar.md diff --git a/.config/awesome/lain/wiki/bat.md b/user/.config/awesome/lain/wiki/bat.md similarity index 100% rename from .config/awesome/lain/wiki/bat.md rename to user/.config/awesome/lain/wiki/bat.md diff --git a/.config/awesome/lain/wiki/cal.md b/user/.config/awesome/lain/wiki/cal.md similarity index 100% rename from .config/awesome/lain/wiki/cal.md rename to user/.config/awesome/lain/wiki/cal.md diff --git a/.config/awesome/lain/wiki/cpu.md b/user/.config/awesome/lain/wiki/cpu.md similarity index 100% rename from .config/awesome/lain/wiki/cpu.md rename to user/.config/awesome/lain/wiki/cpu.md diff --git a/.config/awesome/lain/wiki/fs.md b/user/.config/awesome/lain/wiki/fs.md similarity index 100% rename from .config/awesome/lain/wiki/fs.md rename to user/.config/awesome/lain/wiki/fs.md diff --git a/.config/awesome/lain/wiki/imap.md b/user/.config/awesome/lain/wiki/imap.md similarity index 100% rename from .config/awesome/lain/wiki/imap.md rename to user/.config/awesome/lain/wiki/imap.md diff --git a/.config/awesome/lain/wiki/mem.md b/user/.config/awesome/lain/wiki/mem.md similarity index 100% rename from .config/awesome/lain/wiki/mem.md rename to user/.config/awesome/lain/wiki/mem.md diff --git a/.config/awesome/lain/wiki/moc.md b/user/.config/awesome/lain/wiki/moc.md similarity index 100% rename from .config/awesome/lain/wiki/moc.md rename to user/.config/awesome/lain/wiki/moc.md diff --git a/.config/awesome/lain/wiki/mpd.md b/user/.config/awesome/lain/wiki/mpd.md similarity index 100% rename from .config/awesome/lain/wiki/mpd.md rename to user/.config/awesome/lain/wiki/mpd.md diff --git a/.config/awesome/lain/wiki/net.md b/user/.config/awesome/lain/wiki/net.md similarity index 100% rename from .config/awesome/lain/wiki/net.md rename to user/.config/awesome/lain/wiki/net.md diff --git a/.config/awesome/lain/wiki/pulse.md b/user/.config/awesome/lain/wiki/pulse.md similarity index 100% rename from .config/awesome/lain/wiki/pulse.md rename to user/.config/awesome/lain/wiki/pulse.md diff --git a/.config/awesome/lain/wiki/pulseaudio.md b/user/.config/awesome/lain/wiki/pulseaudio.md similarity index 100% rename from .config/awesome/lain/wiki/pulseaudio.md rename to user/.config/awesome/lain/wiki/pulseaudio.md diff --git a/.config/awesome/lain/wiki/pulsebar.md b/user/.config/awesome/lain/wiki/pulsebar.md similarity index 100% rename from .config/awesome/lain/wiki/pulsebar.md rename to user/.config/awesome/lain/wiki/pulsebar.md diff --git a/.config/awesome/lain/wiki/redshift.md b/user/.config/awesome/lain/wiki/redshift.md similarity index 100% rename from .config/awesome/lain/wiki/redshift.md rename to user/.config/awesome/lain/wiki/redshift.md diff --git a/.config/awesome/lain/wiki/sysload.md b/user/.config/awesome/lain/wiki/sysload.md similarity index 100% rename from .config/awesome/lain/wiki/sysload.md rename to user/.config/awesome/lain/wiki/sysload.md diff --git a/.config/awesome/lain/wiki/task.md b/user/.config/awesome/lain/wiki/task.md similarity index 100% rename from .config/awesome/lain/wiki/task.md rename to user/.config/awesome/lain/wiki/task.md diff --git a/.config/awesome/lain/wiki/temp.md b/user/.config/awesome/lain/wiki/temp.md similarity index 100% rename from .config/awesome/lain/wiki/temp.md rename to user/.config/awesome/lain/wiki/temp.md diff --git a/.config/awesome/lain/wiki/tp_smapi.md b/user/.config/awesome/lain/wiki/tp_smapi.md similarity index 100% rename from .config/awesome/lain/wiki/tp_smapi.md rename to user/.config/awesome/lain/wiki/tp_smapi.md diff --git a/.config/awesome/lain/wiki/watch.md b/user/.config/awesome/lain/wiki/watch.md similarity index 100% rename from .config/awesome/lain/wiki/watch.md rename to user/.config/awesome/lain/wiki/watch.md diff --git a/.config/awesome/lain/wiki/weather.md b/user/.config/awesome/lain/wiki/weather.md similarity index 100% rename from .config/awesome/lain/wiki/weather.md rename to user/.config/awesome/lain/wiki/weather.md diff --git a/.config/awesome/rc.lua b/user/.config/awesome/rc.lua similarity index 89% rename from .config/awesome/rc.lua rename to user/.config/awesome/rc.lua index 3c41c9a01..4159d4c0e 100644 --- a/.config/awesome/rc.lua +++ b/user/.config/awesome/rc.lua @@ -12,7 +12,7 @@ local gears = require("gears") --Utilities such as color parsing and obj local lain = require("lain") local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility local hotkeys_popup = require("awful.hotkeys_popup").widget - require("awful.hotkeys_popup.keys") +require("awful.hotkeys_popup.keys") require("awful.autofocus") local wibox = require("wibox") local naughty = require("naughty") @@ -43,9 +43,7 @@ end run_once({ "unclutter -root" }) -- entries must be comma-separated --[[ THEMES ]]-- -local themes = { - "gruvbox-dark" -- 1 -} +local themes = { "gruvbox-dark" } local chosen_theme = themes[1] local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme) beautiful.init(theme_path) @@ -58,13 +56,13 @@ awful.layout.layouts = { awful.layout.suit.tile.left, awful.layout.suit.tile.bottom, awful.layout.suit.tile.top, - --awful.layout.suit.fair, - --awful.layout.suit.fair.horizontal, + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, --awful.layout.suit.spiral, --awful.layout.suit.spiral.dwindle, awful.layout.suit.max, --awful.layout.suit.max.fullscreen, - awful.layout.suit.magnifier, + --awful.layout.suit.magnifier, awful.layout.suit.floating, --awful.layout.suit.corner.nw, --awful.layout.suit.corner.ne, @@ -90,7 +88,7 @@ lain.layout.cascade.tile.ncol = 2 --[[ VARIABLES ]]-- awful.util.terminal = terminal -- do not remove/edit this local terminal = "alacritty" -edit = "alacritty -e nvim" +edit = "emacsclient -c -a emacs" file = "alacritty -e ./.config/vifm/scripts/vifmrun" web = "qutebrowser" chat = "alacritty -e gomuks" @@ -165,6 +163,13 @@ screen.connect_signal("property::geometry", function(s) end) awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end) +-- Rounded Corners +client.connect_signal("manage", function (c) + c.shape = function(cr,w,h) + gears.shape.rounded_rect(cr,w,h,8) + end +end) + --[[ KEY BINDINGS ]]-- -- Awesome things globalkeys = my_table.join( @@ -172,8 +177,8 @@ globalkeys = my_table.join( {description="Show this help menu", group="Quick Actions"}), awful.key({ modkey, "Control" }, "r", awesome.restart, {description = "Reload WM", group = "Quick Actions"}), - awful.key({ modkey, "Shift" }, "q", awesome.quit, - {description = "Log Out", group = "Quick Actions"}), +-- awful.key({ modkey, "Shift" }, "q", awesome.quit, +-- {description = "Log Out", group = "Quick Actions"}), -- Tag browsing arrow keys and escape awful.key({ modkey, }, "Left", awful.tag.viewprev, {description = "view previous", group = "Tag"}), @@ -207,7 +212,7 @@ globalkeys = my_table.join( awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, {description = "Focus the previous screen", group = "Screen"}), awful.key({ modkey, }, "u", awful.client.urgent.jumpto, - {description = "Jump to urgent client", group = "Cient"}), + {description = "Jump to urgent client", group = "Client"}), awful.key({ modkey, }, "Tab", function () awful.client.focus.history.previous() @@ -215,7 +220,7 @@ globalkeys = my_table.join( client.focus:raise() end end, - {description = "Go back", group = "client"}), + {description = "Go back", group = "Client"}), awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, {description = "Increase master width factor", group = "Layout"}), awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, @@ -236,17 +241,17 @@ globalkeys = my_table.join( awful.key({ modkey }, "Return", function() awful.spawn(terminal) end, {description = "Launch a terminal", group = "Hotkeys"}), -- Dmenu - awful.key({ modkey }, "r", function () awful.util.spawn_with_shell("dmenu_run -l 10 -b -i -p Launch:") end, - {description = "Show Run Launcher", group = "Hotkeys"}), - awful.key({ modkey }, "d", function () awful.util.spawn_with_shell("$HOME/.local/bin/dmenu_drun") end, - {description = "Show App Launcher", group = "Hotkeys"}), - awful.key({ modkey }, "w", function () awful.util.spawn_with_shell("$HOME/.local/bin/dmenu_wifi") end, - {description = "Configure WiFi", group = "Hotkeys"}), - awful.key({ modkey, modkey1 }, "q", function () awful.util.spawn_with_shell("$HOME/.local/bin/dmenu_power") end, - {description = "Show Logout menu", group = "Hotkeys"}), - awful.key({ modkey, modkey1 }, "w", function () awful.util.spawn_with_shell("$HOME/.local/bin/dmenu_wall") end, - {description = "Show Logout menu", group = "Hotkeys"}), - awful.key({}, "Print", function () awful.util.spawn_with_shell("$HOME/.local/bin/dmenu_scrot") end, + awful.key({ modkey, "Shift" }, "r", function () awful.util.spawn_with_shell("dmenu_run -l 10 -b -i -p Launch:") end, + {description = "Show run Launcher", group = "Hotkeys"}), + awful.key({ modkey, "Shift" }, "d", function () awful.util.spawn_with_shell("dmenu_drun") end, + {description = "Show app Launcher", group = "Hotkeys"}), + awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn_with_shell("dmenu_wifi") end, + {description = "Configure wiFi", group = "Hotkeys"}), + awful.key({ modkey, "Shift" }, "q", function () awful.util.spawn_with_shell("dmenu_power") end, + {description = "Show logout menu", group = "Hotkeys"}), + awful.key({ modkey, "Shift" }, "b", function () awful.util.spawn_with_shell("dmenu_wall") end, + {description = "Show wallpaper menu", group = "Hotkeys"}), + awful.key({}, "Print", function () awful.util.spawn_with_shell("dmenu_scrot") end, {description = "Take screenshots", group = "Hotkeys"}), -- Keyboard Layouts awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("setxkbmap -layout es") end, @@ -273,11 +278,11 @@ globalkeys = my_table.join( awful.key({ modkey }, "F8", function () awful.util.spawn(games) end, {description = "Launch gaming app", group = "Apps"}), -- Volume - awful.key({}, "XF86AudioRaiseVolume", function() awful.spawn("amixer set Master 5%+") end, + awful.key({}, "XF86AudioRaiseVolume", function() awful.spawn("pamixer -i 5") end, {description = "Increase volume", group = "Quick Actions"}), - awful.key({}, "XF86AudioLowerVolume", function() awful.spawn("amixer set Master 5%-") end, + awful.key({}, "XF86AudioLowerVolume", function() awful.spawn("pamixer -d 5") end, {description = "Decrease volume", group = "Quick Actions"}), - awful.key({}, "XF86AudioMute", function() awful.spawn("amixer set Master toggle") end, + awful.key({}, "XF86AudioMute", function() awful.spawn("pamixer -t") end, {description = "Mute volume", group = "Quick Actions"}), -- Brightness awful.key({}, "XF86MonBrightnessUp", function () awful.spawn("xbacklight -inc 10") end, @@ -298,20 +303,20 @@ globalkeys = my_table.join( end, {description = "Toggle wibox", group = "Quick Actions"}), -- On the fly useless gaps change - awful.key({ altkey, "Control" }, "j", function () lain.util.useless_gaps_resize(1) end, + awful.key({ modkey, modkey1, altkey }, "j", function () lain.util.useless_gaps_resize(1) end, {description = "Increment gaps", group = "Tag"}), - awful.key({ altkey, "Control" }, "l", function () lain.util.useless_gaps_resize(-1) end, + awful.key({ modkey, modkey1, altkey }, "l", function () lain.util.useless_gaps_resize(-1) end, {description = "Decrement gaps", group = "Tag"}), -- Dynamic tagging - awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end, + awful.key({ modkey, modkey1, altkey }, "n", function () lain.util.add_tag() end, {description = "Add new tag", group = "Tag"}), - awful.key({ modkey, "Control" }, "r", function () lain.util.rename_tag() end, + awful.key({ modkey, modkey1, altkey }, "r", function () lain.util.rename_tag() end, {description = "Rename tag", group = "Tag"}), - awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end, + awful.key({ modkey, modkey1, altkey }, "Left", function () lain.util.move_tag(-1) end, {description = "Move tag to the left", group = "Tag"}), - awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end, + awful.key({ modkey, modkey1, altkey }, "Right", function () lain.util.move_tag(1) end, {description = "Move tag to the right", group = "Tag"}), - awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end, + awful.key({ modkey, modkey1, altkey }, "d", function () lain.util.delete_tag() end, {description = "Delete tag", group = "Tag"}), -- Minimize, maximize, moving clients, fullscreen, etc awful.key({ modkey, "Control" }, "n", @@ -327,7 +332,7 @@ globalkeys = my_table.join( clientkeys = gears.table.join( awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen c:raise() end, {description = "Toggle fullscreen", group = "Client"}), - awful.key({ modkey }, "q", function (c) c:kill() end, + awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end, {description = "Close window", group = "Client"}), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, {description = "Toggle floating", group = "Client"}), @@ -499,5 +504,5 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n --[[ AUTOSTART ]]-- awful.util.spawn_with_shell("sh $HOME/.fehbg &") awful.util.spawn_with_shell("lxpolkit &") -awful.util.spawn_with_shell("pulseaudio --daemonize=no --exit-idle-time=-1 &") awful.util.spawn_with_shell("picom --config $HOME/.config/picom/picom.conf &") +awful.util.spawn_with_shell("dunst -c $HOME/.config/dunst/dunstrc &") diff --git a/.config/awesome/themes/gruvbox-dark/icons/ac.png b/user/.config/awesome/themes/gruvbox-dark/icons/ac.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/ac.png rename to user/.config/awesome/themes/gruvbox-dark/icons/ac.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/battery.png b/user/.config/awesome/themes/gruvbox-dark/icons/battery.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/battery.png rename to user/.config/awesome/themes/gruvbox-dark/icons/battery.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/battery_empty.png b/user/.config/awesome/themes/gruvbox-dark/icons/battery_empty.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/battery_empty.png rename to user/.config/awesome/themes/gruvbox-dark/icons/battery_empty.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/battery_low.png b/user/.config/awesome/themes/gruvbox-dark/icons/battery_low.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/battery_low.png rename to user/.config/awesome/themes/gruvbox-dark/icons/battery_low.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/centerfair.png b/user/.config/awesome/themes/gruvbox-dark/icons/centerfair.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/centerfair.png rename to user/.config/awesome/themes/gruvbox-dark/icons/centerfair.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/centerwork.png b/user/.config/awesome/themes/gruvbox-dark/icons/centerwork.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/centerwork.png rename to user/.config/awesome/themes/gruvbox-dark/icons/centerwork.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/centerworkh.png b/user/.config/awesome/themes/gruvbox-dark/icons/centerworkh.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/centerworkh.png rename to user/.config/awesome/themes/gruvbox-dark/icons/centerworkh.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/cpu.png b/user/.config/awesome/themes/gruvbox-dark/icons/cpu.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/cpu.png rename to user/.config/awesome/themes/gruvbox-dark/icons/cpu.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/dwindle.png b/user/.config/awesome/themes/gruvbox-dark/icons/dwindle.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/dwindle.png rename to user/.config/awesome/themes/gruvbox-dark/icons/dwindle.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/fairh.png b/user/.config/awesome/themes/gruvbox-dark/icons/fairh.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/fairh.png rename to user/.config/awesome/themes/gruvbox-dark/icons/fairh.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/fairv.png b/user/.config/awesome/themes/gruvbox-dark/icons/fairv.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/fairv.png rename to user/.config/awesome/themes/gruvbox-dark/icons/fairv.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/floating.png b/user/.config/awesome/themes/gruvbox-dark/icons/floating.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/floating.png rename to user/.config/awesome/themes/gruvbox-dark/icons/floating.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/hdd.png b/user/.config/awesome/themes/gruvbox-dark/icons/hdd.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/hdd.png rename to user/.config/awesome/themes/gruvbox-dark/icons/hdd.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/internet.png b/user/.config/awesome/themes/gruvbox-dark/icons/internet.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/internet.png rename to user/.config/awesome/themes/gruvbox-dark/icons/internet.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/internet_na.png b/user/.config/awesome/themes/gruvbox-dark/icons/internet_na.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/internet_na.png rename to user/.config/awesome/themes/gruvbox-dark/icons/internet_na.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/magnifier.png b/user/.config/awesome/themes/gruvbox-dark/icons/magnifier.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/magnifier.png rename to user/.config/awesome/themes/gruvbox-dark/icons/magnifier.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/mail.png b/user/.config/awesome/themes/gruvbox-dark/icons/mail.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/mail.png rename to user/.config/awesome/themes/gruvbox-dark/icons/mail.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/mail_on.png b/user/.config/awesome/themes/gruvbox-dark/icons/mail_on.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/mail_on.png rename to user/.config/awesome/themes/gruvbox-dark/icons/mail_on.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/max.png b/user/.config/awesome/themes/gruvbox-dark/icons/max.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/max.png rename to user/.config/awesome/themes/gruvbox-dark/icons/max.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/mem.png b/user/.config/awesome/themes/gruvbox-dark/icons/mem.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/mem.png rename to user/.config/awesome/themes/gruvbox-dark/icons/mem.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/net.png b/user/.config/awesome/themes/gruvbox-dark/icons/net.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/net.png rename to user/.config/awesome/themes/gruvbox-dark/icons/net.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/net_wired.png b/user/.config/awesome/themes/gruvbox-dark/icons/net_wired.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/net_wired.png rename to user/.config/awesome/themes/gruvbox-dark/icons/net_wired.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/note.png b/user/.config/awesome/themes/gruvbox-dark/icons/note.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/note.png rename to user/.config/awesome/themes/gruvbox-dark/icons/note.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/note_on.png b/user/.config/awesome/themes/gruvbox-dark/icons/note_on.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/note_on.png rename to user/.config/awesome/themes/gruvbox-dark/icons/note_on.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/scissors.png b/user/.config/awesome/themes/gruvbox-dark/icons/scissors.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/scissors.png rename to user/.config/awesome/themes/gruvbox-dark/icons/scissors.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/spiral.png b/user/.config/awesome/themes/gruvbox-dark/icons/spiral.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/spiral.png rename to user/.config/awesome/themes/gruvbox-dark/icons/spiral.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/square_sel.png b/user/.config/awesome/themes/gruvbox-dark/icons/square_sel.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/square_sel.png rename to user/.config/awesome/themes/gruvbox-dark/icons/square_sel.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/square_unsel.png b/user/.config/awesome/themes/gruvbox-dark/icons/square_unsel.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/square_unsel.png rename to user/.config/awesome/themes/gruvbox-dark/icons/square_unsel.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/submenu.png b/user/.config/awesome/themes/gruvbox-dark/icons/submenu.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/submenu.png rename to user/.config/awesome/themes/gruvbox-dark/icons/submenu.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/task.png b/user/.config/awesome/themes/gruvbox-dark/icons/task.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/task.png rename to user/.config/awesome/themes/gruvbox-dark/icons/task.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/temp.png b/user/.config/awesome/themes/gruvbox-dark/icons/temp.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/temp.png rename to user/.config/awesome/themes/gruvbox-dark/icons/temp.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/termfair.png b/user/.config/awesome/themes/gruvbox-dark/icons/termfair.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/termfair.png rename to user/.config/awesome/themes/gruvbox-dark/icons/termfair.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/tile.png b/user/.config/awesome/themes/gruvbox-dark/icons/tile.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/tile.png rename to user/.config/awesome/themes/gruvbox-dark/icons/tile.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/tilebottom.png b/user/.config/awesome/themes/gruvbox-dark/icons/tilebottom.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/tilebottom.png rename to user/.config/awesome/themes/gruvbox-dark/icons/tilebottom.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/tileleft.png b/user/.config/awesome/themes/gruvbox-dark/icons/tileleft.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/tileleft.png rename to user/.config/awesome/themes/gruvbox-dark/icons/tileleft.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/tiletop.png b/user/.config/awesome/themes/gruvbox-dark/icons/tiletop.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/tiletop.png rename to user/.config/awesome/themes/gruvbox-dark/icons/tiletop.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png b/user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png rename to user/.config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/vol.png b/user/.config/awesome/themes/gruvbox-dark/icons/vol.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/vol.png rename to user/.config/awesome/themes/gruvbox-dark/icons/vol.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/vol_low.png b/user/.config/awesome/themes/gruvbox-dark/icons/vol_low.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/vol_low.png rename to user/.config/awesome/themes/gruvbox-dark/icons/vol_low.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/vol_mute.png b/user/.config/awesome/themes/gruvbox-dark/icons/vol_mute.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/vol_mute.png rename to user/.config/awesome/themes/gruvbox-dark/icons/vol_mute.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/vol_no.png b/user/.config/awesome/themes/gruvbox-dark/icons/vol_no.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/vol_no.png rename to user/.config/awesome/themes/gruvbox-dark/icons/vol_no.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wired.png b/user/.config/awesome/themes/gruvbox-dark/icons/wired.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wired.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wired.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wired_na.png b/user/.config/awesome/themes/gruvbox-dark/icons/wired_na.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wired_na.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wired_na.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wireless_0.png b/user/.config/awesome/themes/gruvbox-dark/icons/wireless_0.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wireless_0.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wireless_0.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wireless_1.png b/user/.config/awesome/themes/gruvbox-dark/icons/wireless_1.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wireless_1.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wireless_1.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wireless_2.png b/user/.config/awesome/themes/gruvbox-dark/icons/wireless_2.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wireless_2.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wireless_2.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wireless_3.png b/user/.config/awesome/themes/gruvbox-dark/icons/wireless_3.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wireless_3.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wireless_3.png diff --git a/.config/awesome/themes/gruvbox-dark/icons/wireless_na.png b/user/.config/awesome/themes/gruvbox-dark/icons/wireless_na.png similarity index 100% rename from .config/awesome/themes/gruvbox-dark/icons/wireless_na.png rename to user/.config/awesome/themes/gruvbox-dark/icons/wireless_na.png diff --git a/.config/awesome/themes/gruvbox-dark/theme.lua b/user/.config/awesome/themes/gruvbox-dark/theme.lua similarity index 94% rename from .config/awesome/themes/gruvbox-dark/theme.lua rename to user/.config/awesome/themes/gruvbox-dark/theme.lua index 483928276..afc529ee3 100644 --- a/.config/awesome/themes/gruvbox-dark/theme.lua +++ b/user/.config/awesome/themes/gruvbox-dark/theme.lua @@ -12,10 +12,8 @@ local awful = require("awful") local wibox = require("wibox") local lgi = require("lgi") local dpi = require("beautiful.xresources").apply_dpi - local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility - local theme = {} theme.machine_name = lain_helpers.first_line("/sys/class/dmi/id/product_name") theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/gruvbox-dark" @@ -28,21 +26,20 @@ local hotkeys_font_size = "9" theme.font = theme_font_type .. " " .. theme_font_size theme.hotkeys_font = hotkeys_font_type .. " " .. hotkeys_font_size theme.hotkeys_description_font = theme.font - theme.fg_normal = "#ebdbb2" -theme.fg_focus = "#FB4934" -theme.fg_urgent = "#CC9393" +theme.fg_focus = "#fb4934" +theme.fg_urgent = "#cc241d" theme.bg_normal = "#1d2021" -theme.bg_focus = "#313131" +theme.bg_focus = "#32302f" theme.bg_urgent = theme.bg_normal -theme.border_width = dpi(1) -theme.border_normal = "#3F3F3F" -theme.border_focus = "#FB4934" -theme.border_marked = "#CC9393" +theme.border_width = dpi(2) +theme.border_normal = "#7c6f64" +theme.border_focus = "#cc241d" +theme.border_marked = "#cc241d" theme.tasklist_bg_focus = theme.bg_normal theme.titlebar_bg_focus = theme.bg_focus theme.titlebar_bg_normal = theme.bg_normal -theme.titlebar_fg_focus = "#FABD2F" -- gruvbox yellow +theme.titlebar_fg_focus = "#d79921" -- gruvbox yellow theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png" theme.layout_tile = theme.dir .. "/icons/tile.png" @@ -82,7 +79,7 @@ theme.widget_mail = theme.dir .. "/icons/mail.png" theme.widget_mail_on = theme.dir .. "/icons/mail_on.png" theme.tasklist_plain_task_name = true theme.tasklist_disable_icon = true -theme.useless_gap = dpi(2) +theme.useless_gap = dpi(5) theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png" theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png" theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png" @@ -157,9 +154,9 @@ local neticon = wibox.widget.imagebox(theme.widget_net) local net = lain.widget.net({ settings = function() widget:set_markup(markup.font(theme.font, - markup("#7AC82E", "DN: " .. string.format("%2.fK", net_now.received)) + markup("#8ec07c", "DN: " .. string.format("%2.fK", net_now.received)) .. " | " .. - markup("#46A8C3", "UP: " .. string.format("%2.fK", net_now.sent) .. " "))) + markup("#458588", "UP: " .. string.format("%2.fK", net_now.sent) .. " "))) end }) @@ -182,11 +179,11 @@ theme.volume = lain.widget.alsa({ }) theme.volume.widget:buttons(awful.util.table.join( awful.button({}, 4, function () - awful.util.spawn("amixer set Master 1%+") + awful.util.spawn("pamixer -i 1") theme.volume.update() end), awful.button({}, 5, function () - awful.util.spawn("amixer set Master 1%-") + awful.util.spawn("pamixer -d 1") theme.volume.update() end) )) @@ -271,5 +268,4 @@ function theme.at_screen_connect(s) }, } end - return theme diff --git a/user/.config/dmenu/Makefile b/user/.config/dmenu/Makefile new file mode 100644 index 000000000..f4be9d180 --- /dev/null +++ b/user/.config/dmenu/Makefile @@ -0,0 +1,67 @@ +# dmenu - dynamic menu +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = drw.c dmenu.c stest.c util.c +OBJ = $(SRC:.c=.o) + +all: options dmenu stest + +options: + @echo dmenu build options: + @echo "CFLAGS = $(CFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" + @echo "CC = $(CC)" + +.c.o: + $(CC) -c $(CFLAGS) $< + +config.h: + cp config.def.h $@ + +patches.h: + cp patches.def.h $@ + +$(OBJ): arg.h config.h config.mk drw.h patches.h + +dmenu: dmenu.o drw.o util.o + $(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS) + +stest: stest.o + $(CC) -o $@ stest.o $(LDFLAGS) + +clean: + rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz + +dist: clean + mkdir -p dmenu-$(VERSION) + cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\ + drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\ + dmenu-$(VERSION) + tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION) + gzip dmenu-$(VERSION).tar + rm -rf dmenu-$(VERSION) + +install: all + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run + chmod 755 $(DESTDIR)$(PREFIX)/bin/stest + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 + sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1 + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ + $(DESTDIR)$(PREFIX)/bin/dmenu_path\ + $(DESTDIR)$(PREFIX)/bin/dmenu_run\ + $(DESTDIR)$(PREFIX)/bin/stest\ + $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ + $(DESTDIR)$(MANPREFIX)/man1/stest.1 + +.PHONY: all options clean dist install uninstall diff --git a/user/.config/dmenu/arg.h b/user/.config/dmenu/arg.h new file mode 100644 index 000000000..e94e02bba --- /dev/null +++ b/user/.config/dmenu/arg.h @@ -0,0 +1,49 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef ARG_H__ +#define ARG_H__ + +extern char *argv0; + +/* use main(int argc, char *argv[]) */ +#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ + argv[0] && argv[0][0] == '-'\ + && argv[0][1];\ + argc--, argv++) {\ + char argc_;\ + char **argv_;\ + int brk_;\ + if (argv[0][1] == '-' && argv[0][2] == '\0') {\ + argv++;\ + argc--;\ + break;\ + }\ + for (brk_ = 0, argv[0]++, argv_ = argv;\ + argv[0][0] && !brk_;\ + argv[0]++) {\ + if (argv_ != argv)\ + break;\ + argc_ = argv[0][0];\ + switch (argc_) + +#define ARGEND }\ + } + +#define ARGC() argc_ + +#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\ + ((x), abort(), (char *)0) :\ + (brk_ = 1, (argv[0][1] != '\0')?\ + (&argv[0][1]) :\ + (argc--, argv++, argv[0]))) + +#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\ + (char *)0 :\ + (brk_ = 1, (argv[0][1] != '\0')?\ + (&argv[0][1]) :\ + (argc--, argv++, argv[0]))) + +#endif diff --git a/user/.config/dmenu/colors/doom-one.h b/user/.config/dmenu/colors/doom-one.h new file mode 100644 index 000000000..94042cda1 --- /dev/null +++ b/user/.config/dmenu/colors/doom-one.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#cccccc", "#282c34" }, + [SchemeSel] = { "#1c1f24", "#c678dd" }, + [SchemeSelHighlight] = { "#98be65", "#000000" }, + [SchemeNormHighlight] = { "#98be65", "#000000" }, + [SchemeOut] = { "#000000", "#51afef" }, + [SchemeMid] = { "#d7d7d7", "#1c1f24" }, +}; diff --git a/user/.config/dmenu/colors/dracula.h b/user/.config/dmenu/colors/dracula.h new file mode 100644 index 000000000..02ce8be40 --- /dev/null +++ b/user/.config/dmenu/colors/dracula.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#f8f8f2", "#282a36" }, + [SchemeSel] = { "#000000", "#ff79c6" }, + [SchemeSelHighlight] = { "#50fa7b", "#000000" }, + [SchemeNormHighlight] = { "#507a7b", "#000000" }, + [SchemeOut] = { "#000000", "#8be9fd" }, + [SchemeMid] = { "#d7d7d7", "#1c1f24" }, +}; diff --git a/user/.config/dmenu/colors/gruvbox-dark.h b/user/.config/dmenu/colors/gruvbox-dark.h new file mode 100644 index 000000000..7fe0cdaa1 --- /dev/null +++ b/user/.config/dmenu/colors/gruvbox-dark.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#fbf1c7", "#1d2021" }, + [SchemeSel] = { "#fbf1c7", "#cc241d" }, + [SchemeSelHighlight] = { "#fbf1c7", "#282828" }, + [SchemeNormHighlight] = { "#fbf1c7", "#282828" }, + [SchemeOut] = { "#fbf1c7", "#cc241d" }, + [SchemeMid] = { "#fbf1c7", "#282828" }, +}; diff --git a/user/.config/dmenu/colors/monokai-pro.h b/user/.config/dmenu/colors/monokai-pro.h new file mode 100644 index 000000000..7b57079ce --- /dev/null +++ b/user/.config/dmenu/colors/monokai-pro.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#FCFCFA", "#2D2A2E" }, + [SchemeSel] = { "#000000", "#AB9DF2" }, + [SchemeSelHighlight] = { "#A9DC76", "#000000" }, + [SchemeNormHighlight] = { "#A9Dc76", "#000000" }, + [SchemeOut] = { "#2D2A2E", "#78DCE8" }, + [SchemeMid] = { "#FCFCFA", "#000000" }, +}; diff --git a/user/.config/dmenu/colors/nord.h b/user/.config/dmenu/colors/nord.h new file mode 100644 index 000000000..27ce0839b --- /dev/null +++ b/user/.config/dmenu/colors/nord.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#D8DEE9", "#2E3440" }, + [SchemeSel] = { "#000000", "#B48EAD" }, + [SchemeSelHighlight] = { "#A3BE8C", "#000000" }, + [SchemeNormHighlight] = { "#A3BE8C", "#000000" }, + [SchemeOut] = { "#2E3440", "#88C0D0" }, + [SchemeMid] = { "#D8DEE9", "#000000" }, +}; diff --git a/user/.config/dmenu/colors/oceanic-next.h b/user/.config/dmenu/colors/oceanic-next.h new file mode 100644 index 000000000..d9822e67e --- /dev/null +++ b/user/.config/dmenu/colors/oceanic-next.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#d8dee9", "#1b2b34" }, + [SchemeSel] = { "#000000", "#c594c5" }, + [SchemeSelHighlight] = { "#99C794", "#000000" }, + [SchemeNormHighlight] = { "#99C794", "#000000" }, + [SchemeOut] = { "#ffffff", "#6699cc" }, + [SchemeMid] = { "#d8dee9", "#000000" }, +}; diff --git a/user/.config/dmenu/colors/palenight.h b/user/.config/dmenu/colors/palenight.h new file mode 100644 index 000000000..26976efda --- /dev/null +++ b/user/.config/dmenu/colors/palenight.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#d0d0d0", "#292d3e" }, + [SchemeSel] = { "#1c1f24", "#c792ea" }, + [SchemeSelHighlight] = { "#c3e88d", "#000000" }, + [SchemeNormHighlight] = { "#c3e88d", "#000000" }, + [SchemeOut] = { "#000000", "#82aaff" }, + [SchemeMid] = { "#d7d7d7", "#1c1f24" }, +}; diff --git a/user/.config/dmenu/colors/solarized-dark.h b/user/.config/dmenu/colors/solarized-dark.h new file mode 100644 index 000000000..c00611e2f --- /dev/null +++ b/user/.config/dmenu/colors/solarized-dark.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#eee8d5", "#002b36" }, + [SchemeSel] = { "#ffffff", "#d33682" }, + [SchemeSelHighlight] = { "#2aa198", "#000000" }, + [SchemeNormHighlight] = { "#2aa198", "#000000" }, + [SchemeOut] = { "#ffffff", "#268bd2" }, + [SchemeMid] = { "#eee8d5", "#000000" }, +}; diff --git a/user/.config/dmenu/colors/solarized-light.h b/user/.config/dmenu/colors/solarized-light.h new file mode 100644 index 000000000..fe56f2882 --- /dev/null +++ b/user/.config/dmenu/colors/solarized-light.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#657b83", "#fdf6e3" }, + [SchemeSel] = { "#ffffff", "#d33682" }, + [SchemeSelHighlight] = { "#2aa198", "#000000" }, + [SchemeNormHighlight] = { "#2aa198", "#000000" }, + [SchemeOut] = { "#ffffff", "#268bd2" }, + [SchemeMid] = { "#073642", "#eee8d5" }, +}; diff --git a/user/.config/dmenu/colors/tomorrow-night.h b/user/.config/dmenu/colors/tomorrow-night.h new file mode 100644 index 000000000..af5ec8c6d --- /dev/null +++ b/user/.config/dmenu/colors/tomorrow-night.h @@ -0,0 +1,9 @@ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#c5c8c6", "#1d1f21" }, + [SchemeSel] = { "#000000", "#b77ee0" }, + [SchemeSelHighlight] = { "#9ec400", "#000000" }, + [SchemeNormHighlight] = { "#9ec400", "#000000" }, + [SchemeOut] = { "#000000", "#54ced6" }, + [SchemeMid] = { "#c5c8c6", "#000000" }, +}; diff --git a/user/.config/dmenu/config.def.h b/user/.config/dmenu/config.def.h new file mode 100644 index 000000000..0d2f5462b --- /dev/null +++ b/user/.config/dmenu/config.def.h @@ -0,0 +1,146 @@ +/* ____ __ */ +/* / __ \_________ _/ /_____ */ +/* / / / / ___/ __ `/ //_/ _ \ */ +/* / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) */ +/* /_____/_/ \__,_/_/|_|\___/ My custom dmenu build */ + +/* See LICENSE file for copyright and license details. */ +/* Default settings; can be overriden by command line. */ +/* Config was built with dmenu-flexipatch: */ +/* https://github.com/bakkeby/dmenu-flexipatch */ + +/* The patches I have enabled are: +* - alpha +* - border +* - center +* - fuzzyhighlight +* - fuzzymatch +* - grid +* - lineheight +* - morecolor +* - mousesupport +* - numbers +* - XYW */ + +static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ + +#if ALPHA_PATCH +static int opacity = 0; /* -o option; if 0, then alpha is disabled */ +#endif // ALPHA_PATCH + +#if FUZZYMATCH_PATCH +static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */ +#endif // FUZZYMATCH_PATCH + +#if INCREMENTAL_PATCH +static int incremental = 0; /* -r option; if 1, outputs text each time a key is pressed */ +#endif // INCREMENTAL_PATCH + +#if INSTANT_PATCH +static int instant = 0; /* -n option; if 1, selects matching item without the need to press enter */ +#endif // INSTANT_PATCH + +#if CENTER_PATCH +static int center = 0; /* -c option; if 0, dmenu won't be centered on the screen */ +static int min_width = 680; /* minimum width when centered */ +#endif // CENTER_PATCH + +#if RESTRICT_RETURN_PATCH +static int restrict_return = 0; /* -1 option; if 1, disables shift-return and ctrl-return */ +#endif // RESTRICT_RETURN_PATCH + +/* -fn option overrides fonts[0]; default X11 font or font set */ +#if PANGO_PATCH +static char font[] = "monospace 10"; +#else +#if XRESOURCES_PATCH +static char *fonts[] = +#else +static const char *fonts[] = +#endif // XRESOURCES_PATCH +{ + "mononoki Nerd Font:pixelsize=11:antialias=true:autohint=true", +}; +#endif // PANGO_PATCH + + +#if MANAGED_PATCH +static char *prompt = NULL; /* -p option; prompt to the left of input field */ +#else +static const char *prompt = NULL; /* -p option; prompt to the left of input field */ +#endif // MANAGED_PATCH + +#if DYNAMIC_OPTIONS_PATCH +static const char *dynamic = NULL; /* -dy option; dynamic command to run on input change */ +#endif // DYNAMIC_OPTIONS_PATCH + +#if SYMBOLS_PATCH +static const char *symbol_1 = "<"; +static const char *symbol_2 = ">"; +#endif // SYMBOLS_PATCH + +#if ALPHA_PATCH +static const unsigned int baralpha = 0xd0; +static const unsigned int borderalpha = OPAQUE; +static const unsigned int alphas[][3] = { + /* fg bg border */ + [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, + [SchemeSel] = { OPAQUE, baralpha, borderalpha }, +}; + +#endif // ALPHA_PATCH + + +/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ +static unsigned int lines = 0; + +/* + * SELECT YOUR COLOR SCHEME + * Available themes are: + * 1. doom-one.h + * 2. dracula.h + * 3. gruvbox-dark.h + * 4. monokai-pro.h + * 5. nord.h + * 6. oceanic-next.h + * 7. solarized-dark.h + * 8. solarized-light.h + * 9. tomorrow-night.h + */ +#include "colors/gruvbox-dark.h" + +#if GRID_PATCH +/* -g option; if nonzero, dmenu uses a grid comprised of columns and lines */ +static unsigned int columns = 0; +#endif // GRID_PATCH + +#if LINE_HEIGHT_PATCH +static unsigned int lineheight = 22; /* -h option; minimum height of a menu line */ +static unsigned int min_lineheight = 8; +#endif // LINE_HEIGHT_PATCH + +#if NAVHISTORY_PATCH +static unsigned int maxhist = 15; +static int histnodup = 1; /* if 0, record repeated histories */ +#endif // NAVHISTORY_PATCH + +/* + * Characters not considered part of a word while deleting words + * for example: " /?\"&[]" + */ +#if PIPEOUT_PATCH +static const char startpipe[] = "#"; +#endif // PIPEOUT_PATCH +static const char worddelimiters[] = " "; + +#if BORDER_PATCH +/* Size of the window border */ +static unsigned int border_width = 0; +#endif // BORDER_PATCH + +#if PREFIXCOMPLETION_PATCH +/* + * Use prefix matching by default; can be inverted with the -x flag. + */ +static int use_prefix = 1; +#endif // PREFIXCOMPLETION_PATCH diff --git a/user/.config/dmenu/config.mk b/user/.config/dmenu/config.mk new file mode 100644 index 000000000..a8208ce2e --- /dev/null +++ b/user/.config/dmenu/config.mk @@ -0,0 +1,44 @@ +# dmenu version +VERSION = 5.1 + +# paths +PREFIX = /usr +MANPREFIX = $(PREFIX)/share/man + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# Xinerama, comment if you don't want it +XINERAMALIBS = -lXinerama +XINERAMAFLAGS = -DXINERAMA + +# freetype +FREETYPELIBS = -lfontconfig -lXft +FREETYPEINC = /usr/include/freetype2 +# OpenBSD (uncomment) +#FREETYPEINC = $(X11INC)/freetype2 + +# Uncomment this for the json patch / JSON_PATCH +#JANSSONINC = `pkg-config --cflags jansson` +#JANSSONLIBS = `pkg-config --libs jansson` +# uncomment on RHEL for strcasecmp +#EXTRAFLAGS=-D_GNU_SOURCE + +# Uncomment this for the alpha patch / ALPHA_PATCH +XRENDER = -lXrender + +# Uncomment for the pango patch / PANGO_PATCH +#PANGOINC = `pkg-config --cflags xft pango pangoxft` +#PANGOLIB = `pkg-config --libs xft pango pangoxft` + +# includes and libs +INCS = -I$(X11INC) -I$(FREETYPEINC) $(JANSSONINC) ${PANGOINC} +LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) $(JANSSONLIBS) -lm $(XRENDER) ${PANGOLIB} + +# flags +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) $(EXTRAFLAGS) +CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) +LDFLAGS = $(LIBS) + +# compiler and linker +CC = cc diff --git a/user/.config/dmenu/dmenu.1 b/user/.config/dmenu/dmenu.1 new file mode 100644 index 000000000..323f93cf8 --- /dev/null +++ b/user/.config/dmenu/dmenu.1 @@ -0,0 +1,194 @@ +.TH DMENU 1 dmenu\-VERSION +.SH NAME +dmenu \- dynamic menu +.SH SYNOPSIS +.B dmenu +.RB [ \-bfiv ] +.RB [ \-l +.IR lines ] +.RB [ \-m +.IR monitor ] +.RB [ \-p +.IR prompt ] +.RB [ \-fn +.IR font ] +.RB [ \-nb +.IR color ] +.RB [ \-nf +.IR color ] +.RB [ \-sb +.IR color ] +.RB [ \-sf +.IR color ] +.RB [ \-w +.IR windowid ] +.P +.BR dmenu_run " ..." +.SH DESCRIPTION +.B dmenu +is a dynamic menu for X, which reads a list of newline\-separated items from +stdin. When the user selects an item and presses Return, their choice is printed +to stdout and dmenu terminates. Entering text will narrow the items to those +matching the tokens in the input. +.P +.B dmenu_run +is a script used by +.IR dwm (1) +which lists programs in the user's $PATH and runs the result in their $SHELL. +.SH OPTIONS +.TP +.B \-b +dmenu appears at the bottom of the screen. +.TP +.B \-f +dmenu grabs the keyboard before reading stdin if not reading from a tty. This +is faster, but will lock up X until stdin reaches end\-of\-file. +.TP +.B \-i +dmenu matches menu items case insensitively. +.TP +.BI \-l " lines" +dmenu lists items vertically, with the given number of lines. +.TP +.BI \-m " monitor" +dmenu is displayed on the monitor number supplied. Monitor numbers are starting +from 0. +.TP +.BI \-p " prompt" +defines the prompt to be displayed to the left of the input field. +.TP +.BI \-fn " font" +defines the font or font set used. +.TP +.BI \-nb " color" +defines the normal background color. +.IR #RGB , +.IR #RRGGBB , +and X color names are supported. +.TP +.BI \-nf " color" +defines the normal foreground color. +.TP +.BI \-sb " color" +defines the selected background color. +.TP +.BI \-sf " color" +defines the selected foreground color. +.TP +.B \-v +prints version information to stdout, then exits. +.TP +.BI \-w " windowid" +embed into windowid. +.SH USAGE +dmenu is completely controlled by the keyboard. Items are selected using the +arrow keys, page up, page down, home, and end. +.TP +.B Tab +Copy the selected item to the input field. +.TP +.B Return +Confirm selection. Prints the selected item to stdout and exits, returning +success. +.TP +.B Ctrl-Return +Confirm selection. Prints the selected item to stdout and continues. +.TP +.B Shift\-Return +Confirm input. Prints the input text to stdout and exits, returning success. +.TP +.B Escape +Exit without selecting an item, returning failure. +.TP +.B Ctrl-Left +Move cursor to the start of the current word +.TP +.B Ctrl-Right +Move cursor to the end of the current word +.TP +.B C\-a +Home +.TP +.B C\-b +Left +.TP +.B C\-c +Escape +.TP +.B C\-d +Delete +.TP +.B C\-e +End +.TP +.B C\-f +Right +.TP +.B C\-g +Escape +.TP +.B C\-h +Backspace +.TP +.B C\-i +Tab +.TP +.B C\-j +Return +.TP +.B C\-J +Shift-Return +.TP +.B C\-k +Delete line right +.TP +.B C\-m +Return +.TP +.B C\-M +Shift-Return +.TP +.B C\-n +Down +.TP +.B C\-p +Up +.TP +.B C\-u +Delete line left +.TP +.B C\-w +Delete word left +.TP +.B C\-y +Paste from primary X selection +.TP +.B C\-Y +Paste from X clipboard +.TP +.B M\-b +Move cursor to the start of the current word +.TP +.B M\-f +Move cursor to the end of the current word +.TP +.B M\-g +Home +.TP +.B M\-G +End +.TP +.B M\-h +Up +.TP +.B M\-j +Page down +.TP +.B M\-k +Page up +.TP +.B M\-l +Down +.SH SEE ALSO +.IR dwm (1), +.IR stest (1) diff --git a/user/.config/dmenu/dmenu.c b/user/.config/dmenu/dmenu.c new file mode 100644 index 000000000..2f0c88153 --- /dev/null +++ b/user/.config/dmenu/dmenu.c @@ -0,0 +1,2120 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#ifdef XINERAMA +#include +#endif +#include + +#include "patches.h" +/* Patch incompatibility overrides */ +#if MULTI_SELECTION_PATCH +#undef NON_BLOCKING_STDIN_PATCH +#undef PIPEOUT_PATCH +#undef JSON_PATCH +#undef PRINTINPUTTEXT_PATCH +#endif // MULTI_SELECTION_PATCH +#if JSON_PATCH +#undef NON_BLOCKING_STDIN_PATCH +#undef PRINTINPUTTEXT_PATCH +#undef PIPEOUT_PATCH +#endif // JSON_PATCH + +#include "drw.h" +#include "util.h" +#if GRIDNAV_PATCH +#include +#endif // GRIDNAV_PATCH +#if JSON_PATCH +#include +#endif // JSON_PATCH + +/* macros */ +#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \ + * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) +#define LENGTH(X) (sizeof X / sizeof X[0]) +#if PANGO_PATCH +#define TEXTW(X) (drw_font_getwidth(drw, (X), False) + lrpad) +#define TEXTWM(X) (drw_font_getwidth(drw, (X), True) + lrpad) +#else +#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) +#endif // PANGO_PATCH +#if ALPHA_PATCH +#define OPAQUE 0xffU +#define OPACITY "_NET_WM_WINDOW_OPACITY" +#endif // ALPHA_PATCH + +/* enums */ +enum { + SchemeNorm, + SchemeSel, + SchemeOut, + #if MORECOLOR_PATCH + SchemeMid, + #endif // MORECOLOR_PATCH + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + SchemeNormHighlight, + SchemeSelHighlight, + #endif // HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + #if HIGHPRIORITY_PATCH + SchemeHp, + #endif // HIGHPRIORITY_PATCH + #if EMOJI_HIGHLIGHT_PATCH + SchemeHover, + SchemeGreen, + SchemeYellow, + SchemeBlue, + SchemePurple, + SchemeRed, + #endif // EMOJI_HIGHLIGHT_PATCH + SchemeLast, +}; /* color schemes */ + +struct item { + char *text; + #if TSV_PATCH + char *stext; + #endif // TSV_PATCH + struct item *left, *right; + #if NON_BLOCKING_STDIN_PATCH + struct item *next; + #endif // NON_BLOCKING_STDIN_PATCH + #if MULTI_SELECTION_PATCH + int id; /* for multiselect */ + #else + int out; + #endif // MULTI_SELECTION_PATCH + #if HIGHPRIORITY_PATCH + int hp; + #endif // HIGHPRIORITY_PATCH + #if JSON_PATCH + json_t *json; + #endif // JSON_PATCH + #if FUZZYMATCH_PATCH + double distance; + #endif // FUZZYMATCH_PATCH + #if PRINTINDEX_PATCH + int index; + #endif // PRINTINDEX_PATCH +}; + +static char text[BUFSIZ] = ""; +#if PIPEOUT_PATCH +static char pipeout[8] = " | dmenu"; +#endif // PIPEOUT_PATCH +static char *embed; +static int bh, mw, mh; +#if XYW_PATCH +static int dmx = 0, dmy = 0; /* put dmenu at these x and y offsets */ +static unsigned int dmw = 0; /* make dmenu this wide */ +#endif // XYW_PATCH +static int inputw = 0, promptw; +#if PASSWORD_PATCH +static int passwd = 0; +#endif // PASSWORD_PATCH +static int lrpad; /* sum of left and right padding */ +#if REJECTNOMATCH_PATCH +static int reject_no_match = 0; +#endif // REJECTNOMATCH_PATCH +static size_t cursor; +static struct item *items = NULL; +static struct item *matches, *matchend; +static struct item *prev, *curr, *next, *sel; +static int mon = -1, screen; +#if PRINTINDEX_PATCH +static int print_index = 0; +#endif // PRINTINDEX_PATCH +#if MANAGED_PATCH +static int managed = 0; +#endif // MANAGED_PATCH +#if MULTI_SELECTION_PATCH +static int *selid = NULL; +static unsigned int selidsize = 0; +#endif // MULTI_SELECTION_PATCH +#if NO_SORT_PATCH +static unsigned int sortmatches = 1; +#endif // NO_SORT_PATCH +#if PRINTINPUTTEXT_PATCH +static int use_text_input = 0; +#endif // PRINTINPUTTEXT_PATCH +#if PRESELECT_PATCH +static unsigned int preselected = 0; +#endif // PRESELECT_PATCH +#if EMOJI_HIGHLIGHT_PATCH +static int commented = 0; +static int animated = 0; +#endif // EMOJI_HIGHLIGHT_PATCH + +static Atom clip, utf8; +#if WMTYPE_PATCH +static Atom type, dock; +#endif // WMTYPE_PATCH +static Display *dpy; +static Window root, parentwin, win; +static XIC xic; + +#if ALPHA_PATCH +static int useargb = 0; +static Visual *visual; +static int depth; +static Colormap cmap; +#endif // ALPHA_PATCH + +static Drw *drw; +static Clr *scheme[SchemeLast]; + +#include "patch/include.h" + +#include "config.h" + +#if CASEINSENSITIVE_PATCH +static char * cistrstr(const char *s, const char *sub); +static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp; +static char *(*fstrstr)(const char *, const char *) = cistrstr; +#else +static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; +static char *(*fstrstr)(const char *, const char *) = strstr; +#endif // CASEINSENSITIVE_PATCH + +static void appenditem(struct item *item, struct item **list, struct item **last); +static void calcoffsets(void); +static void cleanup(void); +static char * cistrstr(const char *s, const char *sub); +static int drawitem(struct item *item, int x, int y, int w); +static void drawmenu(void); +static void grabfocus(void); +static void grabkeyboard(void); +static void match(void); +static void insert(const char *str, ssize_t n); +static size_t nextrune(int inc); +static void movewordedge(int dir); +static void keypress(XKeyEvent *ev); +static void paste(void); +#if ALPHA_PATCH +static void xinitvisual(void); +#endif // ALPHA_PATCH +static void readstdin(void); +static void run(void); +static void setup(void); +static void usage(void); + +#include "patch/include.c" + +static void +appenditem(struct item *item, struct item **list, struct item **last) +{ + if (*last) + (*last)->right = item; + else + *list = item; + + item->left = *last; + item->right = NULL; + *last = item; +} + +static void +calcoffsets(void) +{ + int i, n; + + if (lines > 0) + #if GRID_PATCH + if (columns) + n = lines * columns * bh; + else + n = lines * bh; + #else + n = lines * bh; + #endif // GRID_PATCH + else + #if SYMBOLS_PATCH + n = mw - (promptw + inputw + TEXTW(symbol_1) + TEXTW(symbol_2)); + #else + n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">")); + #endif // SYMBOLS_PATCH + /* calculate which items will begin the next page and previous page */ + for (i = 0, next = curr; next; next = next->right) + #if PANGO_PATCH + if ((i += (lines > 0) ? bh : MIN(TEXTWM(next->text), n)) > n) + #else + if ((i += (lines > 0) ? bh : MIN(TEXTW(next->text), n)) > n) + #endif // PANGO_PATCH + break; + for (i = 0, prev = curr; prev && prev->left; prev = prev->left) + #if PANGO_PATCH + if ((i += (lines > 0) ? bh : MIN(TEXTWM(prev->left->text), n)) > n) + #else + if ((i += (lines > 0) ? bh : MIN(TEXTW(prev->left->text), n)) > n) + #endif // PANGO_PATCH + break; +} + +static void +cleanup(void) +{ + size_t i; + + XUngrabKey(dpy, AnyKey, AnyModifier, root); + for (i = 0; i < SchemeLast; i++) + free(scheme[i]); + drw_free(drw); + XSync(dpy, False); + XCloseDisplay(dpy); + #if MULTI_SELECTION_PATCH + free(selid); + #endif // MULTI_SELECTION_PATCH +} + +static char * +cistrstr(const char *s, const char *sub) +{ + size_t len; + + for (len = strlen(sub); *s; s++) + if (!strncasecmp(s, sub, len)) + return (char *)s; + return NULL; +} + +static int +drawitem(struct item *item, int x, int y, int w) +{ + int r; + #if TSV_PATCH + char *text = item->stext; + #else + char *text = item->text; + #endif // TSV_PATCH + + #if EMOJI_HIGHLIGHT_PATCH + int iscomment = 0; + if (text[0] == '>') { + if (text[1] == '>') { + iscomment = 3; + switch (text[2]) { + case 'r': + drw_setscheme(drw, scheme[SchemeRed]); + break; + case 'g': + drw_setscheme(drw, scheme[SchemeGreen]); + break; + case 'y': + drw_setscheme(drw, scheme[SchemeYellow]); + break; + case 'b': + drw_setscheme(drw, scheme[SchemeBlue]); + break; + case 'p': + drw_setscheme(drw, scheme[SchemePurple]); + break; + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + case 'h': + drw_setscheme(drw, scheme[SchemeNormHighlight]); + break; + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + case 's': + drw_setscheme(drw, scheme[SchemeSel]); + break; + default: + iscomment = 1; + drw_setscheme(drw, scheme[SchemeNorm]); + break; + } + } else { + drw_setscheme(drw, scheme[SchemeNorm]); + iscomment = 1; + } + } else if (text[0] == ':') { + iscomment = 2; + if (item == sel) { + switch (text[1]) { + case 'r': + drw_setscheme(drw, scheme[SchemeRed]); + break; + case 'g': + drw_setscheme(drw, scheme[SchemeGreen]); + break; + case 'y': + drw_setscheme(drw, scheme[SchemeYellow]); + break; + case 'b': + drw_setscheme(drw, scheme[SchemeBlue]); + break; + case 'p': + drw_setscheme(drw, scheme[SchemePurple]); + break; + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + case 'h': + drw_setscheme(drw, scheme[SchemeNormHighlight]); + break; + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + case 's': + drw_setscheme(drw, scheme[SchemeSel]); + break; + default: + drw_setscheme(drw, scheme[SchemeSel]); + iscomment = 0; + break; + } + } else { + drw_setscheme(drw, scheme[SchemeNorm]); + } + } + #endif // EMOJI_HIGHLIGHT_PATCH + + #if EMOJI_HIGHLIGHT_PATCH + int temppadding = 0; + if (iscomment == 2) { + if (text[2] == ' ') { + #if PANGO_PATCH + temppadding = drw->font->h * 3; + #else + temppadding = drw->fonts->h * 3; + #endif // PANGO_PATCH + animated = 1; + char dest[1000]; + strcpy(dest, text); + dest[6] = '\0'; + drw_text(drw, x, y + , temppadding + #if LINE_HEIGHT_PATCH + , MAX(lineheight, bh) + #else + , bh + #endif // LINE_HEIGHT_PATCH + , temppadding / 2.6 + , dest + 3 + , 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + iscomment = 6; + drw_setscheme(drw, sel == item ? scheme[SchemeHover] : scheme[SchemeNorm]); + } + } + + char *output; + if (commented) { + static char onestr[2]; + onestr[0] = text[0]; + onestr[1] = '\0'; + output = onestr; + } else { + output = text; + } + #endif // EMOJI_HIGHLIGHT_PATCH + + if (item == sel) + drw_setscheme(drw, scheme[SchemeSel]); + #if HIGHPRIORITY_PATCH + else if (item->hp) + drw_setscheme(drw, scheme[SchemeHp]); + #endif // HIGHPRIORITY_PATCH + #if MORECOLOR_PATCH + else if (item->left == sel || item->right == sel) + drw_setscheme(drw, scheme[SchemeMid]); + #endif // MORECOLOR_PATCH + #if MULTI_SELECTION_PATCH + else if (issel(item->id)) + #else + else if (item->out) + #endif // MULTI_SELECTION_PATCH + drw_setscheme(drw, scheme[SchemeOut]); + else + drw_setscheme(drw, scheme[SchemeNorm]); + + r = drw_text(drw + #if EMOJI_HIGHLIGHT_PATCH + , x + ((iscomment == 6) ? temppadding : 0) + #else + , x + #endif // EMOJI_HIGHLIGHT_PATCH + , y + , w + , bh + #if EMOJI_HIGHLIGHT_PATCH + , commented ? (bh - TEXTW(output) - lrpad) / 2 : lrpad / 2 + #else + , lrpad / 2 + #endif // EMOJI_HIGHLIGHT_PATCH + #if EMOJI_HIGHLIGHT_PATCH + , output + iscomment + #else + , text + #endif // EMOJI_HIGHLIGHT_PATCH + , 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + #if EMOJI_HIGHLIGHT_PATCH + drawhighlights(item, output + iscomment, x + ((iscomment == 6) ? temppadding : 0), y, w); + #else + drawhighlights(item, x, y, w); + #endif // EMOJI_HIGHLIGHT_PATCH + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + return r; +} + +static void +drawmenu(void) +{ + #if SCROLL_PATCH + static int curpos, oldcurlen; + int curlen, rcurlen; + #else + unsigned int curpos; + #endif // SCROLL_PATCH + struct item *item; + int x = 0, y = 0, w, rpad = 0, itw = 0, stw = 0; + #if LINE_HEIGHT_PATCH && PANGO_PATCH + int fh = drw->font->h; + #elif LINE_HEIGHT_PATCH + int fh = drw->fonts->h; + #endif // LINE_HEIGHT_PATCH + #if PASSWORD_PATCH + char *censort; + #endif // PASSWORD_PATCH + + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, 0, 0, mw, mh, 1, 1); + + if (prompt && *prompt) { + #if !PLAIN_PROMPT_PATCH + drw_setscheme(drw, scheme[SchemeSel]); + #endif // PLAIN_PROMPT_PATCH + x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + } + /* draw input field */ + w = (lines > 0 || !matches) ? mw - x : inputw; + + #if SCROLL_PATCH + w -= lrpad / 2; + x += lrpad / 2; + rcurlen = TEXTW(text + cursor) - lrpad; + curlen = TEXTW(text) - lrpad - rcurlen; + curpos += curlen - oldcurlen; + curpos = MIN(w, MAX(0, curpos)); + curpos = MAX(curpos, w - rcurlen); + curpos = MIN(curpos, curlen); + oldcurlen = curlen; + + drw_setscheme(drw, scheme[SchemeNorm]); + #if PASSWORD_PATCH + if (passwd) { + censort = ecalloc(1, sizeof(text)); + memset(censort, '.', strlen(text)); + drw_text_align(drw, x, 0, curpos, bh, censort, cursor, AlignR); + drw_text_align(drw, x + curpos, 0, w - curpos, bh, censort + cursor, strlen(censort) - cursor, AlignL); + free(censort); + } else { + drw_text_align(drw, x, 0, curpos, bh, text, cursor, AlignR); + drw_text_align(drw, x + curpos, 0, w - curpos, bh, text + cursor, strlen(text) - cursor, AlignL); + } + #else + drw_text_align(drw, x, 0, curpos, bh, text, cursor, AlignR); + drw_text_align(drw, x + curpos, 0, w - curpos, bh, text + cursor, strlen(text) - cursor, AlignL); + #endif // PASSWORD_PATCH + #if LINE_HEIGHT_PATCH + drw_rect(drw, x + curpos - 1, 2 + (bh-fh)/2, 2, fh - 4, 1, 0); + #else + drw_rect(drw, x + curpos - 1, 2, 2, bh - 4, 1, 0); + #endif // LINE_HEIGHT_PATCH + #else // !SCROLL_PATCH + drw_setscheme(drw, scheme[SchemeNorm]); + #if PASSWORD_PATCH + if (passwd) { + censort = ecalloc(1, sizeof(text)); + memset(censort, '.', strlen(text)); + drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0 + #if PANGO_PATCH + , False + #endif // PANGO_PATCH + ); + drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0 + #if PANGO_PATCH + , False + #endif // PANGO_PATCH + ); + free(censort); + } else + drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0 + #if PANGO_PATCH + , False + #endif // PANGO_PATCH + ); + #else + drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0 + #if PANGO_PATCH + , False + #endif // PANGO_PATCH + ); + #endif // PASSWORD_PATCH + + curpos = TEXTW(text) - TEXTW(&text[cursor]); + if ((curpos += lrpad / 2 - 1) < w) { + drw_setscheme(drw, scheme[SchemeNorm]); + #if LINE_HEIGHT_PATCH + drw_rect(drw, x + curpos, 2 + (bh-fh)/2, 2, fh - 4, 1, 0); + #else + drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); + #endif // LINE_HEIGHT_PATCH + } + #endif // SCROLL_PATCH + + #if NUMBERS_PATCH + recalculatenumbers(); + rpad = TEXTW(numbers); + #endif // NUMBERS_PATCH + if (lines > 0) { + #if GRID_PATCH + /* draw grid */ + int i = 0; + for (item = curr; item != next; item = item->right, i++) + if (columns) + #if VERTFULL_PATCH + drawitem( + item, + 0 + ((i / lines) * (mw / columns)), + y + (((i % lines) + 1) * bh), + mw / columns + ); + #else + drawitem( + item, + x + ((i / lines) * ((mw - x) / columns)), + y + (((i % lines) + 1) * bh), + (mw - x) / columns + ); + #endif // VERTFULL_PATCH + else + #if VERTFULL_PATCH + drawitem(item, 0, y += bh, mw); + #else + drawitem(item, x, y += bh, mw - x); + #endif // VERTFULL_PATCH + #else + /* draw vertical list */ + for (item = curr; item != next; item = item->right) + #if VERTFULL_PATCH + drawitem(item, 0, y += bh, mw); + #else + drawitem(item, x, y += bh, mw - x); + #endif // VERTFULL_PATCH + #endif // GRID_PATCH + } else if (matches) { + /* draw horizontal list */ + x += inputw; + w = TEXTW("<"); + if (curr->left) { + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + } + x += w; + for (item = curr; item != next; item = item->right) { + #if PANGO_PATCH && TSV_PATCH + itw = TEXTWM(item->stext); + #elif PANGO_PATCH + itw = TEXTWM(item->text); + #elif TSV_PATCH + itw = TEXTW(item->stext); + #else + itw = TEXTW(item->text); + #endif // PANGO_PATCH | TSV_PATCH + #if SYMBOLS_PATCH + stw = TEXTW(symbol_2); + #else + stw = TEXTW(">"); + #endif // SYMBOLS_PATCH + x = drawitem(item, x, 0, MIN(itw, mw - x - stw - rpad)); + } + if (next) { + #if SYMBOLS_PATCH + w = TEXTW(symbol_2); + #else + w = TEXTW(">"); + #endif // SYMBOLS_PATCH + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, mw - w - rpad, 0, w, bh, lrpad / 2 + #if SYMBOLS_PATCH + , symbol_2 + #else + , ">" + #endif // SYMBOLS_PATCH + , 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + } + } + #if NUMBERS_PATCH + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, mw - TEXTW(numbers), 0, TEXTW(numbers), bh, lrpad / 2, numbers, 0); + #else + #endif // NUMBERS_PATCH + drw_map(drw, win, 0, 0, mw, mh); + #if NON_BLOCKING_STDIN_PATCH + XFlush(dpy); + #endif // NON_BLOCKING_STDIN_PATCH +} + +static void +grabfocus(void) +{ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + Window focuswin; + int i, revertwin; + + for (i = 0; i < 100; ++i) { + XGetInputFocus(dpy, &focuswin, &revertwin); + if (focuswin == win) + return; + #if !MANAGED_PATCH + XSetInputFocus(dpy, win, RevertToParent, CurrentTime); + #endif // MANAGED_PATCH + nanosleep(&ts, NULL); + } + die("cannot grab focus"); +} + +static void +grabkeyboard(void) +{ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 }; + int i; + + #if MANAGED_PATCH + if (embed || managed) + #else + if (embed) + #endif // MANAGED_PATCH + return; + /* try to grab keyboard, we may have to wait for another process to ungrab */ + for (i = 0; i < 1000; i++) { + if (XGrabKeyboard(dpy, DefaultRootWindow(dpy), True, GrabModeAsync, + GrabModeAsync, CurrentTime) == GrabSuccess) + return; + nanosleep(&ts, NULL); + } + die("cannot grab keyboard"); +} + +static void +match(void) +{ + #if DYNAMIC_OPTIONS_PATCH + if (dynamic && *dynamic) + refreshoptions(); + #endif // DYNAMIC_OPTIONS_PATCH + + #if FUZZYMATCH_PATCH + if (fuzzy) { + fuzzymatch(); + return; + } + #endif + static char **tokv = NULL; + static int tokn = 0; + + char buf[sizeof text], *s; + int i, tokc = 0; + size_t len, textsize; + struct item *item, *lprefix, *lsubstr, *prefixend, *substrend; + #if HIGHPRIORITY_PATCH + struct item *lhpprefix, *hpprefixend; + #endif // HIGHPRIORITY_PATCH + #if NON_BLOCKING_STDIN_PATCH + int preserve = 0; + #endif // NON_BLOCKING_STDIN_PATCH + #if JSON_PATCH + if (json) + fstrstr = strcasestr; + #endif // JSON_PATCH + + strcpy(buf, text); + /* separate input text into tokens to be matched individually */ + for (s = strtok(buf, " "); s; tokv[tokc - 1] = s, s = strtok(NULL, " ")) + if (++tokc > tokn && !(tokv = realloc(tokv, ++tokn * sizeof *tokv))) + die("cannot realloc %u bytes:", tokn * sizeof *tokv); + len = tokc ? strlen(tokv[0]) : 0; + + #if PREFIXCOMPLETION_PATCH + if (use_prefix) { + matches = lprefix = matchend = prefixend = NULL; + textsize = strlen(text); + } else { + matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL; + textsize = strlen(text) + 1; + } + #else + matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL; + textsize = strlen(text) + 1; + #endif // PREFIXCOMPLETION_PATCH + #if HIGHPRIORITY_PATCH + lhpprefix = hpprefixend = NULL; + #endif // HIGHPRIORITY_PATCH + #if NON_BLOCKING_STDIN_PATCH && DYNAMIC_OPTIONS_PATCH + for (item = items; item && (!(dynamic && *dynamic) || item->text); item = (dynamic && *dynamic) ? item + 1 : item->next) + #elif NON_BLOCKING_STDIN_PATCH + for (item = items; item; item = item->next) + #else + for (item = items; item && item->text; item++) + #endif + { + for (i = 0; i < tokc; i++) + if (!fstrstr(item->text, tokv[i])) + break; + #if DYNAMIC_OPTIONS_PATCH + if (i != tokc && !(dynamic && *dynamic)) /* not all tokens match */ + continue; + #else + if (i != tokc) /* not all tokens match */ + continue; + #endif // DYNAMIC_OPTIONS_PATCH + #if HIGHPRIORITY_PATCH + /* exact matches go first, then prefixes with high priority, then prefixes, then substrings */ + #else + /* exact matches go first, then prefixes, then substrings */ + #endif // HIGHPRIORITY_PATCH + #if NO_SORT_PATCH + if (!sortmatches) + appenditem(item, &matches, &matchend); + else + #endif // NO_SORT_PATCH + if (!tokc || !fstrncmp(text, item->text, textsize)) + appenditem(item, &matches, &matchend); + #if HIGHPRIORITY_PATCH + else if (item->hp && !fstrncmp(tokv[0], item->text, len)) + appenditem(item, &lhpprefix, &hpprefixend); + #endif // HIGHPRIORITY_PATCH + else if (!fstrncmp(tokv[0], item->text, len)) + appenditem(item, &lprefix, &prefixend); + #if PREFIXCOMPLETION_PATCH + else if (!use_prefix) + #else + else + #endif // PREFIXCOMPLETION_PATCH + appenditem(item, &lsubstr, &substrend); + #if NON_BLOCKING_STDIN_PATCH + if (sel == item) + preserve = 1; + #endif // NON_BLOCKING_STDIN_PATCH + } + #if HIGHPRIORITY_PATCH + if (lhpprefix) { + if (matches) { + matchend->right = lhpprefix; + lhpprefix->left = matchend; + } else + matches = lhpprefix; + matchend = hpprefixend; + } + #endif // HIGHPRIORITY_PATCH + if (lprefix) { + if (matches) { + matchend->right = lprefix; + lprefix->left = matchend; + } else + matches = lprefix; + matchend = prefixend; + } + #if PREFIXCOMPLETION_PATCH + if (!use_prefix && lsubstr) + #else + if (lsubstr) + #endif // PREFIXCOMPLETION_PATCH + { + if (matches) { + matchend->right = lsubstr; + lsubstr->left = matchend; + } else + matches = lsubstr; + matchend = substrend; + } + #if NON_BLOCKING_STDIN_PATCH + if (!preserve) + #endif // NON_BLOCKING_STDIN_PATCH + curr = sel = matches; + + #if INSTANT_PATCH + if (instant && matches && matches==matchend && !lsubstr) { + puts(matches->text); + cleanup(); + exit(0); + } + #endif // INSTANT_PATCH + + calcoffsets(); +} + +static void +insert(const char *str, ssize_t n) +{ + if (strlen(text) + n > sizeof text - 1) + return; + + #if REJECTNOMATCH_PATCH + static char last[BUFSIZ] = ""; + if (reject_no_match) { + /* store last text value in case we need to revert it */ + memcpy(last, text, BUFSIZ); + } + #endif // REJECTNOMATCH_PATCH + + /* move existing text out of the way, insert new text, and update cursor */ + memmove(&text[cursor + n], &text[cursor], sizeof text - cursor - MAX(n, 0)); + if (n > 0) + memcpy(&text[cursor], str, n); + cursor += n; + match(); + + #if REJECTNOMATCH_PATCH + if (!matches && reject_no_match) { + /* revert to last text value if theres no match */ + memcpy(text, last, BUFSIZ); + cursor -= n; + match(); + } + #endif // REJECTNOMATCH_PATCH +} + +static size_t +nextrune(int inc) +{ + ssize_t n; + + /* return location of next utf8 rune in the given direction (+1 or -1) */ + for (n = cursor + inc; n + inc >= 0 && (text[n] & 0xc0) == 0x80; n += inc) + ; + return n; +} + +static void +movewordedge(int dir) +{ + if (dir < 0) { /* move cursor to the start of the word*/ + while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)])) + cursor = nextrune(-1); + while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)])) + cursor = nextrune(-1); + } else { /* move cursor to the end of the word */ + while (text[cursor] && strchr(worddelimiters, text[cursor])) + cursor = nextrune(+1); + while (text[cursor] && !strchr(worddelimiters, text[cursor])) + cursor = nextrune(+1); + } +} + +static void +keypress(XKeyEvent *ev) +{ + char buf[32]; + int len; + #if PREFIXCOMPLETION_PATCH + struct item * item; + #endif // PREFIXCOMPLETION_PATCH + KeySym ksym; + Status status; + #if GRID_PATCH && GRIDNAV_PATCH + int i; + struct item *tmpsel; + bool offscreen = false; + #endif // GRIDNAV_PATCH + + len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); + switch (status) { + default: /* XLookupNone, XBufferOverflow */ + return; + case XLookupChars: + goto insert; + case XLookupKeySym: + case XLookupBoth: + break; + } + + if (ev->state & ControlMask) { + switch(ksym) { + case XK_a: ksym = XK_Home; break; + case XK_b: ksym = XK_Left; break; + case XK_c: ksym = XK_Escape; break; + case XK_d: ksym = XK_Delete; break; + case XK_e: ksym = XK_End; break; + case XK_f: ksym = XK_Right; break; + case XK_g: ksym = XK_Escape; break; + case XK_h: ksym = XK_BackSpace; break; + case XK_i: ksym = XK_Tab; break; + case XK_j: /* fallthrough */ + case XK_J: /* fallthrough */ + case XK_m: /* fallthrough */ + case XK_M: ksym = XK_Return; ev->state &= ~ControlMask; break; + case XK_n: ksym = XK_Down; break; + case XK_p: ksym = XK_Up; break; + + case XK_k: /* delete right */ + text[cursor] = '\0'; + match(); + break; + case XK_u: /* delete left */ + insert(NULL, 0 - cursor); + break; + case XK_w: /* delete word */ + while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)])) + insert(NULL, nextrune(-1) - cursor); + while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)])) + insert(NULL, nextrune(-1) - cursor); + break; + case XK_y: /* paste selection */ + case XK_Y: + #if CTRL_V_TO_PASTE_PATCH + case XK_v: + case XK_V: + #endif // CTRL_V_TO_PASTE_PATCH + XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, + utf8, utf8, win, CurrentTime); + return; + case XK_Left: + case XK_KP_Left: + movewordedge(-1); + goto draw; + case XK_Right: + case XK_KP_Right: + movewordedge(+1); + goto draw; + case XK_Return: + case XK_KP_Enter: + #if MULTI_SELECTION_PATCH + selsel(); + #endif // MULTI_SELECTION_PATCH + break; + case XK_bracketleft: + cleanup(); + exit(1); + default: + return; + } + } else if (ev->state & Mod1Mask) { + switch(ksym) { + case XK_b: + movewordedge(-1); + goto draw; + case XK_f: + movewordedge(+1); + goto draw; + case XK_g: ksym = XK_Home; break; + case XK_G: ksym = XK_End; break; + case XK_h: ksym = XK_Up; break; + case XK_j: ksym = XK_Next; break; + case XK_k: ksym = XK_Prior; break; + case XK_l: ksym = XK_Down; break; + #if NAVHISTORY_PATCH + case XK_p: + navhistory(-1); + buf[0]=0; + break; + case XK_n: + navhistory(1); + buf[0]=0; + break; + #endif // NAVHISTORY_PATCH + default: + return; + } + } + + switch(ksym) { + default: +insert: + if (!iscntrl(*buf)) + insert(buf, len); + break; + case XK_Delete: + case XK_KP_Delete: + if (text[cursor] == '\0') + return; + cursor = nextrune(+1); + /* fallthrough */ + case XK_BackSpace: + if (cursor == 0) + return; + insert(NULL, nextrune(-1) - cursor); + break; + case XK_End: + case XK_KP_End: + if (text[cursor] != '\0') { + cursor = strlen(text); + break; + } + if (next) { + /* jump to end of list and position items in reverse */ + curr = matchend; + calcoffsets(); + curr = prev; + calcoffsets(); + while (next && (curr = curr->right)) + calcoffsets(); + } + sel = matchend; + break; + case XK_Escape: + cleanup(); + exit(1); + case XK_Home: + case XK_KP_Home: + if (sel == matches) { + cursor = 0; + break; + } + sel = curr = matches; + calcoffsets(); + break; + case XK_Left: + case XK_KP_Left: + #if GRID_PATCH && GRIDNAV_PATCH + if (columns > 1) { + if (!sel) + return; + tmpsel = sel; + for (i = 0; i < lines; i++) { + if (!tmpsel->left || tmpsel->left->right != tmpsel) + return; + if (tmpsel == curr) + offscreen = true; + tmpsel = tmpsel->left; + } + sel = tmpsel; + if (offscreen) { + curr = prev; + calcoffsets(); + } + break; + } + #endif // GRIDNAV_PATCH + if (cursor > 0 && (!sel || !sel->left || lines > 0)) { + cursor = nextrune(-1); + break; + } + if (lines > 0) + return; + /* fallthrough */ + case XK_Up: + case XK_KP_Up: + if (sel && sel->left && (sel = sel->left)->right == curr) { + curr = prev; + calcoffsets(); + } + break; + case XK_Next: + case XK_KP_Next: + if (!next) + return; + sel = curr = next; + calcoffsets(); + break; + case XK_Prior: + case XK_KP_Prior: + if (!prev) + return; + sel = curr = prev; + calcoffsets(); + break; + case XK_Return: + case XK_KP_Enter: + #if RESTRICT_RETURN_PATCH + if (restrict_return && (!sel || ev->state & (ShiftMask | ControlMask))) + break; + #endif // RESTRICT_RETURN_PATCH + #if !MULTI_SELECTION_PATCH + #if JSON_PATCH + if (!printjsonssel(ev->state)) + break; + #elif PIPEOUT_PATCH + #if PRINTINPUTTEXT_PATCH + if (sel && ( + (use_text_input && (ev->state & ShiftMask)) || + (!use_text_input && !(ev->state & ShiftMask)) + )) + #else + if (sel && !(ev->state & ShiftMask)) + #endif // PRINTINPUTTEXT_PATCH + { + if (sel->text[0] == startpipe[0]) { + strncpy(sel->text + strlen(sel->text),pipeout,8); + puts(sel->text+1); + } + #if PRINTINDEX_PATCH + if (print_index) + printf("%d\n", sel->index); + else + #endif // PRINTINDEX_PATCH + puts(sel->text); + } else { + if (text[0] == startpipe[0]) { + strncpy(text + strlen(text),pipeout,8); + puts(text+1); + } + puts(text); + } + #elif PRINTINPUTTEXT_PATCH + if (use_text_input) + puts((sel && (ev->state & ShiftMask)) ? sel->text : text); + #if PRINTINDEX_PATCH + else if (print_index) + printf("%d\n", (sel && !(ev->state & ShiftMask)) ? sel->index : -1); + #endif // PRINTINDEX_PATCH + else + puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); + #elif PRINTINDEX_PATCH + if (print_index) + printf("%d\n", (sel && !(ev->state & ShiftMask)) ? sel->index : -1); + else + puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); + #else + puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); + #endif // PIPEOUT_PATCH | PRINTINPUTTEXT_PATCH | PRINTINDEX_PATCH + #endif // MULTI_SELECTION_PATCH + if (!(ev->state & ControlMask)) { + #if NAVHISTORY_PATCH + savehistory((sel && !(ev->state & ShiftMask)) + ? sel->text : text); + #endif // NAVHISTORY_PATCH + #if MULTI_SELECTION_PATCH + printsel(ev->state); + #endif // MULTI_SELECTION_PATCH + cleanup(); + exit(0); + } + #if !MULTI_SELECTION_PATCH + if (sel) + sel->out = 1; + #endif // MULTI_SELECTION_PATCH + break; + case XK_Right: + case XK_KP_Right: + #if GRID_PATCH && GRIDNAV_PATCH + if (columns > 1) { + if (!sel) + return; + tmpsel = sel; + for (i = 0; i < lines; i++) { + if (!tmpsel->right || tmpsel->right->left != tmpsel) + return; + tmpsel = tmpsel->right; + if (tmpsel == next) + offscreen = true; + } + sel = tmpsel; + if (offscreen) { + curr = next; + calcoffsets(); + } + break; + } + #endif // GRIDNAV_PATCH + if (text[cursor] != '\0') { + cursor = nextrune(+1); + break; + } + if (lines > 0) + return; + /* fallthrough */ + case XK_Down: + case XK_KP_Down: + if (sel && sel->right && (sel = sel->right) == next) { + curr = next; + calcoffsets(); + } + break; + case XK_Tab: + #if PREFIXCOMPLETION_PATCH + if (!matches) + break; /* cannot complete no matches */ + #if FUZZYMATCH_PATCH + /* only do tab completion if all matches start with prefix */ + for (item = matches; item && item->text; item = item->right) + if (item->text[0] != text[0]) + goto draw; + #endif // FUZZYMATCH_PATCH + strncpy(text, matches->text, sizeof text - 1); + text[sizeof text - 1] = '\0'; + len = cursor = strlen(text); /* length of longest common prefix */ + for (item = matches; item && item->text; item = item->right) { + cursor = 0; + while (cursor < len && text[cursor] == item->text[cursor]) + cursor++; + len = cursor; + } + memset(text + len, '\0', strlen(text) - len); + #else + if (!sel) + return; + strncpy(text, sel->text, sizeof text - 1); + text[sizeof text - 1] = '\0'; + cursor = strlen(text); + match(); + #endif // + break; + } + +draw: + #if INCREMENTAL_PATCH + if (incremental) { + puts(text); + fflush(stdout); + } + #endif // INCREMENTAL_PATCH + drawmenu(); +} + +static void +paste(void) +{ + char *p, *q; + int di; + unsigned long dl; + Atom da; + + /* we have been given the current selection, now insert it into input */ + if (XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False, + utf8, &da, &di, &dl, &dl, (unsigned char **)&p) + == Success && p) { + insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); + XFree(p); + } + drawmenu(); +} + +#if ALPHA_PATCH +static void +xinitvisual() +{ + XVisualInfo *infos; + XRenderPictFormat *fmt; + int nitems; + int i; + + XVisualInfo tpl = { + .screen = screen, + .depth = 32, + .class = TrueColor + }; + long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; + + infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); + visual = NULL; + for(i = 0; i < nitems; i ++) { + fmt = XRenderFindVisualFormat(dpy, infos[i].visual); + if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { + visual = infos[i].visual; + depth = infos[i].depth; + cmap = XCreateColormap(dpy, root, visual, AllocNone); + useargb = 1; + break; + } + } + + XFree(infos); + + if (!visual || !opacity) { + visual = DefaultVisual(dpy, screen); + depth = DefaultDepth(dpy, screen); + cmap = DefaultColormap(dpy, screen); + } +} +#endif // ALPHA_PATCH + +#if !NON_BLOCKING_STDIN_PATCH +static void +readstdin(void) +{ + char buf[sizeof text], *p; + #if JSON_PATCH + size_t i; + unsigned int imax = 0; + struct item *item; + #else + size_t i, imax = 0, size = 0; + #endif // JSON_PATCH + unsigned int tmpmax = 0; + + #if PASSWORD_PATCH + if (passwd) { + inputw = lines = 0; + return; + } + #endif // PASSWORD_PATCH + + /* read each line from stdin and add it to the item list */ + for (i = 0; fgets(buf, sizeof buf, stdin); i++) { + #if JSON_PATCH + item = itemnew(); + #else + if (i + 1 >= size / sizeof *items) + if (!(items = realloc(items, (size += BUFSIZ)))) + die("cannot realloc %u bytes:", size); + #endif // JSON_PATCH + if ((p = strchr(buf, '\n'))) + *p = '\0'; + #if JSON_PATCH + if (!(item->text = strdup(buf))) + #else + if (!(items[i].text = strdup(buf))) + #endif // JSON_PATCH + die("cannot strdup %u bytes:", strlen(buf) + 1); + #if TSV_PATCH + if ((p = strchr(buf, '\t'))) + *p = '\0'; + if (!(items[i].stext = strdup(buf))) + die("cannot strdup %u bytes:", strlen(buf) + 1); + #endif // TSV_PATCH + #if MULTI_SELECTION_PATCH + items[i].id = i; /* for multiselect */ + #if PRINTINDEX_PATCH + items[i].index = i; + #endif // PRINTINDEX_PATCH + #elif JSON_PATCH + item->json = NULL; + item->out = 0; + #if PRINTINDEX_PATCH + item->index = i; + #endif // PRINTINDEX_PATCH + #elif PRINTINDEX_PATCH + items[i].index = i; + #else + items[i].out = 0; + #endif // MULTI_SELECTION_PATCH | JSON_PATCH | PRINTINDEX_PATCH + + #if HIGHPRIORITY_PATCH + items[i].hp = arrayhas(hpitems, hplength, items[i].text); + #endif // HIGHPRIORITY_PATCH + #if PANGO_PATCH + drw_font_getexts(drw->font, buf, strlen(buf), &tmpmax, NULL, True); + #else + drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL); + #endif // PANGO_PATCH + if (tmpmax > inputw) { + inputw = tmpmax; + #if JSON_PATCH + imax = items_ln - 1; + #else + imax = i; + #endif // JSON_PATCH + } + } + if (items) + #if JSON_PATCH + items[items_ln].text = NULL; + #else + items[i].text = NULL; + #endif // JSON_PATCH + #if PANGO_PATCH + inputw = items ? TEXTWM(items[imax].text) : 0; + #else + inputw = items ? TEXTW(items[imax].text) : 0; + #endif // PANGO_PATCH + #if JSON_PATCH + lines = MIN(lines, items_ln); + #else + lines = MIN(lines, i); + #endif // JSON_PATCH +} +#endif // NON_BLOCKING_STDIN_PATCH + +static void +#if NON_BLOCKING_STDIN_PATCH +readevent(void) +#else +run(void) +#endif // NON_BLOCKING_STDIN_PATCH +{ + XEvent ev; + #if PRESELECT_PATCH + int i; + #endif // PRESELECT_PATCH + + while (!XNextEvent(dpy, &ev)) { + #if PRESELECT_PATCH + if (preselected) { + for (i = 0; i < preselected; i++) { + if (sel && sel->right && (sel = sel->right) == next) { + curr = next; + calcoffsets(); + } + } + drawmenu(); + preselected = 0; + } + #endif // PRESELECT_PATCH + if (XFilterEvent(&ev, win)) + continue; + switch(ev.type) { + #if MOUSE_SUPPORT_PATCH + case ButtonPress: + buttonpress(&ev); + break; + #endif // MOUSE_SUPPORT_PATCH + case DestroyNotify: + if (ev.xdestroywindow.window != win) + break; + cleanup(); + exit(1); + case Expose: + if (ev.xexpose.count == 0) + drw_map(drw, win, 0, 0, mw, mh); + break; + case FocusIn: + /* regrab focus from parent window */ + if (ev.xfocus.window != win) + grabfocus(); + break; + case KeyPress: + keypress(&ev.xkey); + break; + case SelectionNotify: + if (ev.xselection.property == utf8) + paste(); + break; + case VisibilityNotify: + if (ev.xvisibility.state != VisibilityUnobscured) + XRaiseWindow(dpy, win); + break; + } + } +} + +static void +setup(void) +{ + int x, y, i, j; + unsigned int du; + XSetWindowAttributes swa; + XIM xim; + Window w, dw, *dws; + XWindowAttributes wa; + XClassHint ch = {"dmenu", "dmenu"}; +#ifdef XINERAMA + XineramaScreenInfo *info; + Window pw; + int a, di, n, area = 0; +#endif + /* init appearance */ + #if XRESOURCES_PATCH + for (j = 0; j < SchemeLast; j++) + #if ALPHA_PATCH + scheme[j] = drw_scm_create(drw, (const char**)colors[j], alphas[j], 2); + #else + scheme[j] = drw_scm_create(drw, (const char**)colors[j], 2); + #endif // ALPHA_PATCH + #else + for (j = 0; j < SchemeLast; j++) + #if ALPHA_PATCH + scheme[j] = drw_scm_create(drw, colors[j], alphas[j], 2); + #else + scheme[j] = drw_scm_create(drw, colors[j], 2); + #endif // ALPHA_PATCH + #endif // XRESOURCES_PATCH + + clip = XInternAtom(dpy, "CLIPBOARD", False); + utf8 = XInternAtom(dpy, "UTF8_STRING", False); + #if WMTYPE_PATCH + type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); + dock = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False); + #endif // WMTYPE_PATCH + + /* calculate menu geometry */ + #if PANGO_PATCH + bh = drw->font->h + 2; + #else + bh = drw->fonts->h + 2; + #endif // PANGO_PATCH + #if LINE_HEIGHT_PATCH + bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */ + #endif // LINE_HEIGHT_PATCH + lines = MAX(lines, 0); + mh = (lines + 1) * bh; + #if CENTER_PATCH && PANGO_PATCH + promptw = (prompt && *prompt) ? TEXTWM(prompt) - lrpad / 4 : 0; + #elif CENTER_PATCH + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; + #endif // CENTER_PATCH +#ifdef XINERAMA + i = 0; + if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { + XGetInputFocus(dpy, &w, &di); + if (mon >= 0 && mon < n) + i = mon; + else if (w != root && w != PointerRoot && w != None) { + /* find top-level window containing current input focus */ + do { + if (XQueryTree(dpy, (pw = w), &dw, &w, &dws, &du) && dws) + XFree(dws); + } while (w != root && w != pw); + /* find xinerama screen with which the window intersects most */ + if (XGetWindowAttributes(dpy, pw, &wa)) + for (j = 0; j < n; j++) + if ((a = INTERSECT(wa.x, wa.y, wa.width, wa.height, info[j])) > area) { + area = a; + i = j; + } + } + /* no focused window is on screen, so use pointer location instead */ + if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) + for (i = 0; i < n; i++) + if (INTERSECT(x, y, 1, 1, info[i]) != 0) + break; + + #if CENTER_PATCH + if (center) { + mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); + x = info[i].x_org + ((info[i].width - mw) / 2); + y = info[i].y_org + ((info[i].height - mh) / 2); + } else { + #if XYW_PATCH + x = info[i].x_org + dmx; + y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy); + mw = (dmw>0 ? dmw : info[i].width); + #else + x = info[i].x_org; + y = info[i].y_org + (topbar ? 0 : info[i].height - mh); + mw = info[i].width; + #endif // XYW_PATCH + } + #elif XYW_PATCH + x = info[i].x_org + dmx; + y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy); + mw = (dmw>0 ? dmw : info[i].width); + #else + x = info[i].x_org; + y = info[i].y_org + (topbar ? 0 : info[i].height - mh); + mw = info[i].width; + #endif // CENTER_PATCH / XYW_PATCH + XFree(info); + } else +#endif + { + if (!XGetWindowAttributes(dpy, parentwin, &wa)) + die("could not get embedding window attributes: 0x%lx", + parentwin); + #if CENTER_PATCH + if (center) { + mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); + x = (wa.width - mw) / 2; + y = (wa.height - mh) / 2; + } else { + #if XYW_PATCH + x = dmx; + y = topbar ? dmy : wa.height - mh - dmy; + mw = (dmw>0 ? dmw : wa.width); + #else + x = 0; + y = topbar ? 0 : wa.height - mh; + mw = wa.width; + #endif // XYW_PATCH + } + #elif XYW_PATCH + x = dmx; + y = topbar ? dmy : wa.height - mh - dmy; + mw = (dmw>0 ? dmw : wa.width); + #else + x = 0; + y = topbar ? 0 : wa.height - mh; + mw = wa.width; + #endif // CENTER_PATCH / XYW_PATCH + } + #if !CENTER_PATCH + #if PANGO_PATCH + promptw = (prompt && *prompt) ? TEXTWM(prompt) - lrpad / 4 : 0; + #else + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; + #endif // PANGO_PATCH + #endif // CENTER_PATCH + inputw = MIN(inputw, mw/3); + match(); + + /* create menu window */ + #if MANAGED_PATCH + swa.override_redirect = managed ? False : True; + #else + swa.override_redirect = True; + #endif // MANAGED_PATCH + #if ALPHA_PATCH + swa.background_pixel = 0; + swa.colormap = cmap; + #else + swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; + #endif // ALPHA_PATCH + swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask + #if MOUSE_SUPPORT_PATCH + | ButtonPressMask + #endif // MOUSE_SUPPORT_PATCH + ; + #if BORDER_PATCH + win = XCreateWindow(dpy, parentwin, x, y - (topbar ? 0 : border_width * 2), mw - border_width * 2, mh, border_width, + #else + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, + #endif // BORDER_PATCH + #if ALPHA_PATCH + depth, InputOutput, visual, + CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa + #else + CopyFromParent, CopyFromParent, CopyFromParent, + CWOverrideRedirect | CWBackPixel | CWEventMask, &swa + #endif // ALPHA_PATCH + ); + #if BORDER_PATCH + if (border_width) + XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); + #endif // BORDER_PATCH + XSetClassHint(dpy, win, &ch); + #if WMTYPE_PATCH + XChangeProperty(dpy, win, type, XA_ATOM, 32, PropModeReplace, + (unsigned char *) &dock, 1); + #endif // WMTYPE_PATCH + + + /* input methods */ + if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) + die("XOpenIM failed: could not open input device"); + + xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + XNClientWindow, win, XNFocusWindow, win, NULL); + + #if MANAGED_PATCH + if (managed) { + XTextProperty prop; + char *windowtitle = prompt != NULL ? prompt : "dmenu"; + Xutf8TextListToTextProperty(dpy, &windowtitle, 1, XUTF8StringStyle, &prop); + XSetWMName(dpy, win, &prop); + XSetTextProperty(dpy, win, &prop, XInternAtom(dpy, "_NET_WM_NAME", False)); + XFree(prop.value); + } + #endif // MANAGED_PATCH + + XMapRaised(dpy, win); + if (embed) { + XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask); + if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { + for (i = 0; i < du && dws[i] != win; ++i) + XSelectInput(dpy, dws[i], FocusChangeMask); + XFree(dws); + } + grabfocus(); + } + drw_resize(drw, mw, mh); + drawmenu(); +} + +static void +usage(void) +{ + fputs("usage: dmenu [-bv" + #if CENTER_PATCH + "c" + #endif + #if !NON_BLOCKING_STDIN_PATCH + "f" + #endif // NON_BLOCKING_STDIN_PATCH + #if INCREMENTAL_PATCH + "r" + #endif // INCREMENTAL_PATCH + #if CASEINSENSITIVE_PATCH + "s" + #else + "i" + #endif // CASEINSENSITIVE_PATCH + #if INSTANT_PATCH + "n" + #endif // INSTANT_PATCH + #if PRINTINPUTTEXT_PATCH + "t" + #endif // PRINTINPUTTEXT_PATCH + #if PREFIXCOMPLETION_PATCH + "x" + #endif // PREFIXCOMPLETION_PATCH + #if FUZZYMATCH_PATCH + "F" + #endif // FUZZYMATCH_PATCH + #if PASSWORD_PATCH + "P" + #endif // PASSWORD_PATCH + #if NO_SORT_PATCH + "S" + #endif // NO_SORT_PATCH + #if REJECTNOMATCH_PATCH + "R" // (changed from r to R due to conflict with INCREMENTAL_PATCH) + #endif // REJECTNOMATCH_PATCH + #if RESTRICT_RETURN_PATCH + "1" + #endif // RESTRICT_RETURN_PATCH + "] " + #if MANAGED_PATCH + "[-wm] " + #endif // MANAGED_PATCH + #if GRID_PATCH + "[-g columns] " + #endif // GRID_PATCH + "[-l lines] [-p prompt] [-fn font] [-m monitor]" + "\n [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]" + #if ALPHA_PATCH || BORDER_PATCH || HIGHPRIORITY_PATCH || INITIALTEXT_PATCH || LINE_HEIGHT_PATCH || NAVHISTORY_PATCH || XYW_PATCH || DYNAMIC_OPTIONS_PATCH || JSON_PATCH + "\n " + #endif + #if JSON_PATCH + " [ -j json-file]" + #endif // JSON_PATCH + #if DYNAMIC_OPTIONS_PATCH + " [ -dy command]" + #endif // DYNAMIC_OPTIONS_PATCH + #if ALPHA_PATCH + " [ -o opacity]" + #endif // ALPHA_PATCH + #if BORDER_PATCH + " [-bw width]" + #endif // BORDER_PATCH + #if HIGHPRIORITY_PATCH + " [-hb color] [-hf color] [-hp items]" + #endif // HIGHPRIORITY_PATCH + #if INITIALTEXT_PATCH + " [-it text]" + #endif // INITIALTEXT_PATCH + #if LINE_HEIGHT_PATCH + " [-h height]" + #endif // LINE_HEIGHT_PATCH + #if PRESELECT_PATCH + " [-ps index]" + #endif // PRESELECT_PATCH + #if NAVHISTORY_PATCH + " [-H histfile]" + #endif // NAVHISTORY_PATCH + #if XYW_PATCH + " [-X xoffset] [-Y yoffset] [-W width]" // (arguments made upper case due to conflicts) + #endif // XYW_PATCH + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + "\n [-nhb color] [-nhf color] [-shb color] [-shf color]" // highlight colors + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + "\n", stderr); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + XWindowAttributes wa; + int i; + #if !NON_BLOCKING_STDIN_PATCH + int fast = 0; + #endif // NON_BLOCKING_STDIN_PATCH + + #if XRESOURCES_PATCH + if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fputs("warning: no locale support\n", stderr); + if (!(dpy = XOpenDisplay(NULL))) + die("cannot open display"); + screen = DefaultScreen(dpy); + root = RootWindow(dpy, screen); + if (!embed || !(parentwin = strtol(embed, NULL, 0))) + parentwin = root; + if (!XGetWindowAttributes(dpy, parentwin, &wa)) + die("could not get embedding window attributes: 0x%lx", + parentwin); + + #if ALPHA_PATCH + xinitvisual(); + drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); + #else + drw = drw_create(dpy, screen, root, wa.width, wa.height); + #endif // ALPHA_PATCH + readxresources(); + #endif // XRESOURCES_PATCH + + for (i = 1; i < argc; i++) + /* these options take no arguments */ + if (!strcmp(argv[i], "-v")) { /* prints version information */ + puts("dmenu-"VERSION); + exit(0); + } else if (!strcmp(argv[i], "-b")) { /* appears at the bottom of the screen */ + topbar = 0; + #if CENTER_PATCH + } else if (!strcmp(argv[i], "-c")) { /* toggles centering of dmenu window on screen */ + center = !center; + #endif // CENTER_PATCH + #if !NON_BLOCKING_STDIN_PATCH + } else if (!strcmp(argv[i], "-f")) { /* grabs keyboard before reading stdin */ + fast = 1; + #endif // NON_BLOCKING_STDIN_PATCH + #if INCREMENTAL_PATCH + } else if (!strcmp(argv[i], "-r")) { /* incremental */ + incremental = !incremental; + #endif // INCREMENTAL_PATCH + #if CASEINSENSITIVE_PATCH + } else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */ + fstrncmp = strncmp; + fstrstr = strstr; + #else + } else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; + #endif // CASEINSENSITIVE_PATCH + #if MANAGED_PATCH + } else if (!strcmp(argv[i], "-wm")) { /* display as managed wm window */ + managed = 1; + #endif // MANAGED_PATCH + #if INSTANT_PATCH + } else if (!strcmp(argv[i], "-n")) { /* instant select only match */ + instant = !instant; + #endif // INSTANT_PATCH + #if PRINTINPUTTEXT_PATCH + } else if (!strcmp(argv[i], "-t")) { /* favors text input over selection */ + use_text_input = 1; + #endif // PRINTINPUTTEXT_PATCH + #if PREFIXCOMPLETION_PATCH + } else if (!strcmp(argv[i], "-x")) { /* invert use_prefix */ + use_prefix = !use_prefix; + #endif // PREFIXCOMPLETION_PATCH + #if FUZZYMATCH_PATCH + } else if (!strcmp(argv[i], "-F")) { /* disable/enable fuzzy matching, depends on default */ + fuzzy = !fuzzy; + #endif // FUZZYMATCH_PATCH + #if PASSWORD_PATCH + } else if (!strcmp(argv[i], "-P")) { /* is the input a password */ + passwd = 1; + #endif // PASSWORD_PATCH + #if REJECTNOMATCH_PATCH + } else if (!strcmp(argv[i], "-R")) { /* reject input which results in no match */ + reject_no_match = 1; + #endif // REJECTNOMATCH_PATCH + #if NO_SORT_PATCH + } else if (!strcmp(argv[i], "-S")) { /* do not sort matches */ + sortmatches = 0; + #endif // NO_SORT_PATCH + #if PRINTINDEX_PATCH + } else if (!strcmp(argv[i], "-ix")) { /* adds ability to return index in list */ + print_index = 1; + #endif // PRINTINDEX_PATCH + #if RESTRICT_RETURN_PATCH + } else if (!strcmp(argv[i], "-1")) { + restrict_return = 1; + #endif // RESTRICT_RETURN_PATCH + } else if (i + 1 == argc) + usage(); + /* these options take one argument */ + #if NAVHISTORY_PATCH + else if (!strcmp(argv[i], "-H")) + histfile = argv[++i]; + #endif // NAVHISTORY_PATCH + #if GRID_PATCH + else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */ + columns = atoi(argv[++i]); + if (columns && lines == 0) + lines = 1; + } + #endif // GRID_PATCH + #if JSON_PATCH + else if (!strcmp(argv[i], "-j")) + readjson(argv[++i]); + #endif // JSON_PATCH + else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ + lines = atoi(argv[++i]); + #if XYW_PATCH + else if (!strcmp(argv[i], "-X")) /* window x offset */ + dmx = atoi(argv[++i]); + else if (!strcmp(argv[i], "-Y")) /* window y offset (from bottom up if -b) */ + dmy = atoi(argv[++i]); + else if (!strcmp(argv[i], "-W")) /* make dmenu this wide */ + dmw = atoi(argv[++i]); + #endif // XYW_PATCH + else if (!strcmp(argv[i], "-m")) + mon = atoi(argv[++i]); + #if ALPHA_PATCH + else if (!strcmp(argv[i], "-o")) /* opacity, pass -o 0 to disable alpha */ + opacity = atoi(argv[++i]); + #endif // ALPHA_PATCH + else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ + prompt = argv[++i]; + else if (!strcmp(argv[i], "-fn")) /* font or font set */ + #if PANGO_PATCH + strcpy(font, argv[++i]); + #else + fonts[0] = argv[++i]; + #endif // PANGO_PATCH + #if LINE_HEIGHT_PATCH + else if(!strcmp(argv[i], "-h")) { /* minimum height of one menu line */ + lineheight = atoi(argv[++i]); + lineheight = MAX(lineheight, min_lineheight); /* reasonable default in case of value too small/negative */ + } + #endif // LINE_HEIGHT_PATCH + else if (!strcmp(argv[i], "-nb")) /* normal background color */ + colors[SchemeNorm][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-nf")) /* normal foreground color */ + colors[SchemeNorm][ColFg] = argv[++i]; + else if (!strcmp(argv[i], "-sb")) /* selected background color */ + colors[SchemeSel][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-sf")) /* selected foreground color */ + colors[SchemeSel][ColFg] = argv[++i]; + #if HIGHPRIORITY_PATCH + else if (!strcmp(argv[i], "-hb")) /* high priority background color */ + colors[SchemeHp][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-hf")) /* low priority background color */ + colors[SchemeHp][ColFg] = argv[++i]; + else if (!strcmp(argv[i], "-hp")) + hpitems = tokenize(argv[++i], ",", &hplength); + #endif // HIGHPRIORITY_PATCH + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + else if (!strcmp(argv[i], "-nhb")) /* normal hi background color */ + colors[SchemeNormHighlight][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-nhf")) /* normal hi foreground color */ + colors[SchemeNormHighlight][ColFg] = argv[++i]; + else if (!strcmp(argv[i], "-shb")) /* selected hi background color */ + colors[SchemeSelHighlight][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-shf")) /* selected hi foreground color */ + colors[SchemeSelHighlight][ColFg] = argv[++i]; + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + else if (!strcmp(argv[i], "-w")) /* embedding window id */ + embed = argv[++i]; + #if PRESELECT_PATCH + else if (!strcmp(argv[i], "-ps")) /* preselected item */ + preselected = atoi(argv[++i]); + #endif // PRESELECT_PATCH + #if DYNAMIC_OPTIONS_PATCH + else if (!strcmp(argv[i], "-dy")) /* dynamic command to run */ + dynamic = argv[++i]; + #endif // DYNAMIC_OPTIONS_PATCH + #if BORDER_PATCH + else if (!strcmp(argv[i], "-bw")) /* border width around dmenu */ + border_width = atoi(argv[++i]); + #endif // BORDER_PATCH + #if INITIALTEXT_PATCH + else if (!strcmp(argv[i], "-it")) { /* adds initial text */ + const char * text = argv[++i]; + insert(text, strlen(text)); + } + #endif // INITIALTEXT_PATCH + else + usage(); + + #if XRESOURCES_PATCH + #if PANGO_PATCH + if (!drw_font_create(drw, font)) + die("no fonts could be loaded."); + #else + if (!drw_fontset_create(drw, (const char**)fonts, LENGTH(fonts))) + die("no fonts could be loaded."); + #endif // PANGO_PATCH + #else // !XRESOURCES_PATCH + if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fputs("warning: no locale support\n", stderr); + if (!(dpy = XOpenDisplay(NULL))) + die("cannot open display"); + screen = DefaultScreen(dpy); + root = RootWindow(dpy, screen); + if (!embed || !(parentwin = strtol(embed, NULL, 0))) + parentwin = root; + if (!XGetWindowAttributes(dpy, parentwin, &wa)) + die("could not get embedding window attributes: 0x%lx", + parentwin); + + #if ALPHA_PATCH + xinitvisual(); + drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); + #else + drw = drw_create(dpy, screen, root, wa.width, wa.height); + #endif // ALPHA_PATCH + + #if PANGO_PATCH + if (!drw_font_create(drw, font)) + die("no fonts could be loaded."); + #else + if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) + die("no fonts could be loaded."); + #endif // PANGO_PATCH + #endif // XRESOURCES_PATCH + + #if PANGO_PATCH + lrpad = drw->font->h; + #else + lrpad = drw->fonts->h; + #endif // PANGO_PATCH + + #if LINE_HEIGHT_PATCH + if (lineheight == -1) + #if PANGO_PATCH + lineheight = drw->font->h * 2.5; + #else + lineheight = drw->fonts->h * 2.5; + #endif // PANGO_PATCH + #endif // LINE_HEIGHT_PATCH + +#ifdef __OpenBSD__ + if (pledge("stdio rpath", NULL) == -1) + die("pledge"); +#endif + #if NAVHISTORY_PATCH + loadhistory(); + #endif // NAVHISTORY_PATCH + + #if NON_BLOCKING_STDIN_PATCH + grabkeyboard(); + #else + if (fast && !isatty(0)) { + grabkeyboard(); + #if JSON_PATCH + if (json) + listjson(json); + #if DYNAMIC_OPTIONS_PATCH + else if (!(dynamic && *dynamic)) + readstdin(); + #else + else + readstdin(); + #endif // DYNAMIC_OPTIONS_PATCH + #elif DYNAMIC_OPTIONS_PATCH + if (!(dynamic && *dynamic)) + readstdin(); + #else + readstdin(); + #endif // JSON_PATCH | DYNAMIC_OPTIONS_PATCH + } else { + #if JSON_PATCH + if (json) + listjson(json); + #if DYNAMIC_OPTIONS_PATCH + else if (!(dynamic && *dynamic)) + readstdin(); + #else + else + readstdin(); + #endif // DYNAMIC_OPTIONS_PATCH + #elif DYNAMIC_OPTIONS_PATCH + if (!(dynamic && *dynamic)) + readstdin(); + #else + readstdin(); + #endif // JSON_PATCH | DYNAMIC_OPTIONS_PATCH + grabkeyboard(); + } + #endif // NON_BLOCKING_STDIN_PATCH + setup(); + run(); + + return 1; /* unreachable */ +} diff --git a/user/.config/dmenu/dmenu_path b/user/.config/dmenu/dmenu_path new file mode 100644 index 000000000..3a7cda792 --- /dev/null +++ b/user/.config/dmenu/dmenu_path @@ -0,0 +1,13 @@ +#!/bin/sh + +cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}" +cache="$cachedir/dmenu_run" + +[ ! -e "$cachedir" ] && mkdir -p "$cachedir" + +IFS=: +if stest -dqr -n "$cache" $PATH; then + stest -flx $PATH | sort -u | tee "$cache" +else + cat "$cache" +fi diff --git a/user/.config/dmenu/dmenu_run b/user/.config/dmenu/dmenu_run new file mode 100644 index 000000000..cc05de47f --- /dev/null +++ b/user/.config/dmenu/dmenu_run @@ -0,0 +1,6 @@ +#!/bin/sh +export _JAVA_AWT_WM_NONREPARENTING=1 +exec $(dmenu_path | dmenu "$@") + +# Uncomment for the NAVHISTORY patch (and remove the exec above) +#dmenu_path | dmenu -H "${XDG_CACHE_HOME:-$HOME/.cache/}/dmenu_run.hist" "$@" | ${SHELL:-"/bin/sh"} & \ No newline at end of file diff --git a/user/.config/dmenu/drw.c b/user/.config/dmenu/drw.c new file mode 100644 index 000000000..60199b505 --- /dev/null +++ b/user/.config/dmenu/drw.c @@ -0,0 +1,656 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include +#include + +#include "patches.h" +#include "drw.h" +#include "util.h" + +#if !PANGO_PATCH +#define UTF_INVALID 0xFFFD +#define UTF_SIZ 4 + +static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; +static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; +static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; +static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; + +static long +utf8decodebyte(const char c, size_t *i) +{ + for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) + if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) + return (unsigned char)c & ~utfmask[*i]; + return 0; +} + +static size_t +utf8validate(long *u, size_t i) +{ + if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) + *u = UTF_INVALID; + for (i = 1; *u > utfmax[i]; ++i) + ; + return i; +} + +static size_t +utf8decode(const char *c, long *u, size_t clen) +{ + size_t i, j, len, type; + long udecoded; + + *u = UTF_INVALID; + if (!clen) + return 0; + udecoded = utf8decodebyte(c[0], &len); + if (!BETWEEN(len, 1, UTF_SIZ)) + return 1; + for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { + udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); + if (type) + return j; + } + if (j < len) + return 0; + *u = udecoded; + utf8validate(u, len); + + return len; +} +#endif // PANGO_PATCH + +Drw * +#if ALPHA_PATCH +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap) +#else +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) +#endif // ALPHA_PATCH +{ + Drw *drw = ecalloc(1, sizeof(Drw)); + + drw->dpy = dpy; + drw->screen = screen; + drw->root = root; + drw->w = w; + drw->h = h; + #if ALPHA_PATCH + drw->visual = visual; + drw->depth = depth; + drw->cmap = cmap; + drw->drawable = XCreatePixmap(dpy, root, w, h, depth); + drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL); + #else + drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); + drw->gc = XCreateGC(dpy, root, 0, NULL); + #endif // ALPHA_PATCH + XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); + + return drw; +} + +void +drw_resize(Drw *drw, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + drw->w = w; + drw->h = h; + if (drw->drawable) + XFreePixmap(drw->dpy, drw->drawable); + #if ALPHA_PATCH + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth); + #else + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); + #endif // ALPHA_PATCH +} + +void +drw_free(Drw *drw) +{ + XFreePixmap(drw->dpy, drw->drawable); + XFreeGC(drw->dpy, drw->gc); + #if PANGO_PATCH + drw_font_free(drw->font); + #else + drw_fontset_free(drw->fonts); + #endif // PANGO_PATCH + free(drw); +} + +#if PANGO_PATCH +/* This function is an implementation detail. Library users should use + * drw_font_create instead. + */ +static Fnt * +xfont_create(Drw *drw, const char *fontname) +{ + Fnt *font; + PangoFontMap *fontmap; + PangoContext *context; + PangoFontDescription *desc; + PangoFontMetrics *metrics; + + if (!fontname) { + die("no font specified."); + } + + font = ecalloc(1, sizeof(Fnt)); + font->dpy = drw->dpy; + + fontmap = pango_xft_get_font_map(drw->dpy, drw->screen); + context = pango_font_map_create_context(fontmap); + desc = pango_font_description_from_string(fontname); + font->layout = pango_layout_new(context); + pango_layout_set_font_description(font->layout, desc); + + metrics = pango_context_get_metrics(context, desc, pango_language_from_string ("en-us")); + font->h = pango_font_metrics_get_height(metrics) / PANGO_SCALE; + + pango_font_metrics_unref(metrics); + g_object_unref(context); + + return font; +} +#else +/* This function is an implementation detail. Library users should use + * drw_fontset_create instead. + */ +static Fnt * +xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) +{ + Fnt *font; + XftFont *xfont = NULL; + FcPattern *pattern = NULL; + + if (fontname) { + /* Using the pattern found at font->xfont->pattern does not yield the + * same substitution results as using the pattern returned by + * FcNameParse; using the latter results in the desired fallback + * behaviour whereas the former just results in missing-character + * rectangles being drawn, at least with some fonts. */ + if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) { + fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname); + return NULL; + } + if (!(pattern = FcNameParse((FcChar8 *) fontname))) { + fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname); + XftFontClose(drw->dpy, xfont); + return NULL; + } + } else if (fontpattern) { + if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) { + fprintf(stderr, "error, cannot load font from pattern.\n"); + return NULL; + } + } else { + die("no font specified."); + } + + #if !COLOR_EMOJI_PATCH + /* Do not allow using color fonts. This is a workaround for a BadLength + * error from Xft with color glyphs. Modelled on the Xterm workaround. See + * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 + * https://lists.suckless.org/dev/1701/30932.html + * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349 + * and lots more all over the internet. + */ + FcBool iscol; + if (FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { + XftFontClose(drw->dpy, xfont); + return NULL; + } + #endif // COLOR_EMOJI_PATCH + + font = ecalloc(1, sizeof(Fnt)); + font->xfont = xfont; + font->pattern = pattern; + font->h = xfont->ascent + xfont->descent; + font->dpy = drw->dpy; + + return font; +} +#endif // PANGO_PATCH + +static void +xfont_free(Fnt *font) +{ + if (!font) + return; + #if PANGO_PATCH + if (font->layout) + g_object_unref(font->layout); + #else + if (font->pattern) + FcPatternDestroy(font->pattern); + XftFontClose(font->dpy, font->xfont); + #endif // PANGO_PATCH + free(font); +} + +#if PANGO_PATCH +Fnt* +drw_font_create(Drw* drw, const char font[]) +{ + Fnt *fnt = NULL; + + if (!drw || !font) + return NULL; + + fnt = xfont_create(drw, font); + + return (drw->font = fnt); +} +#else +Fnt* +drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount) +{ + Fnt *cur, *ret = NULL; + size_t i; + + if (!drw || !fonts) + return NULL; + + for (i = 1; i <= fontcount; i++) { + if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) { + cur->next = ret; + ret = cur; + } + } + return (drw->fonts = ret); +} +#endif // PANGO_PATCH + +#if PANGO_PATCH +void +drw_font_free(Fnt *font) +{ + if (font) + xfont_free(font); +} +#else +void +drw_fontset_free(Fnt *font) +{ + if (font) { + drw_fontset_free(font->next); + xfont_free(font); + } +} +#endif // PANGO_PATCH + +void +#if ALPHA_PATCH +drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha) +#else +drw_clr_create(Drw *drw, Clr *dest, const char *clrname) +#endif // ALPHA_PATCH +{ + if (!drw || !dest || !clrname) + return; + + #if ALPHA_PATCH + if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, + clrname, dest)) + die("error, cannot allocate color '%s'", clrname); + + dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24); + #else + if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen), + clrname, dest)) + die("error, cannot allocate color '%s'", clrname); + #endif // ALPHA_PATCH +} + +/* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ +Clr * +#if ALPHA_PATCH +drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount) +#else +drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) +#endif // ALPHA_PATCH +{ + size_t i; + Clr *ret; + + /* need at least two colors for a scheme */ + if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor)))) + return NULL; + + for (i = 0; i < clrcount; i++) + #if ALPHA_PATCH + drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]); + #else + drw_clr_create(drw, &ret[i], clrnames[i]); + #endif // ALPHA_PATCH + return ret; +} + +#if !PANGO_PATCH +void +drw_setfontset(Drw *drw, Fnt *set) +{ + if (drw) + drw->fonts = set; +} +#endif // PANGO_PATCH + +void +drw_setscheme(Drw *drw, Clr *scm) +{ + if (drw) + drw->scheme = scm; +} + +void +drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) +{ + if (!drw || !drw->scheme) + return; + XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel); + if (filled) + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + else + XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); +} + +#if PANGO_PATCH +int +drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup) +{ + char buf[1024]; + int ty; + unsigned int ew; + XftDraw *d = NULL; + size_t i, len; + int render = x || y || w || h; + + if (!drw || (render && !drw->scheme) || !text || !drw->font) + return 0; + + if (!render) { + w = ~w; + } else { + XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + #if ALPHA_PATCH + d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); + #else + d = XftDrawCreate(drw->dpy, drw->drawable, + DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen)); + #endif // ALPHA_PATCH + x += lpad; + w -= lpad; + } + + len = strlen(text); + + if (len) { + drw_font_getexts(drw->font, text, len, &ew, NULL, markup); + /* shorten text if necessary */ + for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) + drw_font_getexts(drw->font, text, len, &ew, NULL, markup); + + if (len) { + memcpy(buf, text, len); + buf[len] = '\0'; + if (len < strlen(text)) + for (i = len; i && i > len - 3; buf[--i] = '.') + ; /* NOP */ + + if (render) { + ty = y + (h - drw->font->h) / 2; + if (markup) + pango_layout_set_markup(drw->font->layout, buf, len); + else + pango_layout_set_text(drw->font->layout, buf, len); + pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg], + drw->font->layout, x * PANGO_SCALE, ty * PANGO_SCALE); + if (markup) /* clear markup attributes */ + pango_layout_set_attributes(drw->font->layout, NULL); + } + x += ew; + w -= ew; + } + } + + if (d) + XftDrawDestroy(d); + + return x + (render ? w : 0); +} +#else +int +drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) +{ + char buf[1024]; + int ty; + unsigned int ew; + XftDraw *d = NULL; + Fnt *usedfont, *curfont, *nextfont; + size_t i, len; + int utf8strlen, utf8charlen, render = x || y || w || h; + long utf8codepoint = 0; + const char *utf8str; + FcCharSet *fccharset; + FcPattern *fcpattern; + FcPattern *match; + XftResult result; + int charexists = 0; + + if (!drw || (render && !drw->scheme) || !text || !drw->fonts) + return 0; + + if (!render) { + w = ~w; + } else { + XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + #if ALPHA_PATCH + d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); + #else + d = XftDrawCreate(drw->dpy, drw->drawable, + DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen)); + #endif // ALPHA_PATCH + x += lpad; + w -= lpad; + } + + usedfont = drw->fonts; + while (1) { + utf8strlen = 0; + utf8str = text; + nextfont = NULL; + while (*text) { + utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ); + for (curfont = drw->fonts; curfont; curfont = curfont->next) { + charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); + if (charexists) { + if (curfont == usedfont) { + utf8strlen += utf8charlen; + text += utf8charlen; + } else { + nextfont = curfont; + } + break; + } + } + + if (!charexists || nextfont) + break; + else + charexists = 0; + } + + if (utf8strlen) { + drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); + /* shorten text if necessary */ + for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--) + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); + + if (len) { + memcpy(buf, utf8str, len); + buf[len] = '\0'; + if (len < utf8strlen) + for (i = len; i && i > len - 3; buf[--i] = '.') + ; /* NOP */ + + if (render) { + ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; + XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], + usedfont->xfont, x, ty, (XftChar8 *)buf, len); + } + x += ew; + w -= ew; + } + } + + if (!*text) { + break; + } else if (nextfont) { + charexists = 0; + usedfont = nextfont; + } else { + /* Regardless of whether or not a fallback font is found, the + * character must be drawn. */ + charexists = 1; + + fccharset = FcCharSetCreate(); + FcCharSetAddChar(fccharset, utf8codepoint); + + if (!drw->fonts->pattern) { + /* Refer to the comment in xfont_create for more information. */ + die("the first font in the cache must be loaded from a font string."); + } + + fcpattern = FcPatternDuplicate(drw->fonts->pattern); + FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); + FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); + FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); + + FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); + FcDefaultSubstitute(fcpattern); + match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); + + FcCharSetDestroy(fccharset); + FcPatternDestroy(fcpattern); + + if (match) { + usedfont = xfont_create(drw, NULL, match); + if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { + for (curfont = drw->fonts; curfont->next; curfont = curfont->next) + ; /* NOP */ + curfont->next = usedfont; + } else { + xfont_free(usedfont); + usedfont = drw->fonts; + } + } + } + } + if (d) + XftDrawDestroy(d); + + return x + (render ? w : 0); +} +#endif // PANGO_PATCH + +void +drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); + XSync(drw->dpy, False); +} + +#if PANGO_PATCH +unsigned int +drw_font_getwidth(Drw *drw, const char *text, Bool markup) +{ + if (!drw || !drw->font || !text) + return 0; + return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup); +} +#else +unsigned int +drw_fontset_getwidth(Drw *drw, const char *text) +{ + if (!drw || !drw->fonts || !text) + return 0; + return drw_text(drw, 0, 0, 0, 0, 0, text, 0); +} +#endif // PANGO_PATCH + +#if PANGO_PATCH +void +drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup) +{ + if (!font || !text) + return; + + PangoRectangle r; + if (markup) + pango_layout_set_markup(font->layout, text, len); + else + pango_layout_set_text(font->layout, text, len); + pango_layout_get_extents(font->layout, 0, &r); + if (markup) /* clear markup attributes */ + pango_layout_set_attributes(font->layout, NULL); + if (w) + *w = r.width / PANGO_SCALE; + if (h) + *h = font->h; +} +#else +void +drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h) +{ + XGlyphInfo ext; + + if (!font || !text) + return; + + XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); + if (w) + *w = ext.xOff; + if (h) + *h = font->h; +} +#endif // PANGO_PATCH + +Cur * +drw_cur_create(Drw *drw, int shape) +{ + Cur *cur; + + if (!drw || !(cur = ecalloc(1, sizeof(Cur)))) + return NULL; + + cur->cursor = XCreateFontCursor(drw->dpy, shape); + + return cur; +} + +void +drw_cur_free(Drw *drw, Cur *cursor) +{ + if (!cursor) + return; + + XFreeCursor(drw->dpy, cursor->cursor); + free(cursor); +} + +#if SCROLL_PATCH +#include "patch/scroll.c" +#endif diff --git a/user/.config/dmenu/drw.h b/user/.config/dmenu/drw.h new file mode 100644 index 000000000..a51e6e3a1 --- /dev/null +++ b/user/.config/dmenu/drw.h @@ -0,0 +1,101 @@ +/* See LICENSE file for copyright and license details. */ + +#if PANGO_PATCH +#include +#include +#endif // PANGO_PATCH + +typedef struct { + Cursor cursor; +} Cur; + +typedef struct Fnt { + Display *dpy; + unsigned int h; + #if PANGO_PATCH + PangoLayout *layout; + #else + XftFont *xfont; + FcPattern *pattern; + struct Fnt *next; + #endif // PANGO_PATCH +} Fnt; + +enum { ColFg, ColBg }; /* Clr scheme index */ +typedef XftColor Clr; + +typedef struct { + unsigned int w, h; + Display *dpy; + int screen; + Window root; + #if ALPHA_PATCH + Visual *visual; + unsigned int depth; + Colormap cmap; + #endif // ALPHA_PATCH + Drawable drawable; + GC gc; + Clr *scheme; + #if PANGO_PATCH + Fnt *font; + #else + Fnt *fonts; + #endif // PANGO_PATCH +} Drw; + +/* Drawable abstraction */ +#if ALPHA_PATCH +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap); +#else +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); +#endif // ALPHA_PATCH +void drw_resize(Drw *drw, unsigned int w, unsigned int h); +void drw_free(Drw *drw); + +/* Fnt abstraction */ +#if PANGO_PATCH +Fnt *drw_font_create(Drw* drw, const char font[]); +void drw_font_free(Fnt* set); +unsigned int drw_font_getwidth(Drw *drw, const char *text, Bool markup); +void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup); +#else +Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); +void drw_fontset_free(Fnt* set); +unsigned int drw_fontset_getwidth(Drw *drw, const char *text); +void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); +#endif // PANGO_PATCH + +/* Colorscheme abstraction */ +#if ALPHA_PATCH +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha); +Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount); +#else +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); +#endif // ALPHA_PATCH + +/* Cursor abstraction */ +Cur *drw_cur_create(Drw *drw, int shape); +void drw_cur_free(Drw *drw, Cur *cursor); + +/* Drawing context manipulation */ +#if !PANGO_PATCH +void drw_setfontset(Drw *drw, Fnt *set); +#endif // PANGO_PATCH +void drw_setscheme(Drw *drw, Clr *scm); + +/* Drawing functions */ +void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); +#if PANGO_PATCH +int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup); +#else +int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); +#endif // PANGO_PATCH + +/* Map functions */ +void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); + +#if SCROLL_PATCH +#include "patch/scroll.h" +#endif \ No newline at end of file diff --git a/user/.config/dmenu/patch/center.c b/user/.config/dmenu/patch/center.c new file mode 100644 index 000000000..9682bfbb4 --- /dev/null +++ b/user/.config/dmenu/patch/center.c @@ -0,0 +1,8 @@ +static int +max_textw(void) +{ + int len = 0; + for (struct item *item = items; item && item->text; item++) + len = MAX(TEXTW(item->text), len); + return len; +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/dynamicoptions.c b/user/.config/dmenu/patch/dynamicoptions.c new file mode 100644 index 000000000..c3cb64755 --- /dev/null +++ b/user/.config/dmenu/patch/dynamicoptions.c @@ -0,0 +1,78 @@ +static void +refreshoptions() +{ + int dynlen = strlen(dynamic); + char* cmd= malloc(dynlen + strlen(text) + 2); + if (cmd == NULL) + die("malloc:"); + sprintf(cmd, "%s %s", dynamic, text); + FILE *stream = popen(cmd, "r"); + if (!stream) + die("popen(%s):", cmd); + readstream(stream); + int pc = pclose(stream); + if (pc == -1) + die("pclose:"); + free(cmd); + curr = sel = items; +} + +static void +readstream(FILE* stream) +{ + char buf[sizeof text], *p; + size_t i, imax = 0, size = 0; + unsigned int tmpmax = 0; + + /* read each line from stdin and add it to the item list */ + for (i = 0; fgets(buf, sizeof buf, stream); i++) { + if (i + 1 >= size / sizeof *items) + if (!(items = realloc(items, (size += BUFSIZ)))) + die("cannot realloc %u bytes:", size); + if ((p = strchr(buf, '\n'))) + *p = '\0'; + if (!(items[i].text = strdup(buf))) + die("cannot strdup %u bytes:", strlen(buf) + 1); + #if TSV_PATCH + if ((p = strchr(buf, '\t'))) + *p = '\0'; + if (!(items[i].stext = strdup(buf))) + die("cannot strdup %u bytes:", strlen(buf) + 1); + #endif // TSV_PATCH + #if MULTI_SELECTION_PATCH + items[i].id = i; + #else + items[i].out = 0; + #endif // MULTI_SELECTION_PATCH + #if HIGHPRIORITY_PATCH + items[i].hp = arrayhas(hpitems, hplength, items[i].text); + #endif // HIGHPRIORITY_PATCH + #if PANGO_PATCH + drw_font_getexts(drw->font, buf, strlen(buf), &tmpmax, NULL, True); + #else + drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL); + #endif // PANGO_PATCH + if (tmpmax > inputw) { + inputw = tmpmax; + imax = i; + } + } + + /* If the command did not give any output at all, then do not clear the existing items */ + if (!i) + return; + + if (items) + items[i].text = NULL; + #if PANGO_PATCH + inputw = items ? TEXTWM(items[imax].text) : 0; + #else + inputw = items ? TEXTW(items[imax].text) : 0; + #endif // PANGO_PATCH + if (!dynamic || !*dynamic) + lines = MIN(lines, i); + else { + text[0] = '\0'; + cursor = 0; + } +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/dynamicoptions.h b/user/.config/dmenu/patch/dynamicoptions.h new file mode 100644 index 000000000..eba9fb0d4 --- /dev/null +++ b/user/.config/dmenu/patch/dynamicoptions.h @@ -0,0 +1,2 @@ +static void refreshoptions(); +static void readstream(FILE* stream); \ No newline at end of file diff --git a/user/.config/dmenu/patch/fuzzyhighlight.c b/user/.config/dmenu/patch/fuzzyhighlight.c new file mode 100644 index 000000000..737b5d923 --- /dev/null +++ b/user/.config/dmenu/patch/fuzzyhighlight.c @@ -0,0 +1,57 @@ +static void +#if EMOJI_HIGHLIGHT_PATCH +drawhighlights(struct item *item, char *output, int x, int y, int maxw) +#else +drawhighlights(struct item *item, int x, int y, int maxw) +#endif // EMOJI_HIGHLIGHT_PATCH +{ + int i, indent; + char *highlight; + char c; + + #if EMOJI_HIGHLIGHT_PATCH + char *itemtext = output; + #elif TSV_PATCH + char *itemtext = item->stext; + #else + char *itemtext = item->text; + #endif // TSV_PATCH + + if (!(strlen(itemtext) && strlen(text))) + return; + + drw_setscheme(drw, scheme[item == sel + ? SchemeSelHighlight + : SchemeNormHighlight]); + for (i = 0, highlight = itemtext; *highlight && text[i];) { + #if FUZZYMATCH_PATCH + if (!fstrncmp(&(*highlight), &text[i], 1)) + #else + if (*highlight == text[i]) + #endif // FUZZYMATCH_PATCH + { + /* get indentation */ + c = *highlight; + *highlight = '\0'; + indent = TEXTW(itemtext); + *highlight = c; + + /* highlight character */ + c = highlight[1]; + highlight[1] = '\0'; + drw_text( + drw, + x + indent - (lrpad / 2), + y, + MIN(maxw - indent, TEXTW(highlight) - lrpad), + bh, 0, highlight, 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + highlight[1] = c; + i++; + } + highlight++; + } +} diff --git a/user/.config/dmenu/patch/fuzzymatch.c b/user/.config/dmenu/patch/fuzzymatch.c new file mode 100644 index 000000000..49811faca --- /dev/null +++ b/user/.config/dmenu/patch/fuzzymatch.c @@ -0,0 +1,82 @@ +#include + +int +compare_distance(const void *a, const void *b) +{ + struct item *da = *(struct item **) a; + struct item *db = *(struct item **) b; + + if (!db) + return 1; + if (!da) + return -1; + + return da->distance == db->distance ? 0 : da->distance < db->distance ? -1 : 1; +} + +void +fuzzymatch(void) +{ + /* bang - we have so much memory */ + struct item *it; + struct item **fuzzymatches = NULL; + char c; + int number_of_matches = 0, i, pidx, sidx, eidx; + int text_len = strlen(text), itext_len; + + matches = matchend = NULL; + + /* walk through all items */ + for (it = items; it && it->text; it++) { + if (text_len) { + itext_len = strlen(it->text); + pidx = 0; /* pointer */ + sidx = eidx = -1; /* start of match, end of match */ + /* walk through item text */ + for (i = 0; i < itext_len && (c = it->text[i]); i++) { + /* fuzzy match pattern */ + if (!fstrncmp(&text[pidx], &c, 1)) { + if (sidx == -1) + sidx = i; + pidx++; + if (pidx == text_len) { + eidx = i; + break; + } + } + } + /* build list of matches */ + if (eidx != -1) { + /* compute distance */ + /* add penalty if match starts late (log(sidx+2)) + * add penalty for long a match without many matching characters */ + it->distance = log(sidx + 2) + (double)(eidx - sidx - text_len); + /* fprintf(stderr, "distance %s %f\n", it->text, it->distance); */ + appenditem(it, &matches, &matchend); + number_of_matches++; + } + } else { + appenditem(it, &matches, &matchend); + } + } + + if (number_of_matches) { + /* initialize array with matches */ + if (!(fuzzymatches = realloc(fuzzymatches, number_of_matches * sizeof(struct item*)))) + die("cannot realloc %u bytes:", number_of_matches * sizeof(struct item*)); + for (i = 0, it = matches; it && i < number_of_matches; i++, it = it->right) { + fuzzymatches[i] = it; + } + /* sort matches according to distance */ + qsort(fuzzymatches, number_of_matches, sizeof(struct item*), compare_distance); + /* rebuild list of matches */ + matches = matchend = NULL; + for (i = 0, it = fuzzymatches[i]; i < number_of_matches && it && \ + it->text; i++, it = fuzzymatches[i]) { + appenditem(it, &matches, &matchend); + } + free(fuzzymatches); + } + curr = sel = matches; + calcoffsets(); +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/highlight.c b/user/.config/dmenu/patch/highlight.c new file mode 100644 index 000000000..57087a93e --- /dev/null +++ b/user/.config/dmenu/patch/highlight.c @@ -0,0 +1,51 @@ +static void +#if EMOJI_HIGHLIGHT_PATCH +drawhighlights(struct item *item, char *output, int x, int y, int maxw) +#else +drawhighlights(struct item *item, int x, int y, int maxw) +#endif // EMOJI_HIGHLIGHT_PATCH +{ + char restorechar, tokens[sizeof text], *highlight, *token; + int indentx, highlightlen; + #if EMOJI_HIGHLIGHT_PATCH + char *itemtext = output; + #elif TSV_PATCH + char *itemtext = item->stext; + #else + char *itemtext = item->text; + #endif // TSV_PATCH + + drw_setscheme(drw, scheme[item == sel ? SchemeSelHighlight : SchemeNormHighlight]); + strcpy(tokens, text); + for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) { + highlight = fstrstr(itemtext, token); + while (highlight) { + // Move item str end, calc width for highlight indent, & restore + highlightlen = highlight - itemtext; + restorechar = *highlight; + itemtext[highlightlen] = '\0'; + indentx = TEXTW(itemtext); + itemtext[highlightlen] = restorechar; + + // Move highlight str end, draw highlight, & restore + restorechar = highlight[strlen(token)]; + highlight[strlen(token)] = '\0'; + if (indentx - (lrpad / 2) - 1 < maxw) + drw_text( + drw, + x + indentx - (lrpad / 2) - 1, + y, + MIN(maxw - indentx, TEXTW(highlight) - lrpad), + bh, 0, highlight, 0 + #if PANGO_PATCH + , True + #endif // PANGO_PATCH + ); + highlight[strlen(token)] = restorechar; + + if (strlen(highlight) - strlen(token) < strlen(token)) + break; + highlight = fstrstr(highlight + strlen(token), token); + } + } +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/highpriority.c b/user/.config/dmenu/patch/highpriority.c new file mode 100644 index 000000000..568c705a5 --- /dev/null +++ b/user/.config/dmenu/patch/highpriority.c @@ -0,0 +1,32 @@ +static char **hpitems = NULL; +static int hplength = 0; + +static char** +tokenize(char *source, const char *delim, int *llen) { + int listlength = 0; + char **list = malloc(1 * sizeof(char*)); + char *token = strtok(source, delim); + + while (token) { + if (!(list = realloc(list, sizeof(char*) * (listlength + 1)))) + die("Unable to realloc %d bytes\n", sizeof(char*) * (listlength + 1)); + if (!(list[listlength] = strdup(token))) + die("Unable to strdup %d bytes\n", strlen(token) + 1); + token = strtok(NULL, delim); + listlength++; + } + + *llen = listlength; + return list; +} + +static int +arrayhas(char **list, int length, char *item) { + for (int i = 0; i < length; i++) { + int len1 = strlen(list[i]); + int len2 = strlen(item); + if (fstrncmp(list[i], item, len1 > len2 ? len2 : len1) == 0) + return 1; + } + return 0; +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/include.c b/user/.config/dmenu/patch/include.c new file mode 100644 index 000000000..84f353b3f --- /dev/null +++ b/user/.config/dmenu/patch/include.c @@ -0,0 +1,38 @@ +#if CENTER_PATCH +#include "center.c" +#endif +#if DYNAMIC_OPTIONS_PATCH +#include "dynamicoptions.c" +#endif +#if FUZZYHIGHLIGHT_PATCH +#include "fuzzyhighlight.c" +#elif HIGHLIGHT_PATCH +#include "highlight.c" +#endif +#if FUZZYMATCH_PATCH +#include "fuzzymatch.c" +#endif +#if HIGHPRIORITY_PATCH +#include "highpriority.c" +#endif +#if MULTI_SELECTION_PATCH +#include "multiselect.c" +#endif +#if JSON_PATCH +#include "json.c" +#endif +#if MOUSE_SUPPORT_PATCH +#include "mousesupport.c" +#endif +#if NAVHISTORY_PATCH +#include "navhistory.c" +#endif +#if NON_BLOCKING_STDIN_PATCH +#include "nonblockingstdin.c" +#endif +#if NUMBERS_PATCH +#include "numbers.c" +#endif +#if XRESOURCES_PATCH +#include "xresources.c" +#endif \ No newline at end of file diff --git a/user/.config/dmenu/patch/include.h b/user/.config/dmenu/patch/include.h new file mode 100644 index 000000000..1aebc525a --- /dev/null +++ b/user/.config/dmenu/patch/include.h @@ -0,0 +1,12 @@ +#if DYNAMIC_OPTIONS_PATCH +#include "dynamicoptions.h" +#endif +#if JSON_PATCH +#include "json.h" +#endif +#if NON_BLOCKING_STDIN_PATCH +#include "nonblockingstdin.h" +#endif +#if NUMBERS_PATCH +#include "numbers.h" +#endif \ No newline at end of file diff --git a/user/.config/dmenu/patch/json.c b/user/.config/dmenu/patch/json.c new file mode 100644 index 000000000..bbd110ae0 --- /dev/null +++ b/user/.config/dmenu/patch/json.c @@ -0,0 +1,80 @@ +#include + +static size_t items_sz = 0; +static size_t items_ln = 0; +static json_t *json = NULL; + +static struct item * +itemnew(void) +{ + if (items_ln + 1 >= (items_sz / sizeof *items)) + if (!(items = realloc(items, (items_sz += BUFSIZ)))) + die("cannot realloc %u bytes:", items_sz); + return &items[items_ln++]; +} + +static void +readjson(const char *path) +{ + json_error_t jerr; + + if (!(json = json_load_file(path, 0, &jerr))) + die("%s @ line: %i - %s", jerr.text, jerr.line, path); +} + +static void +listjson(json_t *obj) +{ + void *iter; + unsigned imax = 0; + unsigned tmpmax = 0; + struct item *item; + + items_ln = 0; + iter = json_object_iter(obj); + while (iter) { + item = itemnew(); + item->text = (char*) json_object_iter_key(iter); + item->json = json_object_iter_value(iter); + #if !MULTI_SELECTION_PATCH + item->out = 0; + #endif // MULTI_SELECTION_PATCH + drw_font_getexts(drw->fonts, item->text, strlen(item->text), + &tmpmax, NULL); + if (tmpmax > inputw) { + inputw = tmpmax; + imax = items_ln - 1; + } + iter = json_object_iter_next(obj, iter); + } + if (items) + items[items_ln].text = NULL; + inputw = items ? TEXTW(items[imax].text) : 0; + lines = MIN(lines, items_ln - 1); +} + +static int +printjsonssel(unsigned int state) +{ + if (sel && sel->json) { + if (json_is_object(sel->json)) { + listjson(sel->json); + text[0] = '\0'; + match(); + drawmenu(); + return 0; + } else { + puts(json_string_value(sel->json)); + } + } else { + #if PRINTINDEX_PATCH + if (print_index) + printf("%d\n", (sel && !(state & ShiftMask)) ? sel->index : -1); + else + puts((sel && !(state & ShiftMask)) ? sel->text : text); + #else + puts((sel && !(state & ShiftMask)) ? sel->text : text); + #endif // PRINTINDEX_PATCH + } + return 1; +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/json.h b/user/.config/dmenu/patch/json.h new file mode 100644 index 000000000..0c9f69e93 --- /dev/null +++ b/user/.config/dmenu/patch/json.h @@ -0,0 +1 @@ +static void listjson(json_t *obj); \ No newline at end of file diff --git a/user/.config/dmenu/patch/mousesupport.c b/user/.config/dmenu/patch/mousesupport.c new file mode 100644 index 000000000..d040e8690 --- /dev/null +++ b/user/.config/dmenu/patch/mousesupport.c @@ -0,0 +1,159 @@ +static void +buttonpress(XEvent *e) +{ + struct item *item; + XButtonPressedEvent *ev = &e->xbutton; + int x = 0, y = 0, h = bh, w; + + if (ev->window != win) + return; + + /* right-click: exit */ + if (ev->button == Button3) + exit(1); + + if (prompt && *prompt) + x += promptw; + + /* input field */ + w = (lines > 0 || !matches) ? mw - x : inputw; + + /* left-click on input: clear input, + * NOTE: if there is no left-arrow the space for < is reserved so + * add that to the input width */ + #if SYMBOLS_PATCH + if (ev->button == Button1 && + ((lines <= 0 && ev->x >= 0 && ev->x <= x + w + + ((!prev || !curr->left) ? TEXTW(symbol_1) : 0)) || + (lines > 0 && ev->y >= y && ev->y <= y + h))) { + insert(NULL, -cursor); + drawmenu(); + return; + } + #else + if (ev->button == Button1 && + ((lines <= 0 && ev->x >= 0 && ev->x <= x + w + + ((!prev || !curr->left) ? TEXTW("<") : 0)) || + (lines > 0 && ev->y >= y && ev->y <= y + h))) { + insert(NULL, -cursor); + drawmenu(); + return; + } + #endif // SYMBOLS_PATCH + /* middle-mouse click: paste selection */ + if (ev->button == Button2) { + XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, + utf8, utf8, win, CurrentTime); + drawmenu(); + return; + } + /* scroll up */ + if (ev->button == Button4 && prev) { + sel = curr = prev; + calcoffsets(); + drawmenu(); + return; + } + /* scroll down */ + if (ev->button == Button5 && next) { + sel = curr = next; + calcoffsets(); + drawmenu(); + return; + } + if (ev->button != Button1) + return; + if (ev->state & ~ControlMask) + return; + if (lines > 0) { + /* vertical list: (ctrl)left-click on item */ + w = mw - x; + for (item = curr; item != next; item = item->right) { + y += h; + if (ev->y >= y && ev->y <= (y + h)) { + #if !MULTI_SELECTION_PATCH + puts(item->text); + #endif // MULTI_SELECTION_PATCH + if (!(ev->state & ControlMask)) { + #if MULTI_SELECTION_PATCH + sel = item; + selsel(); + printsel(ev->state); + #endif // MULTI_SELECTION_PATCH + exit(0); + } + sel = item; + if (sel) { + #if MULTI_SELECTION_PATCH + selsel(); + #else + sel->out = 1; + #endif // MULTI_SELECTION_PATCH + drawmenu(); + } + return; + } + } + } else if (matches) { + /* left-click on left arrow */ + x += inputw; + #if SYMBOLS_PATCH + w = TEXTW(symbol_1); + #else + w = TEXTW("<"); + #endif // SYMBOLS_PATCH + if (prev && curr->left) { + if (ev->x >= x && ev->x <= x + w) { + sel = curr = prev; + calcoffsets(); + drawmenu(); + return; + } + } + /* horizontal list: (ctrl)left-click on item */ + for (item = curr; item != next; item = item->right) { + x += w; + #if SYMBOLS_PATCH + w = MIN(TEXTW(item->text), mw - x - TEXTW(symbol_2)); + #else + w = MIN(TEXTW(item->text), mw - x - TEXTW(">")); + #endif // SYMBOLS_PATCH + if (ev->x >= x && ev->x <= x + w) { + #if !MULTI_SELECTION_PATCH + puts(item->text); + #endif // MULTI_SELECTION_PATCH + if (!(ev->state & ControlMask)) { + #if MULTI_SELECTION_PATCH + sel = item; + selsel(); + printsel(ev->state); + #endif // MULTI_SELECTION_PATCH + exit(0); + } + sel = item; + if (sel) { + #if MULTI_SELECTION_PATCH + selsel(); + #else + sel->out = 1; + #endif // MULTI_SELECTION_PATCH + drawmenu(); + } + return; + } + } + /* left-click on right arrow */ + #if SYMBOLS_PATCH + w = TEXTW(symbol_2); + #else + w = TEXTW(">"); + #endif // SYMBOLS_PATCH + x = mw - w; + if (next && ev->x >= x && ev->x <= x + w) { + sel = curr = next; + calcoffsets(); + drawmenu(); + return; + } + } +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/multiselect.c b/user/.config/dmenu/patch/multiselect.c new file mode 100644 index 000000000..94825b543 --- /dev/null +++ b/user/.config/dmenu/patch/multiselect.c @@ -0,0 +1,49 @@ +static int +issel(size_t id) +{ + for (int i = 0;i < selidsize;i++) + if (selid[i] == id) + return 1; + return 0; +} + +static void +printsel(unsigned int state) +{ + for (int i = 0;i < selidsize;i++) + if (selid[i] != -1 && (!sel || sel->id != selid[i])) + #if PRINTINDEX_PATCH + printf("%d\n", selid[i]); + #else + puts(items[selid[i]].text); + #endif // PRINTINDEX_PATCH + if (sel && !(state & ShiftMask)) + #if PRINTINDEX_PATCH + printf("%d\n", sel->index); + #else + puts(sel->text); + #endif // PRINTINDEX_PATCH + else + puts(text); +} + +static void +selsel() +{ + if (!sel) + return; + if (issel(sel->id)) { + for (int i = 0; i < selidsize; i++) + if (selid[i] == sel->id) + selid[i] = -1; + } else { + for (int i = 0; i < selidsize; i++) + if (selid[i] == -1) { + selid[i] = sel->id; + return; + } + selidsize++; + selid = realloc(selid, (selidsize + 1) * sizeof(int)); + selid[selidsize - 1] = sel->id; + } +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/navhistory.c b/user/.config/dmenu/patch/navhistory.c new file mode 100644 index 000000000..7d10ee462 --- /dev/null +++ b/user/.config/dmenu/patch/navhistory.c @@ -0,0 +1,126 @@ +static char *histfile; +static char **history; +static size_t histsz, histpos; + +static void +loadhistory(void) +{ + FILE *fp = NULL; + static size_t cap = 0; + size_t llen; + char *line; + + if (!histfile) { + return; + } + + fp = fopen(histfile, "r"); + if (!fp) { + return; + } + + for (;;) { + line = NULL; + llen = 0; + if (-1 == getline(&line, &llen, fp)) { + if (ferror(fp)) { + die("failed to read history"); + } + free(line); + break; + } + + if (cap == histsz) { + cap += 64 * sizeof(char*); + history = realloc(history, cap); + if (!history) { + die("failed to realloc memory"); + } + } + strtok(line, "\n"); + history[histsz] = line; + histsz++; + } + histpos = histsz; + + if (fclose(fp)) { + die("failed to close file %s", histfile); + } +} + +static void +navhistory(int dir) +{ + static char def[BUFSIZ]; + char *p = NULL; + size_t len = 0; + + if (!history || histpos + 1 == 0) + return; + + if (histsz == histpos) { + strncpy(def, text, sizeof(def)); + } + + switch(dir) { + case 1: + if (histpos < histsz - 1) { + p = history[++histpos]; + } else if (histpos == histsz - 1) { + p = def; + histpos++; + } + break; + case -1: + if (histpos > 0) { + p = history[--histpos]; + } + break; + } + if (p == NULL) { + return; + } + + len = MIN(strlen(p), BUFSIZ - 1); + strncpy(text, p, len); + text[len] = '\0'; + cursor = len; + match(); +} + +static void +savehistory(char *input) +{ + unsigned int i; + FILE *fp; + + if (!histfile || + 0 == maxhist || + 0 == strlen(input)) { + goto out; + } + + fp = fopen(histfile, "w"); + if (!fp) { + die("failed to open %s", histfile); + } + for (i = histsz < maxhist ? 0 : histsz - maxhist; i < histsz; i++) { + if (0 >= fprintf(fp, "%s\n", history[i])) { + die("failed to write to %s", histfile); + } + } + if (histsz == 0 || !histnodup || (histsz > 0 && strcmp(input, history[histsz-1]) != 0)) { /* TODO */ + if (0 >= fputs(input, fp)) { + die("failed to write to %s", histfile); + } + } + if (fclose(fp)) { + die("failed to close file %s", histfile); + } + +out: + for (i = 0; i < histsz; i++) { + free(history[i]); + } + free(history); +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/nonblockingstdin.c b/user/.config/dmenu/patch/nonblockingstdin.c new file mode 100644 index 000000000..eb7013fa1 --- /dev/null +++ b/user/.config/dmenu/patch/nonblockingstdin.c @@ -0,0 +1,68 @@ +#include +#include +#include + +static void +readstdin(void) +{ + static size_t max = 0; + static struct item **end = &items; + + char buf[sizeof text], *p, *maxstr; + struct item *item; + + #if PASSWORD_PATCH + if (passwd) { + inputw = lines = 0; + return; + } + #endif // PASSWORD_PATCH + + /* read each line from stdin and add it to the item list */ + while (fgets(buf, sizeof buf, stdin)) { + if (!(item = malloc(sizeof *item))) + die("cannot malloc %u bytes:", sizeof *item); + if ((p = strchr(buf, '\n'))) + *p = '\0'; + if (!(item->text = strdup(buf))) + die("cannot strdup %u bytes:", strlen(buf)+1); + if (strlen(item->text) > max) { + max = strlen(maxstr = item->text); + #if PANGO_PATCH + inputw = maxstr ? TEXTWM(maxstr) : 0; + #else + inputw = maxstr ? TEXTW(maxstr) : 0; + #endif // PANGO_PATCH + } + *end = item; + end = &item->next; + item->next = NULL; + item->out = 0; + } + match(); + drawmenu(); +} + +static void +run(void) +{ + fd_set fds; + int flags, xfd = XConnectionNumber(dpy); + + if ((flags = fcntl(0, F_GETFL)) == -1) + die("cannot get stdin control flags:"); + if (fcntl(0, F_SETFL, flags | O_NONBLOCK) == -1) + die("cannot set stdin control flags:"); + for (;;) { + FD_ZERO(&fds); + FD_SET(xfd, &fds); + if (!feof(stdin)) + FD_SET(0, &fds); + if (select(xfd + 1, &fds, NULL, NULL, NULL) == -1) + die("cannot multiplex input:"); + if (FD_ISSET(xfd, &fds)) + readevent(); + if (FD_ISSET(0, &fds)) + readstdin(); + } +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/nonblockingstdin.h b/user/.config/dmenu/patch/nonblockingstdin.h new file mode 100644 index 000000000..a0c4dfe0e --- /dev/null +++ b/user/.config/dmenu/patch/nonblockingstdin.h @@ -0,0 +1 @@ +static void readevent(); \ No newline at end of file diff --git a/user/.config/dmenu/patch/numbers.c b/user/.config/dmenu/patch/numbers.c new file mode 100644 index 000000000..739762e23 --- /dev/null +++ b/user/.config/dmenu/patch/numbers.c @@ -0,0 +1,16 @@ +static char numbers[NUMBERSBUFSIZE] = ""; + +static void +recalculatenumbers() +{ + unsigned int numer = 0, denom = 0; + struct item *item; + if (matchend) { + numer++; + for (item = matchend; item && item->left; item = item->left) + numer++; + } + for (item = items; item && item->text; item++) + denom++; + snprintf(numbers, NUMBERSBUFSIZE, "%d/%d ", numer, denom); +} diff --git a/user/.config/dmenu/patch/numbers.h b/user/.config/dmenu/patch/numbers.h new file mode 100644 index 000000000..34d3dbc6c --- /dev/null +++ b/user/.config/dmenu/patch/numbers.h @@ -0,0 +1,4 @@ +#define NUMBERSMAXDIGITS 100 +#define NUMBERSBUFSIZE (NUMBERSMAXDIGITS * 2) + 1 + +static void recalculatenumbers(); \ No newline at end of file diff --git a/user/.config/dmenu/patch/scroll.c b/user/.config/dmenu/patch/scroll.c new file mode 100644 index 000000000..9021edf66 --- /dev/null +++ b/user/.config/dmenu/patch/scroll.c @@ -0,0 +1,168 @@ +int +utf8nextchar(const char *str, int len, int i, int inc) +{ + int n; + + for (n = i + inc; n + inc >= 0 && n + inc <= len + && (str[n] & 0xc0) == 0x80; n += inc) + ; + return n; +} + +int +drw_text_align(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int textlen, int align) +{ + int ty; + unsigned int ew; + XftDraw *d = NULL; + Fnt *usedfont, *curfont, *nextfont; + size_t len; + int utf8strlen, utf8charlen, render = x || y || w || h; + long utf8codepoint = 0; + const char *utf8str; + FcCharSet *fccharset; + FcPattern *fcpattern; + FcPattern *match; + XftResult result; + int charexists = 0; + int i, n; + + if (!drw || (render && !drw->scheme) || !text || !drw->fonts || textlen <= 0 + || (align != AlignL && align != AlignR)) + return 0; + + if (!render) { + w = ~w; + } else { + XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + d = XftDrawCreate(drw->dpy, drw->drawable, + DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen)); + } + + usedfont = drw->fonts; + i = align == AlignL ? 0 : textlen; + x = align == AlignL ? x : x + w; + while (1) { + utf8strlen = 0; + nextfont = NULL; + /* if (align == AlignL) */ + utf8str = text + i; + + while ((align == AlignL && i < textlen) || (align == AlignR && i > 0)) { + if (align == AlignL) { + utf8charlen = utf8decode(text + i, &utf8codepoint, MIN(textlen - i, UTF_SIZ)); + if (!utf8charlen) { + textlen = i; + break; + } + } else { + n = utf8nextchar(text, textlen, i, -1); + utf8charlen = utf8decode(text + n, &utf8codepoint, MIN(textlen - n, UTF_SIZ)); + if (!utf8charlen) { + textlen -= i; + text += i; + i = 0; + break; + } + } + for (curfont = drw->fonts; curfont; curfont = curfont->next) { + charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); + if (charexists) { + if (curfont == usedfont) { + utf8strlen += utf8charlen; + i += align == AlignL ? utf8charlen : -utf8charlen; + } else { + nextfont = curfont; + } + break; + } + } + + if (!charexists || nextfont) + break; + else + charexists = 0; + } + + if (align == AlignR) + utf8str = text + i; + + if (utf8strlen) { + drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); + /* shorten text if necessary */ + if (align == AlignL) { + for (len = utf8strlen; len && ew > w; ) { + len = utf8nextchar(utf8str, len, len, -1); + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); + } + } else { + for (len = utf8strlen; len && ew > w; ) { + n = utf8nextchar(utf8str, len, 0, +1); + utf8str += n; + len -= n; + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); + } + } + + if (len) { + if (render) { + ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; + XftDrawStringUtf8(d, &drw->scheme[ColFg], + usedfont->xfont, align == AlignL ? x : x - ew, ty, (XftChar8 *)utf8str, len); + } + x += align == AlignL ? ew : -ew; + w -= ew; + } + if (len < utf8strlen) + break; + } + + if ((align == AlignR && i <= 0) || (align == AlignL && i >= textlen)) { + break; + } else if (nextfont) { + charexists = 0; + usedfont = nextfont; + } else { + /* Regardless of whether or not a fallback font is found, the + * character must be drawn. */ + charexists = 1; + + fccharset = FcCharSetCreate(); + FcCharSetAddChar(fccharset, utf8codepoint); + + if (!drw->fonts->pattern) { + /* Refer to the comment in xfont_create for more information. */ + die("the first font in the cache must be loaded from a font string."); + } + + fcpattern = FcPatternDuplicate(drw->fonts->pattern); + FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); + FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); + + FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); + FcDefaultSubstitute(fcpattern); + match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); + + FcCharSetDestroy(fccharset); + FcPatternDestroy(fcpattern); + + if (match) { + usedfont = xfont_create(drw, NULL, match); + if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { + for (curfont = drw->fonts; curfont->next; curfont = curfont->next) + ; /* NOP */ + curfont->next = usedfont; + } else { + xfont_free(usedfont); + usedfont = drw->fonts; + } + } + } + } + if (d) + XftDrawDestroy(d); + + return x; +} \ No newline at end of file diff --git a/user/.config/dmenu/patch/scroll.h b/user/.config/dmenu/patch/scroll.h new file mode 100644 index 000000000..927df9ae6 --- /dev/null +++ b/user/.config/dmenu/patch/scroll.h @@ -0,0 +1,3 @@ +enum { AlignL, AlignR }; + +int drw_text_align(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int textlen, int align); \ No newline at end of file diff --git a/user/.config/dmenu/patch/xresources.c b/user/.config/dmenu/patch/xresources.c new file mode 100644 index 000000000..ae5519f04 --- /dev/null +++ b/user/.config/dmenu/patch/xresources.c @@ -0,0 +1,138 @@ +#include + +void +readxresources(void) +{ + XrmInitialize(); + + char* xrm; + if ((xrm = XResourceManagerString(drw->dpy))) { + char *type; + XrmDatabase xdb = XrmGetStringDatabase(xrm); + XrmValue xval; + + if (XrmGetResource(xdb, "dmenu.font", "*", &type, &xval)) + #if PANGO_PATCH + strcpy(font, xval.addr); + #else + fonts[0] = strdup(xval.addr); + #endif // PANGO_PATCH + #if !PANGO_PATCH + else + fonts[0] = strdup(fonts[0]); + #endif // PANGO_PATCH + if (XrmGetResource(xdb, "dmenu.background", "*", &type, &xval)) + colors[SchemeNorm][ColBg] = strdup(xval.addr); + else + colors[SchemeNorm][ColBg] = strdup(colors[SchemeNorm][ColBg]); + if (XrmGetResource(xdb, "dmenu.foreground", "*", &type, &xval)) + colors[SchemeNorm][ColFg] = strdup(xval.addr); + else + colors[SchemeNorm][ColFg] = strdup(colors[SchemeNorm][ColFg]); + if (XrmGetResource(xdb, "dmenu.selbackground", "*", &type, &xval)) + colors[SchemeSel][ColBg] = strdup(xval.addr); + else + colors[SchemeSel][ColBg] = strdup(colors[SchemeSel][ColBg]); + if (XrmGetResource(xdb, "dmenu.selforeground", "*", &type, &xval)) + colors[SchemeSel][ColFg] = strdup(xval.addr); + else + colors[SchemeSel][ColFg] = strdup(colors[SchemeSel][ColFg]); + if (XrmGetResource(xdb, "dmenu.outbackground", "*", &type, &xval)) + colors[SchemeOut][ColBg] = strdup(xval.addr); + else + colors[SchemeOut][ColBg] = strdup(colors[SchemeOut][ColBg]); + if (XrmGetResource(xdb, "dmenu.outforeground", "*", &type, &xval)) + colors[SchemeOut][ColFg] = strdup(xval.addr); + else + colors[SchemeOut][ColFg] = strdup(colors[SchemeOut][ColFg]); + #if MORECOLOR_PATCH + if (XrmGetResource(xdb, "dmenu.midbackground", "*", &type, &xval)) + colors[SchemeMid][ColBg] = strdup(xval.addr); + else + colors[SchemeMid][ColBg] = strdup(colors[SchemeMid][ColBg]); + if (XrmGetResource(xdb, "dmenu.midforeground", "*", &type, &xval)) + colors[SchemeMid][ColFg] = strdup(xval.addr); + else + colors[SchemeMid][ColFg] = strdup(colors[SchemeMid][ColFg]); + #endif // MORECOLOR_PATCH + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + if (XrmGetResource(xdb, "dmenu.selhlbackground", "*", &type, &xval)) + colors[SchemeSelHighlight][ColBg] = strdup(xval.addr); + else + colors[SchemeSelHighlight][ColBg] = strdup(colors[SchemeSelHighlight][ColBg]); + if (XrmGetResource(xdb, "dmenu.selhlforeground", "*", &type, &xval)) + colors[SchemeSelHighlight][ColFg] = strdup(xval.addr); + else + colors[SchemeSelHighlight][ColFg] = strdup(colors[SchemeSelHighlight][ColFg]); + if (XrmGetResource(xdb, "dmenu.hlbackground", "*", &type, &xval)) + colors[SchemeNormHighlight][ColBg] = strdup(xval.addr); + else + colors[SchemeNormHighlight][ColBg] = strdup(colors[SchemeNormHighlight][ColBg]); + if (XrmGetResource(xdb, "dmenu.hlforeground", "*", &type, &xval)) + colors[SchemeNormHighlight][ColFg] = strdup(xval.addr); + else + colors[SchemeNormHighlight][ColFg] = strdup(colors[SchemeNormHighlight][ColFg]); + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + #if HIGHPRIORITY_PATCH + if (XrmGetResource(xdb, "dmenu.hpbackground", "*", &type, &xval)) + colors[SchemeHp][ColBg] = strdup(xval.addr); + else + colors[SchemeHp][ColBg] = strdup(colors[SchemeHp][ColBg]); + if (XrmGetResource(xdb, "dmenu.hpforeground", "*", &type, &xval)) + colors[SchemeHp][ColFg] = strdup(xval.addr); + else + colors[SchemeHp][ColFg] = strdup(colors[SchemeHp][ColFg]); + #endif // HIGHPRIORITY_PATCH + #if EMOJI_HIGHLIGHT_PATCH + if (XrmGetResource(xdb, "dmenu.hoverbackground", "*", &type, &xval)) + colors[SchemeHover][ColBg] = strdup(xval.addr); + else + colors[SchemeHover][ColBg] = strdup(colors[SchemeHover][ColBg]); + if (XrmGetResource(xdb, "dmenu.hoverforeground", "*", &type, &xval)) + colors[SchemeHover][ColFg] = strdup(xval.addr); + else + colors[SchemeHover][ColFg] = strdup(colors[SchemeHover][ColFg]); + if (XrmGetResource(xdb, "dmenu.greenbackground", "*", &type, &xval)) + colors[SchemeGreen][ColBg] = strdup(xval.addr); + else + colors[SchemeGreen][ColBg] = strdup(colors[SchemeGreen][ColBg]); + if (XrmGetResource(xdb, "dmenu.greenforeground", "*", &type, &xval)) + colors[SchemeGreen][ColFg] = strdup(xval.addr); + else + colors[SchemeGreen][ColFg] = strdup(colors[SchemeGreen][ColFg]); + if (XrmGetResource(xdb, "dmenu.yellowbackground", "*", &type, &xval)) + colors[SchemeYellow][ColBg] = strdup(xval.addr); + else + colors[SchemeYellow][ColBg] = strdup(colors[SchemeYellow][ColBg]); + if (XrmGetResource(xdb, "dmenu.yellowforeground", "*", &type, &xval)) + colors[SchemeYellow][ColFg] = strdup(xval.addr); + else + colors[SchemeYellow][ColFg] = strdup(colors[SchemeYellow][ColFg]); + if (XrmGetResource(xdb, "dmenu.bluebackground", "*", &type, &xval)) + colors[SchemeBlue][ColBg] = strdup(xval.addr); + else + colors[SchemeBlue][ColBg] = strdup(colors[SchemeBlue][ColBg]); + if (XrmGetResource(xdb, "dmenu.blueforeground", "*", &type, &xval)) + colors[SchemeBlue][ColFg] = strdup(xval.addr); + else + colors[SchemeBlue][ColFg] = strdup(colors[SchemeBlue][ColFg]); + if (XrmGetResource(xdb, "dmenu.purplebackground", "*", &type, &xval)) + colors[SchemePurple][ColBg] = strdup(xval.addr); + else + colors[SchemePurple][ColBg] = strdup(colors[SchemePurple][ColBg]); + if (XrmGetResource(xdb, "dmenu.purpleforeground", "*", &type, &xval)) + colors[SchemePurple][ColFg] = strdup(xval.addr); + else + colors[SchemePurple][ColFg] = strdup(colors[SchemePurple][ColFg]); + if (XrmGetResource(xdb, "dmenu.redbackground", "*", &type, &xval)) + colors[SchemeRed][ColBg] = strdup(xval.addr); + else + colors[SchemeRed][ColBg] = strdup(colors[SchemeRed][ColBg]); + if (XrmGetResource(xdb, "dmenu.redforeground", "*", &type, &xval)) + colors[SchemeRed][ColFg] = strdup(xval.addr); + else + colors[SchemeRed][ColFg] = strdup(colors[SchemeRed][ColFg]); + #endif // EMOJI_HIGHLIGHT_PATCH + XrmDestroyDatabase(xdb); + } +} \ No newline at end of file diff --git a/user/.config/dmenu/patches.def.h b/user/.config/dmenu/patches.def.h new file mode 100644 index 000000000..cfd1450fe --- /dev/null +++ b/user/.config/dmenu/patches.def.h @@ -0,0 +1,334 @@ +/* Patches */ + +/* The alpha patch adds transparency for the dmenu window. + * You need to uncomment the corresponding line in config.mk to use the -lXrender library + * when including this patch. + * https://github.com/bakkeby/patches/blob/master/dmenu/dmenu-alpha-5.0_20210725_523aa08.diff + */ +#define ALPHA_PATCH 1 + +/* This patch adds a border around the dmenu window. It is intended to be used with the center + * or xyw patches, to make the menu stand out from similarly coloured windows. + * http://tools.suckless.org/dmenu/patches/border/ + */ +#define BORDER_PATCH 1 + +/* This patch makes dmenu case-insensitive by default, replacing the + * case-insensitive -i option with a case sensitive -s option. + * http://tools.suckless.org/dmenu/patches/case-insensitive/ + */ +#define CASEINSENSITIVE_PATCH 0 + +/* This patch centers dmenu in the middle of the screen. + * https://tools.suckless.org/dmenu/patches/center/ + */ +#define CENTER_PATCH 1 + +/* This patch enables color emoji in dmenu by removing a workaround for a BadLength error + * in the Xft library when color glyphs are used. + * To enable this you will need an updated Xft library that can handle color glyphs otherwise + * the program will crash on encountering such characters. Note that you will also need a font + * that provides color emojis for this to work. + */ +#define COLOR_EMOJI_PATCH 0 + +/* Minor patch to enable the use of Ctrl+v (XA_PRIMARY) and Ctrl+Shift+v (CLIPBOARD) to paste. + * By default dmenu only supports Ctrl+y and Ctrl+Shift+y to paste. + */ +#define CTRL_V_TO_PASTE_PATCH 0 + +/* This patch adds a flag (-dy) which makes dmenu run the command given to it whenever input + * is changed with the current input as the last argument and update the option list according + * to the output of that command. + * https://tools.suckless.org/dmenu/patches/dynamicoptions/ + */ +#define DYNAMIC_OPTIONS_PATCH 0 + +/* This patch will allow for emojis on the left side with a colored background when selected. + * To test this try running: + * $ echo -e ":b here\n:p there\n:r and here" | ./dmenu -p "Search..." -W 400 -l 20 -i -h -1 + * NB: the original patch came embedded with the the xyw patch, the morecolors patch and the + * line height patch and as such is intended to be combined with these. + * https://tools.suckless.org/dmenu/patches/emoji-highlight/ + */ +#define EMOJI_HIGHLIGHT_PATCH 0 + +/* This patch make it so that fuzzy matches gets highlighted and is therefore meant + * to be used together with the fuzzymatch patch. + * https://tools.suckless.org/dmenu/patches/fuzzyhighlight/ + */ +#define FUZZYHIGHLIGHT_PATCH 1 + +/* This patch adds support for fuzzy-matching to dmenu, allowing users to type non-consecutive + * portions of the string to be matched. + * https://tools.suckless.org/dmenu/patches/fuzzymatch/ + */ +#define FUZZYMATCH_PATCH 1 + +/* Allows dmenu's entries to be rendered in a grid by adding a new -g flag to specify + * the number of grid columns. The -g and -l options can be used together to create a + * G columns * L lines grid. + * https://tools.suckless.org/dmenu/patches/grid/ + */ +#define GRID_PATCH 1 + +/* This patch adds the ability to move left and right through a grid. + * This patch depends on the grid patch. + * https://tools.suckless.org/dmenu/patches/gridnav/ + */ +#define GRIDNAV_PATCH 0 + +/* This patch highlights the individual characters of matched text for each dmenu list entry. + * The fuzzy highlight patch takes precedence over this patch. + * https://tools.suckless.org/dmenu/patches/highlight/ + */ +#define HIGHLIGHT_PATCH 0 + +/* This will automatically sort the search result so that high priority items are shown first. + * https://tools.suckless.org/dmenu/patches/highpriority/ + */ +#define HIGHPRIORITY_PATCH 0 + +/* This patch causes dmenu to print out the current text each time a key is pressed. + * https://tools.suckless.org/dmenu/patches/incremental/ + */ +#define INCREMENTAL_PATCH 0 + +/* This patch adds an option to provide preselected text. + * https://tools.suckless.org/dmenu/patches/initialtext/ + */ +#define INITIALTEXT_PATCH 0 + +/* This patch adds a flag which will cause dmenu to select an item immediately if there + * is only one matching option left. + * https://tools.suckless.org/dmenu/patches/instant/ + */ +#define INSTANT_PATCH 0 + +/* This patch adds basic support for json files. + * This patch depends on the jansson library. Uncomment the relevant line in config.mk when + * enabling this patch. + * + * This patch is not compatible with the multi-selection, printinputtext, pipeout and + * non-blocking stdin patches. + * The multi-selection patch takes precedence over this patch. + * This patch takes precedence over non-blocking stdin, pipeout and printintputtext patches. + * + * https://tools.suckless.org/dmenu/patches/json/ + */ +#define JSON_PATCH 0 + +/* This patch adds a '-h' option which sets the minimum height of a dmenu line. This helps + * integrate dmenu with other UI elements that require a particular vertical size. + * http://tools.suckless.org/dmenu/patches/line-height/ + */ +#define LINE_HEIGHT_PATCH 1 + +/* This patch adds a -wm flag which sets override_redirect to false; thus letting your window + * manager manage the dmenu window. + * + * This may be helpful in contexts where you don't want to exclusively bind dmenu or want to + * treat dmenu more as a "window" rather than as an overlay. + * https://tools.suckless.org/dmenu/patches/managed/ + */ +#define MANAGED_PATCH 0 + +/* This patch adds an additional color scheme for highlighting entries adjacent to the current + * selection. + * https://tools.suckless.org/dmenu/patches/morecolor/ + */ +#define MORECOLOR_PATCH 1 + +/* This patch adds basic mouse support for dmenu. + * https://tools.suckless.org/dmenu/patches/mouse-support/ + */ +#define MOUSE_SUPPORT_PATCH 1 + +/* Without this patch when you press Ctrl+Enter dmenu just outputs current item and it is not + * possible to undo that. + * With this patch dmenu will output all selected items only on exit. It is also possible to + * deselect any selected item. + * Also refer to the dmenu_run replacement on the below URL that supports multiple selections. + * + * This patch is not compatible with, and takes precedence over, the json, printinputtext, + * pipeout and non-blocking stdin patches. + * + * https://tools.suckless.org/dmenu/patches/multi-selection/ + */ +#define MULTI_SELECTION_PATCH 0 + +/* This patch provides dmenu the ability for history navigation similar to that of bash. + * + * If you take this patch then it is recommended that you also uncomment the line in the + * dmenu_run script which replaces the exec command. + * + * https://tools.suckless.org/dmenu/patches/navhistory/ + */ +#define NAVHISTORY_PATCH 0 + +/* Adds the -S option to disable sorting menu items after matching. Useful, for example, when menu + * items are sorted by their frequency of use (using an external cache) and the most frequently + * selected items should always appear first regardless of how they were exact, prefix, or + * substring matches. + * https://tools.suckless.org/dmenu/patches/no-sort/ + */ +#define NO_SORT_PATCH 0 + +/* This is a patch to have dmenu read stdin in a non blocking way, making it wait for input both + * from stdin and from X. This means that you can continue feeding dmenu while you type. + * This patch is meant to be used along with the incremental patch, so that you can use stdout + * to feed stdin. + * + * This patch is not compatible with the json and multi-selection patches, both of which takes + * precedence over this patch. + * + * https://tools.suckless.org/dmenu/patches/non_blocking_stdin/ + */ +#define NON_BLOCKING_STDIN_PATCH 0 + +/* Adds text which displays the number of matched and total items in the top right corner of dmenu. + * https://tools.suckless.org/dmenu/patches/numbers/ + */ +#define NUMBERS_PATCH 1 + +/* This patch adds simple markup for dmenu using pango markup. + * This depends on the pango library v1.44 or greater. + * You need to uncomment the corresponding lines in config.mk to use the pango libraries + * when including this patch. + * + * Note that the pango patch is incompatible with the scroll patch and will result in + * compilation errors if both are enabled. + * + * Note that the pango patch does not protect against the BadLength error from Xft + * when color glyphs are used, which means that dmenu will crash if color emoji is used. + * + * If you need color emoji then you may want to install this patched library from the AUR: + * https://aur.archlinux.org/packages/libxft-bgra/ + * + * A long term fix for the libXft library is pending approval of this pull request: + * https://gitlab.freedesktop.org/xorg/lib/libxft/-/merge_requests/1 + * + * Also see: + * https://developer.gnome.org/pygtk/stable/pango-markup-language.html + * https://github.com/StillANixRookie/dmenu-pango + */ +#define PANGO_PATCH 0 + +/* With this patch dmenu will not directly display the keyboard input, but instead replace + * it with dots. All data from stdin will be ignored. + * https://tools.suckless.org/dmenu/patches/password/ + */ +#define PASSWORD_PATCH 0 + +/* This patch allows the selected text to be piped back out with dmenu. This can be useful if you + * want to display the output of a command on the screen. + * Only text starting with the character '#' is piped out by default. + * + * This patch is not compatible with the json and multi-select patches, both of which takes + * precedence over this one. + * + * https://tools.suckless.org/dmenu/patches/pipeout/ + */ +#define PIPEOUT_PATCH 0 + +/* Lifted from the listfullwidth patch this simple change just avoids colors for the prompt (with + * the -p option or in config.h) by making it use the same style as the rest of the input field. + * The rest of the listfullwidth patch is covered by the vertfull patch. + * https://tools.suckless.org/dmenu/patches/listfullwidth/ + */ +#define PLAIN_PROMPT_PATCH 0 + +/* This patch changes the behaviour of matched items and the Tab key to allow tab completion. + * https://tools.suckless.org/dmenu/patches/prefix-completion/ + */ +#define PREFIXCOMPLETION_PATCH 0 + +/* This patch adds an option -ps to specify an item by providing the index that should be + * pre-selected. + * https://tools.suckless.org/dmenu/patches/preselect/ + */ +#define PRESELECT_PATCH 0 + +/* This patch allows dmenu to print out the 0-based index of matched text instead of the matched + * text itself. This can be useful in cases where you would like to select entries from one array + * of text but index into another, or when you are selecting from an ordered list of non-unique + * items. + * https://tools.suckless.org/dmenu/patches/printindex/ + */ +#define PRINTINDEX_PATCH 0 + +/* This patch adds a flag (-t) which makes Return key to ignore selection and print the input + * text to stdout. The flag basically swaps the functions of Return and Shift+Return hotkeys. + * + * This patch is not compatible with the multi-select and json patches, both of which takes + * precedence over this one. + * + * https://tools.suckless.org/dmenu/patches/printinputtext/ + */ +#define PRINTINPUTTEXT_PATCH 0 + +/* This patch adds a new flag to dmenu with which text input will be rejected if it would + * result in no matching item. + * https://tools.suckless.org/dmenu/patches/reject-no-match/ + */ +#define REJECTNOMATCH_PATCH 0 + +/* This patch adds a '-1' option which disables Shift-Return and Ctrl-Return. + * This guarantees that dmenu will only output one item, and that item was read from stdin. + * The original patch used '-r'. This was changed to '-1' to avoid conflict with the incremental + * patch. + * https://tools.suckless.org/dmenu/patches/restrict-return/ + */ +#define RESTRICT_RETURN_PATCH 0 + +/* This patch adds support for text scrolling and no longer appends '...' for long input as + * it can handle long text. + * https://tools.suckless.org/dmenu/patches/scroll/ + */ +#define SCROLL_PATCH 0 + +/* This patch allows the symbols, which are printed in dmenu to indicate that either the input + * is too long or there are too many options to be shown in dmenu in one line, to be defined. + * https://tools.suckless.org/dmenu/patches/symbols/ + */ +#define SYMBOLS_PATCH 0 + +/* With this patch dmenu will split input lines at first tab character and only display first + * part, but it will perform matching on and output full lines as usual. + * + * This can be useful if you want to separate data and representation, for example, a music + * player wrapper can display only a track title to user, but still supply full filename to + * the underlying script. + * https://tools.suckless.org/dmenu/patches/tsv/ + */ +#define TSV_PATCH 0 + +/* This patch prevents dmenu from indenting items at the same level as the prompt length. + * https://tools.suckless.org/dmenu/patches/vertfull/ + */ +#define VERTFULL_PATCH 0 + +/* Adds extended window manager hints such as _NET_WM_WINDOW_TYPE and _NET_WM_WINDOW_TYPE_DOCK. + * https://github.com/Baitinq/dmenu/blob/master/patches/dmenu-wm_type.diff + */ +#define WMTYPE_PATCH 0 + +/* This patch adds the ability to configure dmenu via Xresources. At startup, dmenu will read and + * apply the resources named below: + * dmenu.font : font or font set + * dmenu.background : normal background color + * dmenu.foreground : normal foreground color + * dmenu.selbackground : selected background color + * dmenu.selforeground : selected foreground color + * + * See patch/xresources.c for more color settings. + * + * https://tools.suckless.org/dmenu/patches/xresources/ + */ +#define XRESOURCES_PATCH 0 + +/* This patch adds options for specifying dmenu window position and width. + * The center patch takes precedence over the XYW patch if enabled. + * https://tools.suckless.org/dmenu/patches/xyw/ + */ +#define XYW_PATCH 1 diff --git a/user/.config/dmenu/patches.h b/user/.config/dmenu/patches.h new file mode 100644 index 000000000..cfd1450fe --- /dev/null +++ b/user/.config/dmenu/patches.h @@ -0,0 +1,334 @@ +/* Patches */ + +/* The alpha patch adds transparency for the dmenu window. + * You need to uncomment the corresponding line in config.mk to use the -lXrender library + * when including this patch. + * https://github.com/bakkeby/patches/blob/master/dmenu/dmenu-alpha-5.0_20210725_523aa08.diff + */ +#define ALPHA_PATCH 1 + +/* This patch adds a border around the dmenu window. It is intended to be used with the center + * or xyw patches, to make the menu stand out from similarly coloured windows. + * http://tools.suckless.org/dmenu/patches/border/ + */ +#define BORDER_PATCH 1 + +/* This patch makes dmenu case-insensitive by default, replacing the + * case-insensitive -i option with a case sensitive -s option. + * http://tools.suckless.org/dmenu/patches/case-insensitive/ + */ +#define CASEINSENSITIVE_PATCH 0 + +/* This patch centers dmenu in the middle of the screen. + * https://tools.suckless.org/dmenu/patches/center/ + */ +#define CENTER_PATCH 1 + +/* This patch enables color emoji in dmenu by removing a workaround for a BadLength error + * in the Xft library when color glyphs are used. + * To enable this you will need an updated Xft library that can handle color glyphs otherwise + * the program will crash on encountering such characters. Note that you will also need a font + * that provides color emojis for this to work. + */ +#define COLOR_EMOJI_PATCH 0 + +/* Minor patch to enable the use of Ctrl+v (XA_PRIMARY) and Ctrl+Shift+v (CLIPBOARD) to paste. + * By default dmenu only supports Ctrl+y and Ctrl+Shift+y to paste. + */ +#define CTRL_V_TO_PASTE_PATCH 0 + +/* This patch adds a flag (-dy) which makes dmenu run the command given to it whenever input + * is changed with the current input as the last argument and update the option list according + * to the output of that command. + * https://tools.suckless.org/dmenu/patches/dynamicoptions/ + */ +#define DYNAMIC_OPTIONS_PATCH 0 + +/* This patch will allow for emojis on the left side with a colored background when selected. + * To test this try running: + * $ echo -e ":b here\n:p there\n:r and here" | ./dmenu -p "Search..." -W 400 -l 20 -i -h -1 + * NB: the original patch came embedded with the the xyw patch, the morecolors patch and the + * line height patch and as such is intended to be combined with these. + * https://tools.suckless.org/dmenu/patches/emoji-highlight/ + */ +#define EMOJI_HIGHLIGHT_PATCH 0 + +/* This patch make it so that fuzzy matches gets highlighted and is therefore meant + * to be used together with the fuzzymatch patch. + * https://tools.suckless.org/dmenu/patches/fuzzyhighlight/ + */ +#define FUZZYHIGHLIGHT_PATCH 1 + +/* This patch adds support for fuzzy-matching to dmenu, allowing users to type non-consecutive + * portions of the string to be matched. + * https://tools.suckless.org/dmenu/patches/fuzzymatch/ + */ +#define FUZZYMATCH_PATCH 1 + +/* Allows dmenu's entries to be rendered in a grid by adding a new -g flag to specify + * the number of grid columns. The -g and -l options can be used together to create a + * G columns * L lines grid. + * https://tools.suckless.org/dmenu/patches/grid/ + */ +#define GRID_PATCH 1 + +/* This patch adds the ability to move left and right through a grid. + * This patch depends on the grid patch. + * https://tools.suckless.org/dmenu/patches/gridnav/ + */ +#define GRIDNAV_PATCH 0 + +/* This patch highlights the individual characters of matched text for each dmenu list entry. + * The fuzzy highlight patch takes precedence over this patch. + * https://tools.suckless.org/dmenu/patches/highlight/ + */ +#define HIGHLIGHT_PATCH 0 + +/* This will automatically sort the search result so that high priority items are shown first. + * https://tools.suckless.org/dmenu/patches/highpriority/ + */ +#define HIGHPRIORITY_PATCH 0 + +/* This patch causes dmenu to print out the current text each time a key is pressed. + * https://tools.suckless.org/dmenu/patches/incremental/ + */ +#define INCREMENTAL_PATCH 0 + +/* This patch adds an option to provide preselected text. + * https://tools.suckless.org/dmenu/patches/initialtext/ + */ +#define INITIALTEXT_PATCH 0 + +/* This patch adds a flag which will cause dmenu to select an item immediately if there + * is only one matching option left. + * https://tools.suckless.org/dmenu/patches/instant/ + */ +#define INSTANT_PATCH 0 + +/* This patch adds basic support for json files. + * This patch depends on the jansson library. Uncomment the relevant line in config.mk when + * enabling this patch. + * + * This patch is not compatible with the multi-selection, printinputtext, pipeout and + * non-blocking stdin patches. + * The multi-selection patch takes precedence over this patch. + * This patch takes precedence over non-blocking stdin, pipeout and printintputtext patches. + * + * https://tools.suckless.org/dmenu/patches/json/ + */ +#define JSON_PATCH 0 + +/* This patch adds a '-h' option which sets the minimum height of a dmenu line. This helps + * integrate dmenu with other UI elements that require a particular vertical size. + * http://tools.suckless.org/dmenu/patches/line-height/ + */ +#define LINE_HEIGHT_PATCH 1 + +/* This patch adds a -wm flag which sets override_redirect to false; thus letting your window + * manager manage the dmenu window. + * + * This may be helpful in contexts where you don't want to exclusively bind dmenu or want to + * treat dmenu more as a "window" rather than as an overlay. + * https://tools.suckless.org/dmenu/patches/managed/ + */ +#define MANAGED_PATCH 0 + +/* This patch adds an additional color scheme for highlighting entries adjacent to the current + * selection. + * https://tools.suckless.org/dmenu/patches/morecolor/ + */ +#define MORECOLOR_PATCH 1 + +/* This patch adds basic mouse support for dmenu. + * https://tools.suckless.org/dmenu/patches/mouse-support/ + */ +#define MOUSE_SUPPORT_PATCH 1 + +/* Without this patch when you press Ctrl+Enter dmenu just outputs current item and it is not + * possible to undo that. + * With this patch dmenu will output all selected items only on exit. It is also possible to + * deselect any selected item. + * Also refer to the dmenu_run replacement on the below URL that supports multiple selections. + * + * This patch is not compatible with, and takes precedence over, the json, printinputtext, + * pipeout and non-blocking stdin patches. + * + * https://tools.suckless.org/dmenu/patches/multi-selection/ + */ +#define MULTI_SELECTION_PATCH 0 + +/* This patch provides dmenu the ability for history navigation similar to that of bash. + * + * If you take this patch then it is recommended that you also uncomment the line in the + * dmenu_run script which replaces the exec command. + * + * https://tools.suckless.org/dmenu/patches/navhistory/ + */ +#define NAVHISTORY_PATCH 0 + +/* Adds the -S option to disable sorting menu items after matching. Useful, for example, when menu + * items are sorted by their frequency of use (using an external cache) and the most frequently + * selected items should always appear first regardless of how they were exact, prefix, or + * substring matches. + * https://tools.suckless.org/dmenu/patches/no-sort/ + */ +#define NO_SORT_PATCH 0 + +/* This is a patch to have dmenu read stdin in a non blocking way, making it wait for input both + * from stdin and from X. This means that you can continue feeding dmenu while you type. + * This patch is meant to be used along with the incremental patch, so that you can use stdout + * to feed stdin. + * + * This patch is not compatible with the json and multi-selection patches, both of which takes + * precedence over this patch. + * + * https://tools.suckless.org/dmenu/patches/non_blocking_stdin/ + */ +#define NON_BLOCKING_STDIN_PATCH 0 + +/* Adds text which displays the number of matched and total items in the top right corner of dmenu. + * https://tools.suckless.org/dmenu/patches/numbers/ + */ +#define NUMBERS_PATCH 1 + +/* This patch adds simple markup for dmenu using pango markup. + * This depends on the pango library v1.44 or greater. + * You need to uncomment the corresponding lines in config.mk to use the pango libraries + * when including this patch. + * + * Note that the pango patch is incompatible with the scroll patch and will result in + * compilation errors if both are enabled. + * + * Note that the pango patch does not protect against the BadLength error from Xft + * when color glyphs are used, which means that dmenu will crash if color emoji is used. + * + * If you need color emoji then you may want to install this patched library from the AUR: + * https://aur.archlinux.org/packages/libxft-bgra/ + * + * A long term fix for the libXft library is pending approval of this pull request: + * https://gitlab.freedesktop.org/xorg/lib/libxft/-/merge_requests/1 + * + * Also see: + * https://developer.gnome.org/pygtk/stable/pango-markup-language.html + * https://github.com/StillANixRookie/dmenu-pango + */ +#define PANGO_PATCH 0 + +/* With this patch dmenu will not directly display the keyboard input, but instead replace + * it with dots. All data from stdin will be ignored. + * https://tools.suckless.org/dmenu/patches/password/ + */ +#define PASSWORD_PATCH 0 + +/* This patch allows the selected text to be piped back out with dmenu. This can be useful if you + * want to display the output of a command on the screen. + * Only text starting with the character '#' is piped out by default. + * + * This patch is not compatible with the json and multi-select patches, both of which takes + * precedence over this one. + * + * https://tools.suckless.org/dmenu/patches/pipeout/ + */ +#define PIPEOUT_PATCH 0 + +/* Lifted from the listfullwidth patch this simple change just avoids colors for the prompt (with + * the -p option or in config.h) by making it use the same style as the rest of the input field. + * The rest of the listfullwidth patch is covered by the vertfull patch. + * https://tools.suckless.org/dmenu/patches/listfullwidth/ + */ +#define PLAIN_PROMPT_PATCH 0 + +/* This patch changes the behaviour of matched items and the Tab key to allow tab completion. + * https://tools.suckless.org/dmenu/patches/prefix-completion/ + */ +#define PREFIXCOMPLETION_PATCH 0 + +/* This patch adds an option -ps to specify an item by providing the index that should be + * pre-selected. + * https://tools.suckless.org/dmenu/patches/preselect/ + */ +#define PRESELECT_PATCH 0 + +/* This patch allows dmenu to print out the 0-based index of matched text instead of the matched + * text itself. This can be useful in cases where you would like to select entries from one array + * of text but index into another, or when you are selecting from an ordered list of non-unique + * items. + * https://tools.suckless.org/dmenu/patches/printindex/ + */ +#define PRINTINDEX_PATCH 0 + +/* This patch adds a flag (-t) which makes Return key to ignore selection and print the input + * text to stdout. The flag basically swaps the functions of Return and Shift+Return hotkeys. + * + * This patch is not compatible with the multi-select and json patches, both of which takes + * precedence over this one. + * + * https://tools.suckless.org/dmenu/patches/printinputtext/ + */ +#define PRINTINPUTTEXT_PATCH 0 + +/* This patch adds a new flag to dmenu with which text input will be rejected if it would + * result in no matching item. + * https://tools.suckless.org/dmenu/patches/reject-no-match/ + */ +#define REJECTNOMATCH_PATCH 0 + +/* This patch adds a '-1' option which disables Shift-Return and Ctrl-Return. + * This guarantees that dmenu will only output one item, and that item was read from stdin. + * The original patch used '-r'. This was changed to '-1' to avoid conflict with the incremental + * patch. + * https://tools.suckless.org/dmenu/patches/restrict-return/ + */ +#define RESTRICT_RETURN_PATCH 0 + +/* This patch adds support for text scrolling and no longer appends '...' for long input as + * it can handle long text. + * https://tools.suckless.org/dmenu/patches/scroll/ + */ +#define SCROLL_PATCH 0 + +/* This patch allows the symbols, which are printed in dmenu to indicate that either the input + * is too long or there are too many options to be shown in dmenu in one line, to be defined. + * https://tools.suckless.org/dmenu/patches/symbols/ + */ +#define SYMBOLS_PATCH 0 + +/* With this patch dmenu will split input lines at first tab character and only display first + * part, but it will perform matching on and output full lines as usual. + * + * This can be useful if you want to separate data and representation, for example, a music + * player wrapper can display only a track title to user, but still supply full filename to + * the underlying script. + * https://tools.suckless.org/dmenu/patches/tsv/ + */ +#define TSV_PATCH 0 + +/* This patch prevents dmenu from indenting items at the same level as the prompt length. + * https://tools.suckless.org/dmenu/patches/vertfull/ + */ +#define VERTFULL_PATCH 0 + +/* Adds extended window manager hints such as _NET_WM_WINDOW_TYPE and _NET_WM_WINDOW_TYPE_DOCK. + * https://github.com/Baitinq/dmenu/blob/master/patches/dmenu-wm_type.diff + */ +#define WMTYPE_PATCH 0 + +/* This patch adds the ability to configure dmenu via Xresources. At startup, dmenu will read and + * apply the resources named below: + * dmenu.font : font or font set + * dmenu.background : normal background color + * dmenu.foreground : normal foreground color + * dmenu.selbackground : selected background color + * dmenu.selforeground : selected foreground color + * + * See patch/xresources.c for more color settings. + * + * https://tools.suckless.org/dmenu/patches/xresources/ + */ +#define XRESOURCES_PATCH 0 + +/* This patch adds options for specifying dmenu window position and width. + * The center patch takes precedence over the XYW patch if enabled. + * https://tools.suckless.org/dmenu/patches/xyw/ + */ +#define XYW_PATCH 1 diff --git a/user/.config/dmenu/stest.1 b/user/.config/dmenu/stest.1 new file mode 100644 index 000000000..2667d8aa7 --- /dev/null +++ b/user/.config/dmenu/stest.1 @@ -0,0 +1,90 @@ +.TH STEST 1 dmenu\-VERSION +.SH NAME +stest \- filter a list of files by properties +.SH SYNOPSIS +.B stest +.RB [ -abcdefghlpqrsuwx ] +.RB [ -n +.IR file ] +.RB [ -o +.IR file ] +.RI [ file ...] +.SH DESCRIPTION +.B stest +takes a list of files and filters by the files' properties, analogous to +.IR test (1). +Files which pass all tests are printed to stdout. If no files are given, stest +reads files from stdin. +.SH OPTIONS +.TP +.B \-a +Test hidden files. +.TP +.B \-b +Test that files are block specials. +.TP +.B \-c +Test that files are character specials. +.TP +.B \-d +Test that files are directories. +.TP +.B \-e +Test that files exist. +.TP +.B \-f +Test that files are regular files. +.TP +.B \-g +Test that files have their set-group-ID flag set. +.TP +.B \-h +Test that files are symbolic links. +.TP +.B \-l +Test the contents of a directory given as an argument. +.TP +.BI \-n " file" +Test that files are newer than +.IR file . +.TP +.BI \-o " file" +Test that files are older than +.IR file . +.TP +.B \-p +Test that files are named pipes. +.TP +.B \-q +No files are printed, only the exit status is returned. +.TP +.B \-r +Test that files are readable. +.TP +.B \-s +Test that files are not empty. +.TP +.B \-u +Test that files have their set-user-ID flag set. +.TP +.B \-v +Invert the sense of tests, only failing files pass. +.TP +.B \-w +Test that files are writable. +.TP +.B \-x +Test that files are executable. +.SH EXIT STATUS +.TP +.B 0 +At least one file passed all tests. +.TP +.B 1 +No files passed all tests. +.TP +.B 2 +An error occurred. +.SH SEE ALSO +.IR dmenu (1), +.IR test (1) diff --git a/user/.config/dmenu/stest.c b/user/.config/dmenu/stest.c new file mode 100644 index 000000000..e27d3a5e5 --- /dev/null +++ b/user/.config/dmenu/stest.c @@ -0,0 +1,109 @@ +/* See LICENSE file for copyright and license details. */ +#include + +#include +#include +#include +#include +#include +#include + +#include "arg.h" +char *argv0; + +#define FLAG(x) (flag[(x)-'a']) + +static void test(const char *, const char *); +static void usage(void); + +static int match = 0; +static int flag[26]; +static struct stat old, new; + +static void +test(const char *path, const char *name) +{ + struct stat st, ln; + + if ((!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */ + && (!FLAG('b') || S_ISBLK(st.st_mode)) /* block special */ + && (!FLAG('c') || S_ISCHR(st.st_mode)) /* character special */ + && (!FLAG('d') || S_ISDIR(st.st_mode)) /* directory */ + && (!FLAG('e') || access(path, F_OK) == 0) /* exists */ + && (!FLAG('f') || S_ISREG(st.st_mode)) /* regular file */ + && (!FLAG('g') || st.st_mode & S_ISGID) /* set-group-id flag */ + && (!FLAG('h') || (!lstat(path, &ln) && S_ISLNK(ln.st_mode))) /* symbolic link */ + && (!FLAG('n') || st.st_mtime > new.st_mtime) /* newer than file */ + && (!FLAG('o') || st.st_mtime < old.st_mtime) /* older than file */ + && (!FLAG('p') || S_ISFIFO(st.st_mode)) /* named pipe */ + && (!FLAG('r') || access(path, R_OK) == 0) /* readable */ + && (!FLAG('s') || st.st_size > 0) /* not empty */ + && (!FLAG('u') || st.st_mode & S_ISUID) /* set-user-id flag */ + && (!FLAG('w') || access(path, W_OK) == 0) /* writable */ + && (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */ + if (FLAG('q')) + exit(0); + match = 1; + puts(name); + } +} + +static void +usage(void) +{ + fprintf(stderr, "usage: %s [-abcdefghlpqrsuvwx] " + "[-n file] [-o file] [file...]\n", argv0); + exit(2); /* like test(1) return > 1 on error */ +} + +int +main(int argc, char *argv[]) +{ + struct dirent *d; + char path[PATH_MAX], *line = NULL, *file; + size_t linesiz = 0; + ssize_t n; + DIR *dir; + int r; + + ARGBEGIN { + case 'n': /* newer than file */ + case 'o': /* older than file */ + file = EARGF(usage()); + if (!(FLAG(ARGC()) = !stat(file, (ARGC() == 'n' ? &new : &old)))) + perror(file); + break; + default: + /* miscellaneous operators */ + if (strchr("abcdefghlpqrsuvwx", ARGC())) + FLAG(ARGC()) = 1; + else + usage(); /* unknown flag */ + } ARGEND; + + if (!argc) { + /* read list from stdin */ + while ((n = getline(&line, &linesiz, stdin)) > 0) { + if (line[n - 1] == '\n') + line[n - 1] = '\0'; + test(line, line); + } + free(line); + } else { + for (; argc; argc--, argv++) { + if (FLAG('l') && (dir = opendir(*argv))) { + /* test directory contents */ + while ((d = readdir(dir))) { + r = snprintf(path, sizeof path, "%s/%s", + *argv, d->d_name); + if (r >= 0 && (size_t)r < sizeof path) + test(path, d->d_name); + } + closedir(dir); + } else { + test(*argv, *argv); + } + } + } + return match ? 0 : 1; +} diff --git a/user/.config/dmenu/util.c b/user/.config/dmenu/util.c new file mode 100644 index 000000000..fe044fc7b --- /dev/null +++ b/user/.config/dmenu/util.c @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include + +#include "util.h" + +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + die("calloc:"); + return p; +} + +void +die(const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } else { + fputc('\n', stderr); + } + + exit(1); +} diff --git a/user/.config/dmenu/util.h b/user/.config/dmenu/util.h new file mode 100644 index 000000000..531ab2578 --- /dev/null +++ b/user/.config/dmenu/util.h @@ -0,0 +1,12 @@ +/* See LICENSE file for copyright and license details. */ + +#ifndef MAX +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#endif +#ifndef MIN +#define MIN(A, B) ((A) < (B) ? (A) : (B)) +#endif +#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) + +void die(const char *fmt, ...); +void *ecalloc(size_t nmemb, size_t size); diff --git a/.config/doom/config.el b/user/.config/doom/config.el similarity index 100% rename from .config/doom/config.el rename to user/.config/doom/config.el diff --git a/.config/doom/config.org b/user/.config/doom/config.org similarity index 100% rename from .config/doom/config.org rename to user/.config/doom/config.org diff --git a/.config/doom/emacs-dash.txt b/user/.config/doom/emacs-dash.txt similarity index 100% rename from .config/doom/emacs-dash.txt rename to user/.config/doom/emacs-dash.txt diff --git a/.config/doom/eshell/aliases b/user/.config/doom/eshell/aliases similarity index 100% rename from .config/doom/eshell/aliases rename to user/.config/doom/eshell/aliases diff --git a/.config/doom/eshell/profile b/user/.config/doom/eshell/profile similarity index 100% rename from .config/doom/eshell/profile rename to user/.config/doom/eshell/profile diff --git a/.config/doom/init.el b/user/.config/doom/init.el similarity index 100% rename from .config/doom/init.el rename to user/.config/doom/init.el diff --git a/.config/doom/packages.el b/user/.config/doom/packages.el similarity index 100% rename from .config/doom/packages.el rename to user/.config/doom/packages.el diff --git a/.config/dunst/critical.png b/user/.config/dunst/critical.png similarity index 100% rename from .config/dunst/critical.png rename to user/.config/dunst/critical.png diff --git a/.config/dunst/dunstrc b/user/.config/dunst/dunstrc similarity index 99% rename from .config/dunst/dunstrc rename to user/.config/dunst/dunstrc index 58523bcbe..c4daec285 100644 --- a/.config/dunst/dunstrc +++ b/user/.config/dunst/dunstrc @@ -45,7 +45,7 @@ frame_width = 3 # Defines color of the frame around the notification window. - frame_color = "#689d6a" + frame_color = "#fb4934" # Define a color for the separator. # possible values are: @@ -179,7 +179,7 @@ # corners. # The radius will be automatically lowered if it exceeds half of the # notification height to avoid clipping text and/or icons. - corner_radius = 5 + corner_radius = 7 ### Legacy diff --git a/.config/dunst/normal.png b/user/.config/dunst/normal.png similarity index 100% rename from .config/dunst/normal.png rename to user/.config/dunst/normal.png diff --git a/.config/gtk-3.0/settings.ini b/user/.config/gtk-3.0/settings.ini similarity index 100% rename from .config/gtk-3.0/settings.ini rename to user/.config/gtk-3.0/settings.ini diff --git a/.config/mpv/input.conf b/user/.config/mpv/input.conf similarity index 100% rename from .config/mpv/input.conf rename to user/.config/mpv/input.conf diff --git a/user/.config/neofetch/config.conf b/user/.config/neofetch/config.conf new file mode 100644 index 000000000..5465ef0e2 --- /dev/null +++ b/user/.config/neofetch/config.conf @@ -0,0 +1,772 @@ +print_info() { + prin " " + info "$(color 1) OS " distro + info "$(color 2) VER" kernel + info "$(color 3) UP " uptime + info "$(color 4) PKG" packages + info "$(color 5) DE " de + info "$(color 6) CPU" cpu + info "$(color 7) GPU" gpu + info "$(color 8) MEM" memory + prin "$(color 1) $(color 2) $(color 3) $(color 4) $(color 5) $(color 6) $(color 7) $(color 8)" +} +#### TITLE +# Hide/Show Fully qualified domain name. +# Default: 'off' +# Values: 'on', 'off' +# Flag: --title_fqdn +title_fqdn="off" + + +#### KERNEL +# Shorten the output of the kernel function. +# Default: 'on' +# Values: 'on', 'off' +# Flag: --kernel_shorthand +# Supports: Everything except *BSDs (except PacBSD and PC-BSD) +# Example: +# on: '4.8.9-1-ARCH' +# off: 'Linux 4.8.9-1-ARCH' +kernel_shorthand="on" + + +#### DISTRO +# Shorten the output of the distro function +# Default: 'off' +# Values: 'on', 'tiny', 'off' +# Flag: --distro_shorthand +# Supports: Everything except Windows and Haiku +distro_shorthand="off" + +# Show/Hide OS Architecture. +# Show 'x86_64', 'x86' and etc in 'Distro:' output. +# Default: 'on' +# Values: 'on', 'off' +# Flag: --os_arch +# Example: +# on: 'Arch Linux x86_64' +# off: 'Arch Linux' +os_arch="on" + + +#### UPTIME +# Shorten the output of the uptime function +# Default: 'on' +# Values: 'on', 'tiny', 'off' +# Flag: --uptime_shorthand +# Example: +# on: '2 days, 10 hours, 3 mins' +# tiny: '2d 10h 3m' +# off: '2 days, 10 hours, 3 minutes' +uptime_shorthand="on" + + +#### MEMORY +# Show memory pecentage in output. +# Default: 'off' +# Values: 'on', 'off' +# Flag: --memory_percent +# Example: +# on: '1801MiB / 7881MiB (22%)' +# off: '1801MiB / 7881MiB' +memory_percent="off" + +# Change memory output unit. +# Default: 'mib' +# Values: 'kib', 'mib', 'gib' +# Flag: --memory_unit +# Example: +# kib '1020928KiB / 7117824KiB' +# mib '1042MiB / 6951MiB' +# gib: ' 0.98GiB / 6.79GiB' +memory_unit="mib" + + +#### PACKAGES +# Show/Hide Package Manager names. +# Default: 'tiny' +# Values: 'on', 'tiny' 'off' +# Flag: --package_managers +# Example: +# on: '998 (pacman), 8 (flatpak), 4 (snap)' +# tiny: '908 (pacman, flatpak, snap)' +# off: '908' +package_managers="on" + + +#### SHELL +# Show the path to $SHELL +# Default: 'off' +# Values: 'on', 'off' +# Flag: --shell_path +# Example: +# on: '/bin/bash' +# off: 'bash' +shell_path="off" + +# Show $SHELL version +# Default: 'on' +# Values: 'on', 'off' +# Flag: --shell_version +# Example: +# on: 'bash 4.4.5' +# off: 'bash' +shell_version="on" + + +#### CPU +# CPU speed type +# Default: 'bios_limit' +# Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. +# Flag: --speed_type +# Supports: Linux with 'cpufreq' +# NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. +speed_type="bios_limit" + +# CPU speed shorthand +# Default: 'off' +# Values: 'on', 'off'. +# Flag: --speed_shorthand +# NOTE: This flag is not supported in systems with CPU speed less than 1 GHz +# +# Example: +# on: 'i7-6500U (4) @ 3.1GHz' +# off: 'i7-6500U (4) @ 3.100GHz' +speed_shorthand="off" + +# Enable/Disable CPU brand in output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_brand +# +# Example: +# on: 'Intel i7-6500U' +# off: 'i7-6500U (4)' +cpu_brand="on" + +# CPU Speed +# Hide/Show CPU speed. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_speed +# +# Example: +# on: 'Intel i7-6500U (4) @ 3.1GHz' +# off: 'Intel i7-6500U (4)' +cpu_speed="on" + +# CPU Cores +# Display CPU cores in output +# +# Default: 'logical' +# Values: 'logical', 'physical', 'off' +# Flag: --cpu_cores +# Support: 'physical' doesn't work on BSD. +# +# Example: +# logical: 'Intel i7-6500U (4) @ 3.1GHz' (All virtual cores) +# physical: 'Intel i7-6500U (2) @ 3.1GHz' (All physical cores) +# off: 'Intel i7-6500U @ 3.1GHz' +cpu_cores="logical" + +# CPU Temperature +# Hide/Show CPU temperature. +# Note the temperature is added to the regular CPU function. +# +# Default: 'off' +# Values: 'C', 'F', 'off' +# Flag: --cpu_temp +# Supports: Linux, BSD +# NOTE: For FreeBSD and NetBSD-based systems, you'll need to enable +# coretemp kernel module. This only supports newer Intel processors. +# +# Example: +# C: 'Intel i7-6500U (4) @ 3.1GHz [27.2°C]' +# F: 'Intel i7-6500U (4) @ 3.1GHz [82.0°F]' +# off: 'Intel i7-6500U (4) @ 3.1GHz' +cpu_temp="off" + + +# GPU + + +# Enable/Disable GPU Brand +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gpu_brand +# +# Example: +# on: 'AMD HD 7950' +# off: 'HD 7950' +gpu_brand="on" + +# Which GPU to display +# +# Default: 'all' +# Values: 'all', 'dedicated', 'integrated' +# Flag: --gpu_type +# Supports: Linux +# +# Example: +# all: +# GPU1: AMD HD 7950 +# GPU2: Intel Integrated Graphics +# +# dedicated: +# GPU1: AMD HD 7950 +# +# integrated: +# GPU1: Intel Integrated Graphics +gpu_type="all" + + +# Resolution + + +# Display refresh rate next to each monitor +# Default: 'off' +# Values: 'on', 'off' +# Flag: --refresh_rate +# Supports: Doesn't work on Windows. +# +# Example: +# on: '1920x1080 @ 60Hz' +# off: '1920x1080' +refresh_rate="off" + + +# Gtk Theme / Icons / Font + + +# Shorten output of GTK Theme / Icons / Font +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --gtk_shorthand +# +# Example: +# on: 'Numix, Adwaita' +# off: 'Numix [GTK2], Adwaita [GTK3]' +gtk_shorthand="off" + + +# Enable/Disable gtk2 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk2 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Adwaita [GTK3]' +gtk2="on" + +# Enable/Disable gtk3 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk3 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Numix [GTK2]' +gtk3="on" + + +# IP Address + + +# Website to ping for the public IP +# +# Default: 'http://ident.me' +# Values: 'url' +# Flag: --ip_host +public_ip_host="http://ident.me" + +# Public IP timeout. +# +# Default: '2' +# Values: 'int' +# Flag: --ip_timeout +public_ip_timeout=2 + + +# Desktop Environment + + +# Show Desktop Environment version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --de_version +de_version="on" + + +# Disk + + +# Which disks to display. +# The values can be any /dev/sdXX, mount point or directory. +# NOTE: By default we only show the disk info for '/'. +# +# Default: '/' +# Values: '/', '/dev/sdXX', '/path/to/drive'. +# Flag: --disk_show +# +# Example: +# disk_show=('/' '/dev/sdb1'): +# 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 823G / 893G (93%)' +# +# disk_show=('/'): +# 'Disk (/): 74G / 118G (66%)' +# +disk_show=('/') + +# Disk subtitle. +# What to append to the Disk subtitle. +# +# Default: 'mount' +# Values: 'mount', 'name', 'dir', 'none' +# Flag: --disk_subtitle +# +# Example: +# name: 'Disk (/dev/sda1): 74G / 118G (66%)' +# 'Disk (/dev/sdb2): 74G / 118G (66%)' +# +# mount: 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Local Disk): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 74G / 118G (66%)' +# +# dir: 'Disk (/): 74G / 118G (66%)' +# 'Disk (Local Disk): 74G / 118G (66%)' +# 'Disk (Videos): 74G / 118G (66%)' +# +# none: 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +disk_subtitle="mount" + +# Disk percent. +# Show/Hide disk percent. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --disk_percent +# +# Example: +# on: 'Disk (/): 74G / 118G (66%)' +# off: 'Disk (/): 74G / 118G' +disk_percent="on" + + +# Song + + +# Manually specify a music player. +# +# Default: 'auto' +# Values: 'auto', 'player-name' +# Flag: --music_player +# +# Available values for 'player-name': +# +# amarok +# audacious +# banshee +# bluemindo +# clementine +# cmus +# deadbeef +# deepin-music +# dragon +# elisa +# exaile +# gnome-music +# gmusicbrowser +# gogglesmm +# guayadeque +# io.elementary.music +# iTunes +# juk +# lollypop +# mocp +# mopidy +# mpd +# muine +# netease-cloud-music +# olivia +# playerctl +# pogo +# pragha +# qmmp +# quodlibet +# rhythmbox +# sayonara +# smplayer +# spotify +# strawberry +# tauonmb +# tomahawk +# vlc +# xmms2d +# xnoise +# yarock +music_player="mpd" + +# Format to display song information. +# +# Default: '%artist% - %album% - %title%' +# Values: '%artist%', '%album%', '%title%' +# Flag: --song_format +# +# Example: +# default: 'Song: Jet - Get Born - Sgt Major' +song_format="%artist% - %album% - %title%" + +# Print the Artist, Album and Title on separate lines +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --song_shorthand +# +# Example: +# on: 'Artist: The Fratellis' +# 'Album: Costello Music' +# 'Song: Chelsea Dagger' +# +# off: 'Song: The Fratellis - Costello Music - Chelsea Dagger' +song_shorthand="off" + +# 'mpc' arguments (specify a host, password etc). +# +# Default: '' +# Example: mpc_args=(-h HOST -P PASSWORD) +mpc_args=() + + +# Text Colors + + +# Text Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --colors +# +# Each number represents a different part of the text in +# this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' +# +# Example: +# colors=(distro) - Text is colored based on Distro colors. +# colors=(4 6 1 8 8 6) - Text is colored in the order above. +colors=(distro) + + +# Text Options + + +# Toggle bold text +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bold +bold="on" + +# Enable/Disable Underline +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --underline +underline_enabled="on" + +# Underline character +# +# Default: '-' +# Values: 'string' +# Flag: --underline_char +underline_char="-" + + +# Info Separator +# Replace the default separator with the specified string. +# +# Default: ':' +# Flag: --separator +# +# Example: +# separator="->": 'Shell-> bash' +# separator=" =": 'WM = dwm' +separator=":" + + +# Color Blocks + + +# Color block range +# The range of colors to print. +# +# Default: '0', '15' +# Values: 'num' +# Flag: --block_range +# +# Example: +# +# Display colors 0-7 in the blocks. (8 colors) +# neofetch --block_range 0 7 +# +# Display colors 0-15 in the blocks. (16 colors) +# neofetch --block_range 0 15 +block_range=(0 15) + +# Toggle color blocks +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --color_blocks +color_blocks="on" + +# Color block width in spaces +# +# Default: '3' +# Values: 'num' +# Flag: --block_width +block_width=3 + +# Color block height in lines +# +# Default: '1' +# Values: 'num' +# Flag: --block_height +block_height=1 + +# Color Alignment +# +# Default: 'auto' +# Values: 'auto', 'num' +# Flag: --col_offset +# +# Number specifies how far from the left side of the terminal (in spaces) to +# begin printing the columns, in case you want to e.g. center them under your +# text. +# Example: +# col_offset="auto" - Default behavior of neofetch +# col_offset=7 - Leave 7 spaces then print the colors +col_offset="auto" + +# Progress Bars + + +# Bar characters +# +# Default: '-', '=' +# Values: 'string', 'string' +# Flag: --bar_char +# +# Example: +# neofetch --bar_char 'elapsed' 'total' +# neofetch --bar_char '-' '=' +bar_char_elapsed="-" +bar_char_total="=" + +# Toggle Bar border +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bar_border +bar_border="on" + +# Progress bar length in spaces +# Number of chars long to make the progress bars. +# +# Default: '15' +# Values: 'num' +# Flag: --bar_length +bar_length=15 + +# Progress bar colors +# When set to distro, uses your distro's logo colors. +# +# Default: 'distro', 'distro' +# Values: 'distro', 'num' +# Flag: --bar_colors +# +# Example: +# neofetch --bar_colors 3 4 +# neofetch --bar_colors distro 5 +bar_color_elapsed="distro" +bar_color_total="distro" + + +# Info display +# Display a bar with the info. +# +# Default: 'off' +# Values: 'bar', 'infobar', 'barinfo', 'off' +# Flags: --cpu_display +# --memory_display +# --battery_display +# --disk_display +# +# Example: +# bar: '[---=======]' +# infobar: 'info [---=======]' +# barinfo: '[---=======] info' +# off: 'info' +cpu_display="off" +memory_display="off" +battery_display="off" +disk_display="off" + + +# Backend Settings + + +# Image backend. +# +# Default: 'ascii' +# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', +# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' +# Flag: --backend +image_backend="ascii" + +# Image Source +# +# Which image or ascii file to display. +# +# Default: 'auto' +# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' +# 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")' +# Flag: --source +# +# NOTE: 'auto' will pick the best image source for whatever image backend is used. +# In ascii mode, distro ascii art will be used and in an image mode, your +# wallpaper will be used. +image_source="auto" + + +#### ASCII OPTIONS +# Ascii distro +# Which distro's ascii art to display. +# Default: 'auto' +# Values: 'auto', 'distro_name' +# Flag: --ascii_distro +# NOTE: AIX, Alpine, Anarchy, Android, Antergos, antiX, "AOSC OS", +# "AOSC OS/Retro", Apricity, ArcoLinux, ArchBox, ARCHlabs, +# ArchStrike, XFerience, ArchMerge, Arch, Artix, Arya, Bedrock, +# Bitrig, BlackArch, BLAG, BlankOn, BlueLight, bonsai, BSD, +# BunsenLabs, Calculate, Carbs, CentOS, Chakra, ChaletOS, +# Chapeau, Chrom*, Cleanjaro, ClearOS, Clear_Linux, Clover, +# Condres, Container_Linux, CRUX, Cucumber, Debian, Deepin, +# DesaOS, Devuan, DracOS, DarkOs, DragonFly, Drauger, Elementary, +# EndeavourOS, Endless, EuroLinux, Exherbo, Fedora, Feren, FreeBSD, +# FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, Pentoo, +# gNewSense, GNOME, GNU, GoboLinux, Grombyang, Guix, Haiku, Huayra, +# Hyperbola, janus, Kali, KaOS, KDE_neon, Kibojoe, Kogaion, +# Korora, KSLinux, Kubuntu, LEDE, LFS, Linux_Lite, +# LMDE, Lubuntu, Lunar, macos, Mageia, MagpieOS, Mandriva, +# Manjaro, Maui, Mer, Minix, LinuxMint, MX_Linux, Namib, +# Neptune, NetBSD, Netrunner, Nitrux, NixOS, Nurunner, +# NuTyX, OBRevenge, OpenBSD, openEuler, OpenIndiana, openmamba, +# OpenMandriva, OpenStage, OpenWrt, osmc, Oracle, OS Elbrus, PacBSD, +# Parabola, Pardus, Parrot, Parsix, TrueOS, PCLinuxOS, Peppermint, +# popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, +# Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, +# Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, +# Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz, +# SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, +# openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, +# Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, +# Ubuntu, Venom, Void, Obarun, windows10, Windows7, Xubuntu, Zorin, +# and IRIX have ascii logos +# NOTE: Arch, Ubuntu, Redhat, and Dragonfly have 'old' logo variants. +# Use '{distro name}_old' to use the old logos. +# NOTE: Ubuntu has flavor variants. +# Change this to Lubuntu, Kubuntu, Xubuntu, Ubuntu-GNOME, +# Ubuntu-Studio, Ubuntu-Mate or Ubuntu-Budgie to use the flavors. +# NOTE: Arcolinux, Dragonfly, Fedora, Alpine, Arch, Ubuntu, +# CRUX, Debian, Gentoo, FreeBSD, Mac, NixOS, OpenBSD, android, +# Antrix, CentOS, Cleanjaro, ElementaryOS, GUIX, Hyperbola, +# Manjaro, MXLinux, NetBSD, Parabola, POP_OS, PureOS, +# Slackware, SunOS, LinuxLite, OpenSUSE, Raspbian, +# postmarketOS, and Void have a smaller logo variant. +# Use '{distro name}_small' to use the small variants. +ascii_distro="arch_small" + +# Ascii Colors +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --ascii_colors +# Example: +# ascii_colors=(distro) - Ascii is colored based on Distro colors. +# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. +ascii_colors=(distro) + +# Bold ascii logo +# Whether or not to bold the ascii logo. +# Default: 'on' +# Values: 'on', 'off' +# Flag: --ascii_bold +ascii_bold="on" + +#### IMAGE OPTIONS +# Image loop +# Setting this to on will make neofetch redraw the image constantly until +# Ctrl+C is pressed. This fixes display issues in some terminal emulators. +# Default: 'off' +# Values: 'on', 'off' +# Flag: --loop +image_loop="off" + +# Thumbnail directory +# Default: '~/.cache/thumbnails/neofetch' +# Values: 'dir' +thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" + +# Crop mode +# Default: 'normal' +# Values: 'normal', 'fit', 'fill' +# Flag: --crop_mode +# See this wiki page to learn about the fit and fill options. +# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F +crop_mode="normal" + +# Crop offset +# Note: Only affects 'normal' crop mode. +# Default: 'center' +# Values: 'northwest', 'north', 'northeast', 'west', 'center' +# 'east', 'southwest', 'south', 'southeast' +# Flag: --crop_offset +crop_offset="center" + +# Image size +# The image is half the terminal width by default. +# Default: 'auto' +# Values: 'auto', '00px', '00%', 'none' +# Flags: --image_size +# --size +image_size="auto" + +# Gap between image and text +# Default: '3' +# Values: 'num', '-num' +# Flag: --gap +gap=3 + +# Image offsets +# Only works with the w3m backend. +# Default: '0' +# Values: 'px' +# Flags: --xoffset +# --yoffset +yoffset=0 +xoffset=0 + +# Image background color +# Only works with the w3m backend. +# Default: '' +# Values: 'color', 'blue' +# Flag: --bg_color diff --git a/.config/newsboat/config b/user/.config/newsboat/config similarity index 100% rename from .config/newsboat/config rename to user/.config/newsboat/config diff --git a/.config/newsboat/urls b/user/.config/newsboat/urls similarity index 100% rename from .config/newsboat/urls rename to user/.config/newsboat/urls diff --git a/.config/picom/picom.conf b/user/.config/picom/picom.conf similarity index 84% rename from .config/picom/picom.conf rename to user/.config/picom/picom.conf index fc51ebfb4..4e9be0bd1 100755 --- a/.config/picom/picom.conf +++ b/user/.config/picom/picom.conf @@ -7,10 +7,10 @@ ## Shadows shadow = true; -shadow-radius = 7; +shadow-radius = 10; # shadow-opacity = .75 -shadow-offset-x = -7; -shadow-offset-y = -7; +shadow-offset-x = -10; +shadow-offset-y = -10; # shadow-red = 0 # shadow-green = 0 # shadow-blue = 0 @@ -30,7 +30,7 @@ fade-out-step = 0.05; fade-delta = 8 # fade-exclude = [] # no-fading-openclose = false -no-fading-destroyed-argb = true +no-fading-destroyed-argb = false ## Transparency and opacity inactive-opacity = 1.00; @@ -41,13 +41,17 @@ focus-exclude = [ "class_g = 'Cairo-clock'" ]; ## General Settings backend = "glx"; -vsync = true; +vsync = false; +dbe = false; detect-client-opacity = true; refresh-rate = 0; detect-transient = true; glx-no-stencil = true; -use-damage = true; -xrender-sync-fence = true; +use-damage = false; +unredir-if-possible = true; +unredir-if-possible-exclude = [ + "class_g = 'looking-glass-client' && !focused" +]; glx-use-copysubbuffer-mesa = true; wintypes: diff --git a/.config/qutebrowser/config.py b/user/.config/qutebrowser/config.py similarity index 100% rename from .config/qutebrowser/config.py rename to user/.config/qutebrowser/config.py diff --git a/.config/qutebrowser/gruvbox.py b/user/.config/qutebrowser/gruvbox.py similarity index 100% rename from .config/qutebrowser/gruvbox.py rename to user/.config/qutebrowser/gruvbox.py diff --git a/.config/starship.toml b/user/.config/starship.toml similarity index 100% rename from .config/starship.toml rename to user/.config/starship.toml diff --git a/.config/vifm/colors/Default.vifm b/user/.config/vifm/colors/Default.vifm similarity index 100% rename from .config/vifm/colors/Default.vifm rename to user/.config/vifm/colors/Default.vifm diff --git a/.config/vifm/scripts/README b/user/.config/vifm/scripts/README similarity index 100% rename from .config/vifm/scripts/README rename to user/.config/vifm/scripts/README diff --git a/.config/vifm/scripts/vifmimg b/user/.config/vifm/scripts/vifmimg similarity index 100% rename from .config/vifm/scripts/vifmimg rename to user/.config/vifm/scripts/vifmimg diff --git a/.config/vifm/scripts/vifmrun b/user/.config/vifm/scripts/vifmrun similarity index 100% rename from .config/vifm/scripts/vifmrun rename to user/.config/vifm/scripts/vifmrun diff --git a/.config/vifm/vifm-help.txt b/user/.config/vifm/vifm-help.txt similarity index 100% rename from .config/vifm/vifm-help.txt rename to user/.config/vifm/vifm-help.txt diff --git a/.config/vifm/vifmrc b/user/.config/vifm/vifmrc similarity index 100% rename from .config/vifm/vifmrc rename to user/.config/vifm/vifmrc diff --git a/user/.config/zathura/zathurarc b/user/.config/zathura/zathurarc new file mode 100644 index 000000000..cbdcaa21f --- /dev/null +++ b/user/.config/zathura/zathurarc @@ -0,0 +1,47 @@ +set font "mononoki Nerd Font 9" +set default-bg "#262626" #00 +set default-fg "#ebdbb2" #01 + +set statusbar-fg "#ebdbb2" #04 +set statusbar-bg "#262626" #01 + +set inputbar-bg "#262626" #00 currently not used +set inputbar-fg "#ebdbb2" #02 + +set notification-error-bg "#262626" #08 +set notification-error-fg "#cc241d" #00 + +set notification-warning-bg "#262626" #08 +set notification-warning-fg "#d79921" #00 + +set highlight-color "#262626" #0A +set highlight-active-color "#ebdbb2" #0D + +set completion-highlight-fg "#4e4e4e" #02 +set completion-highlight-bg "#87afaf" #0C + +set completion-bg "#4e4e4e" #02 +set completion-fg "#ebdbb2" #0C + +set notification-bg "#262626" #0B +set notification-fg "#458588" #00 + +set recolor-lightcolor "#262626" #00 +set recolor-darkcolor "#ebdbb2" #06 +set recolor "true" + +# setting recolor-keep true will keep any color your pdf has. +# if it is false, it'll just be black and white +set recolor-keephue "false" + +set selection-clipboard "clipboard" + +# keybindings +map [fullscreen] a adjust_window best-fit +map [fullscreen] s adjust_window width +map [fullscreen] f follow +map [fullscreen] toggle_index +map [fullscreen] j scroll down +map [fullscreen] k scroll up +map [fullscreen] h navigate previous +map [fullscreen] l navigate next diff --git a/.gtkrc-2.0 b/user/.gtkrc-2.0 similarity index 92% rename from .gtkrc-2.0 rename to user/.gtkrc-2.0 index e1d4c071e..8c3b4914c 100644 --- a/.gtkrc-2.0 +++ b/user/.gtkrc-2.0 @@ -1,4 +1,3 @@ -include "/home/drk/.gtkrc-2.0.mine" gtk-theme-name="gruvbox-dark-gtk" gtk-icon-theme-name="gruvbox-dark-icons-gtk" gtk-font-name="Sans 10" diff --git a/.icons/default/index.theme b/user/.icons/default/index.theme similarity index 100% rename from .icons/default/index.theme rename to user/.icons/default/index.theme diff --git a/.moc/config b/user/.moc/config similarity index 100% rename from .moc/config rename to user/.moc/config diff --git a/.moc/themes/black_theme b/user/.moc/themes/black_theme similarity index 100% rename from .moc/themes/black_theme rename to user/.moc/themes/black_theme diff --git a/.moc/themes/darkdot_theme b/user/.moc/themes/darkdot_theme similarity index 100% rename from .moc/themes/darkdot_theme rename to user/.moc/themes/darkdot_theme diff --git a/.moc/themes/example_theme b/user/.moc/themes/example_theme similarity index 100% rename from .moc/themes/example_theme rename to user/.moc/themes/example_theme diff --git a/.moc/themes/green_theme b/user/.moc/themes/green_theme similarity index 100% rename from .moc/themes/green_theme rename to user/.moc/themes/green_theme diff --git a/.moc/themes/moca_theme b/user/.moc/themes/moca_theme similarity index 100% rename from .moc/themes/moca_theme rename to user/.moc/themes/moca_theme diff --git a/.moc/themes/nightly_theme b/user/.moc/themes/nightly_theme similarity index 100% rename from .moc/themes/nightly_theme rename to user/.moc/themes/nightly_theme diff --git a/.moc/themes/red_theme b/user/.moc/themes/red_theme similarity index 100% rename from .moc/themes/red_theme rename to user/.moc/themes/red_theme diff --git a/.moc/themes/transparent-background b/user/.moc/themes/transparent-background similarity index 100% rename from .moc/themes/transparent-background rename to user/.moc/themes/transparent-background diff --git a/.moc/themes/yellow_red_theme b/user/.moc/themes/yellow_red_theme similarity index 100% rename from .moc/themes/yellow_red_theme rename to user/.moc/themes/yellow_red_theme diff --git a/.xinitrc b/user/.xinitrc old mode 100644 new mode 100755 similarity index 95% rename from .xinitrc rename to user/.xinitrc index cebebe6b9..d9dba50d8 --- a/.xinitrc +++ b/user/.xinitrc @@ -1,4 +1,4 @@ -#/bin/sh +#!/bin/sh userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap @@ -24,4 +24,4 @@ if [ -f "$usermodmap" ]; then fi # start window manager / desktop environment -exec dwm +exec awesome diff --git a/user/.zshrc b/user/.zshrc new file mode 100644 index 000000000..6decab065 --- /dev/null +++ b/user/.zshrc @@ -0,0 +1,252 @@ +## ____ __ +## / __ \_________ _/ /_____ +## / / / / ___/ __ `/ //_/ _ \ +## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) +## /_____/_/ \__,_/_/|_|\___/ My custom zsh config +## + +### EXPORT +export TERM="xterm-256color" # getting proper colors +export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)" + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# use neovim for vim if present. +[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d" + +# use $XINITRC variable if file exists. +[ -f "$XINITRC" ] && alias startx="startx $XINITRC" + +### SET VI MODE ### +# Comment this line out to enable default emacs-like bindings +bindkey -v + +### PATH +if [ -d "$HOME/.bin" ] ; + then PATH="$HOME/.bin:$PATH" +fi + +if [ -d "$HOME/.local/bin" ] ; + then PATH="$HOME/.local/bin:$PATH" +fi + +if [ -d "$HOME/Applications" ] ; + then PATH="$HOME/Applications:$PATH" +fi + +### CHANGE TITLE OF TERMINALS +case ${TERM} in + xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*) + PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' + ;; + screen*) + PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' + ;; +esac + +### Function extract for common file formats ### +SAVEIFS=$IFS +IFS=$(echo -en "\n\b") + +function extract { + if [ -z "$1" ]; then + # display usage if no parameters given + echo "Usage: extract ." + echo " extract [path/file_name_2.ext] [path/file_name_3.ext]" + else + for n in "$@" + do + if [ -f "$n" ] ; then + case "${n%,}" in + *.cbt|*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar) + tar xvf "$n" ;; + *.lzma) unlzma ./"$n" ;; + *.bz2) bunzip2 ./"$n" ;; + *.cbr|*.rar) unrar x -ad ./"$n" ;; + *.gz) gunzip ./"$n" ;; + *.cbz|*.epub|*.zip) unzip ./"$n" ;; + *.z) uncompress ./"$n" ;; + *.7z|*.arj|*.cab|*.cb7|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.pkg|*.rpm|*.udf|*.wim|*.xar) + 7z x ./"$n" ;; + *.xz) unxz ./"$n" ;; + *.exe) cabextract ./"$n" ;; + *.cpio) cpio -id < ./"$n" ;; + *.cba|*.ace) unace x ./"$n" ;; + *) + echo "extract: '$n' - unknown archive method" + return 1 + ;; + esac + else + echo "'$n' - file does not exist" + return 1 + fi + done +fi +} + +IFS=$SAVEIFS + +### ALIASES ### +# navigation +up () { + local d="" + local limit="$1" + + # Default to limit of 1 + if [ -z "$limit" ] || [ "$limit" -le 0 ]; then + limit=1 + fi + + for ((i=1;i<=limit;i++)); do + d="../$d" + done + + # perform cd. Show error if cd fails + if ! cd "$d"; then + echo "Couldn't go up $limit dirs."; + fi +} + +# cd +alias \ + ..="cd .." \ + .2="cd ../.." \ + .3="cd ../../.." \ + .4="cd ../../../.." \ + .5="cd ../../../../.." + +# bat as cat +[ -x "$(command -v bat)" ] && alias cat="bat" + +# DOOM Emacs +[ -x "$(command -v emacs)" ] && alias \ + em="/usr/bin/emacs -nw" \ + emacs="emacsclient -c -a 'emacs'" \ + doomsync="~/.emacs.d/bin/doom sync" \ + doomdoctor="~/.emacs.d/bin/doom doctor" \ + doomupgrade="~/.emacs.d/bin/doom upgrade" \ + doompurge="~/.emacs.d/bin/doom purge" + +# Changing "ls" to "exa" +alias \ + ls="exa -al --color=always --group-directories-first" \ + la="exa -a --color=always --group-directories-first" \ + ll="exa -l --color=always --group-directories-first" \ + lt="exa -aT --color=always --group-directories-first" \ + l.='exa -a | egrep "^\."' + +# xbps +[ -x "$(command -v xbps-query)" ] && alias \ + xb-up="sudo xbps-install -Su && xcheckrestart" \ + xb-get="sudo xbps-install -S" \ + xb-rmv="sudo xbps-remove -R" \ + xb-rmv-sec="sudo xbps-remove" \ + xb-qry="sudo xbps-query" \ + xb-cln="sudo xbps-remove -o && sudo xbps-remove -O" + +# pacman +[ -x "$(command -v pacman)" ] && alias \ + pac-up="sudo pacman -Syyu" \ + pac-get="sudo pacman -S" \ + pac-rmv="sudo pacman -Rcns" \ + pac-rmv-sec="sudo pacman -Runs" \ + pac-qry="sudo pacman -Ss" \ + pac-cln="sudo pacman -Scc" + +# colorize grep output (good for log files) +alias \ + grep="grep --color=auto" \ + egrep="egrep --color=auto" \ + fgrep="fgrep --color=auto" + +# git +alias \ + addup="git add -u" \ + addall="git add ." \ + branch="git branch" \ + checkout="git checkout" \ + clone="git clone" \ + commit="git commit -m" \ + fetch="git fetch" \ + pull="git pull origin" \ + push="git push origin" \ + stat="git status" \ + tag="git tag" \ + newtag="git tag -a" + +# adding flags +alias \ + df="df -h" \ + free="free -m" \ + newsboat="newsboat -u ~/.config/newsboat/urls" + +# multimedia scripts +alias \ + fli="flix-cli" \ + ani="ani-cli" \ + aniq="ani-cli -q" + +# audio +alias \ + mx="pulsemixer" \ + amx="alsamixer" \ + mk="cmus" \ + ms="cmus" \ + music="cmus" + +# power management +[ -x "$(command -v xbps-query)" ] && alias \ + po="loginctl poweroff" \ + sp="loginctl suspend" \ + rb="loginctl reboot" +[ -x "$(command -v pacman)" ] && alias \ + po="systemctl poweroff" \ + sp="systemctl suspend" \ + rb="systemctl reboot" + +# file management +alias \ + fm="./.config/vifm/scripts/vifmrun" \ + file="./.config/vifm/scripts/vifmrun" \ + flm="./.config/vifm/scripts/vifmrun" \ + vifm="./.config/vifm/scripts/vifmrun" \ + rm="rm -vI" \ + mv="mv -iv" \ + cp="cp -iv" \ + mkd="mkdir -pv" + +# ps +alias \ + psa="ps auxf" \ + psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" \ + psmem="ps auxf | sort -nr -k 4" \ + pscpu="ps auxf | sort -nr -k 3" + +# youtube +alias \ + yta-aac="yt-dlp --extract-audio --audio-format aac" \ + yta-best="yt-dlp --extract-audio --audio-format best" \ + yta-flac="yt-dlp --extract-audio --audio-format flac" \ + yta-m4a="yt-dlp --extract-audio --audio-format m4a" \ + yta-mp3="yt-dlp --extract-audio --audio-format mp3" \ + yta-opus="yt-dlp --extract-audio --audio-format opus" \ + yta-vorbis="yt-dlp --extract-audio --audio-format vorbis" \ + yta-wav="yt-dlp --extract-audio --audio-format wav" \ + ytv-best="yt-dlp -f bestvideo+bestaudio" \ + yt="ytfzf -f -t" \ + ytm="ytfzf -m" + +# network and bluetooth +alias \ + netstats="nmcli dev" \ + wfi="nmtui-connect" \ + wfi-scan="nmcli dev wifi list" \ + wfi-edit="nmtui-edit" \ + wfi-on="nmcli radio wifi on" \ + wfi-off="nmcli radio wifi off" \ + blt="bluetoothctl" + +### SETTING THE STARSHIP PROMPT ### +eval "$(starship init bash)"