Cargo-app crate and screen recording permission in macOS

I often find myself emailing myself screenshots of random memes or other things on the web. :wink:
I figured I might as well make a small rust app on macos with the cargo-app crate ( However, when I run the program to take a screenshot, my computer will ask: "Screenshot tool would like to record this computer's screen. Grant access to this application in Security and Privacy settings." So naturally, I go to the security panel in settings, and check the box for allowing screen recording under the name of my application. But when I go to run the program again, the same message is displayed and I can't take a screenshot. Is this a problem with how I am using cargo-app or the gtk-rs crate for the gui? Or is there perhapse a field missing in the toml for []?

here is my code for the app:

mod r;
fn main() {

   let application = Application::new(
   ).expect("failed to initialize GTK application");

   application.connect_activate(|app| {
       let window = ApplicationWindow::new(app);
       window.set_title("Screenshot tool");
       window.set_default_size(350, 70);

       let button = Button::new_with_label("Click me!");
       button.connect_clicked(|_| {

                r::sendmail("screenshot taken");


here is the file (excluding the code that doesn't need to be known for this question):

pub fn screenshot() {
    //stuff to take screenshot

pub fn sendmail() {
    //stuff to send mail

and here is the toml:


out = ""

bin = "/Users/xxxxxxx/Library/Mobile Documents/com~apple~CloudDocs/Rust_projects    /screenshottool/target/debug/screenshottoo,"

display_name = "antivirus"

icon = "icon.icns"


version = "0.8.0"

features = ["v3_16"]


version = "0.8.0"

features = ["v2_44"]

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.