Auch bekannt als:

  • 0 Posts
  • 32 Comments
Joined 6 months ago
cake
Cake day: June 22nd, 2024

help-circle





  • To get a TLS certificate from Let’s Encrypt, they need to verify that you are in control of your domain. For regular domains, this can be done via HTTP, for wildcard certificates they require you to create a DNS record with a special token to verify ownership of the domain.

    This means that in order to automatically obtain a TLS certificate, caddy needs to interact with the API of your domain registrar to set up this record. Since there are many different providers, this isn’t built into caddy itself and you require a version that includes the corresponding caddy-dns module. Caddy modules need to compiled into the binary, so it’s not always trivial to set up (in my case I have a systemd timer that rebuilds a local container image whenever a new version of the docker.io/caddy:builder image is available).





  • the hidden “trashbin”, .Trash-$(uid), invented by Ubuntu

    This isn’t some “idiotic principle invented by Ubuntu”, it just follows the freedesktop.org Trash specification. For many users, it can be really beneficial, see also the spec’s introduction:

    An ability to recover accidentally deleted files has become the de facto standard for today’s desktop user experience.

    Users do not expect that anything they delete is permanently gone. Instead, they are used to a “Trash can” metaphor. A deleted document ends up in a “Trash can”, and stays there at least for some time — until the can is manually or automatically cleaned.

    Whether an application like Prism Launcher should use the trash can or delete the files directly is an entirely different question.






  • Just use label.add_css_class(), label.remove_css_class() or label.set_css_classes() and make sure to properly load your CSS style sheets, this is usually done by including them as a resource alongside .ui files and icons. If you are using libadwaita, you can also use its predefined style classes.

    full example (requires nightly toolchain)
    #!/usr/bin/env -S cargo +nightly -Zscript
    ---
    [dependencies]
    gtk = { package = "gtk4", version = "0.9.3", features = ["v4_12"] }
    ---
    
    use gtk::{glib, prelude::*};
    
    const STYLESHEET: &str = r#"
    .green {
        color: green;
    }
    .red {
        color: red;
    }
    "#;
    
    fn main() -> glib::ExitCode {
        let app = gtk::Application::builder()
            .application_id("org.example.HelloWorld")
            .build();
    
        app.connect_activate(|app| {
            let window = gtk::ApplicationWindow::builder()
                .application(app)
                .title("Hello, World!")
                .build();
    
            // Stylesheets are usually bundled with application resources
            // and automatically loaded
            let css_provider = gtk::CssProvider::new();
            css_provider.load_from_string(STYLESHEET);
            gtk::style_context_add_provider_for_display(
                &RootExt::display(&window),
                &css_provider,
                0
            );
    
            let box_ = gtk::Box::new(gtk::Orientation::Vertical, 6);
    
            let label = gtk::Label::builder()
                .label("Hello, World")
                .css_classes(["green"].as_slice())
                .build();
            box_.append(&label);
    
    
            let button = gtk::Button::builder()
                .label("Toggle Color")
                .build();
            box_.append(&button);
    
            button.connect_clicked(glib::clone!(#[weak] label, move |_| {
                if label.has_css_class("red") {
                    label.add_css_class("green");
                    label.remove_css_class("red");
                } else {
                    label.add_css_class("red");
                    label.remove_css_class("green");
                }
            }));
    
            window.set_child(Some(&box_));
            window.present();
        });
    
        app.run()
    }