]> Freerunner's - dotfiles.git/commitdiff
bin: clean up
authorAndre Ramnitz <tux.rising@gmail.com>
Sat, 27 Jan 2024 10:45:05 +0000 (11:45 +0100)
committerAndre Ramnitz <tux.rising@gmail.com>
Sun, 18 Aug 2024 16:18:53 +0000 (18:18 +0200)
local/bin/_emergeworld [changed mode: 0644->0755]
local/bin/cheatsheet [new file with mode: 0755]
local/bin/debug_suspend.sh [new file with mode: 0755]
local/bin/kcr-edit-search [deleted file]
local/bin/kcr-fzf [deleted file]
local/bin/kcr-fzf-buffers [deleted file]
local/bin/kcr-fzf-files [deleted file]
local/bin/kcr-fzf-grep [deleted file]
local/bin/kcr-fzf-shell [deleted file]
local/bin/waybar_reload.sh [new file with mode: 0755]

old mode 100644 (file)
new mode 100755 (executable)
diff --git a/local/bin/cheatsheet b/local/bin/cheatsheet
new file mode 100755 (executable)
index 0000000..7bb6565
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+case "$1" in
+       bash)
+               bat ~/dotfiles/banner-bash.asc
+       ;;
+       *)
+               bat ~/dotfiles/banner.asc
+       ;;
+esac
+
diff --git a/local/bin/debug_suspend.sh b/local/bin/debug_suspend.sh
new file mode 100755 (executable)
index 0000000..e8656ab
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+sudo sh -c "sync && echo 1 > /sys/power/pm_trace && loginctl suspend"
+
diff --git a/local/bin/kcr-edit-search b/local/bin/kcr-edit-search
deleted file mode 100755 (executable)
index c510649..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-# Open files from search results.
-#
-# Usage:
-#
-# kcr edit-search [input: <file>:<line>:<column>:<text>]
-
-# Execute the following Kakoune commands.
-#
-# Input: <file>:<line>:<column>:<text>
-# Output: <file>␤<line>␤<column>
-select_each_line='<a-s>_'
-select_search_fields='s^(.+?):(\d+):(\d+):(.+?)$<ret>'
-save_selections='Z'
-select_file_save_and_restore='1s<ret>"fZz'
-select_line_save_and_restore='2s<ret>"f<a-Z>az'
-select_column_save_and_restore='3s<ret>"f<a-Z>az'
-select_data='"fz'
-prepare_output='y%<a-R>a<ret><esc>'
-delete_end_of_file='ged'
-
-kak -f "${select_each_line}${select_search_fields}${save_selections}${select_file_save_and_restore}${select_line_save_and_restore}${select_column_save_and_restore}${select_data}${prepare_output}${delete_end_of_file}" |
-
-while read file; read line; read column; do
-  kcr edit "$file" "+$line:$column"
-done
diff --git a/local/bin/kcr-fzf b/local/bin/kcr-fzf
deleted file mode 100755 (executable)
index 5af5259..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-"kcr-fzf-$@"
diff --git a/local/bin/kcr-fzf-buffers b/local/bin/kcr-fzf-buffers
deleted file mode 100755 (executable)
index 71efdfe..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# Open buffers.
-#
-# Usage:
-#
-# kcr fzf buffers [patterns]
-
-# – fzf (https://github.com/junegunn/fzf)
-# – bat (https://github.com/sharkdp/bat)
-
-kcr get --raw --value buflist |
-grep -F "$*" |
-fzf --preview 'kcr cat --raw {} | bat --file-name {} --style=numbers --color=always --line-range :500' --header='Select a buffer to open' --prompt='(b)>' |
-
-# Open buffers
-while read name; do
-  kcr send buffer "$name"
-done
diff --git a/local/bin/kcr-fzf-files b/local/bin/kcr-fzf-files
deleted file mode 100755 (executable)
index 3253bb8..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# Open files.
-#
-# Usage:
-#
-# kcr fzf files [paths]
-
-# – fzf (https://github.com/junegunn/fzf)
-# – fd (https://github.com/sharkdp/fd)
-# – bat (https://github.com/sharkdp/bat)
-
-fd --type file . "$@" |
-fzf --preview 'bat --style=numbers --color=always --line-range :500 {}' --header='Select a file to open' --prompt='(f)>' |
-
-# Open files
-while read file; do
-  kcr edit "$file"
-done
diff --git a/local/bin/kcr-fzf-grep b/local/bin/kcr-fzf-grep
deleted file mode 100755 (executable)
index e3605c8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-# Open files by content.
-#
-# Usage:
-#
-# kcr fzf grep [paths]
-
-# – fzf (https://github.com/junegunn/fzf)
-# – ripgrep (https://github.com/BurntSushi/ripgrep)
-
-# Not pretty but robust.
-# https://github.com/junegunn/fzf/issues/2581
-export PATHS_PATH=$(mktemp)
-trap 'rm "$PATHS_PATH"' EXIT
-for path do
-  echo "$path" >> "$PATHS_PATH"
-done
-
-SHELL=sh fzf --phony --delimiter ':' --ansi --bind 'change:reload(while read path; do set -- "$@" "$path"; done < "$PATHS_PATH"; rg --color=always --column --with-filename --fixed-strings -- {q} "$@" || true),enter:execute(kcr edit {1} +{2}:{3})+abort' --preview 'highlight_line={2} line_range_begin=$((line = highlight_line - (FZF_PREVIEW_LINES / 4) && line < 1 ? 1 : line)) line_range_end=$((line_range_begin + FZF_PREVIEW_LINES)) && bat --style=numbers --color=always --line-range "$line_range_begin:$line_range_end" --highlight-line {2} {1} 2> /dev/null' --header='Select a file to open' --prompt='(g)>'
diff --git a/local/bin/kcr-fzf-shell b/local/bin/kcr-fzf-shell
deleted file mode 100755 (executable)
index 33faa3a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# Start an interactive shell.
-#
-# Usage:
-#
-# kcr fzf shell [command] [arguments]
-
-# – fzf (https://github.com/junegunn/fzf)
-
-set_environment() {
-  session=$1 client=${2#null} buffer_name=${3#null} working_directory=$4
-}
-
-# Run fzf with the session list
-rows=$(
-  kcr list --raw |
-  fzf --header='Select a session to switch to' --prompt='(s)>'
-)
-
-IFS='
-'
-for row in $rows; do
-  IFS='        '
-  set_environment $row
-
-  # Start an interactive shell
-  KAKOUNE_SESSION=$session KAKOUNE_CLIENT=$client kcr shell "$@"
-done
diff --git a/local/bin/waybar_reload.sh b/local/bin/waybar_reload.sh
new file mode 100755 (executable)
index 0000000..cf8aba4
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+main() {
+    local CONFIG="$HOME/.config/waybar/config"
+    local STYLE="$HOME/.config//waybar/style.css"
+
+    if [ $(pidof waybar) ];
+        then
+            killall waybar
+            waybar -c "$CONFIG" -s "$STYLE" > /dev/null 2>&1 &
+        else
+            waybar -c "$CONFIG" -s "$STYLE" > /dev/null 2>&1 &
+    fi
+}
+main
+