From 40de0424e7a54bb72d769149ccb068d0d5eee809 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Fri, 23 Apr 2021 10:18:51 +0200 Subject: [PATCH] stuff --- .../update-notifier-electron-builder.json | 4 + .../configstore/update-notifier-npm.json | 2 +- files/.config/ranger/rc.conf | 11 +- files/.profile | 37 ++++ files/.xmonad/lib/Config.hs | 4 +- .../nixpkgs/modules/term/zsh/default.nix | 5 +- .../nixpkgs/modules/term/zsh/nix/sources.json | 12 +- files/nix-stuff/nixpkgs/result | 1 - files/scripts/copy-pasta.sh | 11 ++ files/scripts/fzfimg.sh | 172 ++++++++++++++++++ 10 files changed, 244 insertions(+), 15 deletions(-) create mode 100644 files/.config/configstore/update-notifier-electron-builder.json create mode 100644 files/.profile delete mode 120000 files/nix-stuff/nixpkgs/result create mode 100755 files/scripts/copy-pasta.sh create mode 100755 files/scripts/fzfimg.sh diff --git a/files/.config/configstore/update-notifier-electron-builder.json b/files/.config/configstore/update-notifier-electron-builder.json new file mode 100644 index 0000000..ad5cf77 --- /dev/null +++ b/files/.config/configstore/update-notifier-electron-builder.json @@ -0,0 +1,4 @@ +{ + "optOut": false, + "lastUpdateCheck": 1619085707990 +} \ No newline at end of file diff --git a/files/.config/configstore/update-notifier-npm.json b/files/.config/configstore/update-notifier-npm.json index 0693e2e..cb3259e 100644 --- a/files/.config/configstore/update-notifier-npm.json +++ b/files/.config/configstore/update-notifier-npm.json @@ -1,4 +1,4 @@ { "optOut": false, - "lastUpdateCheck": 1618850694694 + "lastUpdateCheck": 1619084764236 } \ No newline at end of file diff --git a/files/.config/ranger/rc.conf b/files/.config/ranger/rc.conf index 3647e94..45e9767 100644 --- a/files/.config/ranger/rc.conf +++ b/files/.config/ranger/rc.conf @@ -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 set show_hidden! copymap copymap -copymap zf zz # Filter stack map .d filter_stack add type d diff --git a/files/.profile b/files/.profile new file mode 100644 index 0000000..462dfe1 --- /dev/null +++ b/files/.profile @@ -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 '' --no-out-link -A glibcLocales)/lib/locale/locale-archive + +export _JAVA_AWT_WM_NONREPARENTING=1 + diff --git a/files/.xmonad/lib/Config.hs b/files/.xmonad/lib/Config.hs index 1b91003..76f3a17 100644 --- a/files/.xmonad/lib/Config.hs +++ b/files/.xmonad/lib/Config.hs @@ -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-", spawn myTerminal) --, ("M-S-", 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. diff --git a/files/nix-stuff/nixpkgs/modules/term/zsh/default.nix b/files/nix-stuff/nixpkgs/modules/term/zsh/default.nix index 14c34b8..abe100d 100644 --- a/files/nix-stuff/nixpkgs/modules/term/zsh/default.nix +++ b/files/nix-stuff/nixpkgs/modules/term/zsh/default.nix @@ -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' diff --git a/files/nix-stuff/nixpkgs/modules/term/zsh/nix/sources.json b/files/nix-stuff/nixpkgs/modules/term/zsh/nix/sources.json index 6f79117..a452714 100644 --- a/files/nix-stuff/nixpkgs/modules/term/zsh/nix/sources.json +++ b/files/nix-stuff/nixpkgs/modules/term/zsh/nix/sources.json @@ -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///archive/.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///archive/.tar.gz" }, "zsh-abbrev-alias": { diff --git a/files/nix-stuff/nixpkgs/result b/files/nix-stuff/nixpkgs/result deleted file mode 120000 index c4c2ece..0000000 --- a/files/nix-stuff/nixpkgs/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/g0342b3m9b0c8znl1s7xyibadadw0y0w-glibc-locales-2.32 \ No newline at end of file diff --git a/files/scripts/copy-pasta.sh b/files/scripts/copy-pasta.sh new file mode 100755 index 0000000..0ab1fad --- /dev/null +++ b/files/scripts/copy-pasta.sh @@ -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 + diff --git a/files/scripts/fzfimg.sh b/files/scripts/fzfimg.sh new file mode 100755 index 0000000..43dd771 --- /dev/null +++ b/files/scripts/fzfimg.sh @@ -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 . + + +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) + < <("${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 +