diff --git a/bin/dbe b/bin/dbe new file mode 100755 index 0000000..d46fa93 --- /dev/null +++ b/bin/dbe @@ -0,0 +1,6 @@ +#!/bin/sh + +export GTK_IM_MODULE="ibus" +export QT_IM_MODULE="ibus" +export XMODIFIERS="@im=ibus" +dbeaver diff --git a/bin/idea b/bin/idea new file mode 100755 index 0000000..886682f --- /dev/null +++ b/bin/idea @@ -0,0 +1,5 @@ +#!/bin/sh + +wmname LG3D +/home/klesh/Programs/idea-IC-203.7717.32/bin/idea.sh + diff --git a/cli/fish.sh b/cli/fish.sh index c4138ea..0c62277 100755 --- a/cli/fish.sh +++ b/cli/fish.sh @@ -58,6 +58,7 @@ lnsf "$DIR/fish/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fis lnsf "$DIR/fish/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish" lnsf "$DIR/fish/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish" lnsf "$DIR/fish/functions/r.fish" "$XDG_CONFIG_HOME/fish/functions/r.fish" +lnsf "$DIR/fish/functions/f.fish" "$XDG_CONFIG_HOME/fish/functions/f.fish" lnsf "$DIR/fish/functions/append_paths.fish" "$XDG_CONFIG_HOME/fish/functions/append_paths.fish" lnsf "$DIR/fish/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish" diff --git a/cli/fish/config.fish b/cli/fish/config.fish index cfb971b..5d3cd59 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -53,7 +53,7 @@ if status is-interactive alias dt='date "+%Y%m%d-%H%M%S"' # === PATH and file sourcing - append_paths ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin + append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \ ~/.jabba/jabba.fish \ ~/.profile.fish diff --git a/cli/fish/functions/f.fish b/cli/fish/functions/f.fish new file mode 100644 index 0000000..71fbf91 --- /dev/null +++ b/cli/fish/functions/f.fish @@ -0,0 +1,174 @@ +function f --description='sync lf pwd to shell when exit' + set -x LF_ICONS "\ +tw= :\ +st= :\ +ow= :\ +dt= :\ +di= :\ +fi= :\ +ln= :\ +or= :\ +ex= :\ +*.c= :\ +*.cc= :\ +*.clj= :\ +*.coffee= :\ +*.cpp= :\ +*.css= :\ +*.d= :\ +*.dart= :\ +*.erl= :\ +*.exs= :\ +*.fs= :\ +*.go= :\ +*.h= :\ +*.hh= :\ +*.hpp= :\ +*.hs= :\ +*.html= :\ +*.java= :\ +*.jl= :\ +*.js= :\ +*.json= :\ +*.lua= :\ +*.md= :\ +*.php= :\ +*.pl= :\ +*.pro= :\ +*.py= :\ +*.rb= :\ +*.rs= :\ +*.scala= :\ +*.ts= :\ +*.vim= :\ +*.cmd= :\ +*.ps1= :\ +*.sh= :\ +*.bash= :\ +*.zsh= :\ +*.fish= :\ +*.tar= :\ +*.tgz= :\ +*.arc= :\ +*.arj= :\ +*.taz= :\ +*.lha= :\ +*.lz4= :\ +*.lzh= :\ +*.lzma= :\ +*.tlz= :\ +*.txz= :\ +*.tzo= :\ +*.t7z= :\ +*.zip= :\ +*.z= :\ +*.dz= :\ +*.gz= :\ +*.lrz= :\ +*.lz= :\ +*.lzo= :\ +*.xz= :\ +*.zst= :\ +*.tzst= :\ +*.bz2= :\ +*.bz= :\ +*.tbz= :\ +*.tbz2= :\ +*.tz= :\ +*.deb= :\ +*.rpm= :\ +*.jar= :\ +*.war= :\ +*.ear= :\ +*.sar= :\ +*.rar= :\ +*.alz= :\ +*.ace= :\ +*.zoo= :\ +*.cpio= :\ +*.7z= :\ +*.rz= :\ +*.cab= :\ +*.wim= :\ +*.swm= :\ +*.dwm= :\ +*.esd= :\ +*.jpg= :\ +*.jpeg= :\ +*.mjpg= :\ +*.mjpeg= :\ +*.gif= :\ +*.bmp= :\ +*.pbm= :\ +*.pgm= :\ +*.ppm= :\ +*.tga= :\ +*.xbm= :\ +*.xpm= :\ +*.tif= :\ +*.tiff= :\ +*.png= :\ +*.svg= :\ +*.svgz= :\ +*.mng= :\ +*.pcx= :\ +*.mov= :\ +*.mpg= :\ +*.mpeg= :\ +*.m2v= :\ +*.mkv= :\ +*.webm= :\ +*.ogm= :\ +*.mp4= :\ +*.m4v= :\ +*.mp4v= :\ +*.vob= :\ +*.qt= :\ +*.nuv= :\ +*.wmv= :\ +*.asf= :\ +*.rm= :\ +*.rmvb= :\ +*.flc= :\ +*.avi= :\ +*.fli= :\ +*.flv= :\ +*.gl= :\ +*.dl= :\ +*.xcf= :\ +*.xwd= :\ +*.yuv= :\ +*.cgm= :\ +*.emf= :\ +*.ogv= :\ +*.ogx= :\ +*.aac= :\ +*.au= :\ +*.flac= :\ +*.m4a= :\ +*.mid= :\ +*.midi= :\ +*.mka= :\ +*.mp3= :\ +*.mpc= :\ +*.ogg= :\ +*.ra= :\ +*.wav= :\ +*.oga= :\ +*.opus= :\ +*.spx= :\ +*.xspf= :\ +*.pdf= :\ +*.nix= :\ +" + set tempfile (mktemp -t tmp.XXXXXX) + command lf -last-dir-path $tempfile $argv + if test -s $tempfile + set dir (cat $tempfile) + if test -n $dir -a -d $dir + builtin cd -- $dir + end + end + + command rm -f -- $tempfile +end diff --git a/cli/fish/functions/fish_right_prompt.fish b/cli/fish/functions/fish_right_prompt.fish index e4b467e..7048fea 100644 --- a/cli/fish/functions/fish_right_prompt.fish +++ b/cli/fish/functions/fish_right_prompt.fish @@ -9,7 +9,7 @@ function fish_right_prompt test -z $CMD_DURATION -o \( $CMD_DURATION -lt 3000 \) && return test -z $WINDOWID && return set active_window (xdotool getactivewindow 2>/dev/null) - test $active_window -eq $WINDOWID && return + test "$active_window" -eq "$WINDOWID" && return set message (history --max=1) [$duration] notify-send (test "$s" -ne 0 && echo '--icon=dialog-warning') $message end diff --git a/cli/lf.sh b/cli/lf.sh new file mode 100755 index 0000000..394591d --- /dev/null +++ b/cli/lf.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e +DIR=$(dirname "$(readlink -f "$0")") +. "$DIR/../env.sh" + +if ! has_cmd go; then + "$PDIR/devel/go.sh" +fi +log 'Setting up lf' + +# install lf +env GOPROXY= CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf + +# linking configuration files +lnsf "$DIR/lf/lfrc" "$XDG_CONFIG_HOME/lf/lfrc" diff --git a/cli/lf/lfrc b/cli/lf/lfrc new file mode 100644 index 0000000..cd43a86 --- /dev/null +++ b/cli/lf/lfrc @@ -0,0 +1,23 @@ +set drawbox +set icons +cmd mkdir %mkdir "$@" + +cmd copyfilepath %echo "$f" | xsel -b +map Yp copyfilepath + +cmd copyfilename %basename "$f" | xsel -b +map Yn copyfilename + +cmd pasteoverwrite %{{ + load=$(lf -remote 'load') + mode=$(echo "$load" | sed -n '1p') + list=$(echo "$load" | sed '1d') + if [ $mode = 'copy' ]; then + cp -R $list . + elif [ $mode = 'move' ]; then + mv $list . + fi + lf -remote 'send load' + lf -remote 'send clear' +}} +map P pasteoverwrite diff --git a/cli/lf/lfrc.win b/cli/lf/lfrc.win new file mode 100644 index 0000000..8831d89 --- /dev/null +++ b/cli/lf/lfrc.win @@ -0,0 +1,10 @@ +set icons +set drawbox + +cmd mkdir %mkdir "$@" + +cmd fp %powershell -NoProfile -Command Set-Clipboard $env:f +cmd fn %powershell -NoProfile -Command Set-Clipboard (Split-Path -Leaf ($env:f -replace '"','')) + + +map rename diff --git a/cli/tmux/tmux.conf b/cli/tmux/tmux.conf index 18b1754..9e6bf25 100644 --- a/cli/tmux/tmux.conf +++ b/cli/tmux/tmux.conf @@ -9,6 +9,8 @@ set -g pane-base-index 1 set-option -g mouse on #set-option -g mouse-select-pane on set-option -g display-time 4000 +set-option -g set-titles on +set-option -g set-titles-string "#S / #W" ############################ diff --git a/devel/go.sh b/devel/go.sh index 010b865..b6ab9c4 100755 --- a/devel/go.sh +++ b/devel/go.sh @@ -18,7 +18,7 @@ esac if in_china; then go env -w GO111MODULE=on - go env -w GOPROXY=https://goproxy.cn,direct + go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/ fi # coc.nvim diff --git a/gui/mpv/scripts/cut.js b/gui/mpv/scripts/cut.js new file mode 100644 index 0000000..6d81f90 --- /dev/null +++ b/gui/mpv/scripts/cut.js @@ -0,0 +1,61 @@ +var beginPos, endPos + +function markBegin() { + beginPos = mp.get_property('time-pos') + mp.osd_message('Begin Position Marked at ' + beginPos) +} + +function markEnd() { + endPos = mp.get_property('time-pos') + mp.osd_message('End Position Marked at ' + endPos) +} + +function getMarked() { + if (!beginPos && !endPos) { + mp.osd_message('Please set Begin Position with Ctrl-b, End Position with Ctrl-e') + return + } + var ss = beginPos || 0 + var t = endPos || mp.get_property('duration') + var path = mp.get_property('path') + var dir_file = mp.utils.split_path(path) + return { + dir: dir_file[0], + file: dir_file[1], + path: path, + ss: ss, + t: t + } +} + +function outputMarked() { + var m = getMarked() + var output_dir = mp.utils.join_path(m.dir, 'clips') + mp.utils.subprocess({ + args: ['mkdir', '-p', output_dir], + cancellable: false + }) + output_file = mp.utils.join_path(output_dir, m.file) + mp.utils.subprocess({ + args: ['ffmpeg', '-ss', ss, '-i', m.path, '-t', t, '-c', 'copy', output_file], + cancellable: false + }) + mp.osd_message('Clip save to ' + output_file) +} + +function copyCutCmd() { + var m = getMarked() + var cmd = 'ffmpeg -ss ' + m.ss + ' -i ' + "'" + m.file + "' -t " + m.t + " -c copy '"+m.file + "-" + (Math.floor(m.ss/60)) +"'" + mp.utils.subprocess({ + args: ['powershell', '-NoProfile', '-Command', 'Set-Clipboard "'+cmd+'"'], + cancellable: false + }) + mp.osd_message("command has been copied to your clipboard") +} + + + +mp.add_key_binding("ctrl+b", "mark_begin", markBegin); +mp.add_key_binding("ctrl+e", "mark_end", markEnd); +mp.add_key_binding("ctrl+o", "output_marked", outputMarked); +mp.add_key_binding("ctrl+shift+o", "copy_cut_cmd", copyCutCmd); diff --git a/gui/mpv/scripts/cut.lua b/gui/mpv/scripts/cut.lua deleted file mode 100644 index ec58107..0000000 --- a/gui/mpv/scripts/cut.lua +++ /dev/null @@ -1,38 +0,0 @@ -local utils = require "mp.utils" - -function mark_begin() - begin_pos = mp.get_property('time-pos') - mp.osd_message('Begin Position Marked at ' .. begin_pos) -end - -function mark_end() - end_pos = mp.get_property('time-pos') - mp.osd_message('End Position Marked at ' .. end_pos) -end - -function output_marked() - if not begin_pos and not end_pos then - mp.osd_message('Please set Begin Position with Ctrl-b, End Position with Ctrl-e') - return - end - ss = begin_pos or 0 - t = end_pos or mp.get_property('duration') - path = mp.get_property('path') - dir, file = utils.split_path(path) - output_dir = utils.join_path(dir, 'clips') - utils.subprocess({ - args={'mkdir', '-p', output_dir}, - cancellable=false - }) - output_file = utils.join_path(output_dir, file) - utils.subprocess({ - args={'ffmpeg', '-ss', tostring(ss), '-i', path, '-t', tostring(t), '-c', 'copy', output_file}, - cancellable=false - }) - mp.osd_message('Clip save to ' .. output_file) -end - - -mp.add_key_binding("ctrl+b", "mark_begin", mark_begin); -mp.add_key_binding("ctrl+e", "mark_end", mark_end); -mp.add_key_binding("ctrl+o", "output_marked", output_marked); diff --git a/win/WindowsTerminal/settings.json b/win/WindowsTerminal/settings.json index ef32b65..be5722d 100644 --- a/win/WindowsTerminal/settings.json +++ b/win/WindowsTerminal/settings.json @@ -7,9 +7,9 @@ // For documentation on these settings, see: https://aka.ms/terminal-documentation { "$schema": "https://aka.ms/terminal-profiles-schema", - "initialPosition": "2118,0", - "initialRows": 71, - "initialCols": 142, + //"initialPosition": "2118,0", + //"initialRows": 71, + //"initialCols": 142, "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", diff --git a/win/polipo/config b/win/polipo/config new file mode 100644 index 0000000..29c16a5 --- /dev/null +++ b/win/polipo/config @@ -0,0 +1,161 @@ +# Sample configuration file for Polipo. -*-sh-*- + +# You should not need to use a configuration file; all configuration +# variables have reasonable defaults. If you want to use one, you +# can copy this to /etc/polipo/config or to ~/.polipo and modify. + +# This file only contains some of the configuration variables; see the +# list given by ``polipo -v'' and the manual for more. + + +### Basic configuration +### ******************* + +# Uncomment one of these if you want to allow remote clients to +# connect: + +# proxyAddress = "::0" # both IPv4 and IPv6 +proxyAddress = "127.0.0.1" # IPv4 only + +# If you do that, you'll want to restrict the set of hosts allowed to +# connect: + +# allowedClients = 127.0.0.1, 134.157.168.57 +# allowedClients = 127.0.0.1, 134.157.168.0/24 + +# Uncomment this if you want your Polipo to identify itself by +# something else than the host name: + +# proxyName = "polipo.example.org" + +# Uncomment this if there's only one user using this instance of Polipo: + +# cacheIsShared = false + +# Uncomment this if you want to use a parent proxy: + +# parentProxy = "squid.example.org:3128" + +# Uncomment this if you want to use a parent SOCKS proxy: + +socksParentProxy = "localhost:2020" +socksProxyType = socks5 + +# Uncomment this if you want to scrub private information from the log: + +# scrubLogs = true + + +### Memory +### ****** + +# Uncomment this if you want Polipo to use a ridiculously small amount +# of memory (a hundred C-64 worth or so): + +# chunkHighMark = 819200 +# objectHighMark = 128 + +# Uncomment this if you've got plenty of memory: + +# chunkHighMark = 50331648 +# objectHighMark = 16384 + + +### On-disk data +### ************ + +# Uncomment this if you want to disable the on-disk cache: + +# diskCacheRoot = "" + +# Uncomment this if you want to put the on-disk cache in a +# non-standard location: + +# diskCacheRoot = "~/.polipo-cache/" + +# Uncomment this if you want to disable the local web server: + +# localDocumentRoot = "" + +# Uncomment this if you want to enable the pages under /polipo/index? +# and /polipo/servers?. This is a serious privacy leak if your proxy +# is shared. + +# disableIndexing = false +# disableServersList = false + + +### Domain Name System +### ****************** + +# Uncomment this if you want to contact IPv4 hosts only (and make DNS +# queries somewhat faster): + +# dnsQueryIPv6 = no + +# Uncomment this if you want Polipo to prefer IPv4 to IPv6 for +# double-stack hosts: + +# dnsQueryIPv6 = reluctantly + +# Uncomment this to disable Polipo's DNS resolver and use the system's +# default resolver instead. If you do that, Polipo will freeze during +# every DNS query: + +# dnsUseGethostbyname = yes + + +### HTTP +### **** + +# Uncomment this if you want to enable detection of proxy loops. +# This will cause your hostname (or whatever you put into proxyName +# above) to be included in every request: + +# disableVia=false + +# Uncomment this if you want to slightly reduce the amount of +# information that you leak about yourself: + +# censoredHeaders = from, accept-language +# censorReferer = maybe + +# Uncomment this if you're paranoid. This will break a lot of sites, +# though: + +# censoredHeaders = set-cookie, cookie, cookie2, from, accept-language +# censorReferer = true + +# Uncomment this if you want to use Poor Man's Multiplexing; increase +# the sizes if you're on a fast line. They should each amount to a few +# seconds' worth of transfer; if pmmSize is small, you'll want +# pmmFirstSize to be larger. + +# Note that PMM is somewhat unreliable. + +# pmmFirstSize = 16384 +# pmmSize = 8192 + +# Uncomment this if your user-agent does something reasonable with +# Warning headers (most don't): + +# relaxTransparency = maybe + +# Uncomment this if you never want to revalidate instances for which +# data is available (this is not a good idea): + +# relaxTransparency = yes + +# Uncomment this if you have no network: + +# proxyOffline = yes + +# Uncomment this if you want to avoid revalidating instances with a +# Vary header (this is not a good idea): + +# mindlesslyCacheVary = true + +# Uncomment this if you want to add a no-transform directive to all +# outgoing requests. + +# alwaysAddNoTransform = true diff --git a/win/polipo/download.md b/win/polipo/download.md new file mode 100644 index 0000000..f1b78d3 --- /dev/null +++ b/win/polipo/download.md @@ -0,0 +1,3 @@ +https://www.irif.fr/~jch/software/files/polipo/polipo-1.1.0-win32.zip + +create shortcut with `polipo.exe -c config` \ No newline at end of file diff --git a/win/profile.ps1 b/win/profile.ps1 index d75b0e1..4cde92e 100644 --- a/win/profile.ps1 +++ b/win/profile.ps1 @@ -7,6 +7,9 @@ Set-PSReadLineOption -EditMode Emacs Set-PSReadLineOption -PredictionSource History Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r' +Import-Module posh-git +Import-Module oh-my-posh + $Dir = (Get-Item (Get-Item $PSCommandPath).Target).Directory.FullName $Env:Path += ";$Dir\bin" @@ -19,7 +22,11 @@ Set-Alias -Name bm Open-Bookmark Set-Alias -Name v nvim $isPs7 = $host.Version.Major -ge 7 if ( $isPs7 ) { - Set-Prompt + if ((Get-Module oh-my-posh).Version.Major -eq 3) { + Set-PoshPrompt + } else { + Set-Prompt + } } function kcc { k config get-contexts $args } @@ -106,3 +113,13 @@ function pass-edit { Remove-Item $tmpfile.FullName -Force } } + +function f { + [Cmdletbinding()] + + $tmpfile = New-TemporaryFile + lf -last-dir-path $tmpfile + $lastdir = Get-Content $tmpfile + Remove-Item $tmpfile + cd $lastdir +} diff --git a/win/setup/lf.ps1 b/win/setup/lf.ps1 new file mode 100644 index 0000000..5745f22 --- /dev/null +++ b/win/setup/lf.ps1 @@ -0,0 +1,3 @@ + +$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName +New-Item -Force -ItemType SymbolicLink -Target $dotfiles\cli\lf\lfrc.win -Path $Env:LOCALAPPDATA\lf\lfrc diff --git a/win/setup/mpv.ps1 b/win/setup/mpv.ps1 index db6d0e5..650ff9e 100644 --- a/win/setup/mpv.ps1 +++ b/win/setup/mpv.ps1 @@ -1,4 +1,4 @@ -$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName -New-Item -ItemType SymbolicLink -Target $dotfiles\config\mpv\mpv.conf -Path $Env:APPDATA\mpv\mpv.conf -Force -New-Item -ItemType SymbolicLink -Target $dotfiles\config\mpv\scripts -Path $Env:APPDATA\mpv\scripts -Force \ No newline at end of file +$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName +New-Item -ItemType SymbolicLink -Target $dotfiles\gui\mpv\mpv.conf -Path $Env:APPDATA\mpv\mpv.conf -Force +New-Item -ItemType SymbolicLink -Target $dotfiles\gui\mpv\scripts -Path $Env:APPDATA\mpv\scripts -Force diff --git a/win/setup/oh-my-posh.ps1 b/win/setup/oh-my-posh.ps1 index dc22204..3636424 100644 --- a/win/setup/oh-my-posh.ps1 +++ b/win/setup/oh-my-posh.ps1 @@ -1,10 +1,12 @@ # curl: https://curl.se/windows/ # ag: https://github.com/k-takata/the_silver_searcher-win32/releases # fzf: https://github.com/junegunn/fzf/releases/latest -Install-Module -Name PowerShellGet -Force -AllowPrerelease +# $PSDefaultParameterValues = @{ "*:Proxy"="http://localhost:8123" } +#Install-Module -Name PowerShellGet -Force -AllowPrerelease +Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted Install-Module -Name posh-git Install-Module -Name oh-my-posh Install-Module -Name psfzf -$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName +$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName New-Item -ItemType SymbolicLink -Target $dotfiles\win\profile.ps1 -Path $profile -Force diff --git a/win/setup/vim.ps1 b/win/setup/vim.ps1 index f241990..b885e79 100644 --- a/win/setup/vim.ps1 +++ b/win/setup/vim.ps1 @@ -1,5 +1,5 @@ -$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName +$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName if ( ! (Test-Path $Env:LOCALAPPDATA\nvim) ) { New-Item -ItemType Directory -Path $Env:LOCALAPPDATA\nvim } diff --git a/win/setup/windows-terminal.ps1 b/win/setup/windows-terminal.ps1 new file mode 100644 index 0000000..d773fd0 --- /dev/null +++ b/win/setup/windows-terminal.ps1 @@ -0,0 +1,3 @@ + +$dotfiles=(Get-Item $PSScriptRoot).Parent.Parent.FullName +New-Item -Force -ItemType SymbolicLink -Target $dotfiles\win\WindowsTerminal\settings.json -Path $Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json diff --git a/win/win.ahk b/win/win.ahk index dcf3d8d..440e64e 100644 --- a/win/win.ahk +++ b/win/win.ahk @@ -160,6 +160,10 @@ FocusWinByDirection(direction) { } MoveActiveWinByDirection(direction) { + WinGet, isMax, MinMax, A + if (isMax) { + WinRestore, A + } global RATIO GetCursorMonGeometry(x, y, w, h) activeWinId := WinExist("A")