-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://gitlab.com/Seirdy/dotfiles
- Loading branch information
Showing
20 changed files
with
167 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,3 +299,7 @@ Neovim's | |
YouCompleteMe | ||
clickable | ||
lol | ||
featureful | ||
performant | ||
Spotify | ||
iTunes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env dash | ||
grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)" "$@" | ||
grim -g \ | ||
"$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)" \ | ||
"$@" | ||
# vi:ft=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,68 @@ | ||
#!/usr/bin/env dash | ||
|
||
# The following script is based on: | ||
# POSIX-compliant shell script to replace dmenu/rofi's command-running | ||
# functionality. Based on: | ||
# https://gitlab.com/FlyingWombat/my-scripts/blob/a0cb5717777c1587af381004aa8fb048206bee55/sway-launcher | ||
# terminal application launcher for sway, using fzf | ||
|
||
# original command: | ||
|
||
# Based on: https://github.com/swaywm/sway/issues/1367 | ||
|
||
# bindsym $altkey+space exec termite --name=launcher -e \ | ||
|
||
# "bash -c 'compgen -c | sort -u | fzf --no-extended --print-query | \ | ||
|
||
# tail -n1 | xargs -r swaymsg -t command exec'" | ||
|
||
# printf "\033]0;Menu\007" | ||
# Pick your preferred dmenu-like program. It should not do any sorting. | ||
dmenu_program='term-dmenu --no-extended --print-query --no-sort' | ||
|
||
HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/sway-launcher-history.txt" | ||
|
||
# Get shell command list | ||
|
||
# This may include the occasional non-executable file | ||
|
||
# shellcheck disable=SC2046 # word-splitting isn't an issue here. | ||
command_list=$(stest -flx $(echo "$PATH" | tr : ' ' | sort -u)) | ||
|
||
# read existing command history | ||
|
||
if [ -f "$HIST_FILE" ]; then | ||
|
||
command_history=$(cat "$HIST_FILE") | ||
|
||
else | ||
|
||
command_history="" | ||
|
||
fi | ||
|
||
# search command list | ||
|
||
command_str=$(printf "%s\n" "${command_history}" "${command_list}" \ | ||
| sed -E 's/^[0-9]+ (.+)$/\1/' \ | ||
| fzf --no-extended --print-query --no-sort \ | ||
| $dmenu_program \ | ||
| tail -n1) || exit 1 | ||
|
||
if [ "$command_str" = "" ]; then | ||
|
||
exit 1 | ||
|
||
fi | ||
|
||
# echo "Command: $command_str" | ||
|
||
# using \E flag from perl regex | ||
|
||
test "${command_str#*\\E}" != "$command_str" && echo "command can't contain '\E'" | ||
|
||
test "${command_str#*\\E}" != "$command_str" && exit 1 | ||
|
||
# get full line from history (with count number) | ||
|
||
hist_line=$(echo "$command_history" | grep -Pe "^[0-9]+ \Q$command_str\E$") | ||
|
||
# echo "Hist Line: $hist_line" | ||
|
||
if [ "$hist_line" = "" ]; then | ||
|
||
hist_count=1 | ||
|
||
else | ||
|
||
# Increment usage count | ||
|
||
hist_count=$(echo "$hist_line" | sed -E 's/^([0-9]+) .+$/\1/') | ||
|
||
hist_count=$((hist_count + 1)) | ||
|
||
# delete line, to add updated later | ||
|
||
# echo "Hist Before: $command_history" | ||
|
||
command_history=$(echo "$command_history" \ | ||
| grep --invert-match -Pe "^[0-9]+ \Q$command_str\E$") | ||
|
||
# echo "Hist After: $command_history" | ||
|
||
fi | ||
|
||
# update history | ||
|
||
update_line="${hist_count} ${command_str}" | ||
|
||
printf "%s\n" "${update_line}" "${command_history}" \ | ||
| sort --numeric-sort --reverse >"$HIST_FILE" | ||
|
||
# echo "$update_line" | ||
update_history() { | ||
# get full line from history (with count number) | ||
hist_line=$(echo "$command_history" | grep -Pe "^[0-9]+ \Q$command_str\E$") | ||
|
||
if [ "$hist_line" = "" ]; then | ||
hist_count=1 | ||
else | ||
# Increment usage count | ||
hist_count=$(echo "$hist_line" | sed -E 's/^([0-9]+) .+$/\1/') | ||
hist_count=$((hist_count + 1)) | ||
# delete line, to add updated later | ||
command_history=$(echo "$command_history" \ | ||
| grep --invert-match -Pe "^[0-9]+ \Q$command_str\E$") | ||
fi | ||
|
||
# update history | ||
update_line="${hist_count} ${command_str}" | ||
printf "%s\n" "${update_line}" "${command_history}" \ | ||
| sort --numeric-sort --reverse >"$HIST_FILE" | ||
} | ||
update_history & | ||
|
||
# execute command | ||
|
||
echo "$command_str" | ||
|
||
swaymsg -t command exec "$command_str" | ||
swaymsg -t command exec "$command_str" & | ||
|
||
# vi:ft=sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env dash | ||
|
||
# term-dmenu is a dmenu/rofi-dmenu replacement that launches a terminal | ||
# emulator to filter stdin using fzf. Arguments are passed to fzf. | ||
# By default, it uses kitty. Change this if you wish. | ||
|
||
export FZF_DEFAULT_OPTS="$* $FZF_DEFAULT_OPTS" | ||
|
||
# This happens in three steps: | ||
|
||
# 1. if a named pipe for term-dmenu doesn't exist, create it | ||
[ -p /tmp/term-dmenu ] || mkfifo /tmp/term-dmenu | ||
|
||
# 2. export stdin, separated by newlines, so the terminal process can access it | ||
IFS=$(printf '\n') | ||
input=$(cat) | ||
export input | ||
|
||
# 3. open a floating terminal, running a shell command that does the following:. | ||
# 3a. filter $input in fzf | ||
# 3b. send the result to the named pipe in a detached abduco session | ||
# shellcheck disable=SC2016 # I don't want expressions to expand | ||
kitty --class launcher -e dash -c \ | ||
'output=$(echo "$input" | fzf); export output; abduco -rnf term-dmenu dash -c "echo \"$output\" >/tmp/term-dmenu" 2>/dev/null' | ||
|
||
# 4. send the value from the named pipe to stdout | ||
cat </tmp/term-dmenu | ||
|
||
# vi:ft=sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/env dash | ||
|
||
cd "$(mktemp -d)" \ | ||
&& curl-tor "$@" >/tmp/page.html && w3m-sandbox /tmp/page.html | ||
&& curl-tor "$@" >/tmp/page.html \ | ||
&& w3m-sandbox /tmp/page.html | ||
|
||
# vi:ft=sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env dash | ||
|
||
# Window-switcher for SwayWM, similar to switchers typically launched with alt-tab | ||
# based on | ||
# https://framagit.org/roipoussiere/dotfiles/blob/6618e7a39c5d43b4b3e776afd4ee0a5c999c294a/home/.config/sway/config#L165 | ||
# and https://www.reddit.com/comments/aolf3u/_/eg6twfh | ||
|
||
dmenu_program=term-dmenu | ||
|
||
swaymsg -t get_tree \ | ||
| jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.type=="con"),select(.type=="floating_con")|(.id|tostring)+" "+.app_id+": "+.name' \ | ||
| grep -v '^[0-9]* \: $' \ | ||
| $dmenu_program \ | ||
| awk '{print $1}' \ | ||
| xargs -I % swaymsg '[con_id="%"] focus' | ||
|
||
# vi:ft=sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.