### Example wrapper script for Wayland Gnome session Source: https://github.com/apognu/tuigreet/blob/master/README.md This example demonstrates a wrapper script required for Wayland sessions like Gnome, which may need specific environment variables set. The script sets XDG_SESSION_TYPE and uses dbus-run-session to start gnome-session. This script would then be referenced in a .desktop file. ```shell XDG_SESSION_TYPE=wayland dbus-run-session gnome-session ``` -------------------------------- ### Install tuigreet Source: https://context7.com/apognu/tuigreet/llms.txt Installation commands for various Linux distributions including Arch Linux and Gentoo. ```bash pacman -S greetd-tuigreet yay -S greetd-tuigreet-bin yay -S greetd-tuigreet-git emerge --ask --verbose gui-apps/tuigreet ``` -------------------------------- ### Configure Session Wrappers Source: https://context7.com/apognu/tuigreet/llms.txt Sets up wrappers for X11 and Wayland sessions to ensure proper environment initialization. Includes an example wrapper script for GNOME. ```bash tuigreet --xsession-wrapper 'startx /usr/bin/env' tuigreet --no-xsession-wrapper tuigreet --session-wrapper '/usr/local/bin/wayland-wrapper.sh' # /usr/local/bin/gnome-wayland-wrapper.sh export XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session ``` -------------------------------- ### Example .desktop file for a custom session Source: https://github.com/apognu/tuigreet/blob/master/README.md This snippet shows a .desktop file entry for a custom session, such as 'Wayland Gnome'. It specifies the Name of the session and the Executable path, which would point to a wrapper script or the session command. This file would be placed in a directory specified by tuigreet's --sessions argument. ```ini [Desktop Entry] Name=Wayland Gnome Exec=/path/to/my/wrapper.sh ``` -------------------------------- ### Configure tuigreet for passwordless power actions Source: https://github.com/apognu/tuigreet/blob/master/README.md This TOML configuration example shows how to set custom commands for power actions in greetd, specifically for shutting down the system using 'sudo systemctl poweroff'. This requires that the specified commands are executable by regular users, potentially via passwordless sudo configuration. ```toml [default_session] command = "tuigreet --power-shutdown 'sudo systemctl poweroff'" ``` -------------------------------- ### Build tuigreet from Source with Cargo Source: https://github.com/apognu/tuigreet/blob/master/README.md This snippet shows how to clone the tuigreet repository, build the release version using cargo, and install the executable to the system's PATH. It requires Rust's stable toolchain and cargo to be installed. ```bash git clone https://github.com/apognu/tuigreet && cd tuigreet cargo build --release # mv target/release/tuigreet /usr/local/bin/tuigreet ``` -------------------------------- ### Setup cache directory for user persistence Source: https://context7.com/apognu/tuigreet/llms.txt Configure the required system directory for tuigreet to persist user login history and session preferences. ```bash sudo mkdir -p /var/cache/tuigreet sudo chown greeter:greeter /var/cache/tuigreet sudo chmod 0755 /var/cache/tuigreet ``` -------------------------------- ### Install tuigreet on Arch Linux using pacman Source: https://github.com/apognu/tuigreet/blob/master/README.md This command installs the tuigreet package on Arch Linux systems using the pacman package manager. It installs the version available in the 'extra' repository. ```bash pacman -S greetd-tuigreet ``` -------------------------------- ### Build and Test tuigreet Source: https://context7.com/apognu/tuigreet/llms.txt Commands to clone, build, and run the test suite for tuigreet. Includes support for NSS wrapper to test user listing functionality. ```bash git clone https://github.com/apognu/tuigreet && cd tuigreet cargo build --release sudo mv target/release/tuigreet /usr/local/bin/tuigreet cargo test export NSS_WRAPPER_PASSWD=contrib/fixtures/passwd export NSS_WRAPPER_GROUP=contrib/fixtures/group LD_PRELOAD=/path/to/libnss_wrapper.so cargo test --all-features ``` -------------------------------- ### Configure Tuigreet via Command Line Interface Source: https://context7.com/apognu/tuigreet/llms.txt The CLI provides extensive configuration for display, theming, power management, and session handling. It allows users to define custom paths for sessions, set color themes, and configure keyboard shortcuts. ```bash tuigreet --cmd sway tuigreet \ --time \ --time-format "%Y-%m-%d %H:%M:%S" \ --issue \ --remember \ --remember-session \ --width 100 \ --asterisks tuigreet \ --sessions /usr/share/wayland-sessions:/custom/wayland-sessions \ --xsessions /usr/share/xsessions:/custom/xsessions \ --xsession-wrapper "startx /usr/bin/env" tuigreet \ --theme 'border=magenta;text=cyan;prompt=green;time=red;action=blue;button=yellow;container=black;input=red' tuigreet \ --power-shutdown 'sudo systemctl poweroff' \ --power-reboot 'sudo systemctl reboot' \ --power-no-setsid tuigreet \ --user-menu \ --user-menu-min-uid 1000 \ --user-menu-max-uid 60000 tuigreet \ --kb-command 2 \ --kb-sessions 3 \ --kb-power 12 tuigreet \ --cmd sway \ --env XDG_SESSION_TYPE=wayland \ --env MOZ_ENABLE_WAYLAND=1 tuigreet --debug /var/log/tuigreet.log --cmd sway ``` -------------------------------- ### Configure Greetd and NixOS for Tuigreet Source: https://context7.com/apognu/tuigreet/llms.txt Integration of Tuigreet into the system login manager using TOML configuration or declarative NixOS modules. These configurations define the default session and ensure necessary directories exist. ```toml [terminal] vt = 1 [default_session] command = "tuigreet --time --remember --remember-session --cmd sway" user = "greeter" ``` ```nix { pkgs, ... }: { services.greetd = { enable = true; settings = { default_session = { command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd sway"; user = "greeter"; }; }; }; systemd.tmpfiles.rules = [ "d /var/cache/tuigreet 0755 greeter greeter -" ]; } ``` -------------------------------- ### Configure tuigreet service on NixOS Source: https://github.com/apognu/tuigreet/blob/master/README.md This NixOS configuration snippet enables the greetd service and configures tuigreet as the default session. It specifies the command to run tuigreet with options to display time and set 'sway' as the command to execute after login. The user for the session is set to 'greeter'. ```nix { pkgs, ... }: { services.greetd = { enable = true; settings = { default_session = { command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; user = "greeter"; }; }; }; } ``` -------------------------------- ### Create XDG Desktop Session Files Source: https://context7.com/apognu/tuigreet/llms.txt Configuration files following the XDG Desktop Entry specification to define available sessions for the greeter. These files are placed in standard system directories to be discovered by Tuigreet. ```ini [Desktop Entry] Name=Sway Comment=An i3-compatible Wayland compositor Exec=sway Type=Application DesktopNames=sway [Desktop Entry] Name=GNOME on Xorg Comment=GNOME desktop environment (X11) Exec=gnome-session Type=Application DesktopNames=GNOME ``` -------------------------------- ### Configure greetd to use tuigreet Source: https://github.com/apognu/tuigreet/blob/master/README.md This snippet shows how to set the default session command in greetd's configuration file to use tuigreet. It specifies the command to run and the user to run it as. This is essential for integrating tuigreet as the login manager. ```toml [terminal] vt = 1 [default_session] command = "tuigreet --cmd sway" user = "greeter" ``` -------------------------------- ### Create and Configure Cache Directory for tuigreet Source: https://github.com/apognu/tuigreet/blob/master/README.md This snippet demonstrates the necessary steps to create and set ownership/permissions for the cache directory required by tuigreet's `--remember*` features. The directory must be owned by the user running the greeter. ```bash # mkdir /var/cache/tuigreet # chown greeter:greeter /var/cache/tuigreet # chmod 0755 /var/cache/tuigreet ``` -------------------------------- ### Configure Power Management Source: https://context7.com/apognu/tuigreet/llms.txt Configures custom shutdown and reboot commands for tuigreet using systemctl, doas, or loginctl. Requires appropriate sudoers permissions. ```bash tuigreet \ --power-shutdown 'sudo systemctl poweroff' \ --power-reboot 'sudo systemctl reboot' tuigreet \ --power-shutdown 'doas poweroff' \ --power-reboot 'doas reboot' tuigreet \ --power-shutdown 'loginctl poweroff' \ --power-reboot 'loginctl reboot' \ --power-no-setsid ``` -------------------------------- ### Run tuigreet tests with NSS Wrapper Mocking Source: https://github.com/apognu/tuigreet/blob/master/README.md This snippet shows how to run specific tuigreet tests that utilize NSS (Name Service Switch) mocking. It involves setting environment variables for the wrapper's passwd and group files, and preloading the libnss_wrapper.so library. The `--features nsswrapper nsswrapper_` flags are used to enable the necessary features for these tests. ```bash export NSS_WRAPPER_PASSWD=contrib/fixtures/passwd export NSS_WRAPPER_GROUP=contrib/fixtures/group LD_PRELOAD=/path/to/libnss_wrapper.so cargo test --features nsswrapper nsswrapper_ # To run those tests specifically LD_PRELOAD=/path/to/libnss_wrapper.so cargo test --all-features # To run the whole test suite ``` -------------------------------- ### Interact with greetd via IPC Source: https://context7.com/apognu/tuigreet/llms.txt Use the greetd_ipc protocol to handle authentication requests and session management. This Rust implementation demonstrates how to create sessions, respond to auth prompts, and handle success or error responses. ```rust use greetd_ipc::{Request, Response, AuthMessageType, ErrorType}; // Create a session for a user Request::CreateSession { username: "john".to_string(), } // Respond to authentication prompts Request::PostAuthMessageResponse { response: Some("password123".to_string()), } // Start the session Request::StartSession { cmd: vec!["sway".to_string()], env: vec!["XDG_SESSION_TYPE=wayland".to_string()], } ``` -------------------------------- ### Customize keyboard shortcuts Source: https://context7.com/apognu/tuigreet/llms.txt Remap default function key shortcuts for command entry, session selection, and power management using command-line arguments. ```bash tuigreet \ --kb-command 1 \ --kb-sessions 2 \ --kb-power 11 ``` -------------------------------- ### Configure user menu and UID filtering Source: https://context7.com/apognu/tuigreet/llms.txt Enable the graphical user selection menu and restrict displayed users based on UID ranges. ```bash tuigreet \ --user-menu \ --user-menu-min-uid 1000 \ --user-menu-max-uid 65534 ``` -------------------------------- ### Configure tuigreet visual themes Source: https://context7.com/apognu/tuigreet/llms.txt Customize the appearance of the tuigreet interface using the --theme flag. Supports ANSI color names, RGB values, and indexed colors for various UI components. ```bash tuigreet --theme 'container=black;border=magenta;title=magenta;text=white;prompt=cyan;input=green;action=gray;button=magenta' tuigreet --theme 'container=white;border=blue;text=black;prompt=darkblue;input=darkgreen' ``` -------------------------------- ### Core Application Structs Source: https://context7.com/apognu/tuigreet/llms.txt Rust enums defining the internal state machine, secret display behavior, greeting alignment, and authentication status for tuigreet. ```rust pub enum Mode { Username, Password, Action, Users, Command, Sessions, Power, Processing, } pub enum SecretDisplay { Hidden, Character(String), } pub enum GreetAlign { Center, Left, Right, } pub enum AuthStatus { Success, Failure, Cancel, } ``` -------------------------------- ### Define Session Structures in Rust Source: https://context7.com/apognu/tuigreet/llms.txt Internal Rust data structures used by Tuigreet to represent XDG desktop entries and manage session types. These structures facilitate the parsing of session metadata and environment variable mapping. ```rust pub struct Session { pub slug: Option, pub name: String, pub command: String, pub session_type: SessionType, pub path: Option, pub xdg_desktop_names: Option, } pub enum SessionType { X11, Wayland, Tty, None, } pub enum SessionSource { None, DefaultCommand(String, Option>), Command(String), Session(usize), } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.