From cc334e92d0742bc995b34b232e32ecfd5dbad9d8 Mon Sep 17 00:00:00 2001 From: piccihud Date: Sat, 14 Dec 2024 18:24:03 +0100 Subject: [PATCH] update dotfiles --- .bashrc | 273 +++++++ .inputrc | 2 + .profile | 54 ++ .vimrc | 384 +++++++++ LICENSE | 14 +- README.md | 100 ++- alacritty/alacritty.toml | 40 + alacritty/alacritty.yml | 76 ++ fcd/bookmarks | 5 + fcd/fcd-config.toml | 102 +++ kitty/diff.conf | 19 + kitty/dracula.conf | 66 ++ kitty/kitty.conf | 9 + mako/config | 23 + ranger/colorschemes/__init__.py | 0 .../__init__.cpython-311.opt-1.pyc | Bin 0 -> 159 bytes .../__pycache__/dracula.cpython-311.opt-1.pyc | Bin 0 -> 6873 bytes .../__pycache__/zenburn.cpython-311.opt-1.pyc | Bin 0 -> 4437 bytes ranger/colorschemes/dracula.py | 218 +++++ ranger/colorschemes/zenburn.py | 163 ++++ ranger/rc.conf | 761 ++++++++++++++++++ ranger/rifle.conf | 8 + ranger/scope.sh | 349 ++++++++ sway/cheatsheet | 166 ++++ sway/config | 23 + sway/config.d/application_defaults | 51 ++ sway/config.d/autostart_applications | 28 + sway/config.d/clamshell | 6 + sway/config.d/default | 240 ++++++ sway/config.d/input | 20 + sway/config.d/output | 11 + sway/config.d/theme | 39 + sway/keyboard.conf | 457 +++++++++++ sway/scripts/clamshell.sh | 8 + sway/scripts/import-gsettings | 15 + sway/scripts/lockman.sh | 9 + sway/scripts/screenshot.sh | 18 + sway/scripts/swayfader.py | 229 ++++++ sway/scripts/weather.sh | 15 + swaybg.sh | 11 + swaydotfile.sh | 1 + swaylock/config | 24 + swaylock/qt5ct/qt5ct.conf | 28 + waybar/config | 247 ++++++ waybar/scripts/PBPbattery.sh | 21 + waybar/scripts/keyhint.sh | 2 + waybar/scripts/power-menu.sh | 16 + waybar/scripts/weather.sh | 13 + waybar/style.css | 200 +++++ wofi/config | 17 + wofi/config.power | 9 + wofi/config.screenshot | 9 + wofi/style.css | 47 ++ wofi/style.widgets.css | 45 ++ wofi/windows.py | 119 +++ 55 files changed, 4801 insertions(+), 9 deletions(-) create mode 100644 .bashrc create mode 100644 .inputrc create mode 100644 .profile create mode 100755 .vimrc create mode 100644 alacritty/alacritty.toml create mode 100644 alacritty/alacritty.yml create mode 100644 fcd/bookmarks create mode 100644 fcd/fcd-config.toml create mode 100644 kitty/diff.conf create mode 100644 kitty/dracula.conf create mode 100644 kitty/kitty.conf create mode 100644 mako/config create mode 100644 ranger/colorschemes/__init__.py create mode 100644 ranger/colorschemes/__pycache__/__init__.cpython-311.opt-1.pyc create mode 100644 ranger/colorschemes/__pycache__/dracula.cpython-311.opt-1.pyc create mode 100644 ranger/colorschemes/__pycache__/zenburn.cpython-311.opt-1.pyc create mode 100644 ranger/colorschemes/dracula.py create mode 100644 ranger/colorschemes/zenburn.py create mode 100644 ranger/rc.conf create mode 100644 ranger/rifle.conf create mode 100755 ranger/scope.sh create mode 100644 sway/cheatsheet create mode 100644 sway/config create mode 100644 sway/config.d/application_defaults create mode 100644 sway/config.d/autostart_applications create mode 100644 sway/config.d/clamshell create mode 100644 sway/config.d/default create mode 100644 sway/config.d/input create mode 100644 sway/config.d/output create mode 100644 sway/config.d/theme create mode 100644 sway/keyboard.conf create mode 100755 sway/scripts/clamshell.sh create mode 100755 sway/scripts/import-gsettings create mode 100755 sway/scripts/lockman.sh create mode 100755 sway/scripts/screenshot.sh create mode 100755 sway/scripts/swayfader.py create mode 100755 sway/scripts/weather.sh create mode 100755 swaybg.sh create mode 100755 swaydotfile.sh create mode 100644 swaylock/config create mode 100644 swaylock/qt5ct/qt5ct.conf create mode 100644 waybar/config create mode 100755 waybar/scripts/PBPbattery.sh create mode 100755 waybar/scripts/keyhint.sh create mode 100755 waybar/scripts/power-menu.sh create mode 100755 waybar/scripts/weather.sh create mode 100644 waybar/style.css create mode 100644 wofi/config create mode 100644 wofi/config.power create mode 100644 wofi/config.screenshot create mode 100644 wofi/style.css create mode 100644 wofi/style.widgets.css create mode 100755 wofi/windows.py diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..e574579 --- /dev/null +++ b/.bashrc @@ -0,0 +1,273 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in + xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; + *) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +#if [ -f ~/.bash_aliases ]; then +# . ~/.bash_aliases +#fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +#if ! shopt -oq posix; then +# if [ -f /usr/share/bash-completion/bash_completion ]; then +# . /usr/share/bash-completion/bash_completion +# elif [ -f /etc/bash_completion ]; then +# . /etc/bash_completion +# fi +#fi + +################################################################################################################################################### +# # +# PERSONAL SETTINGS # +# # +################################################################################################################################################### + +# path + +export PATH="$PATH:HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin:$HOME/scripts/:$HOME/scripts/backup-ws" + +# for setting history length see HISTSIZE and HISTFILESIZE in bash +HISTSIZE=-1 +HISTFILESIZE=-1 + +# To get first completion and a listing you can add the following to bashrc +bind 'set show-all-if-ambiguous on' +bind 'TAB:menu-complete' + +# Use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion + +# alias + +# alias + +## BASH command + +alias t='tail -f' +alias dud='du -d 1 -h 2> /dev/null | sort -hsr' +alias dus='du -sh * 2> /dev/null | sort -hsr' +alias egrep='egrep --color=auto' +alias fd='find . -type d -name' +alias fdi='find . -type d -iname' +alias ff='find . -type f -name' +alias ffi='find . -type f -iname' +alias df='df -hT' +alias md='mkdir -p' +alias rd='rmdir' +alias ss="scrcpy -S" +alias scl="screen -ls" +alias scr="screen -R" +alias scl="screen -ls" +alias nn="ncdu --color dark" +alias maps="telnet mapscii.me" +alias myip='curl ipinfo.io/ip' +alias files_replace_space='for f in *\ *; do mv "$f" "${f// /_}"; done' +alias dtr="rm -rf .local/share/Trash/files/*" +alias hugo-sync="hugo && rsync -avz --delete public/ ilnostropianetaselvaggio:/home/sistemostro/website/" + +## ls + +alias l='ls -CF' +#alias ls='ls -1FSsh' +alias ldot='ls -ld .*' +alias lt='ls -ltFh' +alias ll='exa -lgh --icons' + +## apt + +alias aac='sudo apt autoclean' +alias ac='sudo apt clean' +alias as='apt search' +alias aug='sudo apt update && sudo apt upgrade' +alias afug='sudo apt update && sudo apt dist-upgrade' +alias ai='sudo apt install' +alias ap='sudo apt purge' +alias ar='sudo apt remove' +alias aar='sudo apt autoremove' +alias upg='sudo apt update ; sudo apt upgrade ; sudo apt autoremove ; flatpak upgrade -y ; flatpak uninstall --unused -y' + +## flatpak + +alias fl='flatpak list' +alias fu='flatpak update' +alias fun='flatpak uninstall --unused' +alias code="flatpak run com.vscodium.codium 2> /dev/null" + +## docker + +alias dex='docker exec -i -t' +alias di='docker images ls' +alias dv='docker volume ls' +alias dps='docker ps' +alias dpsa='docker ps -a' +alias dcd='docker compose down' +alias dcp='docker compose pull' +alias dcu='docker compose up -d' +alias dspaf='docker system prune -af' + +## tmux + +alias ta='tmux attach -t' +alias tad='tmux attach -dt' +alias tkss='tmux kill-session -t' +alias tksv='tmux kill-server' +alias tl='tmux list-sessions' +alias ts='tmux new-session -s' + +## symlink + +alias delete-broken-symlink='find . -maxdepth 1 -xtype l -delete' +alias view-broken-symlink='find . -maxdepth 1 -xtype l' + +## vim + +alias v="vim 2> /dev/null" +alias sv="sudo vim 2> /dev/null" +alias vi='TERM=xterm-sc vim' +alias vim='TERM=xterm-sc vim' + +## git + +alias g=git +alias ga='git add' +alias gf='git fetch' +alias gp='git pull' +alias gpo='git push -u origin' +alias grmc='git rm --cached' +alias gs='git status -sb' +alias gm='git commit -m' +alias gcf='git config --list' + +#alias gb='git branch' +#alias gbD='git branch -D' +#alias gba='git branch -a' +#alias gbd='git branch -d' +#alias gcb='git checkout -b' +#alias glgga='git log --graph --decorate=full --all' +#alias glog='git log --oneline --decorate --color --graph' +#alias grmv='git remote rename' +#alias gro='git-rename-origin' +#alias grset='git remote set-url' +#alias grso='git remote show origin' +#alias grv='git remote -v' + +# PS1 + +DEFAULT="\[\033[0m\]" +RED="\[\033[1;31m\]" +GREEN="\[\033[0;32m\]" +BLUE="\[\033[1;34m\]" +EBLACK="\[\033[1;30m\]" +PURPLE="\[\033[35m\]" +YELLOW="\[\033[1;33m\]" +CYAN="\[\033[1;36m\]" + +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' +} + +export PS1="$GREEN[\A \d]$CYAN\u$BLUE@\h $DEFAULT(\!):$YELLOW\w $PURPLE\n\$(parse_git_branch)$DEFAULT > " + +# editor + +export EDITOR='vim' +export VISUAL='vim' + +# language + +LANG="it_IT.UTF-8" +export LANG +export TERM=xterm-256color \ No newline at end of file diff --git a/.inputrc b/.inputrc new file mode 100644 index 0000000..53de1a1 --- /dev/null +++ b/.inputrc @@ -0,0 +1,2 @@ +"\e[5~": history-search-backward +"\e[6~": history-search-forward diff --git a/.profile b/.profile new file mode 100644 index 0000000..060f9e4 --- /dev/null +++ b/.profile @@ -0,0 +1,54 @@ +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/.local/bin" ] ; then + PATH="$HOME/.local/bin:$PATH" +fi + +########## WAYLAND ########## + +export MOZ_ENABLE_WAYLAND=1 # for firefox +export QT_SCREEN_SCALE_FACTORS="1;1" +export XDG_SESSION_TYPE=wayland +export GDK_BACKEND=wayland +export QT_QPA_PLATFORM=wayland +export QT_QPA_PLATFORMTHEME=qt5ct +export SDL_VIDEODRIVER=wayland +export XDG_SESSION_DESKTOP=sway +export AWT_TOOLKIT=MToolkit +#export XDG_CURRENT_DESKTOP=sway dbus-run-session sway + +if [ "$XDG_SESSION_DESKTOP" = "sway" ] ; then + # https://github.com/swaywm/sway/issues/595 + export _JAVA_AWT_WM_NONREPARENTING=1 +fi + +# automatically login into sway +if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then + exec sway +fi + +# https://wiki.archlinux.org/title/GNOME/Keyring#PAM_method +dbus-update-activation-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY + diff --git a/.vimrc b/.vimrc new file mode 100755 index 0000000..a90b118 --- /dev/null +++ b/.vimrc @@ -0,0 +1,384 @@ +" IMPOSTAZIONI ----------------------------------------------------------- + +packadd! dracula +colorscheme dracula +set completeopt=longest,menuone +setlocal complete+=k +set dictionary+=/home/dado/.vim/dict/dict_it.txt +set clipboard=unnamedplus +set wrap +set linebreak +set expandtab +autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE +set spell spelllang=it,en +syntax on " Enable type file detection. Vim will be able to try to detect the type of file in use. +filetype on " Enable plugins and load plugin for the detected file type. +set nocompatible " be iMproved, required +filetype plugin indent on +set omnifunc=syntaxcomplete " Enable Omnicomplete features +filetype plugin on " Load an indent file for the detected file type. +filetype indent on +set foldenable +set autoindent " Automatically guesses the indentation given the previous one +set hlsearch " Automatically highlights search results, to hide them run :noh +set incsearch " Searches incrementally as you type. +set ruler " Shows the rulers +set showcmd " Shows current cursor info +set ignorecase " Ignores cases when searching +set noswapfile " Disables swap files +set undofile " Enable keeping history across sessions, don't forget to mkdir +set undodir=~/.vim/undo/ +set nofixeol " Do not insert a new line at the end of the file automatically +set backspace=indent,eol,start " Enable backspace key to delete stuffs properly +set termguicolors +set relativenumber +set clipboard=unnamedplus +set cursorline " Highlight cursor line underneath the cursor horizontally. +set nobackup " Do not save backup files. +set incsearch " While searching though a file incrementally highlight matching characters as you type. +set ignorecase " Ignore capital letters during search. +set smartcase " This will allow you to search specifically for capital letters. +set showmode " Show the mode you are on the last line. +set showmatch " Show matching words during a search. +set wildmenu " Enable auto completion menu after pressing TAB. +set wildmode=list:longest " Make wildmenu behave like similar to Bash completion. +set foldenable +set foldmethod=indent +set ttyfast " Speed up scrolling in Vim +set encoding=UTF-8 +set updatetime=300 +set signcolumn=yes +" + + +" PLUGINS ---------------------------------------------------------------- + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' +" +" All of your Plugins must be added before the following line +" + +" Plugin 'preservim/nerdtree' +Plugin 'jasonccox/vim-wayland-clipboard' +Plugin 'gabrielelana/vim-markdown' +Plugin 'itchyny/vim-cursorword' +Plugin 'iamcco/markdown-preview.nvim' +Plugin 'iamcco/mathjax-support-for-mkdp' +Plugin 'alvan/vim-closetag' +Plugin 'mattn/emmet-vim' +Plugin 'jiangmiao/auto-pairs' +Plugin 'ryanoasis/vim-devicons' +Plugin 'frazrepo/vim-rainbow' +Plugin 'mg979/vim-visual-multi', {'branch': 'master'} +Plugin 'itchyny/lightline.vim' +Plugin 'voldikss/vim-floaterm' +Plugin 'mracos/mermaid.vim' +Plugin 'mzlogin/vim-markdown-toc' +Plugin 'bbrtj/vim-vorg-md' +Plugin 'sheerun/vim-polyglot' +Plugin 'ervandew/supertab' +Plugin 'Valloric/YouCompleteMe' + +call vundle#end() " required + +" zo + + +" MAPPINGS --------------------------------------------------------------- + +" Mappings code goes here. + +" + + +" VIMSCRIPT -------------------------------------------------------------- + +" This will enable code folding. +" zo per aprire una singola piega sotto il cursore. +" zc per chiudere la piega sotto il cursore. +" zR per aprire tutte le pieghe. +" zM per chiudere tutte le pieghe. + +augroup filetype_vim + autocmd! + autocmd FileType vim setlocal foldmethod=marker +augroup END + +" More Vimscripts code goes here. + +" + + +" PREDICTIVE ------------------------------------------------------------- +" +let g:predictive#dict_path = expand($HOME . '/dict') +let g:predictive#disable_plugin = 0 +" +" + + +" YOUCOMPLETEME ------------------------------------------------------------- +" +let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py' +let g:ycm_confirm_extra_conf=0 +let g:ycm_python_binary_path='/usr/bin/python3' +" +" + + +" NERD-TREE ------------------------------------------------------------- +" +" Start NERDTree and put the cursor back in the other window. +"autocmd VimEnter * NERDTree | wincmd p" +" +" Exit Vim if NERDTree is the only window remaining in the only tab. +"autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif" +" +" Close the tab if NERDTree is the only window remaining in it. +"autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif +" +" Open the existing NERDTree on each new tab. +"autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif + +" + + +" MD-FOLDING ------------------------------------------------------------- +" +let g:markdown_folding = 1 +" +"zo open current fold +"zO recursively open current fold +"zc close current fold +"zC recursively close current fold +"za toggle current fold +"zA recursively open/close current fold +"zm reduce foldlevel by one +"zM close all folds +"zr increase foldlevel by one +"zR open all folds +" + + +" MARK-DOWN-PREVIEW ----------------------------------------------------- +" https://github.com/iamcco/markdown-preview.nvim +" +" set to 1, nvim will open the preview window after entering the markdown buffer +" default: 0 +let g:mkdp_auto_start = 0 + +" set to 1, the nvim will auto close current preview window when change +" from markdown buffer to another buffer +" default: 1 +let g:mkdp_auto_close = 1 + +" set to 1, the vim will refresh markdown when save the buffer or +" leave from insert mode, default 0 is auto refresh markdown as you edit or +" move the cursor +" default: 0 +let g:mkdp_refresh_slow = 0 + +" set to 1, the MarkdownPreview command can be use for all files, +" by default it can be use in markdown file +" default: 0 +let g:mkdp_command_for_global = 0 + +" set to 1, preview server available to others in your network +" by default, the server listens on localhost (127.0.0.1) +" default: 0 +let g:mkdp_open_to_the_world = 0 + +" use custom IP to open preview page +" useful when you work in remote vim and preview on local browser +" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9 +" default empty +let g:mkdp_open_ip = '' + +" specify browser to open preview page +" for path with space +" valid: `/path/with\ space/xxx` +" invalid: `/path/with\\ space/xxx` +" default: '' +let g:mkdp_browser = '' + +" set to 1, echo preview page url in command line when open preview page +" default is 0 +let g:mkdp_echo_preview_url = 0 + +" a custom vim function name to open preview page +" this function will receive url as param +" default is empty +let g:mkdp_browserfunc = '' + +" options for markdown render +" mkit: markdown-it options for render +" katex: katex options for math +" uml: markdown-it-plantuml options +" maid: mermaid options +" disable_sync_scroll: if disable sync scroll, default 0 +" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle' +" middle: mean the cursor position alway show at the middle of the preview page +" top: mean the vim top viewport alway show at the top of the preview page +" relative: mean the cursor position alway show at the relative positon of the preview page +" hide_yaml_meta: if hide yaml metadata, default is 1 +" sequence_diagrams: js-sequence-diagrams options +" content_editable: if enable content editable for preview page, default: v:false +" disable_filename: if disable filename header for preview page, default: 0 +let g:mkdp_preview_options = { + \ 'mkit': {}, + \ 'katex': {}, + \ 'uml': {}, + \ 'maid': {}, + \ 'disable_sync_scroll': 0, + \ 'sync_scroll_type': 'middle', + \ 'hide_yaml_meta': 1, + \ 'sequence_diagrams': {}, + \ 'flowchart_diagrams': {}, + \ 'content_editable': v:false, + \ 'disable_filename': 0, + \ 'toc': {} + \ } + +" use a custom markdown style must be absolute path +" like '/Users/username/markdown.css' or expand('~/markdown.css') +let g:mkdp_markdown_css = '' + +" use a custom highlight style must absolute path +" like '/Users/username/highlight.css' or expand('~/highlight.css') +let g:mkdp_highlight_css = '' + +" use a custom port to start server or empty for random +let g:mkdp_port = '' + +" preview page title +" ${name} will be replace with the file name +let g:mkdp_page_title = '「${name}」' + +" recognized filetypes +" these filetypes will have MarkdownPreview... commands +let g:mkdp_filetypes = ['markdown'] + +" set default theme (dark or light) +" By default the theme is define according to the preferences of the system +let g:mkdp_theme = 'dark' +" + + +" VIM-TAG --------------------------------------------------------------- +" +" filenames like *.xml, *.html, *.xhtml, ... +" These are the file extensions where this plugin is enabled. +" +let g:closetag_filenames = '*.html,*.xhtml,*.phtml' + +" filenames like *.xml, *.xhtml, ... +" This will make the list of non-closing tags self-closing in the specified files. +" +let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' + +" filetypes like xml, html, xhtml, ... +" These are the file types where this plugin is enabled. +" +let g:closetag_filetypes = 'html,xhtml,phtml' + +" filetypes like xml, xhtml, ... +" This will make the list of non-closing tags self-closing in the specified files. +" +let g:closetag_xhtml_filetypes = 'xhtml,jsx' + +" integer value [0|1] +" This will make the list of non-closing tags case-sensitive (e.g. `` will be closed while `` won't.) +" +let g:closetag_emptyTags_caseSensitive = 1 + +" dict +" Disables auto-close if not in a "valid" region (based on filetype) +" +let g:closetag_regions = { + \ 'typescript.tsx': 'jsxRegion,tsxRegion', + \ 'javascript.jsx': 'jsxRegion', + \ 'typescriptreact': 'jsxRegion,tsxRegion', + \ 'javascriptreact': 'jsxRegion', + \ } + +" Shortcut for closing tags, default is '>' +" +let g:closetag_shortcut = '>' + +" Add > at current position without closing the current tag, default is '' +" +let g:closetag_close_shortcut = '>' + +" + + +" EMMET-PLUGIN --------------------------------------------------------- +let g:user_emmet_settings = { + \ 'variables': {'lang': 'ja'}, + \ 'html': { + \ 'default_attributes': { + \ 'option': {'value': v:null}, + \ 'textarea': {'id': v:null, 'name': v:null, 'cols': 10, 'rows': 10}, + \ }, + \ 'snippets': { + \ 'html:5': "\n" + \ ."\n" + \ ."\n" + \ ."\t\n" + \ ."\t\n" + \ ."\t\n" + \ ."\t\n" + \ ."\n" + \ ."\n\t${child}|\n\n" + \ ."", + \ }, + \ }, + \} +" + + +" RAINBOW PARENTHESES -------------------------------------------------- +" https://github.com/frazrepo/vim-rainbow + +let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta'] + + + + +" MULTI-CURSOR --------------------------------------------------------- +" https://github.com/mg979/vim-visual-multi + +"To make a basic selection, use the Ctrl+N keystroke in normal mode, followed by a motion: +"c – change text. +"I – insert at start of range. +"A – insert at end of range. +let g:multi_cursor_use_default_mapping=0 + +" Default mapping +let g:multi_cursor_start_word_key = '' +let g:multi_cursor_select_all_word_key = '' +let g:multi_cursor_start_key = 'g' +let g:multi_cursor_select_all_key = 'g' +let g:multi_cursor_next_key = '' +let g:multi_cursor_prev_key = '' +let g:multi_cursor_skip_key = '' +let g:multi_cursor_quit_key = '' + + + + +" VIM-LIGHTLINE --------------------------------------------------------- +" https://github.com/itchyny/lightline.vim + +let g:lightline = { + \ 'colorscheme': 'wombat', + \ } + +" +" + diff --git a/LICENSE b/LICENSE index e53f163..d41c0bd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 -Copyright © 2007 Free Software Foundation, Inc. +Copyright © 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -208,25 +208,25 @@ If you develop a new program, and you want it to be of the greatest possible use To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. - swayDotfiles - Copyright (C) 2024 dado + + Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along with this program. If not, see . + You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - swayDotfiles Copyright (C) 2024 dado + Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. -You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . -The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/README.md b/README.md index ce8a8eb..cf940b5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,99 @@ -# swayDotfiles +# Sway on Debian SID -my dots \ No newline at end of file +My dotfiles. See [here](https://gitea.it/PicciHud/Wallpapers) for the wallpapers + +```bash +sudo apt update && sudo apt -y upgrade --no-install-recommends +``` + +## Install Sway and utilities + +```bash +sudo apt install vim wget git apt-transport-https curl gnupg vim-gtk3 nala neofetch megatools grimshot vrms brightnessctl brightness-udev qtwayland5 pavucontrol arc-theme gtk2-engines-murrine firefox-esr pulseaudio btop qt5ct virtualbox virtualbox-guest-additions-iso screen libgtk-layer-shell0 sway swaylock swayidle swaybg wofi waybar lxappearance thunar thunar-archive-plugin thunar-volman file-roller dex mako-notifier acpi libnm0 network-manager network-manager-gnome sysstat wayland-protocols xwayland wl-clipboard dex jq pavucontrol unzip unrar feh gnome-applets lshw network-manager-openvpn profile-sync-daemon wl-clipboard clipman slurp grim blueman rfkill pulseaudio-utils pulseaudio-module-bluetooth xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk --no-install-recommends --no-install-suggests +``` + +## PolicyKit + +```bash +sudo apt install policykit-1-gnome +``` + +### PolicyKit rules + +Create the following rules + +```bash + > cat /etc/polkit-1/localauthority.conf.d/51-debian-sudo.conf +[Configuration] +AdminIdentities=unix-group:sudo + + > sudo cat /etc/polkit-1/rules.d/49-nopasswd_global.rules +[sudo] password di dado: +/* Allow members of the sudo group to execute any actions + * * without password authentication, similar to "sudo NOPASSWD:" + * */ +polkit.addRule(function(action, subject) { + if (subject.isInGroup("sudo")) { + return polkit.Result.YES; + } +}); + + > sudo cat /etc/polkit-1/rules.d/50-default.rules +polkit.addAdminRule(function(action, subject) { + return ["unix-group:sudo"]; +}); +``` +## adb rules + +See [Here](https://gitea.it/PicciHud/mywiki/src/branch/master/android/adb.md) for more details + +```bash + > cat /etc/udev/rules.d/51-android.rules +SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0666", GROUP="plugdev" +SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", ATTR{idProduct}=="78fd", MODE="0666", GROUP="plugdev" +``` +## Main programs + +```bash +sudo apt install ncdu arc exa alacritty openjdk-21-jre seahorse gammastep speedtest-cli python3 python3-pip postgresql android-tools-adb android-tools-fastboot telegram-desktop ipcalc nextcloud-desktop syncthing pandoc openssh-server papirus-icon-theme wget wike foliate orage galculator ncal poppler-utils smartmontools ufw hw-probe duf cmus cava udisks2 fuse3 ntfs-3g clamav python3-venv bash-completion lsof multitail dnsutils nala zathura zathura-cb mpv mousepad ristretto mtp-tools jmtpfs libudisks2-dev gvfs gvfs-backends gvfs-fuse cups system-config-printer pipx feh ranger tmux iptraf-ng profile-sync-daemon kitty flatpak libavcodec-extra libwayland-dev pamix --no-install-recommends +``` + +### Ranger addictions + +```bash +sudo apt install atool tar sed ffmpeg mediainfo odt2txt imagemagick python3-pil highlight poppler-utils gnome-epub-thumbnailer --no-install-recommends +``` + +### Thunar addictions + +```bash +sudo apt install tumbler tumbler-plugins-extra ffmpegthumbnailer thunar-archive-plugin --no-install-recommends +``` + +### rnr and other programs + +```bash +sudo apt install grimshot --no-install-recommends +pipx install autotiling shotman pipx ensurepath pipx list sleep 5 +sudo apt install archivemount pipx install rnr +``` +## Remove the following programs + +```bash +sudo apt remove debian-reference-it debian-reference-common debian-faq doc-debian -y +``` + +## Gnome-keyring + +```bash +> cat /usr/share/xdg-desktop-portal/portals/gnome-keyring.portal +> +[portal] +DBusName=org.freedesktop.secrets +Interfaces=org.freedesktop.impl.portal.Secret +UseIn=gnome;sway +``` + +## Credits + +[Sway EndeavourOS Community Edition](https://github.com/EndeavourOS-Community-Editions/sway) diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml new file mode 100644 index 0000000..596b309 --- /dev/null +++ b/alacritty/alacritty.toml @@ -0,0 +1,40 @@ +import = ["/home/dado/git/alacritty-master/dracula.toml"] + +[cursor.style] +blinking = "On" +shape = "Beam" + +[font] +size = 12.0 + +[font.bold] +family = "Ubuntu Mono" +style = "Bold" + +[font.bold_italic] +family = "Ubuntu Mono" +style = "Bold Italic" + +[font.italic] +family = "Ubuntu Mono" +style = "Italic" + +[font.normal] +family = "Ubuntu Mono" +style = "Retina" + +[font.offset] +x = 0 +y = 1 + +[window] +dynamic_padding = true +opacity = 0.97 + +[window.padding] +x = 5 +y = 0 + +[window.position] +x = 75 +y = 75 diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..d7a8e45 --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,76 @@ +import: + - ~/git/alacritty-master/dracula.yml +window: + opacity: 0.97 + # Window position (changes require restart) + # + # Specified in number of pixels. + # If the position is not set, the window manager will handle the placement. + position: + x: 75 + y: 75 + # Window padding (changes require restart) + # + # Blank space added around the window in pixels. This padding is scaled + # by DPI and the specified value is always added at both opposing sides. + padding: + x: 5 + y: 0 + # Spread additional padding evenly around the terminal content. + dynamic_padding: true + +cursor: + style: + shape: Beam + blinking: On + +# Font configuration +font: + # Normal (roman) font face + normal: + # Font family + family: Ubuntu Mono + + # The `style` can be specified to pick a specific face. + style: Retina + + # Bold font face + bold: + # Font family + # + # If the bold family is not specified, it will fall back to the + # value specified for the normal font. + family: Ubuntu Mono + + # The `style` can be specified to pick a specific face. + style: Bold + + # Italic font face + italic: + # Font family + # + # If the italic family is not specified, it will fall back to the + # value specified for the normal font. + family: Ubuntu Mono + + # The `style` can be specified to pick a specific face. + style: Italic + + # Bold italic font face + bold_italic: + # Font family + # + # If the bold italic family is not specified, it will fall back to the + # value specified for the normal font. + family: Ubuntu Mono + + # The `style` can be specified to pick a specific face. + style: Bold Italic + + # Point size + size: 12.0 + + # padding + offset: + x: 0 # For letter spacing (default: 0). + y: 1 # For line spacing (default: 0). diff --git a/fcd/bookmarks b/fcd/bookmarks new file mode 100644 index 0000000..12fa16c --- /dev/null +++ b/fcd/bookmarks @@ -0,0 +1,5 @@ +c:/home/dado/.config/fcd +d:/home/dado/Downloads +g:/home/dado/git +h:/home/dado +n:/home/dado/Nextcloud diff --git a/fcd/fcd-config.toml b/fcd/fcd-config.toml new file mode 100644 index 0000000..651afb2 --- /dev/null +++ b/fcd/fcd-config.toml @@ -0,0 +1,102 @@ +[options] +opener = "xdg-open" +pager = "less" +editor = "vim" + +show_button_bar = true +use_shadows = false +use_internal_viewer = true + +[ui] +hotkey_fg = "white" +hotkey_bg = "black" +selected_fg_root = "black" +selected_fg_user = "black" +selected_bg_root = "red" +selected_bg_user = "blue" + +marked_fg = "magenta" +markselect_fg_root = "black" +markselect_fg_user = "black" + +shadow_fg = "dark gray" +shadow_bg = "black" + +error_fg = "light red" +error_bg = "reset" + +[panel] +fg = "gray" +bg = "black" +reverse_fg = "black" +reverse_bg = "gray" + +[error] +fg = "white" +bg = "red" +title_fg = "light yellow" +focus_fg = "black" +focus_bg = "gray" + +[dialog] +fg = "black" +bg = "gray" +title_fg = "light blue" +focus_fg = "black" +focus_bg = "cyan" + +input_fg = "black" +input_bg = "cyan" + +[file_manager] +directory_fg = "white" +dir_symlink_fg = "white" +executable_fg = "light green" +symlink_fg = "gray" +stalelink_fg = "light red" +device_fg = "light magenta" +special_fg = "black" +archive_fg = "light magenta" + +[viewer] +tab_size = 4 + +lineno_fg = "white" +hex_even_fg = "cyan" +hex_odd_fg = "gray" +hex_text_even_fg = "cyan" +hex_text_odd_fg = "gray" + +[highlight] +# Default Background +base00 = "blue" + +# Comments, Invisibles, Line Highlighting +base03 = "cyan" + +# Default Foreground, Caret, Delimiters, Operators +base05 = "gray" + +# Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted +base08 = "light yellow" + +# Integers, Boolean, Constants, XML Attributes, Markup Link Url +base09 = "light magenta" + +# Classes, Markup Bold, Search Text Background +base0A = "light red" + +# Strings, Inherited Class, Markup Code, Diff Inserted +base0B = "light cyan" + +# Support, Regular Expressions, Escape Characters, Markup Quotes +base0C = "white" + +# Functions, Methods, Attribute IDs, Headings +base0D = "light red" + +# Keywords, Storage, Selector, Markup Italic, Diff Changed +base0E = "light yellow" + +# Deprecated, Opening/Closing Embedded Language Tags, e.g. `` +base0F = "light yellow" \ No newline at end of file diff --git a/kitty/diff.conf b/kitty/diff.conf new file mode 100644 index 0000000..5fec447 --- /dev/null +++ b/kitty/diff.conf @@ -0,0 +1,19 @@ +foreground #f8f8f2 +background #282a36 +title_fg #f8f8f2 +title_bg #282a36 +margin_bg #6272a4 +margin_fg #44475a +removed_bg #ff5555 +highlight_removed_bg #ff5555 +removed_margin_bg #ff5555 +added_bg #50fa7b +highlight_added_bg #50fa7b +added_margin_bg #50fa7b +filler_bg #44475a +hunk_margin_bg #44475a +hunk_bg #bd93f9 +search_bg #8be9fd +search_fg #282a36 +select_bg #f1fa8c +select_fg #282a36 diff --git a/kitty/dracula.conf b/kitty/dracula.conf new file mode 100644 index 0000000..8f05c52 --- /dev/null +++ b/kitty/dracula.conf @@ -0,0 +1,66 @@ +# https://draculatheme.com/kitty +# +# Installation instructions: +# +# cp dracula.conf ~/.config/kitty/ +# echo "include dracula.conf" >> ~/.config/kitty/kitty.conf +# +# Then reload kitty for the config to take affect. +# Alternatively copy paste below directly into kitty.conf + +foreground #f8f8f2 +background #282a36 +selection_foreground #ffffff +selection_background #44475a + +url_color #8be9fd + +# black +color0 #21222c +color8 #6272a4 + +# red +color1 #ff5555 +color9 #ff6e6e + +# green +color2 #50fa7b +color10 #69ff94 + +# yellow +color3 #f1fa8c +color11 #ffffa5 + +# blue +color4 #bd93f9 +color12 #d6acff + +# magenta +color5 #ff79c6 +color13 #ff92df + +# cyan +color6 #8be9fd +color14 #a4ffff + +# white +color7 #f8f8f2 +color15 #ffffff + +# Cursor colors +cursor #f8f8f2 +cursor_text_color background + +# Tab bar colors +active_tab_foreground #282a36 +active_tab_background #f8f8f2 +inactive_tab_foreground #282a36 +inactive_tab_background #6272a4 + +# Marks +mark1_foreground #282a36 +mark1_background #ff5555 + +# Splits/Windows +active_border_color #f8f8f2 +inactive_border_color #6272a4 diff --git a/kitty/kitty.conf b/kitty/kitty.conf new file mode 100644 index 0000000..8acb4a1 --- /dev/null +++ b/kitty/kitty.conf @@ -0,0 +1,9 @@ +background_opacity 0.97 +include dracula.conf +font_family Ubuntu Mono +bold_font auto +italic_font auto +bold_italic_font auto +font_size 12.0 +cursor_shape beam +cursor_beam_thickness 1.5 diff --git a/mako/config b/mako/config new file mode 100644 index 0000000..ae4922a --- /dev/null +++ b/mako/config @@ -0,0 +1,23 @@ +font=UbuntuMono 12.5 + +background-color=#404552 +text-color=#e5e9f0 +width=315 +height=200 +padding=10 +margin=10 +progress-color=over #eceff480 +icon-path=/usr/share/icons/Arc-X-D +max-icon-size=70 +layer=overlay + +border-size=5 +border-radius=0 +border-color=#5294e2 + +default-timeout=5000 + +[urgency=high] + +ignore-timeout=1 + diff --git a/ranger/colorschemes/__init__.py b/ranger/colorschemes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ranger/colorschemes/__pycache__/__init__.cpython-311.opt-1.pyc b/ranger/colorschemes/__pycache__/__init__.cpython-311.opt-1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e91ff851661ec56638da0c942b3a262f6ca6e902 GIT binary patch literal 159 zcmZ3^%ge<81ShM$q=4whAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnFC+bo{M=Oi zl*E*LeZA!TytK@8{i4LY^wc8#88^74EG|<^{I}j6dw&UF!rCMtR*489y9Or_7%7WFG$D-I(>-?M>26cq zV`IlgC_;)?S|#3y)pCGn6-5L@qHxH;hbZEjn-^J%)zV5UMLGCpv>YOG$@i*zs>k-2 z-Q3c)%T=#lzj{^gz3;v1KNO2O3D4hGzA$HoB#;_tE#EIEmbvBMVq3%SJP$+ZN^Na&6*js zx|v0rGj*ImF3e0aquy#7yG6*Vx2;19r13{5cK1!RH>6ehHKOu|Wdo(%m!vh#%>-KK z7`)=F{R~E8mT9KE1})bVP{nF26BIh$r@2gf%nGYor}UKpTG3Rwgsk9t1n=l#RP6eW zwx+m4;N#v&yiA2Qidz6JFWyzn6ljW><|_!jxE?3kT#^*)k>OlDZ91cs4|8Q9@!MFX zB={Z=&b0dyovqjj`eIG=%WW?7``Z16_5pn0Tj>a`c0e~<`YWp2nn!D^sqem2gOJ+Q?4A_3uqAYJP4llK=My@m8k^df<+1*OZp9E zv28oW%ya$3q<;dEkGF?>H{xV)0)-<_pwfPaJd0>sw8$9#|$LpJ2Uc!j$DK1k3oxn8(8OjK@rL=~aNBS8q8$ zurTFVrfq~Nn-DEbE!w8#g(;(D+Fq#FJz$*e;w|#kP&aLcMLf0~=BziYdMhwynpUV9 z?sBL#?1mSneXl-m0r^a8(XInDo3;x8o%K93%mv15%`w!VbtVbhH;Lt0vI1fkNH4V9VMP&0yn z`E*XF>G|>-6LX$pO_+x1O^k!NVb4x5!=1I*M2x_M_x^+#!R7eEa@Yf;wj0Z}8Rjkd z7F!vLp>%vdojkyQ31)dq+R68A=PP@Xs-L*se`0-deez%Z$JZx8zWSX#Nzwb?oqF#D z-q|VltzV29Og_CQ$@=lz1rad@Y9 z;QjQqo(*khaA-r>PZHp(02 z50zMP+POY_b9Vc|CwVW~LaBVc{{DrHSGP*%@Ee~^bQGnb?Gm;HwQj!r`=9d8CsTi! z?yl%|{$wOMerum{k-kb~l}O+Cu&;iXPUP55ssH-y73@hZ9uqpiZg=R^Pm>Gu^PS%* zl{db*5v;FnWh-~#T>H~D0R#Qr{S_LdZ7sn6_7f#7K#fQpNNe(I0+twx2!J)xvr8Z- zk~n}03D+fPO;ULdqa=kZcuRG4&XlCaz6{8HDj=qV+Z1}JuyQsduR}d*}`@0 zN@1N`hDT%;XA7U1-zq;$K6CT+^^37j!=mZ<;5p?goB&QvLAFZn7n$nc!LQQO>(MiV%HL=hDEG>!%NeV=fgHi>>R9vn^$vm;p z{k=uWsIw&N-=`0yzmApTm7?-V&{<|xN(!_!6%vGotY}ghwNFY(T0v2@rhzXh&5GQg zj^Yz#6XcP`-T4x4%uYv+cnaoWXQ-jFfxBenrsSch@be26b8Mfk1AgR-Q^fZzYAEIL zY#OE;%v<4AzvcUsCeuyNFp;nN7MO<%f$!JgoKZO+W)|x{PggoRbV zZ|vlLU<56nynOh8my4MNsO0|#O`LByBmrEwziI+nC>J0VDKUWqj= zYy$ofKp!;;6jKSshOYiRk}GhTl1(gI*2i|rgWKhYIVcnIDf$V4_%Cfdd*ub55aR^Y zZR&`ZI$`lELT&{ob0FjZdfdU2u%nt!09`wH;EGAO(LEyJ&%(I{KY)^)JsGPV5U5OZ z;2TSYDUM6*T-$@#H1%Gj<||>&@aGq8Yw0k|#S_1V1pg;!xc#Xn5Q!rOJ6Rv0+&6XQ z#q~)f7qY6RpNHXis#A;ScLtAd4?ap2!=1QypNIQ9EPF8LbVPD;U=gl8i9<|qjb97h zNB13bL^}(bIL|+q1aJqqwHxxvL4=1tVT+*iGwD!5Gtj zi}(Fspo#L-z((pyG0s$o<$PQq#pwyPiGGNZ*-zmJ5S3L?3ae41b`W^w)~+z`)6~C# zg7;%;ego??GTpcz>SE;4E=HzA(`jV7!5=I!=vzW!T9g>Py5Odz>VjK3E-~0EAaJ9( zo@;SK&RBD{Ylc~zy)kDQxL%-#uRj)peOZ+Rbc@C|9)p=#ju%*m@L0_J88ZB3GzZN| zIHsfKpMB5c9gc#rSz$6NvZ?5fDZF~!M?p!b?&pCsh*<9^5+gJeHh?M=B!p#mp8)lS z)LA0F0{R*X44!(EfX#IBT&6D;LLM7km2L`TgjDgY%8_M0K=6Jn0ytU0o!Vz}k|V4w zgrIXzIp-iJ3H%Yr5#Nvg7deoU6f9+ok}pb>5e5=jqL5CC6IxZ2APMKawZ}U2@r^(H z+k=2DpH76}6biwBjqw`6mlBVLjQk#eV-%DyooXOK;eT+T|g(=iFxXtHq zDUWZ$>=M!QAhb(w_5-36KoMmMyG$gFU&{44dv>mgzaXlm_^WX`V?QQ70$Re%C|$lv zB!b~6_Lzxr*DzIEzO|BXS4tTC4V=COw|+~yee7$v0pN1Dp-~bI^wT^w(+#kA znl8JUYbCBTzi!IdmF?hc4Wo)(3%SdMqDi zYc;yq)oNj`R&zYF)ueu*R(ri=G^3fQ@*&UR&cfY;+n$lNBNKb*eI#)><99zsUm1Br zNbmm=&0FGU=XhmH8`{$@$*GY&siXa&QXqjOE$Nw~e(y-*Tl;_alpa~xlm6eDv(Kn9Y}LJ8pZ}cCd~w7)Kdt`)ZEYZ( literal 0 HcmV?d00001 diff --git a/ranger/colorschemes/__pycache__/zenburn.cpython-311.opt-1.pyc b/ranger/colorschemes/__pycache__/zenburn.cpython-311.opt-1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..971bf2d094538d215ff300d90dda3df6b860c913 GIT binary patch literal 4437 zcma)9&2JmW6`%bemlU~{Xo;3-OR^L@QIsZ<9iw$V+!%FS6i8ejs-S3@qQr{3qSoT> zy0c3ucBM2yQ@{p%paG|LQ5*0fNE{?6P@sn%`bVe$3lIw!6;Sk`_E5Uc!N{q^LQuLL^hdh1sU(9Z?fUxfKGvM3uwz92m zNf&#T7}t_K%M5F=zNW-~4LXjTXM#*m8+56z7Kpq@n9xi1#p7#`)Or+GO=(*;VI63! zgUhC}Ed$BMe6pzuB-RU_lt6L`p0q&n2}Bc!9wYfJHJIvAj9r-^f5`_}8|~p-AIg>4 zmfhFDHx~1q4375Zj54&pM`0e@#2mdBJ($B{^sK6%BHLfY8TW_#mKDCmQao>t02vZR z(vHY-v1f^on>nGSkBmG;!+}^vhrY>}lFf`OnaHo17qy~B6c6eURj(8yhaegEhCe>k zl5FZ5j4M=U7kw&xtihC@AlB9_BF3LS%tbiIfx$&V#%@~1^N9cvk$Yg8C|W@4^U z_#Ss9x&^g@&-=C&w~bMD{|4?OG56V_kxCb5V~#xdlbMr{Q&iLaBk+FrDJFH=XTauS z$q`V=YK*{#-vaB`OQ!0$*MU6~OZ^5^+@XAYK!-wkbhE$)JQ5k`=V@Xvrh#l=7kBqh zl(%ECU9!~IIy~1=&7X~Bv@Le=xgI5YY`#ZvonjmGWRzXmM|&5Ro=@;mpAYPf1m8l; zSAf(DF-6^ytg<*0!11k^;}obDV@hNiNZhZY--c=EM|WU=KQj=k?0z%$mtt$nNlE|w zQ=?mqC8$GX_e01nB{1aM-2`_03Csa@B7sp?RDr$x1ol&4Cu2+t)_QY#d$@05_1is! zzX>YNj(_^8K0j$=9&+D_wJ3BhxYNK+B{1r8>aSN47{yDS+>b3fQ{*jWOI@XR{zC4gzBoj z>V;|FtFFVVv}tYFRa`LYw!0pxHP16cWyLVVk-(@`9D}dJ2?ct>bk)0LTV|MZV2>^+ z4aW`Bg2N0oh}bUl=CBsnLETz05ayca2d?430r(N-vE~Ox(C}$7cgf<8?fbUp;-ceN zzE6Rs>z-l4%Kl5-t08fI1-#L9DAYEpzA%!-r0O}29fWFNy@xcc*|oJgK0)Mw;jeGl z)@GOzt_Zb2M+b>#n!yhNK;C5=<8T%WhSy+cjLjP%_%Y zf{9y>7g%DtVy)S(8D_w5tXW7OSu$;0-k=5-I~4_A4K=D3`75v1LV2YYszwlSpL$@H zp07_Xt$B{MWExcNrA4r>+O;K4KJumLPAIO5{?e7`61RBia;P+X>q@SBt6Ky?cMtzR z=)DivgUM&F<*&+D&oJu&f$V2vXAnnlutw6eL>H5G@nBPq1}whcVUk{oN$`GyJlHNyLL$-ksPrP(`E_clLy zzoST{QxBO`eB~<|Itmy&X;vr>s;3xaeLAuhn}EApl#aREn|Hu~NyIRI=;j*;vM|@4 zIC%Hmjq}ZO6d72NqxRI%JLh+bCz{L6<@?n{mVP;qme%N8ho$uC`}3_AUK6u^WaGu# zrRJIDnRaQadA50Wm%iHLhg#!^6Bh1IetB3-{;d6FUt}{`j@IZik-o0PfSZx$a$&mf zxzG;xe?>{0YL8Feoxg$Tl)_ZIbU3n)ug9WMP=i_YNq+3(bJxyarKm*#Gf~)Y?-Y-V zu$P;1w=!@g-E9ql+=S<-0HV2hnld;oVtkA$-kj>^Co+ZvO>~wlKxV=SZWntgu_uESt_n}V^nOwR&J)la@iB4J+W7IyU85jjv`X^6TSK? zg%j=4bgOhcs!TK^lV>{YP_}gMRO{$TF{2{A)BOImA9l-x6y~VGu?@SmK{sW)E#F79 zL8RMC)L&8k#PJaAlfICoPd_M5HRY&oBD&JO&DQ)WinBE62^ArmY>8F@MrdcpMp^~2 zHwKVnR5~C7?)MIk-O)nxNL++D!*tL z^=O5^4qm>D;d92{q4|$!pr4LnpjWw1*QF2QKlJO4dZ42&%PBPM@G(+FS}rVP!voRD zy;y75ILql5y*Rx&U3L-N7o_?J<9R>CVe-{h%1JVBw r0}ee&>WndIX@@N)|J&^Co&WE@llieMA;RI~)%AyB<*TQx3m5+fpF1PZ literal 0 HcmV?d00001 diff --git a/ranger/colorschemes/dracula.py b/ranger/colorschemes/dracula.py new file mode 100644 index 0000000..bef0e2c --- /dev/null +++ b/ranger/colorschemes/dracula.py @@ -0,0 +1,218 @@ +# This file is part of ranger, the console file manager. +# License: GNU GPL version 3, see the file "AUTHORS" for details. +# This theme was greatly inspired by "RougarouTheme" for ranger +# It can be found in: `https://github.com/RougarouTheme/ranger` + +from __future__ import absolute_import, division, print_function + +from ranger.gui.colorscheme import ColorScheme +from ranger.gui.color import ( + black, + blue, + cyan, + green, + magenta, + red, + white, + yellow, + default, + normal, + bold, + reverse, + default_colors, +) + + +class Dracula(ColorScheme): + progress_bar_color = 13 + + def verify_browser(self, context, fg, bg, attr): + if context.selected: + attr = reverse + else: + attr = normal + if context.empty or context.error: + bg = 1 + fg = 0 + if context.border: + fg = default + if context.document: + attr |= normal + fg = 13 + if context.media: + if context.image: + attr |= normal + fg = 3 + elif context.video: + fg = 1 + elif context.audio: + fg = 6 + else: + fg = 10 + if context.container: + attr |= bold + fg = 9 + if context.directory: + attr |= bold + fg = 4 + elif context.executable and not any( + (context.media, context.container, context.fifo, context.socket) + ): + attr |= bold + fg = 2 + if context.socket: + fg = 5 + attr |= bold + if context.fifo or context.device: + fg = 3 + if context.device: + attr |= bold + if context.link: + fg = 6 if context.good else 13 + if context.tag_marker and not context.selected: + attr |= bold + if fg in (red, magenta): + fg = 1 + else: + fg = 15 + if not context.selected and (context.cut or context.copied): + fg = 8 + attr |= bold + if context.main_column: + if context.selected: + attr |= bold + if context.marked: + attr |= bold + fg = 11 + if context.badinfo: + if attr & reverse: + bg = 5 + else: + fg = 5 + + if context.inactive_pane: + fg = 6 + + return fg, bg, attr + + def verify_titlebar(self, context, fg, bg, attr): + attr |= bold + if context.hostname: + fg = 1 if context.bad else 2 + elif context.directory: + fg = 4 + elif context.tab: + if context.good: + bg = 2 + elif context.link: + fg = 6 + + return fg, bg, attr + + def verify_statusbar(self, context, fg, bg, attr): + if context.permissions: + if context.good: + fg = 2 + elif context.bad: + bg = 5 + fg = 8 + if context.marked: + attr |= bold | reverse + fg = 3 + if context.frozen: + attr |= bold | reverse + fg = 6 + if context.message: + if context.bad: + attr |= bold + fg = 1 + if context.loaded: + bg = self.progress_bar_color + if context.vcsinfo: + fg = 4 + attr &= ~bold + if context.vcscommit: + fg = 3 + attr &= ~bold + if context.vcsdate: + fg = 6 + attr &= ~bold + + return fg, bg, attr + + def verify_taskview(self, context, fg, bg, attr): + if context.title: + fg = 4 + + if context.selected: + attr |= reverse + + if context.loaded: + if context.selected: + fg = self.progress_bar_color + else: + bg = self.progress_bar_color + + return fg, bg, attr + + def verify_vcsfile(self, context, fg, bg, attr): + attr &= ~bold + if context.vcsconflict: + fg = 5 + elif context.vcschanged: + fg = 1 + elif context.vcsunknown: + fg = 1 + elif context.vcsstaged: + fg = 2 + elif context.vcssync: + fg = 2 + elif context.vcsignored: + fg = default + + return fg, bg, attr + + def verify_vcsremote(self, context, fg, bg, attr): + attr &= ~bold + if context.vcssync or context.vcsnone: + fg = 2 + elif context.vcsbehind: + fg = 1 + elif context.vcsahead: + fg = 6 + elif context.vcsdiverged: + fg = 5 + elif context.vcsunknown: + fg = 1 + + return fg, bg, attr + + def use(self, context): + fg, bg, attr = default_colors + + if context.reset: + return default_colors + + elif context.in_browser: + fg, bg, attr = self.verify_browser(context, fg, bg, attr) + + elif context.in_titlebar: + fg, bg, attr = self.verify_titlebar(context, fg, bg, attr) + + elif context.in_statusbar: + fg, bg, attr = self.verify_statusbar(context, fg, bg, attr) + + if context.text: + if context.highlight: + attr |= reverse + + if context.in_taskview: + fg, bg, attr = self.verify_taskview(context, fg, bg, attr) + + if context.vcsfile and not context.selected: + fg, bg, attr = self.verify_vcsfile(context, fg, bg, attr) + + elif context.vcsremote and not context.selected: + fg, bg, attr = self.verify_vcsremote(context, fg, bg, attr) + + return fg, bg, attr diff --git a/ranger/colorschemes/zenburn.py b/ranger/colorschemes/zenburn.py new file mode 100644 index 0000000..ca75f23 --- /dev/null +++ b/ranger/colorschemes/zenburn.py @@ -0,0 +1,163 @@ +# Ivaylo Kuzev , 2014 +# Zenburn like colorscheme for https://github.com/hut/ranger . + +# default colorscheme. +# Copyright (C) 2009-2013 Roman Zimbelmann +# This software is distributed under the terms of the GNU GPL version 3. + +from ranger.gui.colorscheme import ColorScheme +from ranger.gui.color import default_colors, reverse, bold, normal, default + + +# pylint: disable=too-many-branches,too-many-statements +class Zenburn(ColorScheme): + progress_bar_color = 108 + + def use(self, context): + fg, bg, attr = default_colors + + if context.reset: + return default_colors + + elif context.in_browser: + if context.selected: + attr = reverse + else: + attr = normal + if context.empty or context.error: + fg = 174 + bg = 235 + if context.border: + fg = 248 + if context.image: + fg = 109 + if context.video: + fg = 66 + if context.audio: + fg = 116 + if context.document: + fg = 151 + if context.container: + attr |= bold + fg = 174 + if context.directory: + attr |= bold + fg = 223 + elif context.executable and not \ + any((context.media, context.container, + context.fifo, context.socket)): + attr |= bold + fg = 108 + if context.socket: + fg = 180 + attr |= bold + if context.fifo or context.device: + fg = 144 + if context.device: + attr |= bold + if context.link: + fg = 223 if context.good else 116 + bg = 234 + if context.bad: + bg = 235 + if context.tag_marker and not context.selected: + attr |= bold + if fg in (174, 95): + fg = 248 + else: + fg = 174 + if not context.selected and (context.cut or context.copied): + fg = 108 + bg = 234 + if context.main_column: + if context.selected: + attr |= bold + if context.marked: + attr |= bold + fg = 223 + if context.badinfo: + if attr & reverse: + bg = 95 + else: + fg = 95 + + elif context.in_titlebar: + attr |= bold + if context.hostname: + fg = 174 if context.bad else 180 + elif context.directory: + fg = 223 + elif context.tab: + if context.good: + bg = 180 + elif context.link: + fg = 116 + + elif context.in_statusbar: + if context.permissions: + if context.good: + fg = 108 + elif context.bad: + fg = 174 + if context.marked: + attr |= bold | reverse + fg = 223 + if context.message: + if context.bad: + attr |= bold + fg = 174 + if context.loaded: + bg = self.progress_bar_color + if context.vcsinfo: + fg = 116 + attr &= ~bold + if context.vcscommit: + fg = 144 + attr &= ~bold + + if context.text: + if context.highlight: + attr |= reverse + + if context.in_taskview: + if context.title: + fg = 116 + + if context.selected: + attr |= reverse + + if context.loaded: + if context.selected: + fg = self.progress_bar_color + else: + bg = self.progress_bar_color + + if context.vcsfile and not context.selected: + attr &= ~bold + if context.vcsconflict: + fg = 95 + elif context.vcschanged: + fg = 174 + elif context.vcsunknown: + fg = 174 + elif context.vcsstaged: + fg = 108 + elif context.vcssync: + fg = 108 + elif context.vcsignored: + fg = default + + elif context.vcsremote and not context.selected: + attr &= ~bold + if context.vcssync: + fg = 108 + elif context.vcsbehind: + fg = 174 + elif context.vcsahead: + fg = 116 + elif context.vcsdiverged: + fg = 95 + elif context.vcsunknown: + fg = 174 + + return fg, bg, attr diff --git a/ranger/rc.conf b/ranger/rc.conf new file mode 100644 index 0000000..e4d47e4 --- /dev/null +++ b/ranger/rc.conf @@ -0,0 +1,761 @@ +# =================================================================== +# This file contains the default startup commands for ranger. +# To change them, it is recommended to create either /etc/ranger/rc.conf +# (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom +# commands there. +# +# If you copy this whole file there, you may want to set the environment +# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice. +# +# The purpose of this file is mainly to define keybindings and settings. +# For running more complex python code, please create a plugin in "plugins/" or +# a command in "commands.py". +# +# Each line is a command that will be run before the user interface +# is initialized. As a result, you can not use commands which rely +# on the UI such as :delete or :mark. +# =================================================================== + +# =================================================================== +# == Options +# =================================================================== + +set preview_images true + +# Which viewmode should be used? Possible values are: +# miller: Use miller columns which show multiple levels of the hierarchy +# multipane: Midnight-commander like multipane view showing all tabs next +# to each other +set viewmode miller +#set viewmode multipane + +# How many columns are there, and what are their relative widths? +set column_ratios 5,5 + +# Which files should be hidden? (regular expression) +set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ + +# Show hidden files? You can toggle this by typing 'zh' +set show_hidden false + +# Ask for a confirmation when running the "delete" command? +# Valid values are "always", "never", "multiple" (default) +# With "multiple", ranger will ask only if you delete multiple files at once. +set confirm_on_delete never + +# Use non-default path for file preview script? +# ranger ships with scope.sh, a script that calls external programs (see +# README.md for dependencies) to preview images, archives, etc. +#set preview_script ~/.config/ranger/scope.sh + +# Use the external preview script or display simple plain text or image previews? +set use_preview_script true + +# Automatically count files in the directory, even before entering them? +set automatically_count_files true + +# Open all images in this directory when running certain image viewers +# like feh or sxiv? You can still open selected files by marking them. +set open_all_images true + +# Be aware of version control systems and display information. +set vcs_aware false + +# State of the four backends git, hg, bzr, svn. The possible states are +# disabled, local (only show local info), enabled (show local and remote +# information). +set vcs_backend_git enabled +set vcs_backend_hg disabled +set vcs_backend_bzr disabled +set vcs_backend_svn disabled + +# Truncate the long commit messages to this length when shown in the statusbar. +set vcs_msg_length 40 + +# Use one of the supported image preview protocols +set preview_images true + +# Set the preview image method. Supported methods: +# +# * w3m (default): +# Preview images in full color with the external command "w3mimgpreview"? +# This requires the console web browser "w3m" and a supported terminal. +# It has been successfully tested with "xterm" and "urxvt" without tmux. +# +# * iterm2: +# Preview images in full color using iTerm2 image previews +# (http://iterm2.com/images.html). This requires using iTerm2 compiled +# with image preview support. +# +# This feature relies on the dimensions of the terminal's font. By default, a +# width of 8 and height of 11 are used. To use other values, set the options +# iterm2_font_width and iterm2_font_height to the desired values. +# +# * terminology: +# Previews images in full color in the terminology terminal emulator. +# Supports a wide variety of formats, even vector graphics like svg. +# +# * urxvt: +# Preview images in full color using urxvt image backgrounds. This +# requires using urxvt compiled with pixbuf support. +# +# * urxvt-full: +# The same as urxvt but utilizing not only the preview pane but the +# whole terminal window. +# +# * kitty: +# Preview images in full color using kitty image protocol. +# Requires python PIL or pillow library. +# If ranger does not share the local filesystem with kitty +# the transfer method is changed to encode the whole image; +# while slower, this allows remote previews, +# for example during an ssh session. +# Tmux is unsupported. +# +# * ueberzug: +# Preview images in full color with the external command "ueberzug". +# Images are shown by using a child window. +# Only for users who run X11 in GNU/Linux. +set preview_images_method kitty + +# Delay in seconds before displaying an image with the w3m method. +# Increase it in case of experiencing display corruption. +set w3m_delay 0.02 + +# Manually adjust the w3mimg offset when using a terminal which needs this +set w3m_offset 0 + +# Default iTerm2 font size (see: preview_images_method: iterm2) +set iterm2_font_width 8 +set iterm2_font_height 11 + +# Use a unicode "..." character to mark cut-off filenames? +set unicode_ellipsis false + +# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic). +# Requires the python-bidi pip package +set bidi_support false + +# Show dotfiles in the bookmark preview box? +set show_hidden_bookmarks true + +# Which colorscheme to use? These colorschemes are available by default: +# default, jungle, snow, solarized +set colorscheme dracula + +# Preview files on the rightmost column? +# And collapse (shrink) the last column if there is nothing to preview? +set preview_files true +set preview_directories true +set collapse_preview false + +# Wrap long lines in plain text previews? +set wrap_plaintext_previews true + +# Save the console history on exit? +set save_console_history true + +# Draw the status bar on top of the browser window (default: bottom) +set status_bar_on_top false + +# Draw a progress bar in the status bar which displays the average state of all +# currently running tasks which support progress bars? +set draw_progress_bar_in_status_bar true + +# Draw borders around columns? (separators, outline, both, or none) +# Separators are vertical lines between columns. +# Outline draws a box around all the columns. +# Both combines the two. +set draw_borders both + +# Display the directory name in tabs? +set dirname_in_tabs true + +# Enable the mouse support? +set mouse_enabled false + +# Display the file size in the main column or status bar? +set display_size_in_main_column true +set display_size_in_status_bar true + +# Display the free disk space in the status bar? +set display_free_space_in_status_bar true + +# Display files tags in all columns or only in main column? +set display_tags_in_all_columns true + +# Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME` +set update_title false + +# Set the tmux/screen window-name to "ranger"? +set update_tmux_title true + +# Shorten the title if it gets long? The number defines how many +# directories are displayed at once, 0 turns off this feature. +set shorten_title 3 + +# Show hostname in titlebar? +set hostname_in_titlebar true + +# Abbreviate $HOME with ~ in the titlebar (first line) of ranger? +set tilde_in_titlebar true + +# How many directory-changes or console-commands should be kept in history? +set max_history_size 20 +set max_console_history_size 50 + +# Try to keep so much space between the top/bottom border when scrolling: +set scroll_offset 8 + +# Flush the input after each key hit? (Noticeable when ranger lags) +set flushinput true + +# Padding on the right when there's no preview? +# This allows you to click into the space to run the file. +set padding_right true + +# Save bookmarks (used with mX and `X) instantly? +# This helps to synchronize bookmarks between multiple ranger +# instances but leads to *slight* performance loss. +# When false, bookmarks are saved when ranger is exited. +set autosave_bookmarks true + +# Save the "`" bookmark to disk. This can be used to switch to the last +# directory by typing "``". +set save_backtick_bookmark true + +# You can display the "real" cumulative size of directories by using the +# command :get_cumulative_size or typing "dc". The size is expensive to +# calculate and will not be updated automatically. You can choose +# to update it automatically though by turning on this option: +set autoupdate_cumulative_size false + +# Turning this on makes sense for screen readers: +set show_cursor false + +# One of: size, natural, basename, atime, ctime, mtime, type, random +set sort natural + +# Additional sorting options +set sort_reverse false +set sort_case_insensitive true +set sort_directories_first true +set sort_unicode false + +# Enable this if key combinations with the Alt Key don't work for you. +# (Especially on xterm) +set xterm_alt_key false + +# Whether to include bookmarks in cd command +set cd_bookmarks true + +# Changes case sensitivity for the cd command tab completion +set cd_tab_case sensitive + +# Use fuzzy tab completion with the "cd" command. For example, +# ":cd /u/lo/b" expands to ":cd /usr/local/bin". +set cd_tab_fuzzy false + +# Avoid previewing files larger than this size, in bytes. Use a value of 0 to +# disable this feature. +set preview_max_size 0 + +# The key hint lists up to this size have their sublists expanded. +# Otherwise the submaps are replaced with "...". +set hint_collapse_threshold 10 + +# Add the highlighted file to the path in the titlebar +set show_selection_in_titlebar true + +# The delay that ranger idly waits for user input, in milliseconds, with a +# resolution of 100ms. Lower delay reduces lag between directory updates but +# increases CPU load. +set idle_delay 2000 + +# When the metadata manager module looks for metadata, should it only look for +# a ".metadata.json" file in the current directory, or do a deep search and +# check all directories above the current one as well? +set metadata_deep_search false + +# Clear all existing filters when leaving a directory +set clear_filters_on_dir_change false + +# Disable displaying line numbers in main column. +# Possible values: false, absolute, relative. +set line_numbers relative + +# When line_numbers=relative show the absolute line number in the +# current line. +set relative_current_zero false + +# Start line numbers from 1 instead of 0 +set one_indexed false + +# Save tabs on exit +set save_tabs_on_exit false + +# Enable scroll wrapping - moving down while on the last item will wrap around to +# the top and vice versa. +set wrap_scroll false + +# Set the global_inode_type_filter to nothing. Possible options: d, f and l for +# directories, files and symlinks respectively. +set global_inode_type_filter + +# This setting allows to freeze the list of files to save I/O bandwidth. It +# should be 'false' during start-up, but you can toggle it by pressing F. +set freeze_files false + +# Print file sizes in bytes instead of the default human-readable format. +set size_in_bytes false + +# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words +# give a warning when you nest ranger in a subshell started by ranger. +# Special value "error" makes the warning more visible. +set nested_ranger_warning true + +# =================================================================== +# == Local Options +# =================================================================== +# You can set local options that only affect a single directory. + +# Examples: +# setlocal path=~/downloads sort mtime + +# =================================================================== +# == Command Aliases in the Console +# =================================================================== + +alias e edit +alias q quit +alias q! quit! +alias qa quitall +alias qa! quitall! +alias qall quitall +alias qall! quitall! +alias setl setlocal + +alias filter scout -prts +alias find scout -aets +alias mark scout -mr +alias unmark scout -Mr +alias search scout -rs +alias search_inc scout -rts +alias travel scout -aefklst + +# =================================================================== +# == Define keys for the browser +# =================================================================== + +# Basic +map Q quitall +map q quit +copymap q ZZ ZQ + +map R reload_cwd +map F set freeze_files! +map reset +map redraw_window +map abort +map change_mode normal +map ~ set viewmode! + +map i display_file +map scroll_preview 1 +map scroll_preview -1 +map ? help +map W display_log +map w taskview_open +map S shell $SHELL + +map : console +map ; console +map ! console shell%space +map @ console -p6 shell %%s +map # console shell -p%space +map s console shell%space +map r chain draw_possible_programs; console open_with%space +map f console find%space +map cd console cd%space + +map chain console; eval fm.ui.console.history_move(-1) + +# Change the line mode +map Mf linemode filename +map Mi linemode fileinfo +map Mm linemode mtime +map Mh linemode humanreadablemtime +map Mp linemode permissions +map Ms linemode sizemtime +map MH linemode sizehumanreadablemtime +map Mt linemode metatitle + +# Tagging / Marking +map t tag_toggle +map ut tag_remove +map " tag_toggle tag=%any +map mark_files toggle=True +map v mark_files all=True toggle=True +map uv mark_files all=True val=False +map V toggle_visual_mode +map uV toggle_visual_mode reverse=True + +# For the nostalgics: Midnight Commander bindings +map help +map rename_append +map display_file +map edit +map copy +map cut +map console mkdir%space +map console delete +#map console trash +map exit + +# In case you work on a keyboard with dvorak layout +map move up=1 +map move down=1 +map move left=1 +map move right=1 +map move to=0 +map move to=-1 +map move down=1 pages=True +map move up=1 pages=True +map move right=1 +#map console delete +map console touch%space + +# VIM-like +copymap k +copymap j +copymap h +copymap l +copymap gg +copymap G +copymap +copymap + +map J move down=0.5 pages=True +map K move up=0.5 pages=True +copymap J +copymap K + +# Jumping around +map H history_go -1 +map L history_go 1 +map ] move_parent 1 +map [ move_parent -1 +map } traverse +map { traverse_backwards +map ) jump_non + +map gh cd ~ +map ge cd /etc +map gu cd /usr +map gd cd /dev +map gl cd -r . +map gL cd -r %f +map go cd /opt +map gv cd /var +map gm cd /media +map gi eval fm.cd('/run/media/' + os.getenv('USER')) +map gM cd /mnt +map gs cd /srv +map gp cd /tmp +map gr cd / +map gR eval fm.cd(ranger.RANGERDIR) +map g/ cd / +map g? cd /usr/share/doc/ranger + +# External Programs +map E edit +map du shell -p du --max-depth=1 -h --apparent-size +map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh +map yp yank path +map yd yank dir +map yn yank name +map y. yank name_without_extension + +# Filesystem Operations +map = chmod + +map cw console rename%space +map a rename_append +map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%")) +map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7) + +map pp paste +map po paste overwrite=True +map pP paste append=True +map pO paste overwrite=True append=True +map pl paste_symlink relative=False +map pL paste_symlink relative=True +map phl paste_hardlink +map pht paste_hardlinked_subtree +map pd console paste dest= +map p` paste dest=%any_path +map p' paste dest=%any_path + +map dD console delete +map dT console trash + +map dd cut +map ud uncut +map da cut mode=add +map dr cut mode=remove +map dt cut mode=toggle + +map yy copy +map uy uncut +map ya copy mode=add +map yr copy mode=remove +map yt copy mode=toggle + +# Temporary workarounds +map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier) +map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier) +map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier) +map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier) +map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier) +map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier) +map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier) +map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier) + +# Searching +map / console search%space +map n search_next +map N search_next forward=False +map ct search_next order=tag +map cs search_next order=size +map ci search_next order=mimetype +map cc search_next order=ctime +map cm search_next order=mtime +map ca search_next order=atime + +# Tabs +map tab_new +map tab_close +map tab_move 1 +map tab_move -1 +map tab_move 1 +map tab_move -1 +map gt tab_move 1 +map gT tab_move -1 +map gn tab_new +map gc tab_close +map uq tab_restore +map tab_open 1 +map tab_open 2 +map tab_open 3 +map tab_open 4 +map tab_open 5 +map tab_open 6 +map tab_open 7 +map tab_open 8 +map tab_open 9 +map tab_shift 1 +map tab_shift -1 + +# Sorting +map or set sort_reverse! +map oz set sort=random +map os chain set sort=size; set sort_reverse=False +map ob chain set sort=basename; set sort_reverse=False +map on chain set sort=natural; set sort_reverse=False +map om chain set sort=mtime; set sort_reverse=False +map oc chain set sort=ctime; set sort_reverse=False +map oa chain set sort=atime; set sort_reverse=False +map ot chain set sort=type; set sort_reverse=False +map oe chain set sort=extension; set sort_reverse=False + +map oS chain set sort=size; set sort_reverse=True +map oB chain set sort=basename; set sort_reverse=True +map oN chain set sort=natural; set sort_reverse=True +map oM chain set sort=mtime; set sort_reverse=True +map oC chain set sort=ctime; set sort_reverse=True +map oA chain set sort=atime; set sort_reverse=True +map oT chain set sort=type; set sort_reverse=True +map oE chain set sort=extension; set sort_reverse=True + +map dc get_cumulative_size + +# Settings +map zc set collapse_preview! +map zd set sort_directories_first! +map zh set show_hidden! +map set show_hidden! +copymap +copymap +map zI set flushinput! +map zi set preview_images! +map zm set mouse_enabled! +map zp set preview_files! +map zP set preview_directories! +map zs set sort_case_insensitive! +map zu set autoupdate_cumulative_size! +map zv set use_preview_script! +map zf console filter%space +copymap zf zz + +# Filter stack +map .d filter_stack add type d +map .f filter_stack add type f +map .l filter_stack add type l +map .m console filter_stack add mime%space +map .n console filter_stack add name%space +map .# console filter_stack add hash%space +map ." filter_stack add duplicate +map .' filter_stack add unique +map .| filter_stack add or +map .& filter_stack add and +map .! filter_stack add not +map .r filter_stack rotate +map .c filter_stack clear +map .* filter_stack decompose +map .p filter_stack pop +map .. filter_stack show + +# Bookmarks +map ` enter_bookmark %any +map ' enter_bookmark %any +map m set_bookmark %any +map um unset_bookmark %any + +map m draw_bookmarks +copymap m um ` ' + +# Generate all the chmod bindings with some python help: +eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg)) + +eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg)) + +# =================================================================== +# == Define keys for the console +# =================================================================== +# Note: Unmapped keys are passed directly to the console. + +# Basic +cmap eval fm.ui.console.tab() +cmap eval fm.ui.console.tab(-1) +cmap eval fm.ui.console.close() +cmap eval fm.ui.console.execute() +cmap redraw_window + +copycmap +copycmap + +# Move around +cmap eval fm.ui.console.history_move(-1) +cmap eval fm.ui.console.history_move(1) +cmap eval fm.ui.console.move(left=1) +cmap eval fm.ui.console.move(right=1) +cmap eval fm.ui.console.move(right=0, absolute=True) +cmap eval fm.ui.console.move(right=-1, absolute=True) +cmap eval fm.ui.console.move_word(left=1) +cmap eval fm.ui.console.move_word(right=1) + +copycmap +copycmap + +# Line Editing +cmap eval fm.ui.console.delete(-1) +cmap eval fm.ui.console.delete(0) +cmap eval fm.ui.console.delete_word() +cmap eval fm.ui.console.delete_word(backward=False) +cmap eval fm.ui.console.delete_rest(1) +cmap eval fm.ui.console.delete_rest(-1) +cmap eval fm.ui.console.paste() + +# And of course the emacs way +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap + +# Note: There are multiple ways to express backspaces. (code 263) +# and (code 127). To be sure, use both. +copycmap + +# This special expression allows typing in numerals: +cmap false + +# =================================================================== +# == Pager Keybindings +# =================================================================== + +# Movement +pmap pager_move down=1 +pmap pager_move up=1 +pmap pager_move left=4 +pmap pager_move right=4 +pmap pager_move to=0 +pmap pager_move to=-1 +pmap pager_move down=1.0 pages=True +pmap pager_move up=1.0 pages=True +pmap pager_move down=0.5 pages=True +pmap pager_move up=0.5 pages=True + +copypmap k +copypmap j +copypmap h +copypmap l +copypmap g +copypmap G +copypmap d +copypmap u +copypmap n f +copypmap p b + +# Basic +pmap redraw_window +pmap pager_close +copypmap q Q i +pmap E edit_file + +# =================================================================== +# == Taskview Keybindings +# =================================================================== + +# Movement +tmap taskview_move up=1 +tmap taskview_move down=1 +tmap taskview_move to=0 +tmap taskview_move to=-1 +tmap taskview_move down=1.0 pages=True +tmap taskview_move up=1.0 pages=True +tmap taskview_move down=0.5 pages=True +tmap taskview_move up=0.5 pages=True + +copytmap k +copytmap j +copytmap g +copytmap G +copytmap u +copytmap n f +copytmap p b + +# Changing priority and deleting tasks +tmap J eval -q fm.ui.taskview.task_move(-1) +tmap K eval -q fm.ui.taskview.task_move(0) +tmap dd eval -q fm.ui.taskview.task_remove() +tmap eval -q fm.ui.taskview.task_move(-1) +tmap eval -q fm.ui.taskview.task_move(0) +tmap eval -q fm.ui.taskview.task_remove() + +# Basic +tmap redraw_window +tmap taskview_close +copytmap q Q w diff --git a/ranger/rifle.conf b/ranger/rifle.conf new file mode 100644 index 0000000..d0e019e --- /dev/null +++ b/ranger/rifle.conf @@ -0,0 +1,8 @@ +ext css|md|conf|txt|sh = vim "$@" +ext ogv|mp3|mp4|avi|mkv|ogg|mov = mpv "$@" +ext pdf= firefox-esr "$@" +ext epub = foliate "$@" +#ext png|jpg = feh "$@" +ext png|jpg|jpeg = ristretto "$@" +ext cb[zr] = zathura "$@" +ext html = firefox-esr "$@" diff --git a/ranger/scope.sh b/ranger/scope.sh new file mode 100755 index 0000000..c5511b2 --- /dev/null +++ b/ranger/scope.sh @@ -0,0 +1,349 @@ +#!/usr/bin/env bash + +set -o noclobber -o noglob -o nounset -o pipefail +IFS=$'\n' + +## If the option `use_preview_script` is set to `true`, +## then this script will be called and its output will be displayed in ranger. +## ANSI color codes are supported. +## STDIN is disabled, so interactive scripts won't work properly + +## This script is considered a configuration file and must be updated manually. +## It will be left untouched if you upgrade ranger. + +## Because of some automated testing we do on the script #'s for comments need +## to be doubled up. Code that is commented out, because it's an alternative for +## example, gets only one #. + +## Meanings of exit codes: +## code | meaning | action of ranger +## -----+------------+------------------------------------------- +## 0 | success | Display stdout as preview +## 1 | no preview | Display no preview at all +## 2 | plain text | Display the plain content of the file +## 3 | fix width | Don't reload when width changes +## 4 | fix height | Don't reload when height changes +## 5 | fix both | Don't ever reload +## 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview +## 7 | image | Display the file directly as an image + +## Script arguments +FILE_PATH="${1}" # Full path of the highlighted file +PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters) +## shellcheck disable=SC2034 # PV_HEIGHT is provided for convenience and unused +PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters) +IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview +PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise. + +FILE_EXTENSION="${FILE_PATH##*.}" +FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')" + +## Settings +HIGHLIGHT_SIZE_MAX=262143 # 256KiB +HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8} +HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo} +HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}" +PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn} +OPENSCAD_IMGSIZE=${RNGR_OPENSCAD_IMGSIZE:-1000,1000} +OPENSCAD_COLORSCHEME=${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night} + +handle_extension() { + case "${FILE_EXTENSION_LOWER}" in + ## Archive + a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\ + rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip) + atool --list -- "${FILE_PATH}" && exit 5 + bsdtar --list --file "${FILE_PATH}" && exit 5 + exit 1;; + rar) + ## Avoid password prompt by providing empty password + unrar lt -p- -- "${FILE_PATH}" && exit 5 + exit 1;; + 7z) + ## Avoid password prompt by providing empty password + 7z l -p -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## PDF + pdf) + ## Preview as text conversion + pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | \ + fmt -w "${PV_WIDTH}" && exit 5 + mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | \ + fmt -w "${PV_WIDTH}" && exit 5 + exiftool "${FILE_PATH}" && exit 5 + exit 1;; + + ## BitTorrent + torrent) + transmission-show -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## OpenDocument + odt|ods|odp|sxw) + ## Preview as text conversion + odt2txt "${FILE_PATH}" && exit 5 + ## Preview as markdown conversion + pandoc -s -t markdown -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## XLSX + xlsx) + ## Preview as csv conversion + ## Uses: https://github.com/dilshod/xlsx2csv + xlsx2csv -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## HTML + htm|html|xhtml) + ## Preview as text conversion + w3m -dump "${FILE_PATH}" && exit 5 + lynx -dump -- "${FILE_PATH}" && exit 5 + elinks -dump "${FILE_PATH}" && exit 5 + pandoc -s -t markdown -- "${FILE_PATH}" && exit 5 + ;; + + ## JSON + json) + jq --color-output . "${FILE_PATH}" && exit 5 + python -m json.tool -- "${FILE_PATH}" && exit 5 + ;; + + ## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected + ## by file(1). + dff|dsf|wv|wvc) + mediainfo "${FILE_PATH}" && exit 5 + exiftool "${FILE_PATH}" && exit 5 + ;; # Continue with next handler on failure + esac +} + +handle_image() { + ## Size of the preview if there are multiple options or it has to be + ## rendered from vector graphics. If the conversion program allows + ## specifying only one dimension while keeping the aspect ratio, the width + ## will be used. + local DEFAULT_SIZE="1920x1080" + + local mimetype="${1}" + case "${mimetype}" in + ## SVG + image/svg+xml|image/svg) + convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6 + exit 1;; + + ## DjVu + image/vnd.djvu) + ddjvu -format=tiff -quality=90 -page=1 -size="${DEFAULT_SIZE}" \ + - "${IMAGE_CACHE_PATH}" < "${FILE_PATH}" \ + && exit 6 || exit 1;; + + ## Image + image/*) + local orientation + orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )" + ## If orientation data is present and the image actually + ## needs rotating ("1" means no rotation)... + if [[ -n "$orientation" && "$orientation" != 1 ]]; then + ## ...auto-rotate the image according to the EXIF data. + convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6 + fi + + ## `w3mimgdisplay` will be called for all images (unless overriden + ## as above), but might fail for unsupported types. + exit 7;; + + ## Video + video/*) + # Thumbnail + ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6 + exit 1;; + + ## PDF + application/pdf) + pdftoppm -f 1 -l 1 \ + -scale-to-x "${DEFAULT_SIZE%x*}" \ + -scale-to-y -1 \ + -singlefile \ + -jpeg -tiffcompression jpeg \ + -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \ + && exit 6 || exit 1;; + + + ## ePub, MOBI, FB2 (using Calibre) + application/epub+zip|application/x-mobipocket-ebook|\ + application/x-fictionbook+xml) + # ePub (using https://github.com/marianosimone/epub-thumbnailer) + epub-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" \ + "${DEFAULT_SIZE%x*}" && exit 6 + ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FILE_PATH}" \ + >/dev/null && exit 6 + exit 1;; + + ## Font + application/font*|application/*opentype) + preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png" + if fontimage -o "${preview_png}" \ + --pixelsize "120" \ + --fontname \ + --pixelsize "80" \ + --text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \ + --text " abcdefghijklmnopqrstuvwxyz " \ + --text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \ + --text " The quick brown fox jumps over the lazy dog. " \ + "${FILE_PATH}"; + then + convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \ + && rm "${preview_png}" \ + && exit 6 + else + exit 1 + fi + ;; + + ## Preview archives using the first image inside. + ## (Very useful for comic book collections for example.) + # application/zip|application/x-rar|application/x-7z-compressed|\ + # application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar) + # local fn=""; local fe="" + # local zip=""; local rar=""; local tar=""; local bsd="" + # case "${mimetype}" in + # application/zip) zip=1 ;; + # application/x-rar) rar=1 ;; + # application/x-7z-compressed) ;; + # *) tar=1 ;; + # esac + # { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \ + # { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \ + # { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \ + # { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return + # + # fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \ + # [ print(l, end='') for l in sys.stdin if \ + # (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\ + # sort -V | head -n 1) + # [ "$fn" = "" ] && return + # [ "$bsd" ] && fn=$(printf '%b' "$fn") + # + # [ "$tar" ] && tar --extract --to-stdout \ + # --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6 + # fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g') + # [ "$bsd" ] && bsdtar --extract --to-stdout \ + # --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6 + # [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}" + # [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \ + # "${IMAGE_CACHE_PATH}" && exit 6 + # [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \ + # "${IMAGE_CACHE_PATH}" && exit 6 + # [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}" + # ;; + esac + + # openscad_image() { + # TMPPNG="$(mktemp -t XXXXXX.png)" + # openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \ + # --imgsize="${OPENSCAD_IMGSIZE/x/,}" \ + # -o "${TMPPNG}" "${1}" + # mv "${TMPPNG}" "${IMAGE_CACHE_PATH}" + # } + + # case "${FILE_EXTENSION_LOWER}" in + # ## 3D models + # ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH} + # ## is hardcoded as jpeg. So we make a tempfile.png and just + # ## move/rename it to jpg. This works because image libraries are + # ## smart enough to handle it. + # csg|scad) + # openscad_image "${FILE_PATH}" && exit 6 + # ;; + # 3mf|amf|dxf|off|stl) + # openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6 + # ;; + # esac +} + +handle_mime() { + local mimetype="${1}" + case "${mimetype}" in + ## RTF and DOC + text/rtf|*msword) + ## Preview as text conversion + ## note: catdoc does not always work for .doc files + ## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/ + catdoc -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## DOCX, ePub, FB2 (using markdown) + ## You might want to remove "|epub" and/or "|fb2" below if you have + ## uncommented other methods to preview those formats + *wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml) + ## Preview as markdown conversion + pandoc -s -t markdown -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## XLS + *ms-excel) + ## Preview as csv conversion + ## xls2csv comes with catdoc: + ## http://www.wagner.pp.ru/~vitus/software/catdoc/ + xls2csv -- "${FILE_PATH}" && exit 5 + exit 1;; + + ## Text + text/* | */xml) + ## Syntax highlight + if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then + exit 2 + fi + if [[ "$( tput colors )" -ge 256 ]]; then + local pygmentize_format='terminal256' + local highlight_format='xterm256' + else + local pygmentize_format='terminal' + local highlight_format='ansi' + fi + env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \ + --out-format="${highlight_format}" \ + --force -- "${FILE_PATH}" && exit 5 + env COLORTERM=8bit bat --color=always --style="plain" \ + -- "${FILE_PATH}" && exit 5 + pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\ + -- "${FILE_PATH}" && exit 5 + exit 2;; + + ## DjVu + image/vnd.djvu) + ## Preview as text conversion (requires djvulibre) + djvutxt "${FILE_PATH}" | fmt -w "${PV_WIDTH}" && exit 5 + exiftool "${FILE_PATH}" && exit 5 + exit 1;; + + ## Image + image/*) + ## Preview as text conversion + # img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4 + exiftool "${FILE_PATH}" && exit 5 + exit 1;; + + ## Video and audio + video/* | audio/*) + mediainfo "${FILE_PATH}" && exit 5 + exiftool "${FILE_PATH}" && exit 5 + exit 1;; + esac +} + +handle_fallback() { + echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5 +} + + +MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" +if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then + handle_image "${MIMETYPE}" +fi +handle_extension +handle_mime "${MIMETYPE}" +handle_fallback + +exit 1 diff --git a/sway/cheatsheet b/sway/cheatsheet new file mode 100644 index 0000000..925027a --- /dev/null +++ b/sway/cheatsheet @@ -0,0 +1,166 @@ +Sway-WM CheatSheet: + + = windows key + +# start floating xfce4-terminal ++Return + +# start fixed termite-terminal ++Shift+Return + +# kill focused window ++q + +# Application menu - wofi: ++d + +# Activities: ++p + +# Power-Menu: ++Shift+e + +# Lock the system ++f1 + +# reload the configuration file ++Shift+c + +# change window focus,like vim ++h focus left ++j focus down ++k focus up ++l focus right + +# alternatively, you can use the cursor keys: ++Left focus left ++Down focus down ++Up focus up ++Right focus right + +# move a focused window ++Shift+h move left ++Shift+j move down ++Shift+k move up ++Shift+l move right + +# alternatively, you can use the cursor keys: ++Shift+Left move left ++Shift+Down move down ++Shift+Up move up ++Shift+Right move right + +# split in horizontal orientation (changes take place on next opened window): ++b + +# split in vertical orientation (changes take place on next opened window): ++v + +# enter fullscreen mode for the focused container: ++f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split): ++s layout stacking ++w layout tabbed ++e layout toggle split + +# toggle tiling / floating: ++Shift+space floating toggle + +# change focus between tiling / floating windows: ++space focus mode_toggle + +# focus the parent container: ++a focus parent + +# resize floating window: ++right mouse button + +# move floating window: ++left mouse button + +# scratchpad: ++Shift+Minus move scratchpad ++minus scratchpad cycle + +# resize mode: ++r + +# resize,like vim: +h focus left +j focus down +k focus up +l focus right + +# alternatively, you can use the cursor keys: +Left focus left +Down focus down +Up focus up +Right focus right + +# Return to default mode: +Return or Escape + +# Workspaces: +# + # Switch to workspace + +1 workspace number 1 + +2 workspace number 2 + +3 workspace number 3 + +4 workspace number 4 + +5 workspace number 5 + +6 workspace number 6 + +7 workspace number 7 + +8 workspace number 8 + +9 workspace number 9 + +0 workspace number 10 + # Move focused container to workspace: + +Shift+1 move container to workspace number 1 + +Shift+2 move container to workspace number 2 + +Shift+3 move container to workspace number 3 + +Shift+4 move container to workspace number 4 + +Shift+5 move container to workspace number 5 + +Shift+6 move container to workspace number 6 + +Shift+7 move container to workspace number 7 + +Shift+8 move container to workspace number 8 + +Shift+9 move container to workspace number 9 + +Shift+0 move container to workspace number 10 + + +# Multimedia Keys (be aware that these may not work for every keyboard): +They are enabled - you may need to hold down the function key while doing so. + + # Screenshots: + PrintSrc for full screenshot + Shift+PrintSrc for screenshot options + +# App Shortcuts: ++n thunar ++o firefox + + +# Other Things: + + # Input - ~/.config/sway/config.d/input + # You can get the names of your inputs by running: swaymsg -t get_inputs + # Put your touchpad's IDENFICATOR to replace "Touchpad-ID" (keep the quotation marks) + # Read `man 5 sway-input` for more information about this section. + + # Output - ~/.config/sway/config.d/output + # You can get the names of your outputs by running: swaymsg -t get_outputs + # Read `man 5 sway-output` for more information about this section. + + # Wallpaper - ~/.config/sway/config.d/theme + # exec swaybg -i /path/to/wallpaper + + # Waybar - ~/.config/waybar/config : ~/.config/waybar/style.css + # It is an external bar we have chosen because of the option's it allows. + # If you wish to use the default swaybar - ~/.config/sway/config.d/theme and change waybar to sway-bar + # Read `man 5 sway-bar` for more information about this section + + # Autostart - ~/.config/sway/config.d/autostart_applications + + + + + diff --git a/sway/config b/sway/config new file mode 100644 index 0000000..90c4edb --- /dev/null +++ b/sway/config @@ -0,0 +1,23 @@ +# Initial Setup +# exec ~/set_once.sh + +# Config for sway +# +# Read `man 5 sway` for a complete reference. + +# user config directory +include $HOME/.config/sway/config.d/* + +# only enable this if every app you use is compatible with wayland +# xwayland disable + +set $gnome-schema org.gnome.desktop.interface +exec_always { + gsettings set $gnome-schema gtk-theme 'Arc-Dark' + gsettings set $gnome-schema icon-theme 'ePapirus-Dark' + gsettings set $gnome-schema cursor-theme 'Adwaita' + gsettings set $gnome-schema font-name 'Ubuntu Nerd Font' +} + +# https://wiki.archlinux.org/title/Sway +exec wl-paste -t text --watch clipman store --no-persist diff --git a/sway/config.d/application_defaults b/sway/config.d/application_defaults new file mode 100644 index 0000000..59e65cc --- /dev/null +++ b/sway/config.d/application_defaults @@ -0,0 +1,51 @@ +# Assign workspaces +#assign [app_id="firefox"] 2 +#for_window [app_id="firefox"] focus +# +#assign [class="firefox"] 2 +#for_window [class="firefox"] focus +# +#assign [app_id=thunar] 3 +#for_window [app_id=thunar] focus +# +#assign [class="Telegram"] 4 +#for_window [class="Telegram"] focus + + +for_window [app_id="xed"] focus + + +# set floating (nontiling)for apps needing it: +for_window [class="Yad" instance="yad"] floating enable +for_window [app_id="yad"] floating enable +for_window [app_id="blueman-manager"] floating enable, resize set width 40 ppt height 30 ppt + +# set floating (nontiling) for special apps: +for_window [class="Xsane" instance="xsane"] floating enable +for_window [app_id="pavucontrol" ] floating enable, resize set width 40 ppt height 30 ppt +for_window [class="qt5ct" instance="qt5ct"] floating enable, resize set width 60 ppt height 50 ppt +for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable +for_window [app_id="pamac-manager"] floating enable, resize set width 80 ppt height 70 ppt +for_window [class="Lxappearance"] floating enable, resize set width 60 ppt height 50 ppt + +# set floating for window roles +for_window [window_role="pop-up"] floating enable +for_window [window_role="bubble"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="Preferences"] floating enable +for_window [window_type="dialog"] floating enable +for_window [window_type="menu"] floating enable +for_window [window_role="About"] floating enable +for_window [title="File Operation Progress"] floating enable, border pixel 1, sticky enable, resize set width 40 ppt height 30 ppt +for_window [app_id="firefox" title="^Library$"] floating enable, border pixel 1, sticky enable, resize set width 40 ppt height 30 ppt +for_window [app_id="floating_shell_portrait"] floating enable, border pixel 1, sticky enable, resize set width 30 ppt height 40 ppt +for_window [title="Picture in picture"] floating enable, sticky enable +for_window [title="nmtui"] floating enable, resize set width 50 ppt height 70 ppt +for_window [title="htop"] floating enable, resize set width 50 ppt height 70 ppt +for_window [app_id="xsensors"] floating enable +for_window [title="Save File"] floating enable +for_window [app_id="firefox" title="Firefox — Sharing Indicator"] kill + +# Inhibit idle +for_window [app_id="firefox"] inhibit_idle fullscreen +for_window [app_id="Chromium"] inhibit_idle fullscreen diff --git a/sway/config.d/autostart_applications b/sway/config.d/autostart_applications new file mode 100644 index 0000000..612ab35 --- /dev/null +++ b/sway/config.d/autostart_applications @@ -0,0 +1,28 @@ +# Auth with polkit-gnome +exec '/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &' + +# Desktop notifications +exec mako + +# Network Applet +exec nm-applet --indicator + +# GTK3 applications take a long time to start +exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK +exec hash dbus-update-activation-environment 2>/dev/null && \ + dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK + +# Welcome App +#exec dex -a -s /etc/xdg/autostart/:~/.config/autostart/ + +# Sway Fader +# exec python3 ~/.config/sway/scripts/swayfader.py + +# Autostart +exec_always 'gammastep -c .config/gammastep/config.ini &' +exec 'syncthing &' +exec 'seahorse' +exec_always 'autotiling -w 1 2 3 4 5 6 7 8 9 10' +exec 'appimagelauncherd' +# exec '~/Applications/filen_x86_64.AppImage &' +# exec 'nextcloud' \ No newline at end of file diff --git a/sway/config.d/clamshell b/sway/config.d/clamshell new file mode 100644 index 0000000..cd7cc46 --- /dev/null +++ b/sway/config.d/clamshell @@ -0,0 +1,6 @@ +# Clamshell Mode +set $laptop eDP-1 +bindswitch --reload --locked lid:on output $laptop disable +bindswitch --reload --locked lid:off output $laptop enable + +exec_always ~/.config/sway/scripts/clamshell.sh diff --git a/sway/config.d/default b/sway/config.d/default new file mode 100644 index 0000000..61ca3e8 --- /dev/null +++ b/sway/config.d/default @@ -0,0 +1,240 @@ +# Logo key. Use Mod1 for Alt. +set $mod Mod4 + +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l + +# audio control +set $sink_volume pactl get-sink-volume @DEFAULT_SINK@ | grep '^Volume:' | cut -d / -f 2 | tr -d ' ' | sed 's/%//' +set $source_volume pactl get-source-volume @DEFAULT_SOURCE@ | grep '^Volume:' | cut -d / -f 2 | tr -d ' ' | sed 's/%//' +set $volume_down $(pactl set-sink-volume @DEFAULT_SINK@ -5% && $sink_volume) +set $volume_up $(pactl set-sink-volume @DEFAULT_SINK@ +5% && $sink_volume) +set $volume_mute $(pactl set-sink-mute @DEFAULT_SINK@ toggle && pactl get-sink-mute @DEFAULT_SINK@ | sed -En "/no/ s/.*/$($sink_volume)/p; /yes/ s/.*/0/p") +set $mic_mute $(pactl set-source-mute @DEFAULT_SOURCE@ toggle && pactl get-source-mute @DEFAULT_SOURCE@ | sed -En "/no/ s/.*/$($source_volume)/p; /yes/ s/.*/0/p") + +# Your preferred terminal emulators +set $term-float alacritty + +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +set $menu wofi -c ~/.config/wofi/config -I + +set $powermenu ~/.config/waybar/scripts/power-menu.sh + +### Idle configuration +exec swayidle -w\ + timeout 600 'swaylock -f -C ~/.config/swaylock/config'\ + timeout 770 'swaymsg "output * power off"' \ + resume 'swaymsg "output * power on"' \ + before-sleep 'swaylock -C ~/.config/swaylock/config' +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. + +## Lock Screen + bindsym $mod+f1 exec ~/.config/sway/scripts/lockman.sh + +### Key bindings +# +# Basics: +# + # Start a floating terminal + bindsym $mod+Return exec $term-float + + # Open the power menu + bindsym $mod+Shift+e exec $powermenu + + # Kill focused window + bindsym $mod+shift+q kill + + # Start your launcher + bindsym $mod+space exec $menu + + # Activities + bindsym $mod+p exec ~/.config/wofi/windows.py + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + #bindsym $mod+shift+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $right resize grow width 10px + bindsym $up resize shrink height 10px + bindsym $down resize grow height 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Right resize grow width 10px + bindsym Up resize shrink height 10px + bindsym Down resize grow height 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + +# Resize floating windows with mouse scroll: + bindsym --whole-window --border $mod+button4 resize shrink height 5 px or 5 ppt + bindsym --whole-window --border $mod+button5 resize grow height 5 px or 5 ppt + bindsym --whole-window --border $mod+Shift+button4 resize shrink width 5 px or 5 ppt + bindsym --whole-window --border $mod+Shift+button5 resize grow width 5 px or 5 ppt + +# +# Volume +# + # Control volume trough pamixer + # bindsym --locked XF86AudioRaiseVolume exec pamixer -ui 2 + # bindsym --locked XF86AudioLowerVolume exec pamixer -ud 2 + # bindsym --locked XF86AudioMute exec pamixer -t + + # Control volume directly trough pactl + bindsym --locked XF86AudioRaiseVolume exec $volume_up + bindsym --locked XF86AudioLowerVolume exec $volume_down + bindsym --locked XF86AudioMute exec $volume_mute +# +# Player +# + bindsym XF86AudioPlay exec playerctl play + bindsym XF86AudioPause exec playerctl pause + bindsym XF86AudioNext exec playerctl next + bindsym XF86AudioPrev exec playerctl previous +# +# Backlight +# + bindsym XF86MonBrightnessUp exec brightnessctl -c backlight set +5% + bindsym XF86MonBrightnessDown exec brightnessctl -c backlight set 5%- +# +# App shortcuts +# + #bindsym $mod+shift+n exec gnome-commander + bindsym $mod+shift+n exec thunar + bindsym $mod+o exec firefox + +# +# Suspend, restart, shutdown and lock the system +# + bindsym $mod+escape exec systemctl suspend + bindsym $mod+shift+r exec systemctl reboot + bindsym $mod+shift+p exec systemctl poweroff + bindsym $mod+alt+l exec swaylock -f -C ~/.config/swaylock/config + +# +# Screenshots +# + #bindsym print exec shotman area + bindsym print exec grim -g "$(slurp)" - | wl-copy + #bindsym $mod+alt+p exec shotman output + #bindsym $mod+ctrl+p exec shotman window + +# +# Keybindings List +# + bindsym $mod+t exec alacritty -e vim ~/.config/sway/cheatsheet \ No newline at end of file diff --git a/sway/config.d/input b/sway/config.d/input new file mode 100644 index 0000000..53f0ad9 --- /dev/null +++ b/sway/config.d/input @@ -0,0 +1,20 @@ +### Input configuration +# +# Example configuration: +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Put your touchpad's ID to replace "Touchpad-ID" (keep the quotation marks) + +input type:touchpad { + dwt enabled + tap enabled + natural_scroll enabled +} + +# Read `man 5 sway-input` for more information about this section. +# +input type:keyboard xkb_layout "us" + +exec_always { + 'swaymsg input type:keyboard xkb_layout "$(localectl status | grep "X11 Layout" | sed -e "s/^.*X11 Layout://")"' + 'swaymsg input type:keyboard xkb_variant "$(localectl status | grep "X11 Variant" | sed -e "s/^.*X11 Variant://")"' +} diff --git a/sway/config.d/output b/sway/config.d/output new file mode 100644 index 0000000..828880b --- /dev/null +++ b/sway/config.d/output @@ -0,0 +1,11 @@ +### Output configuration +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs +# +# Wacom Tablet - Example +# input "1386:884:Wacom_Intuos_S_Pad" map_to_output HDMI-A-1 +# input "1386:884:Wacom_Intuos_S_Pen" map_to_output HDMI-A-1 diff --git a/sway/config.d/theme b/sway/config.d/theme new file mode 100644 index 0000000..3c76f2f --- /dev/null +++ b/sway/config.d/theme @@ -0,0 +1,39 @@ +# Apply gtk theming +exec_always ~/.config/sway/scripts/import-gsettings + +# Set inner/outer gaps +gaps inner 5 +gaps outer 5 + +# Hide titlebar on windows: +default_border pixel 5 + +# Default Font +font pango:Ubuntu Mono 11 + +# Thin borders: +smart_borders on + +# Set wallpaper: +#exec swaybg -i ~/git/Wallpapers/img/img138.jpg +exec "cd ~/scripts/ && ./swaybg.sh" + +# Title format for windows +for_window [shell="xdg_shell"] title_format "%title (%app_id)" +for_window [shell="x_wayland"] title_format "%class - %title" + +# class border bground text indicator child_border +client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4 +client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A +client.unfocused #282A36 #282A36 #BFBFBF #282A36 #282A36 +client.urgent #44475A #FF5555 #F8F8F2 #FF5555 #FF5555 +client.placeholder #282A36 #282A36 #F8F8F2 #282A36 #282A36 +client.background #F8F8F2 + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + swaybar_command waybar +} diff --git a/sway/keyboard.conf b/sway/keyboard.conf new file mode 100644 index 0000000..0c034fd --- /dev/null +++ b/sway/keyboard.conf @@ -0,0 +1,457 @@ +! layout + us USA + ad Andorra + af Afghanistan + ara Arabic + al Albania + am Armenia + az Azerbaijan + by Belarus + be Belgium + bd Bangladesh + in India + ba Bosnia and Herzegovina + br Brazil + bg Bulgaria + ma Morocco + mm Myanmar + ca Canada + cd Congo, Democratic Republic of the + cn China + hr Croatia + cz Czechia + dk Denmark + nl Netherlands + bt Bhutan + ee Estonia + ir Iran + iq Iraq + fo Faroe Islands + fi Finland + fr France + gh Ghana + gn Guinea + ge Georgia + de Germany + gr Greece + hu Hungary + is Iceland + il Israel + it Italy + jp Japan + kg Kyrgyzstan + kh Cambodia + kz Kazakhstan + la Laos + latam Latin American + lt Lithuania + lv Latvia + mao Maori + me Montenegro + mk Macedonia + mt Malta + mn Mongolia + no Norway + pl Poland + pt Portugal + ro Romania + ru Russia + rs Serbia + si Slovenia + sk Slovakia + es Spain + se Sweden + ch Switzerland + sy Syria + tj Tajikistan + lk Sri Lanka + th Thailand + tr Turkey + tw Taiwan + ua Ukraine + gb United Kingdom + uz Uzbekistan + vn Vietnam + kr Korea, Republic of + nec_vndr/jp Japan (PC-98xx Series) + ie Ireland + pk Pakistan + mv Maldives + za South Africa + epo Esperanto + np Nepal + ng Nigeria + et Ethiopia + sn Senegal + brai Braille + tm Turkmenistan + ml Mali + tz Tanzania + +! variant + chr us: Cherokee + euro us: With EuroSign on 5 + intl us: International (with dead keys) + alt-intl us: Alternative international (former us_intl) + colemak us: Colemak + dvorak us: Dvorak + dvorak-intl us: Dvorak international + dvorak-l us: Left handed Dvorak + dvorak-r us: Right handed Dvorak + dvorak-classic us: Classic Dvorak + dvp us: Programmer Dvorak + rus us: Russian phonetic + mac us: Macintosh + altgr-intl us: International (AltGr dead keys) + olpc2 us: Group toggle on multiply/divide key + srp us: Serbian + ps af: Pashto + uz af: Southern Uzbek + olpc-ps af: OLPC Pashto + olpc-fa af: OLPC Dari + olpc-uz af: OLPC Southern Uzbek + azerty ara: azerty + azerty_digits ara: azerty/digits + digits ara: digits + qwerty ara: qwerty + qwerty_digits ara: qwerty/digits + buckwalter ara: Buckwalter + phonetic am: Phonetic + phonetic-alt am: Alternative Phonetic + eastern am: Eastern + western am: Western + eastern-alt am: Alternative Eastern + cyrillic az: Cyrillic + legacy by: Legacy + latin by: Latin + oss be: Alternative + oss_latin9 be: Alternative, latin-9 only + oss_sundeadkeys be: Alternative, Sun dead keys + iso-alternate be: ISO Alternate + nodeadkeys be: Eliminate dead keys + sundeadkeys be: Sun dead keys + wang be: Wang model 724 azerty + probhat bd: Probhat + ben in: Bengali + ben_probhat in: Bengali Probhat + guj in: Gujarati + guru in: Gurmukhi + jhelum in: Gurmukhi Jhelum + kan in: Kannada + mal in: Malayalam + mal_lalitha in: Malayalam Lalitha + ori in: Oriya + tam_unicode in: Tamil Unicode + tam_keyboard_with_numerals in: Tamil Keyboard with Numerals + tam_TAB in: Tamil TAB Typewriter + tam_TSCII in: Tamil TSCII Typewriter + tam in: Tamil + tel in: Telugu + urd-phonetic in: Urdu, Phonetic + urd-phonetic3 in: Urdu, Alternative phonetic + urd-winkeys in: Urdu, Winkeys + bolnagri in: Hindi Bolnagri + hin-wx in: Hindi Wx + alternatequotes ba: Use guillemets for quotes + unicode ba: Use Bosnian digraphs + unicodeus ba: US keyboard with Bosnian digraphs + us ba: US keyboard with Bosnian letters + nodeadkeys br: Eliminate dead keys + dvorak br: Dvorak + nativo br: Nativo + nativo-us br: Nativo for USA keyboards + nativo-epo br: Nativo for Esperanto + phonetic bg: Traditional phonetic + bas_phonetic bg: New phonetic + french ma: French + tifinagh ma: Tifinagh + tifinagh-alt ma: Tifinagh Alternative + tifinagh-alt-phonetic ma: Tifinagh Alternative Phonetic + tifinagh-extended ma: Tifinagh Extended + tifinagh-phonetic ma: Tifinagh Phonetic + tifinagh-extended-phonetic ma: Tifinagh Extended Phonetic + fr-dvorak ca: French Dvorak + fr-legacy ca: French (legacy) + multix ca: Multilingual + multi ca: Multilingual, first part + multi-2gr ca: Multilingual, second part + ike ca: Inuktitut + shs ca: Secwepemctsin + kut ca: Ktunaxa + eng ca: English + tib cn: Tibetan + tib_asciinum cn: Tibetan (with ASCII numerals) + alternatequotes hr: Use guillemets for quotes + unicode hr: Use Croatian digraphs + unicodeus hr: US keyboard with Croatian digraphs + us hr: US keyboard with Croatian letters + bksl cz: With <\|> key + qwerty cz: qwerty + qwerty_bksl cz: qwerty, extended Backslash + ucw cz: UCW layout (accented letters only) + dvorak-ucw cz: US Dvorak with CZ UCW support + nodeadkeys dk: Eliminate dead keys + mac dk: Macintosh + mac_nodeadkeys dk: Macintosh, eliminate dead keys + dvorak dk: Dvorak + sundeadkeys nl: Sun dead keys + mac nl: Macintosh + std nl: Standard + nodeadkeys ee: Eliminate dead keys + dvorak ee: Dvorak + us ee: US keyboard with Estonian letters + pes_keypad ir: Persian, with Persian Keypad + ku ir: Kurdish, Latin Q + ku_f ir: Kurdish, (F) + ku_alt ir: Kurdish, Latin Alt-Q + ku_ara ir: Kurdish, Arabic-Latin + ku iq: Kurdish, Latin Q + ku_f iq: Kurdish, (F) + ku_alt iq: Kurdish, Latin Alt-Q + ku_ara iq: Kurdish, Arabic-Latin + nodeadkeys fo: Eliminate dead keys + nodeadkeys fi: Eliminate dead keys + smi fi: Northern Saami + classic fi: Classic + mac fi: Macintosh + nodeadkeys fr: Eliminate dead keys + sundeadkeys fr: Sun dead keys + oss fr: Alternative + oss_latin9 fr: Alternative, latin-9 only + oss_nodeadkeys fr: Alternative, eliminate dead keys + oss_sundeadkeys fr: Alternative, Sun dead keys + latin9 fr: (Legacy) Alternative + latin9_nodeadkeys fr: (Legacy) Alternative, eliminate dead keys + latin9_sundeadkeys fr: (Legacy) Alternative, Sun dead keys + bepo fr: Bepo, ergonomic, Dvorak way + bepo_latin9 fr: Bepo, ergonomic, Dvorak way, latin-9 only + dvorak fr: Dvorak + mac fr: Macintosh + bre fr: Breton + oci fr: Occitan + geo fr: Georgian AZERTY Tskapo + generic gh: Multilingual + akan gh: Akan + ewe gh: Ewe + fula gh: Fula + ga gh: Ga + hausa gh: Hausa + ergonomic ge: Ergonomic + mess ge: MESS + ru ge: Russian + os ge: Ossetian + deadacute de: Dead acute + deadgraveacute de: Dead grave acute + nodeadkeys de: Eliminate dead keys + ro de: Romanian keyboard with German letters + ro_nodeadkeys de: Romanian keyboard with German letters, eliminate dead keys + dvorak de: Dvorak + sundeadkeys de: Sun dead keys + neo de: Neo 2 + mac de: Macintosh + mac_nodeadkeys de: Macintosh, eliminate dead keys + dsb de: Lower Sorbian + dsb_qwertz de: Lower Sorbian (qwertz) + qwerty de: qwerty + simple gr: Simple + extended gr: Extended + nodeadkeys gr: Eliminate dead keys + polytonic gr: Polytonic + standard hu: Standard + nodeadkeys hu: Eliminate dead keys + qwerty hu: qwerty + 101_qwertz_comma_dead hu: 101/qwertz/comma/Dead keys + 101_qwertz_comma_nodead hu: 101/qwertz/comma/Eliminate dead keys + 101_qwertz_dot_dead hu: 101/qwertz/dot/Dead keys + 101_qwertz_dot_nodead hu: 101/qwertz/dot/Eliminate dead keys + 101_qwerty_comma_dead hu: 101/qwerty/comma/Dead keys + 101_qwerty_comma_nodead hu: 101/qwerty/comma/Eliminate dead keys + 101_qwerty_dot_dead hu: 101/qwerty/dot/Dead keys + 101_qwerty_dot_nodead hu: 101/qwerty/dot/Eliminate dead keys + 102_qwertz_comma_dead hu: 102/qwertz/comma/Dead keys + 102_qwertz_comma_nodead hu: 102/qwertz/comma/Eliminate dead keys + 102_qwertz_dot_dead hu: 102/qwertz/dot/Dead keys + 102_qwertz_dot_nodead hu: 102/qwertz/dot/Eliminate dead keys + 102_qwerty_comma_dead hu: 102/qwerty/comma/Dead keys + 102_qwerty_comma_nodead hu: 102/qwerty/comma/Eliminate dead keys + 102_qwerty_dot_dead hu: 102/qwerty/dot/Dead keys + 102_qwerty_dot_nodead hu: 102/qwerty/dot/Eliminate dead keys + Sundeadkeys is: Sun dead keys + nodeadkeys is: Eliminate dead keys + mac is: Macintosh + dvorak is: Dvorak + lyx il: lyx + phonetic il: Phonetic + biblical il: Biblical Hebrew (Tiro) + nodeadkeys it: Eliminate dead keys + mac it: Macintosh + us it: US keyboard with Italian letters + geo it: Georgian + kana jp: Kana + OADG109A jp: OADG 109A + mac jp: Macintosh + phonetic kg: Phonetic + ruskaz kz: Russian with Kazakh + kazrus kz: Kazakh with Russian + basic la: Laos + stea la: Laos - STEA (proposed standard layout) + nodeadkeys latam: Eliminate dead keys + deadtilde latam: Include dead tilde + sundeadkeys latam: Sun dead keys + std lt: Standard + us lt: US keyboard with Lithuanian letters + ibm lt: IBM (LST 1205-92) + lekp lt: LEKP + lekpa lt: LEKPa + apostrophe lv: Apostrophe (') variant + tilde lv: Tilde (~) variant + fkey lv: F-letter (F) variant + cyrillic me: Cyrillic + cyrillicyz me: Cyrillic, Z and ZHE swapped + latinunicode me: Latin unicode + latinyz me: Latin qwerty + latinunicodeyz me: Latin unicode qwerty + cyrillicalternatequotes me: Cyrillic with guillemets + latinalternatequotes me: Latin with guillemets + nodeadkeys mk: Eliminate dead keys + us mt: Maltese keyboard with US layout + nodeadkeys no: Eliminate dead keys + dvorak no: Dvorak + smi no: Northern Saami + smi_nodeadkeys no: Northern Saami, eliminate dead keys + mac no: Macintosh + mac_nodeadkeys no: Macintosh, eliminate dead keys + qwertz pl: qwertz + dvorak pl: Dvorak + dvorak_quotes pl: Dvorak, Polish quotes on quotemark key + dvorak_altquotes pl: Dvorak, Polish quotes on key 1 + csb pl: Kashubian + ru_phonetic_dvorak pl: Russian phonetic Dvorak + dvp pl: Programmer Dvorak + nodeadkeys pt: Eliminate dead keys + sundeadkeys pt: Sun dead keys + mac pt: Macintosh + mac_nodeadkeys pt: Macintosh, eliminate dead keys + mac_sundeadkeys pt: Macintosh, Sun dead keys + nativo pt: Nativo + nativo-us pt: Nativo for USA keyboards + nativo-epo pt: Nativo for Esperanto + cedilla ro: Cedilla + std ro: Standard + std_cedilla ro: Standard (Cedilla) + winkeys ro: Winkeys + crh_f ro: Crimean Tatar (Turkish F) + crh_alt ro: Crimean Tatar (Turkish Alt-Q) + crh_dobruca1 ro: Crimean Tatar (Dobruca-1 Q) + crh_dobruca2 ro: Crimean Tatar (Dobruca-2 Q) + phonetic ru: Phonetic + phonetic_winkeys ru: Phonetic Winkeys + typewriter ru: Typewriter + legacy ru: Legacy + typewriter-legacy ru: Typewriter, legacy + tt ru: Tatar + os_legacy ru: Ossetian, legacy + os_winkeys ru: Ossetian, Winkeys + cv ru: Chuvash + cv_latin ru: Chuvash Latin + udm ru: Udmurt + kom ru: Komi + sah ru: Yakut + xal ru: Kalmyk + dos ru: DOS + srp ru: Serbian + bak ru: Bashkirian + yz rs: Z and ZHE swapped + latin rs: Latin + latinunicode rs: Latin Unicode + latinyz rs: Latin qwerty + latinunicodeyz rs: Latin Unicode qwerty + alternatequotes rs: With guillemets + latinalternatequotes rs: Latin with guillemets + alternatequotes si: Use guillemets for quotes + us si: US keyboard with Slovenian letters + bksl sk: Extended Backslash + qwerty sk: qwerty + qwerty_bksl sk: qwerty, extended Backslash + nodeadkeys es: Eliminate dead keys + deadtilde es: Include dead tilde + sundeadkeys es: Sun dead keys + dvorak es: Dvorak + ast es: Asturian variant with bottom-dot H and bottom-dot L + cat es: Catalan variant with middle-dot L + mac es: Macintosh + nodeadkeys se: Eliminate dead keys + dvorak se: Dvorak + rus se: Russian phonetic + rus_nodeadkeys se: Russian phonetic, eliminate dead keys + smi se: Northern Saami + mac se: Macintosh + svdvorak se: Svdvorak + legacy ch: Legacy + de_nodeadkeys ch: German, eliminate dead keys + de_sundeadkeys ch: German, Sun dead keys + fr ch: French + fr_nodeadkeys ch: French, eliminate dead keys + fr_sundeadkeys ch: French, Sun dead keys + fr_mac ch: French (Macintosh) + de_mac ch: German (Macintosh) + syc sy: Syriac + syc_phonetic sy: Syriac phonetic + ku sy: Kurdish, Latin Q + ku_f sy: Kurdish, (F) + ku_alt sy: Kurdish, Latin Alt-Q + legacy tj: Legacy + tam_unicode lk: Tamil Unicode + tam_TAB lk: Tamil TAB Typewriter + tis th: TIS-820.2538 + pat th: Pattachote + f tr: (F) + alt tr: Alt-Q + sundeadkeys tr: Sun dead keys + ku tr: Kurdish, Latin Q + ku_f tr: Kurdish, (F) + ku_alt tr: Kurdish, Latin Alt-Q + intl tr: International (with dead keys) + crh tr: Crimean Tatar (Turkish Q) + crh_f tr: Crimean Tatar (Turkish F) + crh_alt tr: Crimean Tatar (Turkish Alt-Q) + indigenous tw: Indigenous + saisiyat tw: Saisiyat + phonetic ua: Phonetic + typewriter ua: Typewriter + winkeys ua: Winkeys + legacy ua: Legacy + rstu ua: Standard RSTU + rstu_ru ua: Standard RSTU on Russian layout + homophonic ua: Homophonic + crh ua: Crimean Tatar (Turkish Q) + crh_f ua: Crimean Tatar (Turkish F) + crh_alt ua: Crimean Tatar (Turkish Alt-Q) + extd gb: Extended - Winkeys + intl gb: International (with dead keys) + dvorak gb: Dvorak + dvorakukp gb: Dvorak (UK Punctuation) + mac gb: Macintosh + colemak gb: Colemak + latin uz: Latin + crh uz: Crimean Tatar (Turkish Q) + crh_f uz: Crimean Tatar (Turkish F) + crh_alt uz: Crimean Tatar (Turkish Alt-Q) + kr104 kr: 101/104 key Compatible + CloGaelach ie: CloGaelach + UnicodeExpert ie: UnicodeExpert + ogam ie: Ogham + ogam_is434 ie: Ogham IS434 + urd-crulp pk: CRULP + urd-nla pk: NLA + ara pk: Arabic + legacy epo: displaced semicolon and quote (obsolete) + igbo ng: Igbo + yoruba ng: Yoruba + hausa ng: Hausa + left_hand brai: Left hand + right_hand brai: Right hand + alt tm: Alt-Q + fr-oss ml: Français (France Alternative) + us-mac ml: English (USA Macintosh) + us-intl ml: English (USA International) diff --git a/sway/scripts/clamshell.sh b/sway/scripts/clamshell.sh new file mode 100755 index 0000000..e25072a --- /dev/null +++ b/sway/scripts/clamshell.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash +if [-d "/proc/acpi" ]; then + if cat /proc/acpi/button/lid/*/state | grep -q open; then + swaymsg output eDP-1 enable + else + swaymsg output eDP-1 disable + fi +fi diff --git a/sway/scripts/import-gsettings b/sway/scripts/import-gsettings new file mode 100755 index 0000000..e1257df --- /dev/null +++ b/sway/scripts/import-gsettings @@ -0,0 +1,15 @@ +#!/bin/sh + +# usage: import-gsettings +config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" +if [ ! -f "$config" ]; then exit 1; fi + +gnome_schema="org.gnome.desktop.interface" +gtk_theme="$(grep 'gtk-theme-name' "$config" | cut -d'=' -f2)" +icon_theme="$(grep 'gtk-icon-theme-name' "$config" | cut -d'=' -f2)" +cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | cut -d'=' -f2)" +font_name="$(grep 'gtk-font-name' "$config" | cut -d'=' -f2)" +gsettings set "$gnome_schema" gtk-theme "$gtk_theme" +gsettings set "$gnome_schema" icon-theme "$icon_theme" +gsettings set "$gnome_schema" cursor-theme "$cursor_theme" +gsettings set "$gnome_schema" font-name "$font_name" diff --git a/sway/scripts/lockman.sh b/sway/scripts/lockman.sh new file mode 100755 index 0000000..69edccf --- /dev/null +++ b/sway/scripts/lockman.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Times the screen off and puts it to background +swayidle \ + timeout 300 'swaymsg "output * power off"' \ + resume 'swaymsg "output * power on"' & +# Locks the screen immediately +swaylock +# Kills last background task so idle timer doesn't keep running +kill %% diff --git a/sway/scripts/screenshot.sh b/sway/scripts/screenshot.sh new file mode 100755 index 0000000..d946a21 --- /dev/null +++ b/sway/scripts/screenshot.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +entries="Active Screen Output Area Window" + +selected=$(printf '%s\n' $entries | wofi --style=$HOME/.config/wofi/style.widgets.css --conf=$HOME/.config/wofi/config.screenshot | awk '{print tolower($1)}') + +case $selected in + active) + /usr/share/sway/scripts/grimshot --notify save active;; + screen) + /usr/share/sway/scripts/grimshot --notify save screen;; + output) + /usr/share/sway/scripts/grimshot --notify save output;; + area) + /usr/share/sway/scripts/grimshot --notify save area;; + window) + /usr/share/sway/scripts/grimshot --notify save window;; +esac diff --git a/sway/scripts/swayfader.py b/sway/scripts/swayfader.py new file mode 100755 index 0000000..b2920b6 --- /dev/null +++ b/sway/scripts/swayfader.py @@ -0,0 +1,229 @@ +from i3ipc import Connection, Event +from threading import Thread +from time import sleep + + +FRAME_T = 0.01 # time taken between each frame of fade + +# transparency values +CON_AC = 1 # active window +CON_INAC = 0.5 # inactive window +FLOAT_AC = 1 # active floating window +FLOAT_INAC = 0.5 # inactive floating window +BOT_INAC = 0.9 # bottom window + + +# fade durations +FADE_TIME = 0.2 +ALT_FADE_TIME = 0.1 + +CON_OUT = FADE_TIME # window fading out +CON_IN = 0.15 # window fading in +FLOAT_OUT = ALT_FADE_TIME # floating window fading out +FLOAT_IN = ALT_FADE_TIME # floating window fading in +BOT_OUT = ALT_FADE_TIME # bottom window fading out +BOT_IN = ALT_FADE_TIME # bottom window fading in +BOT_SWITCH_IN = FADE_TIME # window becoming bottom window +BOT_SWITCH_OUT = FADE_TIME # bottom window becoming window +FLOAT_BOT_OUT = FADE_TIME # floating window fading out from bottom +FLOAT_BOT_IN = FADE_TIME # floating window fading in from bottom + + +class Fader: + def __init__(self): + self.floating_windows = [] + self.fader_running = False + self.fade_queue = [] + self.fade_data = {} + self.bottom_win = None + self.old_win = None + self.active_win = None + + ipc = Connection() + ipc.on(Event.WINDOW_FOCUS, self.on_window_focus) + ipc.on(Event.WINDOW_NEW, self.on_window_new) + ipc.on(Event.WINDOW_FLOATING, self.on_window_floating) + + for win in ipc.get_tree(): + if win.type == "floating_con": + self.floating_windows.append(win.id) + if win.focused: + change_opacity(win, FLOAT_AC) + self.active_win = win + else: + change_opacity(win, FLOAT_INAC) + elif win.type == "con": + if win.focused: + self.active_win = win + change_opacity(win, CON_AC) + else: + change_opacity(win, CON_INAC) + + ipc.main() + + def add_fade(self, win, start, target, duration): + if not duration: + if win.id in self.fade_queue: + self.fade_queue.remove(win.id) + del self.fade_data[win.id] + change_opacity(win, target) + return + + if win.id in self.fade_queue: + f = self.fade_data[win.id] + change = (FRAME_T / duration) * (target - f["opacity"]) + f["change"] = change + f["target"] = target + return + + change_opacity(win, start) + change = (FRAME_T / duration) * (target - start) + fade_data = {"opacity": start, "change": change, "target": target, "win": win} + self.fade_queue.append(win.id) + self.fade_data[win.id] = fade_data + + def start_fader(self): + if not self.fader_running: + self.fader_running = True + Thread(target=self.fader).start() + + def fader(self): + while self.fade_queue: + for win_id in self.fade_queue.copy(): + try: + f = self.fade_data[win_id] + except KeyError: + continue + f["opacity"] += f["change"] + + finished = False + if f["change"] > 0: + if f["opacity"] >= f["target"]: + finished = True + elif f["opacity"] <= f["target"]: + finished = True + + if finished: + change_opacity(f["win"], f["target"]) + try: + self.fade_queue.remove(win_id) + del self.fade_data[win_id] + except (KeyError, ValueError): + continue + else: + change_opacity(f["win"], f["opacity"]) + + sleep(FRAME_T) + self.fader_running = False + + def on_window_focus(self, ipc, e): + if self.active_win.id == e.container.id: + return + + if self.active_win.type == "con": + if e.container.type == "con": + self.add_fade( + e.container, CON_INAC, + CON_AC, CON_IN) + self.add_fade( + self.active_win, CON_AC, + CON_INAC, CON_OUT) + + else: + self.add_fade( + e.container, FLOAT_INAC, + FLOAT_AC, FLOAT_IN) + self.add_fade( + self.active_win, CON_AC, + BOT_INAC, BOT_OUT) + self.bottom_win = self.active_win + + else: + if e.container.type == "con": + self.add_fade( + self.active_win, FLOAT_AC, + FLOAT_INAC, FLOAT_BOT_OUT) + + if not self.bottom_win: + self.add_fade( + e.container, CON_INAC, + CON_AC, CON_IN) + + elif e.container.id != self.bottom_win.id: + self.add_fade( + self.bottom_win, BOT_INAC, + CON_INAC, BOT_SWITCH_OUT) + self.add_fade( + e.container, CON_INAC, + CON_AC, BOT_SWITCH_IN) + self.bottom_win = e.container + + else: + self.add_fade( + self.bottom_win, BOT_INAC, + CON_AC, BOT_IN) + + else: + self.add_fade( + self.active_win, FLOAT_AC, + FLOAT_INAC, FLOAT_OUT) + self.add_fade( + e.container, FLOAT_INAC, + FLOAT_AC, FLOAT_IN) + + self.start_fader() + self.active_win = e.container + + def on_window_new(self, ipc, e): + if self.active_win: + if self.active_win.type == "con": + change_opacity(self.active_win, CON_INAC) + else: + change_opacity(self.active_win, FLOAT_INAC) + + if self.bottom_win: + change_opacity(self.bottom_win, CON_INAC) + + elif self.active_win and self.active_win.type == "con": + self.bottom_win = self.active_win + change_opacity(self.bottom_win, CON_INAC) + + change_opacity(e.container, CON_AC) + self.old_win = self.active_win + self.active_win = e.container + + def on_window_floating(self, ipc, e): + c_id = e.container.id + if c_id not in self.floating_windows: + self.floating_windows.append(c_id) + + if self.active_win.id != e.container.id: + change_opacity(e.container, FLOAT_INAC) + + else: + if self.old_win and self.bottom_win: + if self.old_win.type == "con": + self.bottom_win = self.old_win + change_opacity(self.bottom_win, BOT_INAC) + change_opacity(e.container, FLOAT_AC) + + else: + self.floating_windows.remove(c_id) + if self.active_win.id != e.container.id: + change_opacity(e.container, CON_INAC) + + else: + if self.old_win and self.old_win.type == "con": + change_opacity(self.old_win, CON_INAC) + change_opacity(self.active_win, CON_AC) + + self.active_win = e.container + + +def change_opacity(win, trans): + win.command("opacity " + str(trans)) + + +if __name__ == "__main__": + Fader() + diff --git a/sway/scripts/weather.sh b/sway/scripts/weather.sh new file mode 100755 index 0000000..ce0f458 --- /dev/null +++ b/sway/scripts/weather.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +LOC="$1" +# HTML encode string as %20 +LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC") +content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=NewYork°=C") +ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' ) +# echo $ICON +TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g') +TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g') +CLASS=$(echo $content | jq .skytext) +echo '{"text": "'$TEMP'", "tooltip": "'$ICON $TOOLTIP $LOC'", "class": '$CLASS' }' + + + diff --git a/swaybg.sh b/swaybg.sh new file mode 100755 index 0000000..c1ac6a0 --- /dev/null +++ b/swaybg.sh @@ -0,0 +1,11 @@ +#!/bin/sh +swaybg -i $(find ~/git/Wallpapers/img/ -type f | shuf -n1) -m fill & +OLD_PID=$! +while true; do + sleep 295 + swaybg -i $(find ~/git/Wallpapers/img/ -type f | shuf -n1) -m fill & + NEXT_PID=$! + sleep 5 + kill $OLD_PID + OLD_PID=$NEXT_PID +done diff --git a/swaydotfile.sh b/swaydotfile.sh new file mode 100755 index 0000000..96d48f0 --- /dev/null +++ b/swaydotfile.sh @@ -0,0 +1 @@ +rsync -az ~/.config/sway ~/.config/swaylock ~/.config/waybar ~/.config/wofi ~/scripts/swaybg.sh ~/scripts/swaydotfile.sh ~/.config/fcd ~/.config/mako ~/.config/ranger ~/.config/alacritty ~/.vimrc ~/.profile ~/.bashrc ~/.inputrc ~/.config/kitty ~/git/swayDotfiles/ && cd ~/git/swayDotfiles && git add . && git commit -m "update dotfiles" && git push -u origin main diff --git a/swaylock/config b/swaylock/config new file mode 100644 index 0000000..231d73a --- /dev/null +++ b/swaylock/config @@ -0,0 +1,24 @@ +# indicator +# no-unlock-indicator +# daemonize +indicator-caps-lock +# datestr=%A +image=$HOME/git/Wallpapers/img/img181.jpg +scaling=fill +font=UbuntuMono +font-size=20 + +# Ring +indicator-radius=115 +# line-uses-ring +line-color=#3b4252 +text-color=#d8dee9 +inside-color=#2e344098 +inside-ver-color=#5e81ac +line-ver-color=#5e81ac +ring-ver-color=#5e81ac98 +ring-color=#4c566a +key-hl-color=#5e81ac +separator-color=#4c566a +layout-text-color=#eceff4 +line-wrong-color=#d08770 diff --git a/swaylock/qt5ct/qt5ct.conf b/swaylock/qt5ct/qt5ct.conf new file mode 100644 index 0000000..b32291b --- /dev/null +++ b/swaylock/qt5ct/qt5ct.conf @@ -0,0 +1,28 @@ +[Appearance] +color_scheme_path=/usr/share/qt5ct/colors/airy.conf +custom_palette=false +icon_theme=Papirus +standard_dialogs=default +style=kvantum-dark + +[Fonts] +fixed=@Variant(\0\0\0@\0\0\0\x12\0\x43\0\x61\0n\0t\0\x61\0r\0\x65\0l\0l@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) +general=@Variant(\0\0\0@\0\0\0\x12\0\x43\0\x61\0n\0t\0\x61\0r\0\x65\0l\0l@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) + +[Interface] +activate_item_on_single_click=1 +buttonbox_layout=0 +cursor_flash_time=1000 +dialog_buttons_have_icons=1 +double_click_interval=400 +gui_effects=@Invalid() +keyboard_scheme=2 +menus_have_icons=true +show_shortcuts_in_context_menus=true +stylesheets=@Invalid() +toolbutton_style=4 +underline_shortcut=1 +wheel_scroll_lines=3 + +[SettingsWindow] +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\a\x80\0\0\0\"\0\0\v:\0\0\x4\x1c\0\0\a\x80\0\0\0\"\0\0\xe\xff\0\0\x4\x37\0\0\0\0\x2\0\0\0\a\x80\0\0\a\x80\0\0\0\"\0\0\v:\0\0\x4\x1c) diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..1f81b45 --- /dev/null +++ b/waybar/config @@ -0,0 +1,247 @@ +// https://github.com/Alexays/Waybar/blob/master/resources/config +// https://github.com/EndeavourOS-Community-Editions/sway + +// Global +{ + "layer": "top", + "position": "top", + + // If height property would be not present, it'd be calculated dynamically + "height": 30, + + "modules-left": [ + // "custom/launcher", + "sway/workspaces", + "sway/mode", + ], + + "modules-center": [ + ], + + "modules-right": [ + "disk", + "network", + //"idle_inhibitor", + "memory", + "cpu", + "temperature", + "pulseaudio", + "custom/keyboard-layout", + "battery", + //"custom/PBPbattery", + "backlight#icon", + "backlight#value", + "clock", + "tray", + //"custom/weather", + "custom/power", + ], + + // Modules + + "disk": { + "interval": 30, + "format": "{used} used on {path} ({percentage_used}%) | ", + }, + + "idle_inhibitor": { + "format": "{icon} ", + "format-icons":{ + "activated": "", + "deactivated": "" + } + }, + + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": ["/sys/class/hwmon/hwmon2/temp1_input", "/sys/class/thermal/thermal_zone0/temp"], + // "critical-threshold": 80, + // "format-critical": "{temperatureC}°C ", + "format": "{temperatureC}°C  |" + }, + + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": [" ", " ", " ", " ", " "] + }, + + "custom/PBPbattery": { + "exec": "~/.config/waybar/scripts/PBPbattery.sh", + "format": "{}", + }, + + "clock": { + "interval": 10, + //"format-alt": "󰃭 {:%e %b %Y}", // Icon: calendar-alt + "format": "󰃭 {:%e %b %Y %H:%M}", + "tooltip-format": "{calendar}", + "on-click": "orage" + }, + + "cpu": { + "interval": 5, + "format": " {usage}% ({load}) |", // Icon: microchip + "states": { + "warning": 70, + "critical": 90, + }, + // "on-click": "flatpak run io.missioncenter.MissionCenter &", + }, + + "custom/keyboard-layout": { + "exec": "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4", + // Interval set only as a fallback, as the value is updated by signal + "interval": 30, + "format": "󰌌 {} |", // Icon: keyboard + // Signal sent by Sway key binding (~/.config/sway/key-bindings) + "signal": 1, // SIGHUP + "tooltip": false, + "on-click": "~/.config/waybar/scripts/keyhint.sh", + }, + + "custom/keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + + "memory": { + "interval": 5, + "format": " {}% | ", // Icon: memory + "on-click": "kitty -e 'btop'", + "states": { + "warning": 70, + "critical": 90 + } + }, + + "network": { + "interval": 5, + "format-wifi": "SSID: {essid} ({signalStrength}%) |", // Icon: wifi + "format-ethernet": " {ifname}: {ipaddr}/{cidr}", // Icon: ethernet + "format-disconnected": "⚠ Disconnected", + "tooltip-format": "{ifname}: {ipaddr}", + "on-click": "kitty -e 'nmtui'", + }, + "network#vpn": { + "interface": "tun0", + "format": " {essid} ({signalStrength}%)", + "format-disconnected": "⚠ Disconnected", + "tooltip-format": "{ifname}: {ipaddr}/{cidr}", + }, + + "sway/mode": { + "format": "{}", + "tooltip": false + }, + + "sway/window": { + "format": "{}", + "max-length": 120 + }, + + // "sway/workspaces": { + // "disable-scroll": true, + // "disable-markup" : false, + // "all-outputs": true, + // "format": " {icon} ", + // //"format":"{icon}", + // "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // } + // }, + + "pulseaudio": { + "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon}", + "format-bluetooth": "{volume}% {icon}  {format_source}", + "format-bluetooth-muted": "󰝟 {icon}  {format_source}", + "format-muted": "󰝟 {format_source}", + "format-source": "{volume}%  ", + "format-source-muted": " ", + "format-icons": { + "headphone": "󰋋 ", + "hands-free": "וֹ", + "headset": "󰋎 ", + "phone": " ", + "portable": " ", + "car": " ", + "default": [" "] + }, + "on-click": "pavucontrol", + "on-scroll-up": "pactl set-sink-volume @DEFAULT_SINK@ +2%", + "on-scroll-down": "pactl set-sink-volume @DEFAULT_SINK@ -2%", + }, + + // to use the weather module replace with your city or town + // note: do not use spaces: new york would be newyork + "custom/weather": { + "exec": "~/.config/waybar/scripts/weather.sh ", + "return-type": "json", + "interval": 600, + }, + + "tray": { + "icon-size": 18, + "spacing":10, + }, + + "backlight#icon": { + "format": "{icon}", + "format-icons": [""], + "on-scroll-down": "brightnessctl -c backlight set 1%-", + "on-scroll-up": "brightnessctl -c backlight set +1%" + }, + + "backlight#value" :{ + "format": "{percent}%", + "on-scroll-down": "brightnessctl -c backlight set 1%-", + "on-scroll-up": "brightnessctl -c backlight set +1%" + }, + + // "custom/firefox": { + // "format": " ", + // "on-click": "exec firefox", + // "tooltip": false + // }, + // + // "custom/terminal": { + // "format": " ", + // "on-click": "exec xfce4-terminal", + // "tooltip": false + // }, + // + // "custom/files": { + // "format": " ", + // "on-click": "exec thunar", + // "tooltip": false + // }, + // + // "custom/launcher": { + // "format":" ", + // "on-click": "exec wofi -c ~/.config/wofi/config -I", + // "tooltip": false, + // }, + // + "custom/power": { + "format":"⏻ ", + "on-click": "exec ~/.config/waybar/scripts/power-menu.sh", + "tooltip": false, + }, +} diff --git a/waybar/scripts/PBPbattery.sh b/waybar/scripts/PBPbattery.sh new file mode 100755 index 0000000..1cf34da --- /dev/null +++ b/waybar/scripts/PBPbattery.sh @@ -0,0 +1,21 @@ + +#!/bin/bash +#simple Shellscript for waybar/i3blocks/polybar on Pinebook pro +#05012020 geri123@gmx.net Gerhard S. + +PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity) +STATUS=$(cat /sys/class/power_supply/cw2015-battery/status) +case $(( + $PERCENT >= 0 && $PERCENT <= 20 ? 1 : + $PERCENT > 20 && $PERCENT <= 40 ? 2 : + $PERCENT > 40 && $PERCENT <= 60 ? 3 : + $PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in +# + (1) echo $STATUS:"":$PERCENT%;; + (2) echo $STATUS:"":$PERCENT%;; + (3) echo $STATUS:"":$PERCENT%;; + (4) echo $STATUS:"":$PERCENT%;; + (5) echo $STATUS:"":$PERCENT%;; +esac + + diff --git a/waybar/scripts/keyhint.sh b/waybar/scripts/keyhint.sh new file mode 100755 index 0000000..bbfd11a --- /dev/null +++ b/waybar/scripts/keyhint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +yad --title="Sway-WM keybindings:" --no-buttons --geometry=400x345-15-400 --list --column=key: --column=description: --column=command: "ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" "+enter" "Terminal" "(xfce4-terminal)" "+d" "Application Menu" "(wofi)" "+p" "Activities" "(wofi)" "+o" "" "Open Broswer" "+n" "" "Open Files" "+q" "close focused app" "(kill)" "[Shift]+Print-key" "screenshot" "(grim)" "+Shift+e" "power-menu" "(wofi)" "+t" "open keybinding helper" "full list" diff --git a/waybar/scripts/power-menu.sh b/waybar/scripts/power-menu.sh new file mode 100755 index 0000000..edaa5d6 --- /dev/null +++ b/waybar/scripts/power-menu.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +entries="Logout Suspend Reboot Shutdown" + +selected=$(printf '%s\n' $entries | wofi --conf=$HOME/.config/wofi/config.power --style=$HOME/.config/wofi/style.widgets.css | awk '{print tolower($1)}') + +case $selected in + logout) + swaymsg exit;; + suspend) + exec systemctl suspend;; + reboot) + exec systemctl reboot;; + shutdown) + exec systemctl poweroff -i;; +esac diff --git a/waybar/scripts/weather.sh b/waybar/scripts/weather.sh new file mode 100755 index 0000000..b03cd1c --- /dev/null +++ b/waybar/scripts/weather.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +LOC="$1" +# HTML encode string as %20 +LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC") +content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=$LOCATION°=C") +ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' ) +# echo $ICON +TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g') +TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g') +CLASS=$(echo $content | jq .skytext) +echo '{"text": "'$TEMP'", "tooltip": "'$ICON $TOOLTIP $LOC'", "class": '$CLASS' }' + diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..a289374 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,200 @@ +/* ============================================================================= + * + * Waybar configuration + * + * Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration + * + * =========================================================================== */ + +/* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + +/* +Arc-Dark Color Scheme +*/ +@define-color highlight #5294e2 ; +@define-color base1 #404552 ; + +@keyframes blink-warning { + 70% { + color: white; + } + + to { + color: white; + background-color: orange; + } +} + +@keyframes blink-critical { + 70% { + color: white; + } + + to { + color: white; + background-color: red; + } +} + +/* ----------------------------------------------------------------------------- + * Base styles + * -------------------------------------------------------------------------- */ + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 1px; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: transparent; + color: #bebebe; + background-color: @base1; + font-family: UbuntuMono; + font-size: 12px; +} + +/* Every modules */ +#battery, +#clock, +#backlight, +#cpu, +#custom-keyboard-layout, +#memory, +#mode, +#custom-weather, +#network, +#pulseaudio, +#temperature, +#tray, +#idle_inhibitor, +#custom-PBPbattery { + padding:0.5rem 0.6rem; + margin: 1px 0px; +} + +/* ----------------------------------------------------------------------------- + * Modules styles + * -------------------------------------------------------------------------- */ + +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#battery.warning { + color: orange; +} + +#battery.critical { + color: red; +} + +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +#cpu.warning { + color: orange; +} + +#cpu.critical { + color: red; +} + +#memory { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#memory.warning { + color: orange; + } + +#memory.critical { + color: red; + animation-name: blink-critical; + animation-duration: 2s; + padding-left:5px; + padding-right:5px; +} + +#mode { + background: @highlight; + border-bottom: 3px transparent; + color:white; + margin-left: 5px; + padding: 7px; +} + +#network.disconnected { + color: orange; +} + +#pulseaudio { + padding-top:6px; +} + +#pulseaudio.muted { + color: @highlight; +} + +#temperature.critical { + color: red; +} + +#window { + font-weight: bold; +} + +#workspaces { + font-size:13px; +} + +#workspaces button { + border-bottom: 3px solid transparent; + margin-bottom: 0px; + padding:0px; +} + +#workspaces button.focused { + border-bottom: 3px solid @highlight; + margin-bottom: 1px; + padding-left:0; +} + +#workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; +} + +#custom-power { + margin-left:15px; + margin-right:15px; + font-size:15px; +} + +#custom-launcher { + font-size:13px; + margin-left:15px; + margin-right:10px; +} + +#backlight.icon { + padding-right:1px; + font-size: 13px; +} diff --git a/wofi/config b/wofi/config new file mode 100644 index 0000000..a7f1910 --- /dev/null +++ b/wofi/config @@ -0,0 +1,17 @@ +hide_scroll=true +show=drun +width=25% +lines=10 +line_wrap=word +term=xfce4-terminal +allow_markup=true +always_parse_args=true +show_all=true +print_command=true +layer=overlay +allow_images=true +insensitive=true +prompt= +image_size=15 +display_generic=true +location=center diff --git a/wofi/config.power b/wofi/config.power new file mode 100644 index 0000000..0ad9ecf --- /dev/null +++ b/wofi/config.power @@ -0,0 +1,9 @@ +hide_search=true +hide_scroll=true +insensitive=true +show=dmenu +width=100 +lines=4 +location=top_right +x=-120 +y=10 diff --git a/wofi/config.screenshot b/wofi/config.screenshot new file mode 100644 index 0000000..d18a3c8 --- /dev/null +++ b/wofi/config.screenshot @@ -0,0 +1,9 @@ +hide_search=true +hide_scroll=true +insensitive=true +width=1 +show=dmenu +lines=5 +location=centre +x=870 +y=455 diff --git a/wofi/style.css b/wofi/style.css new file mode 100644 index 0000000..3a18d9a --- /dev/null +++ b/wofi/style.css @@ -0,0 +1,47 @@ +/* +Arc-Dark Color Scheme +*/ + +@define-color highlight #5294e2; +@define-color base1 #404552; +@define-color base2 #40455; +@define-color base3 #4b5160; + +*{ + font-family: UbuntuMono; +} + +window { + border: 1px solid @highlight; +} + +#input { + margin-bottom: 15px; + padding:3px; + border-radius: 5px; + border:none; + color: white; +} + +#inner-box { + background-color: @base3; +} + +#outer-box { + margin: 5px; + padding:15px; + background-color: @base2; +} + +#text { + padding: 5px; + color: white; +} + +#entry:nth-child(even) { + background-color: @base1; +} + +#entry:selected { + background-color: @highlight; +} diff --git a/wofi/style.widgets.css b/wofi/style.widgets.css new file mode 100644 index 0000000..7718255 --- /dev/null +++ b/wofi/style.widgets.css @@ -0,0 +1,45 @@ +/* +Arc-Dark Color Scheme +*/ + +@define-color highlight #5294e2; +@define-color base1 #404552; +@define-color base2 #40455; +@define-color base3 #4b5160; + +*{ + font-family: UbuntuMono; +} + +#window { + border: 1px solid @highlight; + margin: 0px 5px 0px 5px; +} + +#inner-box { + background-color: @base2; +} + +#outer-box { + margin: 5px; + padding:10px; + background-color: @base2; + margin-top: -22px; +} + +#text { + padding: 5px; + color: white; +} + +#entry:nth-child(even) { + background-color: @base1; +} + +#entry { + background-color: @base3; +} + +#entry:selected { + background-color: @highlight; +} diff --git a/wofi/windows.py b/wofi/windows.py new file mode 100755 index 0000000..6b41a60 --- /dev/null +++ b/wofi/windows.py @@ -0,0 +1,119 @@ +#!/bin/python3 +import json +import subprocess +from argparse import ArgumentParser + +ENTER = "\n" + + +def get_windows(): + + command = "swaymsg -t get_tree" + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + data = json.loads(process.communicate()[0]) + + # Select outputs that are active + windows = [] + for output in data["nodes"]: + + # The scratchpad (under __i3) is not supported + if output.get("name") != "__i3" and output.get("type") == "output": + workspaces = output.get("nodes", []) + for ws in workspaces: + if ws.get("type") == "workspace": + windows.extend(extract_nodes_iterative(ws)) + return windows + + +# Extracts all windows from a sway workspace json object +def extract_nodes_iterative(workspace): + all_nodes = [] + + floating_nodes = workspace.get("floating_nodes", []) + + for floating_node in floating_nodes: + all_nodes.append(floating_node) + + nodes = workspace.get("nodes", []) + + for node in nodes: + + # Leaf node + if not node.get("nodes"): + all_nodes.append(node) + # Nested node, handled iterative + else: + for inner_node in node.get("nodes"): + nodes.append(inner_node) + + return all_nodes + + +# Returns an array of all windows +def parse_windows(windows): + return [window.get("name") for window in windows] + + +# Returns a newline seperated UFT-8 encoded string of all windows for wofi +def build_wofi_string(windows): + return ENTER.join(windows).encode("UTF-8") + + +# Executes wofi with the given input string +def show_wofi(windows): + + command = 'wofi -c ~/.config/wofi/menu -s ~/.config/wofi/style.css -p "Windows: " -d -i --hide-scroll' + + process = subprocess.Popen( + command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE + ) + return process.communicate(input=windows)[0] + + +# Returns the sway window id of the window that was selected by the user inside wofi +def parse_id(windows, parsed_windows, selected): + if not selected: + return None + else: + selected = (selected.decode("UTF-8"))[:-1] # Remove new line character + window_index = int( + parsed_windows.index(selected) + ) # Get index of selected window in the parsed window array + return str( + windows[window_index].get("id") + ) # Get sway window id based on the index + + +# Switches the focus to the given id +def switch_window(id): + command = "swaymsg [con_id={}] focus".format(id) + + process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + process.communicate()[0] + + +# Entry point +if __name__ == "__main__": + + parser = ArgumentParser(description="Wofi based window switcher") + + windows = get_windows() + + parsed_windows = parse_windows(windows) + + wofi_string = build_wofi_string(parsed_windows) + + selected = show_wofi(wofi_string) + + # Otherwise no point in running + if selected: + + selected_id = parse_id(windows, parsed_windows, selected) + + switch_window(selected_id)