Migrating to wl-clipboard-manager tooling.
For some reason clipman causes crashes, plus this works better.
This commit is contained in:
parent
f3bf8f377f
commit
3e1eb7e28d
|
@ -13,8 +13,6 @@ set $tty-popup $scripts/tty-popup
|
||||||
set $menu bash ~/.config/sway/scripts/menu
|
set $menu bash ~/.config/sway/scripts/menu
|
||||||
set $pass_menu $tty-popup pass $scripts/fzf-pass
|
set $pass_menu $tty-popup pass $scripts/fzf-pass
|
||||||
|
|
||||||
set $clipman_menu bash ~/.config/sway/scripts/menu_clipman
|
|
||||||
set $clipman_clear_menu bash ~/.config/sway/scripts/clipman_clear_menu
|
|
||||||
set $printscreen bash ~/.config/sway/scripts/printscreen
|
set $printscreen bash ~/.config/sway/scripts/printscreen
|
||||||
|
|
||||||
# Support for picture in picture mode.
|
# Support for picture in picture mode.
|
||||||
|
|
|
@ -7,6 +7,10 @@ exec --no-startup-id protonmail-bridge 2>&1 >/tmp/mail.log
|
||||||
### Make things a little easier easier on the eyes.
|
### Make things a little easier easier on the eyes.
|
||||||
exec --no-startup-id redshift 2>&1 >/tmp/redshift.log
|
exec --no-startup-id redshift 2>&1 >/tmp/redshift.log
|
||||||
|
|
||||||
|
### Clipboard manager
|
||||||
|
exec --no-startup-id $scripts/clipboard daemon 2>&1 >/tmp/clipboardmanager.log
|
||||||
|
|
||||||
|
|
||||||
### Notifications
|
### Notifications
|
||||||
# https://github.com/emersion/mako
|
# https://github.com/emersion/mako
|
||||||
exec --no-startup-id mako 2>&1 >/tmp/mako.log
|
exec --no-startup-id mako 2>&1 >/tmp/mako.log
|
||||||
|
@ -39,9 +43,5 @@ exec_always {
|
||||||
tail -f /tmp/wobpipe | ~/.config/sway/scripts/sanitize_wob | wob
|
tail -f /tmp/wobpipe | ~/.config/sway/scripts/sanitize_wob | wob
|
||||||
}
|
}
|
||||||
|
|
||||||
### Clipboard manager
|
|
||||||
# https://github.com/yory8/clipman
|
|
||||||
exec --no-startup-id wl-paste -t text --watch clipman store
|
|
||||||
|
|
||||||
# vim: ft=cfg
|
# vim: ft=cfg
|
||||||
# -*- mode: conf-space -*-
|
# -*- mode: conf-space -*-
|
||||||
|
|
|
@ -8,9 +8,7 @@ bindsym $mod+q kill
|
||||||
bindsym $mod+space exec $menu
|
bindsym $mod+space exec $menu
|
||||||
# gopass prompt
|
# gopass prompt
|
||||||
bindsym $mod+backslash exec $pass_menu
|
bindsym $mod+backslash exec $pass_menu
|
||||||
# Clipboard management
|
|
||||||
bindsym $mod+Mod1+c exec $clipman_menu
|
|
||||||
bindsym $mod+Shift+Mod1+c exec $clipman_clear_menu
|
|
||||||
|
|
||||||
# reload the configuration file
|
# reload the configuration file
|
||||||
bindsym $mod+Shift+c reload
|
bindsym $mod+Shift+c reload
|
||||||
|
|
50
sway/scripts/clipboard
Executable file
50
sway/scripts/clipboard
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
workdir="${XDG_DATA_HOME:-$HOME/.local/share/clipboard/history}"
|
||||||
|
mkdir -p "$workdir"
|
||||||
|
cd "$workdir"
|
||||||
|
|
||||||
|
if [ "$1" = "daemon" ]; then
|
||||||
|
wl-paste -w $0 on-copy
|
||||||
|
elif [ "$1" = "lock" ]; then
|
||||||
|
touch .lock
|
||||||
|
elif [ "$1" = "unlock" ]; then
|
||||||
|
rm -f .lock
|
||||||
|
elif [ "$1" = "on-copy" ]; then
|
||||||
|
[ -f .lock ] && exit 0
|
||||||
|
file="$(date +%s)"
|
||||||
|
cat >"$file"
|
||||||
|
ext="$(file --mime-type "$file" | cut -d' ' -f2 | cut -d'/' -f2)"
|
||||||
|
mv "$file" "$file.$ext"
|
||||||
|
fdupes -idN .
|
||||||
|
find . -type f -size 0 -delete
|
||||||
|
find . -type f -size +10000000c -delete
|
||||||
|
find . -type f -print0 | sort -zn | head -z -n -10000 | xargs -r -0 rm
|
||||||
|
elif [ "$1" = "dmenu" ]; then
|
||||||
|
find . -type f -printf '%P\0' | sort -znr | while IFS= read -r -d '' file; do
|
||||||
|
if [[ "$file" =~ \.(plain|x-python)$ ]]; then
|
||||||
|
cat "$file"
|
||||||
|
else
|
||||||
|
printf '%s' "$file"
|
||||||
|
fi
|
||||||
|
printf '\0'
|
||||||
|
done | dmenu -0 -p clipboard -r "$(realpath "$0") preview" | {
|
||||||
|
read -r -d '' result
|
||||||
|
if [ -z "$result" ]; then
|
||||||
|
exit 0
|
||||||
|
elif [ -f "$result" ]; then
|
||||||
|
wl-copy <"$result"
|
||||||
|
else
|
||||||
|
printf '%s' "$result" | sed -e 's/[[:space:]]*$//' | sed -Ez 's/\s+$//' | wl-copy
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
elif [ "$1" = "preview" ]; then
|
||||||
|
if [ -f "$2" ]; then
|
||||||
|
kitty +kitten icat --silent --stdin=no "$2"
|
||||||
|
else
|
||||||
|
echo "$2" | bat -l bash --color always -pp
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "Usage: $0 <daemon|lock|unlock|on-copy|dmenu|preview>"
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -1,3 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
# -*- sh -*-
|
|
||||||
clipman clear --tool rofi
|
|
|
@ -1,3 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
# -*- sh -*-
|
|
||||||
clipman pick --tool rofi
|
|
Loading…
Reference in New Issue
Block a user