mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Moves utils-launcher preview to be at bottom and updates window rules for utils-launcher
This commit is contained in:
1
env/.local/scripts/hypr/logging
vendored
1
env/.local/scripts/hypr/logging
vendored
@@ -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
|
||||
|
||||
3
env/.local/scripts/hypr/utils-launcher
vendored
3
env/.local/scripts/hypr/utils-launcher
vendored
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
1
env/.local/scripts/hypr/workspacectl
vendored
1
env/.local/scripts/hypr/workspacectl
vendored
@@ -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" "$@"
|
||||
|
||||
Reference in New Issue
Block a user