mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
feat: Adds ability to narrow down keys returned for preview-stats.
This commit is contained in:
28
env/.local/scripts/hypr/preview-stats
vendored
28
env/.local/scripts/hypr/preview-stats
vendored
@@ -15,11 +15,17 @@ USAGE:
|
|||||||
|
|
||||||
MODES:
|
MODES:
|
||||||
|
|
||||||
monitor <id>: Get monitor data.
|
monitor <id> <keys>: Get monitor data, optionally providing keys to return.
|
||||||
window <address>: Get window data.
|
window <address> <keys>: Get window data, optionally providing keys to return.
|
||||||
workspace <id>: Get workspace data.
|
workspace <id> <keys>: Get workspace data, optionally providing keys to return.
|
||||||
utlis <name> <config>: Get utils-launcher data.
|
utlis <name> <config>: Get utils-launcher data.
|
||||||
|
|
||||||
|
EXAMPLE:
|
||||||
|
|
||||||
|
Here's an example of getting window data, but only returning "title", "workspace", and "address".
|
||||||
|
|
||||||
|
$ $THIS window "0xaaaaea92a7e0" "{title, workspace, address}"
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,11 +52,27 @@ mode="$1"
|
|||||||
arg="${2//\'/}"
|
arg="${2//\'/}"
|
||||||
|
|
||||||
if [[ $mode == "monitor" ]]; then
|
if [[ $mode == "monitor" ]]; then
|
||||||
|
keys="$3"
|
||||||
|
if [[ -n $keys ]]; then
|
||||||
|
hyprctl monitors -j | jq -C ".[] | select(.id == $arg) | $keys"
|
||||||
|
else
|
||||||
hyprctl monitors -j | jq -C ".[] | select(.id == $arg)"
|
hyprctl monitors -j | jq -C ".[] | select(.id == $arg)"
|
||||||
|
fi
|
||||||
elif [[ $mode == "window" ]]; then
|
elif [[ $mode == "window" ]]; then
|
||||||
|
keys="$3"
|
||||||
|
if [[ -n $keys ]]; then
|
||||||
|
hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\") | $keys"
|
||||||
|
else
|
||||||
hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\")"
|
hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\")"
|
||||||
|
fi
|
||||||
|
|
||||||
elif [[ $mode == "workspace" ]]; then
|
elif [[ $mode == "workspace" ]]; then
|
||||||
|
keys="$3"
|
||||||
|
if [[ -n $keys ]]; then
|
||||||
|
hyprctl workspaces -j | jq -C ".[] | select(.id == $arg) | $keys"
|
||||||
|
else
|
||||||
hyprctl workspaces -j | jq -C ".[] | select(.id == $arg)"
|
hyprctl workspaces -j | jq -C ".[] | select(.id == $arg)"
|
||||||
|
fi
|
||||||
elif [[ $mode == "utils" ]]; then
|
elif [[ $mode == "utils" ]]; then
|
||||||
config="${3//\'/}"
|
config="${3//\'/}"
|
||||||
if [[ ! -f $config ]]; then
|
if [[ ! -f $config ]]; then
|
||||||
|
|||||||
2
env/.local/scripts/hypr/windowctl
vendored
2
env/.local/scripts/hypr/windowctl
vendored
@@ -143,7 +143,7 @@ ask_what_to_do_with_selection() {
|
|||||||
--delimiter=':' --with-nth=2 \
|
--delimiter=':' --with-nth=2 \
|
||||||
--header="What should we do with the selected window?" \
|
--header="What should we do with the selected window?" \
|
||||||
--preview-label="[ Description ]" \
|
--preview-label="[ Description ]" \
|
||||||
--preview="echo -e {1}; echo -e '\n\n\e[35mSelected Window:\e[0m'; $SCRIPTS/hypr/preview-stats window $selected_value;"
|
--preview="echo -e {1}; echo -e '\n\n\e[35mSelected Window:\e[0m'; $SCRIPTS/hypr/preview-stats window $selected_value \"{title, workspace, address}\";"
|
||||||
)
|
)
|
||||||
# Set choice to just the action portion.
|
# Set choice to just the action portion.
|
||||||
choice="${choice#*:}"
|
choice="${choice#*:}"
|
||||||
|
|||||||
Reference in New Issue
Block a user