This commit is contained in:
elkowar 2021-04-23 10:18:51 +02:00
parent f86a631da1
commit 40de0424e7
10 changed files with 244 additions and 15 deletions

View file

@ -0,0 +1,4 @@
{
"optOut": false,
"lastUpdateCheck": 1619085707990
}

View file

@ -1,4 +1,4 @@
{
"optOut": false,
"lastUpdateCheck": 1618850694694
"lastUpdateCheck": 1619084764236
}

View file

@ -51,7 +51,8 @@ set display_size_in_main_column true
set display_size_in_status_bar true
set display_free_space_in_status_bar true
set display_tags_in_all_columns true
set update_title false # Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME`
# Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME`
set update_title false
set update_tmux_title true
set shorten_title 3
set hostname_in_titlebar true
@ -59,7 +60,8 @@ set tilde_in_titlebar true
set max_history_size 50
set max_console_history_size 50
set scroll_offset 8
set flushinput true # Flush the input after each key hit? (Noticeable when ranger lags)
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
set padding_right true
set autosave_bookmarks true
set save_backtick_bookmark true
@ -97,8 +99,8 @@ set relative_current_zero false
set one_indexed false
set save_tabs_on_exit false
set wrap_scroll false
set xterm_alt_key false # Enable this if key combinations with the Alt Key don't work for you.
# Enable this if key combinations with the Alt Key don't work for you.
set xterm_alt_key false
# ===================================================================
@ -345,7 +347,6 @@ map zh set show_hidden!
map <C-h> set show_hidden!
copymap <C-h> <backspace>
copymap <backspace> <backspace2>
copymap zf zz
# Filter stack
map .d filter_stack add type d

37
files/.profile Normal file
View file

@ -0,0 +1,37 @@
export EDITOR="nvim"
export PATH="/home/leon/.local/bin/scripts:$PATH:/home/leon/.emacs.d/bin/"
export PATH="$HOME/.npm-global/bin:$HOME/intelliJInstall/bin:$PATH:$HOME/.cargo/bin"
export PATH="$HOME/.nix-profile/share/applications/:$PATH"
export PATH="/home/leon/.nix-profile/bin/:$PATH"
export PATH="/home/leon/.cpm/bin:$PATH"
export PATH="/home/leon/.local/bin:$PATH"
export PATH="/home/leon/.nimble/bin:$PATH"
export _JAVA_AWT_WM_NONREPARENTING=1
export RANGER_LOAD_DEFAULT_RC=FALSE
export FZF_DEFAULT_COMMAND='rg --files'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="rg --files --null | xargs -0 dirname | sort -u"
export LESSHISTFILE="/dev/null"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export NNN_PLUG='F:fzopen;S:suedit'
[ "$XDG_CURRENT_DESKTOP" = "KDE" ] || [ "$XDG_CURRENT_DESKTOP" = "GNOME" ] || export QT_QPA_PLATFORMTHEME="qt5ct"
export FREETYPE_PROPERTIES='truetype:interpreter-version=40'
export _JAVA_OPTIONS='-Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd'
if [ -e /home/leon/.nix-profile/etc/profile.d/nix.sh ]; then
. /home/leon/.nix-profile/etc/profile.d/nix.sh;
fi # added by Nix installer
export XDG_DATA_DIRS="$HOME/.nix-profile/share/applications:$HOME/.local/share/applications:/usr/local/share:/usr/share"
export LOCALE_ARCHIVE=$(nix-build '<nixpkgs>' --no-out-link -A glibcLocales)/lib/locale/locale-archive
export _JAVA_AWT_WM_NONREPARENTING=1

View file

@ -274,6 +274,7 @@ myStartupHook = do
spawn "/home/leon/.config/polybar/launch.sh"
spawnOnce "nitrogen --restore"
spawnOnce "mailnag"
spawnOnce "flameshot"
spawn "flashfocus"
for_ ["led1", "led2"] $ \led -> safeSpawn "sudo" ["liquidctl", "set", led, "color", "fixed", "00ffff"]
withDisplay $ \dpy -> do
@ -361,7 +362,7 @@ myKeys = concat [ zoomRowBindings, tabbedBindings, multiMonitorBindings, program
--, ("M-b", launchWithBackgroundInstance (className =? "qutebrowser") "bwrap --bind / / --dev-bind /dev /dev --tmpfs /tmp --tmpfs /run qutebrowser")
--, ("M-b", safeSpawnProg "qutebrowser")
, ("M-b", safeSpawnProg "firefox")
, ("M-b", safeSpawnProg "google-chrome-stable")
, ("M-S-<Return>", spawn myTerminal)
--, ("M-S-<Return>", launchWithBackgroundInstance (className =? "Alacritty") "alacritty")
, ("M-S-<", spawn "flameshot gui")
@ -635,6 +636,7 @@ focusWindow' window ws
Nothing -> ws
-- | Fixes fullscreen behaviour of chromium based apps by quickly applying and undoing a resize.
-- This causes chromium to recalculate the fullscreen window
-- dimensions to match the actual "windowed fullscreen" dimensions.

View file

@ -84,7 +84,10 @@ let
realpath=\''${(Qe)~realpath}
"
zstyle ':fzf-tab:complete:*:*' extra-opts --preview=$extract'/home/leon/scripts/preview.sh $realpath'
#zstyle ':fzf-tab:complete:*:*' fzf-preview '/home/leon/fzfimg.sh'
#zstyle ':fzf-tab:complete:*:*' fzf-preview '/home/leon/fzfimg.sh $realpath'
zstyle ':fzf-tab:complete:*:*' fzf-preview '/home/leon/scripts/preview.sh $realpath'
#zstyle ':fzf-tab:complete:*:*' extra-opts --preview=$extract'/home/leon/scripts/preview.sh $realpath'
#zstyle ':fzf-tab:complete:nvim:*' extra-opts --preview=$extract'bat -p --color=always $realpath'
#zstyle ':fzf-tab:complete:ls:*' extra-opts --preview=$extract'exa --icons -1 --color=always $realpath'

View file

@ -17,10 +17,10 @@
"homepage": null,
"owner": "Aloxaf",
"repo": "fzf-tab",
"rev": "0c36bdcf6a80ec009280897f07f56969f94d377e",
"sha256": "0ymp9ky0jlkx9b63jajvpac5g3ll8snkf8q081g0yw42b9hwpiid",
"rev": "b5e836f1d271507db40e23deadde75d8c9fef078",
"sha256": "0rg8wyk39f4v09q4imw3dh6m9i9aijk52175dmjjmqcbszy29wq9",
"type": "tarball",
"url": "https://github.com/Aloxaf/fzf-tab/archive/0c36bdcf6a80ec009280897f07f56969f94d377e.tar.gz",
"url": "https://github.com/Aloxaf/fzf-tab/archive/b5e836f1d271507db40e23deadde75d8c9fef078.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
@ -65,10 +65,10 @@
"homepage": "",
"owner": "olets",
"repo": "zsh-abbr",
"rev": "28e3543cbfbc66e6e569fe2a3f681820d6d73188",
"sha256": "0y1hi20s51fws9m18b3lbpcbja2b39lj729a4kyvipv7irwilhgw",
"rev": "7609657a39738ee512af33a5c39733b7ea94cff3",
"sha256": "01fp7f8j6i93yqy0p6c2vgq4z1gcdil4mrpqjp4n3akj9w5zxgj8",
"type": "tarball",
"url": "https://github.com/olets/zsh-abbr/archive/28e3543cbfbc66e6e569fe2a3f681820d6d73188.tar.gz",
"url": "https://github.com/olets/zsh-abbr/archive/7609657a39738ee512af33a5c39733b7ea94cff3.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"zsh-abbrev-alias": {

View file

@ -1 +0,0 @@
/nix/store/g0342b3m9b0c8znl1s7xyibadadw0y0w-glibc-locales-2.32

11
files/scripts/copy-pasta.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
GEN_SCRIPT_DATA_PATH="/home/leon/gen-script-data"
options=$(for x in $GEN_SCRIPT_DATA_PATH/*; do echo "$x" | sed "s|$GEN_SCRIPT_DATA_PATH/||g"; done)
echo "$options" | rofi -dmenu

172
files/scripts/fzfimg.sh Executable file
View file

@ -0,0 +1,172 @@
#!/usr/bin/env bash
# This is just an example how ueberzug can be used with fzf.
# Copyright (C) 2019 Nico Bäurer
# 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 <https://www.gnu.org/licenses/>.
readonly BASH_BINARY="$(which bash)"
readonly REDRAW_COMMAND="toggle-preview+toggle-preview"
readonly REDRAW_KEY="µ"
declare -r -x DEFAULT_PREVIEW_POSITION="right"
declare -r -x UEBERZUG_FIFO="$(mktemp --dry-run --suffix "fzf-$$-ueberzug")"
declare -r -x PREVIEW_ID="preview"
function is_option_key [[ "${@}" =~ ^(\-.*|\+.*) ]]
function is_key_value [[ "${@}" == *=* ]]
function map_options {
local -n options="${1}"
local -n options_map="${2}"
for ((i=0; i < ${#options[@]}; i++)); do
local key="${options[$i]}" next_key="${options[$((i + 1))]:---}"
local value=true
is_option_key "${key}" || \
continue
if is_key_value "${key}"; then
<<<"${key}" \
IFS='=' read key value
elif ! is_option_key "${next_key}"; then
value="${next_key}"
fi
options_map["${key}"]="${value}"
done
}
function parse_options {
declare -g -a script_options=("${@}")
declare -g -A mapped_options
map_options script_options mapped_options
declare -g -r -x PREVIEW_POSITION="${mapped_options[--preview-window]%%:[^:]*}"
}
function start_ueberzug {
mkfifo "${UEBERZUG_FIFO}"
<"${UEBERZUG_FIFO}" \
ueberzug layer --parser bash --silent &
# prevent EOF
3>"${UEBERZUG_FIFO}" \
exec
}
function finalise {
3>&- \
exec
&>/dev/null \
rm "${UEBERZUG_FIFO}"
&>/dev/null \
kill $(jobs -p)
}
function calculate_position {
# TODO costs: creating processes > reading files
# so.. maybe we should store the terminal size in a temporary file
# on receiving SIGWINCH
# (in this case we will also need to use perl or something else
# as bash won't execute traps if a command is running)
< <(</dev/tty stty size) \
read TERMINAL_LINES TERMINAL_COLUMNS
case "${PREVIEW_POSITION:-${DEFAULT_PREVIEW_POSITION}}" in
left|up|top)
X=1
Y=1
;;
right)
X=$((TERMINAL_COLUMNS - COLUMNS - 2))
Y=1
;;
down|bottom)
X=1
Y=$((TERMINAL_LINES - LINES - 1))
;;
esac
}
function draw_preview {
case "$(file --mime-type "$1")" in
*text*)
bat --color always --plain --theme gruvbox "$1"
;;
*image*)
calculate_position
>"${UEBERZUG_FIFO}" declare -A -p cmd=( \
[action]=add [identifier]="${PREVIEW_ID}" \
[x]="${X}" [y]="${Y}" \
[width]="${COLUMNS}" [height]="${LINES}" \
#[scaler]=forced_cover [scaling_position_x]=0.5 [scaling_position_y]=0.5 \
[path]="${@}")
# add [synchronously_draw]=True if you want to see each change
;;
*pdf)
if command -v timg; then
timg -g50x50 -E -F "$1"
elif command -v catimg; then
catimg -w 100 -r 2 "$1"
else
echo "Install timg or catimg to view images!"
fi
;;
*directory*)
exa --icons -1 --color=always "$1"
;;
*)
echo "unknown file format"
;;
esac
}
function print_on_winch {
# print "$@" to stdin on receiving SIGWINCH
# use exec as we will only kill direct childs on exiting,
# also the additional bash process isn't needed
</dev/tty \
exec perl -e '
require "sys/ioctl.ph";
while (1) {
local $SIG{WINCH} = sub {
ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV;
};
sleep;
}' \
"${@}" &
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
trap finalise EXIT
parse_options "${@}"
# print the redraw key twice as there's a run condition we can't circumvent
# (we can't know the time fzf finished redrawing it's layout)
print_on_winch "${REDRAW_KEY}${REDRAW_KEY}"
start_ueberzug
export -f draw_preview calculate_position
SHELL="${BASH_BINARY}" \
fzf --preview "draw_preview {}" \
--preview-window "${DEFAULT_PREVIEW_POSITION}" \
--bind "${REDRAW_KEY}:${REDRAW_COMMAND}" \
"${@}"
#"$filePath"
fi