feat: Moves utils-launcher preview to be at bottom and updates window rules for utils-launcher

This commit is contained in:
2025-10-09 13:34:07 -04:00
parent a006539bf1
commit 390230e532
6 changed files with 41 additions and 37 deletions

View File

@@ -18,18 +18,14 @@ windowrule = size 90% 80%, class:^(com.ghostty.weather)$
# Force windows to be a floating window
windowrule = tag +floating-window, class:^(blueberry.py|org.gnome.Nautilus|com.ghostty.float)$
windowrule = tag +floating-window, class:^(com.ghostty.windowctl)$
windowrule = tag +floating-window, class:^(com.ghostty.utils-launcher)$
# Force to stay focused when visible.
windowrule = stayfocused, class:(blueberry.py)
windowrule = stayfocused, class:Pinentry.gtk
windowrule = stayfocused, class:com.ghostty.float
windowrule = stayfocused, class:com.ghostty.windowctl
# Utils-Launcher
windowrule = stayfocused, class:^(com.ghostty.utils-launcher)$
windowrule = float, class:^(com.ghostty.utils-launcher)$
windowrule = center, class:^(com.ghostty.utils-launcher)$
windowrule = size 80% 80%, class:^(com.ghostty.utils-launcher)$
# Clipboard history tui in floating window.
windowrule = tag +floating-window, class:.*clipse.*

View File

@@ -31,7 +31,6 @@ set -e
set -o nounset
set -o pipefail
LOG_FILE=${LOG_FILE:-""}
LOG_INVOCATION_ID=${LOG_INVOCATION_ID:-""}
LOG_LABEL=${LOG_LABEL:-""}
# Run in dry run mode, which just prints to the console and does

View File

@@ -118,7 +118,8 @@ sel=$(
printf "%s\n" "${rows[@]}" |
fzf --style=full --footer="$(footer)" --with-nth=2 --delimiter='|' \
--preview-label='[ Command ]' \
--preview="$SCRIPTS/hypr/utils/fzf/preview-stats utils {2} $config_file"
--preview="$SCRIPTS/hypr/utils/fzf/preview-stats utils {2} $config_file" \
--preview-window='down,30%'
)
log "Selection: $sel"

View File

@@ -11,6 +11,9 @@ THIS=${THIS:-$LOG_LABEL}
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
FZF_DEFAULT_OPTS=${FZF_DEFAULT_OPTS:-""}
return_name_if_special_flag="0"
return_name_flag="0"
usage() {
cat <<EOF
@@ -59,13 +62,10 @@ prompt_for_selection() {
local rows=()
local fzf_opts=$1
local sel=""
local workspaces=$(hyprctl workspaces -j | jq 'sort_by(.id)')
readarray -t names <<<"$(echo "$workspaces" | jq -r '.[] | .name')"
readarray -t ids <<<"$(echo "$workspaces" | jq -r '.[] | .id')"
for i in "${!names[@]}"; do
rows+=("${ids[i]}|${names[i]}")
for id in $(hyprctl workspaces -j | jq 'sort_by(.id)' | jq 'reverse' | jq -r '.[] | .id'); do
name=$(hyprctl workspaces -j | jq -r ".[] | select(.id == $id) | .name")
rows+=("$id|$name")
done
log "Showing workspace picker / stats..."
@@ -80,6 +80,26 @@ prompt_for_selection() {
echo "$sel"
}
parse_return_val() {
local sel=""
read -r sel
if [[ -z $sel ]]; then
log --error "Selection was empty." && exit 1
fi
local name=${sel##*\|}
local id=${sel%%\|*}
if [[ $return_name_flag == "1" ]] ||
([[ $return_name_if_special_flag == "1" ]] && [[ $name =~ ^special ]]); then
# Return only the name portion of the selection.
echo "$name"
else
# Return only the id portion of the selection.
echo "$id"
fi
}
################################################################################
# MAIN
################################################################################
@@ -88,8 +108,6 @@ prompt_for_selection() {
source "$SCRIPTS/hypr/logging"
setup-logging "$LOG_FILE" "$LOG_LABEL"
return_name_if_special_flag="0"
return_name_flag="0"
uses_supplied_footer="0"
fzf_opts=()
@@ -118,13 +136,4 @@ if [[ $uses_supplied_footer == "0" ]]; then
fzf_opts+=("--footer=$(footer)")
fi
sel=$(prompt_for_selection "${fzf_opts[@]}")
name=${sel##*\|}
id=${sel%%\|*}
if [[ $return_name_flag == "1" ]] ||
([[ $return_name_if_special_flag == "1" ]] && [[ $name =~ ^special ]]); then
echo "$name" && exit 0
fi
echo "$id"
prompt_for_selection "${fzf_opts[@]}" | parse_return_val

View File

@@ -39,15 +39,15 @@ hypr_dispatch() {
################################################################################
# Setup logging file and label.
# source "$SCRIPTS/hypr/logging"
# setup-logging "$LOG_FILE" "$LOG_LABEL"
#
# while [[ $# -gt 0 ]]; do
# if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
# usage && exit 0
# fi
# shift
# done
source "$SCRIPTS/hypr/logging"
setup-logging "$LOG_FILE" "$LOG_LABEL"
while [[ $# -gt 0 ]]; do
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
usage && exit 0
fi
shift
done
# Workspace to hide everything in
HIDE_WS="special:hidden"
@@ -62,14 +62,14 @@ CUR_WS=$(hyprctl -j activeworkspace | jq -r '.id')
if [[ -f "$STATE_FILE" ]]; then
# Restore windows
ORIG_WS=$(cat "$STATE_FILE")
# log "Restoring windows to: '$ORIG_WS'"
log "Restoring windows to: '$ORIG_WS'"
for win in $(hyprctl -j clients | jq -r ".[] | select(.workspace.name | contains(\"$HIDE_WS\")) | .address"); do
hyprctl dispatch movetoworkspace "$ORIG_WS,address:$win"
hyprctl dispatch workspace "$ORIG_WS"
done
rm "$STATE_FILE"
else
# log "Hiding windows from: '$CUR_WS'"
log "Hiding windows from: '$CUR_WS'"
# Hide all windows (move to special hidden workspace)
for win in $(hyprctl -j clients | jq -r ".[] | select(.workspace.id == $CUR_WS) | .address"); do
hyprctl dispatch movetoworkspace "$HIDE_WS,address:$win"

View File

@@ -55,7 +55,6 @@ while [[ $# -gt 0 ]]; do
shift
THIS="$THIS picker" "$SCRIPTS/hypr/utils/workspaces/workspace-picker" "$@"
exit $?
elif [[ $1 == "switch" ]]; then
shift
THIS="$THIS switch" "$SCRIPTS/hypr/utils/workspaces/switch-to-workspace" "$@"