mirror of
https://github.com/fairyglade/ly.git
synced 2026-05-06 15:20:36 +00:00
Feature: Add custom command & label support (#945)
## What are the changes about? Adds customizable commands and labels to ly. Solves https://codeberg.org/fairyglade/ly/issues/905. Since Ly doesn't use INI headers. I use them exclusively for declarations of custom commands and labels. ### Commands Bind a keybind to a command, and add a hint to the HUD. Useful for use cases like display brightness, switching between GPUs, etc. Supports localization in the `name` field only. ex: where `lang = es`: `$brightness_up` => `bajar brillo` Declared in config.ini with the following: ```ini [cmd:F8] name = custom command 2 cmd = touch /tmp/ly.gaming ``` ### Labels Add a label to the HUD. As specified in #905. The text of the label corresponds to the output of the command specified in `[lbl:NAME]`. Only shows the first line of the output. Declared in config.ini with the following: ```ini [lbl:kernel] cmd = uname -srn refresh = 0 ``` Example to add to the config.ini: ```ini # Declare a command with the F8 binding. [cmd:F8] #The name of the command to show up in Ly. name = custom command cmd = touch /tmp/ly.gaming # Declare a label with an ID. This ID should be unique across all labels. [lbl:kernel] cmd = uname -srn # In frames, the time to re-run the command and update the label. If 0, only run once- do not refresh. refresh = 0 # Once you're done setting up labels and commands, add an empty header # below to continue configurating the rest of Ly. # Put other settings not belonging to custom commands/labels below here. [] ``` ## Pre-requisites - [x] I have tested & confirmed the changes work locally  Reviewed-on: https://codeberg.org/fairyglade/ly/pulls/945 Reviewed-by: AnErrupTion <anerruption+codeberg@disroot.org> Co-authored-by: RadsammyT <radsammyt@gmail.com> Co-committed-by: RadsammyT <radsammyt@gmail.com>
This commit is contained in:
@@ -143,6 +143,11 @@ colormix_col2 = 0x000000FF
|
||||
# Color mixing animation third color id
|
||||
colormix_col3 = 0x20000000
|
||||
|
||||
# For custom binds: the horizontal limit in characters for each
|
||||
# line of custom binds before moving on to the next.
|
||||
# If null, defaults to the width of the terminal instead.
|
||||
custom_bind_width = null
|
||||
|
||||
# Custom sessions directory
|
||||
# You can specify multiple directories,
|
||||
# e.g. $CONFIG_DIRECTORY/ly/custom-sessions:$PREFIX_DIRECTORY/share/custom-sessions
|
||||
@@ -380,3 +385,35 @@ xinitrc = ~/.xinitrc
|
||||
# You can specify multiple directories,
|
||||
# e.g. $PREFIX_DIRECTORY/share/xsessions:$PREFIX_DIRECTORY/local/share/xsessions
|
||||
xsessions = $PREFIX_DIRECTORY/share/xsessions
|
||||
|
||||
# Custom Commands and Labels:
|
||||
# The following examples below give an outline for setting up custom commands and labels.
|
||||
# Unless specified as optional, an option is mandatory.
|
||||
|
||||
# Comments preceding with '##' are for documentation.
|
||||
# Comments preceding with '#' comment out the example INI.
|
||||
|
||||
##---
|
||||
## Declare a command with the F8 binding.
|
||||
#[cmd:F8]
|
||||
## The name of the command to show up in Ly.
|
||||
## Note: "$" in "$brightness_up" fetches the appropriate string from the specified locale file
|
||||
## and is replaced with the value representing "brightness_up".
|
||||
## You can see the list of keys in any locale file in $CONFIG_DIRECTORY/ly/lang.
|
||||
#name = custom command $brightness_up
|
||||
#cmd = touch /tmp/ly.gaming
|
||||
#
|
||||
## Declare a label with an ID. This ID should be unique across all labels.
|
||||
#[lbl:kernel]
|
||||
#cmd = uname -srn
|
||||
## Optional, defaulting to 0.
|
||||
## In frames, the time to re-run the command and update the label.
|
||||
## If 0, only run once and do not refresh afterwards
|
||||
#refresh = 0
|
||||
#
|
||||
## Once you're done setting up labels and commands, add an empty header
|
||||
## below to continue configurating the rest of Ly.
|
||||
## Put other settings not belonging to custom commands/labels below here.
|
||||
#[]
|
||||
#
|
||||
##---
|
||||
|
||||
Reference in New Issue
Block a user