added cliphist script

This commit is contained in:
Tomas Rivera
2026-02-26 18:30:55 +01:00
parent 0fb41b8041
commit 321fe30583
6 changed files with 56 additions and 3 deletions
-1
View File
@@ -44,7 +44,6 @@ writeShellApplication {
while true; do
get_info
state="$status-$percentage"
if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then
notify critical "Battery Critically Low" "$percentage% suspending."
+50
View File
@@ -0,0 +1,50 @@
{ writeShellApplication
, cliphist
, rofi
, wl-clipboard
}:
writeShellApplication {
name = "custom-cliphist";
runtimeInputs = [
cliphist # clipboard manager
rofi # launcher menu
wl-clipboard # wl-copy
];
text = ''
set -euo pipefail
action="${1:-}"
case "$action" in
c|-c|--copy)
cliphist list |
rofi -dmenu" |
cliphist decode |
wl-copy
;;
d|-d|--delete)
cliphist list |
rofi -dmenu" |
cliphist delete
;;
w|-w|--wipe)
if [[ "$(printf "Yes\nNo" | rofi -dmenu")" == "Yes" ]]; then
cliphist wipe
fi
;;
*)
echo "custom-cliphist [action]"
echo "c -c --copy : list and copy selected"
echo "d -d --delete : list and delete selected"
echo "w -w --wipe : wipe clipboard database"
exit 1
;;
esac
'';
}