Closed skela closed 5 months ago
Thanks for raising this @skela
You'll be pleased to know that this functionality already exists for all Linux builds. What command did you bind for opening the TUI? If you bind clipse $PPID
that should achieve the 'close on selection' effect you're looking for.
For anyone using MacOs, sadly this does not kill the terminal window. Have been looking into a fix but AFAIK it requires a lot of complex system adjustments by the user.
Let me know if this helps!
Cheers
I'm using linux, endevour OS to be specific (not that that should matter here).
I've got this in my hyprland config:
bind = CONTROL ALT, C, exec, kitty --class floating -e fish -c 'clipse $PPID'
And this in my waybar config:
"custom/clipboard": {
"format": "",
"interval": "once",
"return-type": "json",
"on-click": "kitty --class floating -e fish -c 'clipse $PPID'",
"on-click-right": "kitty --class floating -e fish -c 'clipse $PPID'",
"on-click-middle": "clipse -clear",
// "on-click": "/home/skela/.dotfiles/scripts/launcher-clipboard.sh left",
// "on-click-right": "/home/skela/.dotfiles/scripts/launcher-clipboard.sh right",
// "on-click-middle": "cliphist wipe",
"exec": "printf '{\"tooltip\":\"%s\"}' $(cliphist list | wc -l)",
// "exec-if": "[ -x \"$(command -v cliphist)\" ] && [ $(cliphist list | wc -l) -gt 0 ]",
"signal": 9
}
Ok, i might have figured out why it wasnt working.
I was passing in fish as my environment, having also tried /usr/bin/fish, with it seemingly working, so thought that was all good.
But after replacing fish with bash, it closes the window when I hit enter.
So might be an issue specific to the fish shell iand clipse.
Love the idea of adding this to the waybar! Might copy you there.
As for the not closing.. you're bind seems perfect already so must be something else going wrong. Do you get a status message in the TUI after selection? I'd recommend checking the following:
echo $PPID
then run run kill <the ppid returned>
to see if that closes the terminal window. If not, the issue lies with your terminal environment, similar to MacOs. If it does, try hardcoding a returned PPID from a new echo command into a direct session, eg. clipse 17223
. If this works, the error lies with how the $PPID
var is being parsed in the binding.config/clipse/err_log.txt
file, maybe better debugging info in there. $PPID
& $PID
interchangeably so could be worth trying clipse $PID
hopefully this gets you somewhere
both echo $PPID and echo $PID return nothing.
Ok, i might have figured out why it wasn't working.
I was passing in fish as my environment, having also tried /usr/bin/fish, with it seemingly working, so thought that was all good.
But after replacing fish with bash, it closes the window when I hit enter.
So might be an issue specific to the fish shell and clipse.
Ah! that's super good to know, thank you for letting me know. Will keep an eye out for that in the future.
Found this variable in fish that lets me kill it:
So yeah, this bind works for me in fish:
bind = CONTROL ALT, C, exec, kitty --class floating -e fish -c 'clipse $fish_pid'
Thanks a lot!
both echo $PPID and echo $PID return nothing.
So there we have our issue - if fish does not return a $PPID, the command was just running clipse
in the binding, opening the TUI in persist mode.
Looks like this might need a different var instead: https://github.com/fish-shell/fish-shell/issues/6203
So yeah, this bind works for me in fish:
bind = CONTROL ALT, C, exec, kitty --class floating -e fish -c 'clipse $fish_pid'
Thanks a lot!
Excellent! glad you found a fix :)
I think its a sensible and expected user experience, but if not, could we have a setting or config for it to make it so?
Love this program, already started using it in Hyprland. So happy to not do this via rofi anymore.