sane-open-clipboard: init; integrate with sway

This commit is contained in:
2024-12-07 21:40:15 +00:00
parent 7ef6916b04
commit 106a4fd67c
5 changed files with 44 additions and 5 deletions

View File

@@ -1,6 +1,11 @@
{ ... }:
{
sane.programs.sane-open = {
suggestedPrograms = [
"gdbus"
"xdg-utils"
];
sandbox.autodetectCliPaths = "existing"; # for when opening a file
sandbox.whitelistDbus = [ "user" ];
sandbox.keepPidsAndProc = true; #< to toggle keyboard
@@ -8,11 +13,19 @@
".local/share/applications"
];
sandbox.extraRuntimePaths = [ "sway" ]; #< calls `swaymsg` to query rotation and see if there's room for a keyboard
suggestedPrograms = [
"gdbus"
"xdg-utils"
];
mime.associations."application/x-desktop" = "sane-open-desktop.desktop";
};
sane.programs."sane-open.clipboard" = {
suggestedPrograms = [
"sane-open"
];
# this calls into `sane-open`, but explicitly doesn't use all functionality,
# so doesn't need all sandboxing.
# that might hint that the packages should be split/restructured...
sandbox.whitelistWayland = true; #< to access clipboard
sandbox.whitelistDbus = [ "user" ];
};
}

View File

@@ -83,10 +83,10 @@ bindsym $mod+Print exec sane-open --application sane-screenshot.desktop
bindsym $mod+p exec sane-open --application sane-screenshot.desktop
bindsym $mod+l exec systemctl start $locker
bindsym $mod+s exec sane-open --application rofi-snippets.desktop
# bindsym $mod+slash exec sane-open splatmoji.desktop
bindsym $mod+d exec sane-open --application rofi.desktop
bindsym $mod+Return exec sane-open --application xdg-terminal-exec.desktop
bindsym $mod+b exec sane-open --uri "https://uninsane.org/places"
bindsym $mod+v exec sane-open-clipboard
bindsym $mod+Shift+q kill
# bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'

View File

@@ -160,6 +160,7 @@ in
"rofi-snippets"
"sane-screenshot"
"sane-open"
"sane-open.clipboard"
"sane-theme"
"seatd"
# "splatmoji" # used by sway config

View File

@@ -26,4 +26,23 @@ static-nix-shell.mkBash {
noDisplay = true;
})
];
passthru.clipboard = static-nix-shell.mkBash {
pname = "sane-open-clipboard";
srcRoot = ./.;
pkgs = [
"sane-open"
"wl-clipboard"
];
nativeBuildInputs = [
copyDesktopItems
];
desktopItems = [
(makeDesktopItem {
name = "sane-open-clipboard";
exec = "sane-open-clipboard";
desktopName = "Open Clipboard";
})
];
};
}

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash -p sane-open -p wl-clipboard
set -e
# TODO: restrict to `--file` or `--uri`? little reason to dispatch anything ending in `.desktop` here.
exec sane-open "$@" "$(wl-paste)"