### Run Eww Daemon and Open Widget Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Start the Eww daemon and then open a widget by its name. Ensure the Eww binary is in your PATH or run from its directory. ```bash ./eww daemon ./eww open ``` -------------------------------- ### Build Eww for X11 Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Build the Eww project in release mode with X11 features enabled. Ensure you have the necessary prerequisites installed. ```bash cargo build --release --no-default-features --features x11 ``` -------------------------------- ### Build Eww for Wayland Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Build the Eww project in release mode with Wayland features enabled. This is for Wayland environments. Ensure you have the necessary prerequisites installed. ```bash cargo build --release --no-default-features --features=wayland ``` -------------------------------- ### JSON Access Example Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Demonstrates accessing fields within a JSON structure stored in a variable. Supports dot notation, bracket notation with string keys, and bracket notation with numeric indices. ```lisp json_variable.field_name ``` ```lisp json_variable["field_name"] ``` ```lisp json_variable[12] ``` -------------------------------- ### Conditional Expression Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Example of a conditional expression (ternary operator). It evaluates a condition and returns one of two values based on the boolean result. ```lisp condition ? 'value' : 'other value' ``` -------------------------------- ### Navigate to Build Directory Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Change the current directory to the release build output directory. ```bash cd target/release ``` -------------------------------- ### Navigate to Eww Directory Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Change the current directory to the cloned Eww repository. ```bash cd eww ``` -------------------------------- ### Make Eww Executable Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Grant execute permissions to the Eww binary. ```bash chmod +x ./eww ``` -------------------------------- ### Invoke a custom widget Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Demonstrates how to call the custom greeter widget within a window definition. ```lisp (defwindow example ; ... values omitted (greeter :text "Say hello!" :name "Tim")) ``` -------------------------------- ### Open windows with specific IDs Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Use the --id flag with the open command to spawn multiple instances of the same window configuration. ```bash eww open my_bar --screen 0 --id primary eww open my_bar --screen 1 --id secondary ``` ```bash eww open-many my_config:primary my_config:secondary ``` -------------------------------- ### Use a wrapper widget Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Shows how to pass a button as a child to the labeled-container widget. ```lisp (labeled-container :name "foo" (button :onclick "notify-send hey ho" "click me")) ``` -------------------------------- ### Include external configuration files Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Use the include directive to import contents from another yuck file into the current configuration. ```lisp (include "./path/to/your/file.yuck") ``` -------------------------------- ### Define a window with arguments Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Define window arguments in the defwindow block to allow for dynamic configuration based on input parameters. These arguments are constant once the window is opened. ```lisp (defwindow my_bar [arg1 ?arg2] :geometry (geometry :x "0%" :y "6px" :width "100%" :height { arg1 == "small" ? "30px" : "40px" } :anchor "top center") :stacking "bg" :windowtype "dock" :reserve (struts :distance "50px" :side "top") (my_widget :arg2 arg2)) ``` -------------------------------- ### Create a wrapper widget with children Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Uses the children placeholder to allow a custom widget to accept and render child elements. ```lisp (defwidget labeled-container [name] (box :class "container" name (children))) ``` -------------------------------- ### Pass arguments to windows Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Provide arguments to windows using the --arg flag during the open or open-many commands. ```bash eww open my_bar --id primary --arg arg1=some_value --arg arg2=another_value ``` ```bash # Please note that `--arg` option must be given after all the windows names eww open-many my_bar:primary --arg primary:arg1=some_value --arg primary:arg2=another_value ``` -------------------------------- ### Define a top-level window Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Use the defwindow macro to specify window properties like geometry, monitor, and content. ```lisp (defwindow example :monitor 0 :geometry (geometry :x "0%" :y "20px" :width "90%" :height "30px" :anchor "top center") :stacking "fg" :reserve (struts :distance "40px" :side "top") :windowtype "dock" :wm-ignore false "example content") ``` -------------------------------- ### Clone Eww Repository Source: https://github.com/elkowar/eww/blob/master/docs/src/eww.md Clone the Eww project repository from GitHub to your local machine. ```bash git clone https://github.com/elkowar/eww ``` -------------------------------- ### Define a custom greeter widget Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Defines a widget with an optional text attribute and a required name attribute. ```lisp (defwidget greeter [?text name] (box :orientation "horizontal" :halign "center" text (button :onclick "notify-send 'Hello' 'Hello, ${name}'" "Greet"))) ``` -------------------------------- ### View Eww Logs Source: https://github.com/elkowar/eww/blob/master/docs/src/troubleshooting.md This command displays the current logs for the Eww application, useful for diagnosing issues. ```bash eww logs ``` -------------------------------- ### Open GTK Debugger Source: https://github.com/elkowar/eww/blob/master/docs/src/working_with_gtk.md Run this command in your terminal to open the GTK debugger for Eww. Use it to inspect and debug styling issues. ```bash eww inspector ``` -------------------------------- ### Apply arguments across multiple windows Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Apply arguments to multiple windows simultaneously or target specific windows by name in open-many. ```bash eww open-many my_bar:primary my_bar:secondary --arg gui_size="small" ``` ```bash eww open-many my_primary_bar --arg my_primary_bar:screen=0 ``` -------------------------------- ### Debug Eww Widget Structure Source: https://github.com/elkowar/eww/blob/master/docs/src/troubleshooting.md This command provides detailed information about your widget's structure and other debugging data. ```bash eww debug ``` -------------------------------- ### Inspect Eww State Source: https://github.com/elkowar/eww/blob/master/docs/src/troubleshooting.md Use this command to view the current state of all variables managed by Eww. ```bash eww state ``` -------------------------------- ### Time Formatting with Timezone Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Demonstrates formatting a UNIX timestamp into a human-readable string using a specified format and timezone. Refer to chrono's documentation for format strings and timezones. ```lisp formattime(unix_timestamp, "%Y-%m-%d %H:%M:%S", "America/New_York") ``` -------------------------------- ### Environment Variable Access Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Shows how to retrieve the value of an environment variable using the get_env function. ```lisp get_env("MY_VARIABLE") ``` -------------------------------- ### Byte Formatting (IEC) Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Formats a byte count into a human-readable string using IEC units (KiB, MiB, GiB). Supports negative byte counts and an option for compact output. ```lisp formatbytes(bytes, false, "iec") ``` ```lisp formatbytes(bytes, true, "iec") ``` -------------------------------- ### Generate widgets from JSON using for-element Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Use the for-element to iterate over a JSON array and dynamically create widgets within a container. ```lisp (defvar my-json "[1, 2, 3]") ; Then, inside your widget, you can use (box (for entry in my-json (button :onclick "notify-send 'click' 'button ${entry}'" entry))) ``` -------------------------------- ### Byte Formatting (SI) Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Formats a byte count into a human-readable string using SI units (KB, MB, GB). Supports negative byte counts and an option for compact output. ```lisp formatbytes(bytes, false, "si") ``` ```lisp formatbytes(bytes, true, "si") ``` -------------------------------- ### Basic Expression Language Usage Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Demonstrates embedding expressions within strings and conditional attribute values. Expressions can perform math, string interpolation, and conditional logic. ```lisp (box "Some math: ${12 + foo * 10}" (button :class {button_active ? "active" : "inactive"} :onclick "toggle_thing" {button_active ? "disable" : "enable"})) ``` -------------------------------- ### Manually Reload Eww Source: https://github.com/elkowar/eww/blob/master/docs/src/troubleshooting.md If hot reloading is not functioning, use this command to manually reload the Eww configuration. ```bash eww reload ``` -------------------------------- ### Render specific children by index Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Uses the nth attribute of the children placeholder to place specific child elements into different containers. ```lisp (defwidget two-boxes [] (box (box :class "first" (children :nth 0)) (box :class "second" (children :nth 1)))) ``` -------------------------------- ### Define and use a literal widget Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Use the literal widget to render a dynamically generated Yuck widget tree from a string variable. Note that this operation is computationally expensive and should be used sparingly. ```lisp (defvar variable_containing_yuck "(box (button 'foo') (button 'bar'))") ; Then, inside your widget, use: (literal :content variable_containing_yuck) ``` -------------------------------- ### Define a listening variable Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Listening variables run a script once and update the variable value whenever the script outputs a new line. This is highly efficient for monitoring continuous data streams. ```lisp (deflisten foo :initial "whatever" `tail -F /tmp/some_file`) ``` -------------------------------- ### jq Function Usage Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Illustrates using the jq function to process JSON data with jq-compatible filters. The 'r' flag can be used for raw output. ```lisp jq(json_value, ".field | .subfield") ``` ```lisp jq(json_value, ".field | .subfield", ["r"]) ``` -------------------------------- ### Kill Eww Daemon Source: https://github.com/elkowar/eww/blob/master/docs/src/troubleshooting.md Use this command to stop the Eww daemon. Re-open your window with the `--debug` flag afterwards for additional log output. ```bash eww kill ``` -------------------------------- ### Regex Match Operator Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Illustrates the regex match operator (=~). The left-hand side is the regex pattern, and the right-hand side is the string to test against. Supports Rust regex syntax. ```lisp workspace.name =~ '^special:.+$' ``` -------------------------------- ### Time Formatting without Timezone Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Shows formatting a UNIX timestamp using the system's local timezone. Uses chrono's documentation for format string details. ```lisp formattime(unix_timestamp, "%Y-%m-%d %H:%M:%S") ``` -------------------------------- ### Define a basic variable Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Basic variables require manual updates via the eww update command and do not change automatically. ```lisp (defvar foo "initial value") ``` -------------------------------- ### Safe Access Operator Source: https://github.com/elkowar/eww/blob/master/docs/src/expression_language.md Shows the Safe Access operator (?.) for accessing object fields or array elements. It returns null if the left-hand side is null or an empty string, preventing errors. ```lisp object.field?.nested_field ``` ```lisp array[index]?.[nested_index] ``` -------------------------------- ### Define a polling variable Source: https://github.com/elkowar/eww/blob/master/docs/src/configuration.md Polling variables execute a shell script at a specified interval. The :run-while property can be used to conditionally enable or disable the polling process. ```lisp (defvar time-visible false) ; for :run-while property of below variable ; when this turns true, the polling starts and ; var gets updated with given interval (defpoll time :interval "1s" :initial "initial-value" ; optional, defaults to poll at startup :run-while time-visible ; optional, defaults to 'true' `date +%H:%M:%S`) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.