mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-13 22:02:34 +00:00
feat: Adds ability to narrow down keys returned for preview-stats.
This commit is contained in:
36
env/.local/scripts/hypr/preview-stats
vendored
36
env/.local/scripts/hypr/preview-stats
vendored
@@ -15,10 +15,16 @@ USAGE:
|
||||
|
||||
MODES:
|
||||
|
||||
monitor <id>: Get monitor data.
|
||||
window <address>: Get window data.
|
||||
workspace <id>: Get workspace data.
|
||||
utlis <name> <config>: Get utils-launcher data.
|
||||
monitor <id> <keys>: Get monitor data, optionally providing keys to return.
|
||||
window <address> <keys>: Get window data, optionally providing keys to return.
|
||||
workspace <id> <keys>: Get workspace data, optionally providing keys to return.
|
||||
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
|
||||
}
|
||||
@@ -46,11 +52,27 @@ mode="$1"
|
||||
arg="${2//\'/}"
|
||||
|
||||
if [[ $mode == "monitor" ]]; then
|
||||
hyprctl monitors -j | jq -C ".[] | select(.id == $arg)"
|
||||
keys="$3"
|
||||
if [[ -n $keys ]]; then
|
||||
hyprctl monitors -j | jq -C ".[] | select(.id == $arg) | $keys"
|
||||
else
|
||||
hyprctl monitors -j | jq -C ".[] | select(.id == $arg)"
|
||||
fi
|
||||
elif [[ $mode == "window" ]]; then
|
||||
hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\")"
|
||||
keys="$3"
|
||||
if [[ -n $keys ]]; then
|
||||
hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\") | $keys"
|
||||
else
|
||||
hyprctl clients -j | jq -C ".[] | select(.address == \"$arg\")"
|
||||
fi
|
||||
|
||||
elif [[ $mode == "workspace" ]]; then
|
||||
hyprctl workspaces -j | jq -C ".[] | select(.id == $arg)"
|
||||
keys="$3"
|
||||
if [[ -n $keys ]]; then
|
||||
hyprctl workspaces -j | jq -C ".[] | select(.id == $arg) | $keys"
|
||||
else
|
||||
hyprctl workspaces -j | jq -C ".[] | select(.id == $arg)"
|
||||
fi
|
||||
elif [[ $mode == "utils" ]]; then
|
||||
config="${3//\'/}"
|
||||
if [[ ! -f $config ]]; then
|
||||
|
||||
4
env/.local/scripts/hypr/windowctl
vendored
4
env/.local/scripts/hypr/windowctl
vendored
@@ -142,8 +142,8 @@ ask_what_to_do_with_selection() {
|
||||
fzf --style=full --footer="$(action_footer)" \
|
||||
--delimiter=':' --with-nth=2 \
|
||||
--header="What should we do with the selected window?" \
|
||||
--preview-label="[ Description ]" \
|
||||
--preview="echo -e {1}; echo -e '\n\n\e[35mSelected Window:\e[0m'; $SCRIPTS/hypr/preview-stats window $selected_value;"
|
||||
--preview-label="[ Description ]" \
|
||||
--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.
|
||||
choice="${choice#*:}"
|
||||
|
||||
Reference in New Issue
Block a user