feat: Adds more items to utility launcher, fixes bug in toggle waybar, and fix window-table to use fzf

This commit is contained in:
2025-10-04 18:02:12 -04:00
parent c38348e62c
commit 33e6683369
4 changed files with 31 additions and 14 deletions

View File

@@ -19,6 +19,7 @@ $pwa = $scripts/launch-webapp
$tmuxSessionator = ~/.local/scripts/tmux-sessionator $tmuxSessionator = ~/.local/scripts/tmux-sessionator
$clipboardHistory = com.ghostty.clipse $terminal --class=com.ghostty.clipse -e clipse $clipboardHistory = com.ghostty.clipse $terminal --class=com.ghostty.clipse -e clipse
$uninstallDesktop = $terminal --class=com.ghostty.float -e $scripts/uninstall-desktop-app $uninstallDesktop = $terminal --class=com.ghostty.float -e $scripts/uninstall-desktop-app
$utilsLauncher = com.ghostty.utils-launcher $scripts/utils-launcher --launch
$housecallPro = https://pro.housecallpro.com/app/calendar_new $housecallPro = https://pro.housecallpro.com/app/calendar_new
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
@@ -63,7 +64,7 @@ bindd = $mainMod SHIFT, R, [R]estart menu bar, exec,
bindd = $mainMod, S, Toggle [s]pecial workspace, togglespecialworkspace, magic # use $windowMod S to send window to the special workspace bindd = $mainMod, S, Toggle [s]pecial workspace, togglespecialworkspace, magic # use $windowMod S to send window to the special workspace
bindd = $mainMod, Y, [Y]ouTube, exec, $pwa --or-focus "https://youtube.com" bindd = $mainMod, Y, [Y]ouTube, exec, $pwa --or-focus "https://youtube.com"
bindd = $mainMod, U, [U]nifi, exec, $pwa "https://unifi.ui.com" bindd = $mainMod, U, [U]nifi, exec, $pwa "https://unifi.ui.com"
bindd = $mainMod SHIFT, U, [U]ninstall desktop app, exec, $uninstallDesktop bindd = $mainMod SHIFT, U, [U]tility launcher, exec, $scripts/launch --or-close $utilsLauncher
bindd = $mainMod, V, Clipboard history, exec, $scripts/launch --or-close $clipboardHistory bindd = $mainMod, V, Clipboard history, exec, $scripts/launch --or-close $clipboardHistory
bindd = $mainMod, W, Close current window, killactive, bindd = $mainMod, W, Close current window, killactive,
bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/close-windows --active-workspace bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/close-windows --active-workspace

View File

@@ -22,5 +22,13 @@
{ {
"name": "Toggle waybar", "name": "Toggle waybar",
"exec": "$SCRIPTS/hypr/toggle-waybar" "exec": "$SCRIPTS/hypr/toggle-waybar"
},
{
"name": "Close Windows - Active Workspace",
"exec": "$SCRIPTS/hypr/close-windows --active-workspace"
},
{
"name": "Close Windows - ALL",
"exec": "$SCRIPTS/hypr/close-windows --all"
} }
] ]

View File

@@ -7,5 +7,5 @@ if [ -n "$WAYBAR_PID" ]; then
kill "$WAYBAR_PID" kill "$WAYBAR_PID"
else else
# start waybar in the background. # start waybar in the background.
waybar & setsid uwsm app -- waybar >/dev/null 2>&1 &
fi fi

View File

@@ -44,6 +44,8 @@ rows=()
selected_value="" selected_value=""
window_data=$(hyprctl clients -j | jq 'sort_by(.workspace.name)') window_data=$(hyprctl clients -j | jq 'sort_by(.workspace.name)')
SCRIPTS=${SCRIPTS}
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
if [[ $launch_flag == "1" ]]; then if [[ $launch_flag == "1" ]]; then
launch_args+=("$1") launch_args+=("$1")
@@ -77,43 +79,42 @@ generate_rows() {
# Zip into a new comma separated values # Zip into a new comma separated values
for i in "${!addresses[@]}"; do for i in "${!addresses[@]}"; do
if [[ $show_window_class_flag == "1" ]]; then if [[ $show_window_class_flag == "1" ]]; then
rows+=("${workspaces[i]}, ${titles[i]}, ${classes[i]}, ${addresses[i]}") rows+=("${workspaces[i]} | ${titles[i]} | ${classes[i]} | ${addresses[i]}")
else else
rows+=("${workspaces[i]}, ${titles[i]}, ${addresses[i]}") rows+=("${workspaces[i]} | ${titles[i]} | ${addresses[i]}")
fi fi
done done
} }
show_table_return_choice() { show_table_return_choice() {
local columns="Workspace, Title, Address" local columns="Workspace | Title | Address"
local ret_column=3
if [[ $show_window_class_flag == "1" ]]; then if [[ $show_window_class_flag == "1" ]]; then
columns="Workspace, Title, Class, Address" columns="Workspace | Title | Class | Address"
ret_column=4
fi fi
local ret=$( local ret=$(
printf '%s\n' "${rows[@]}" | printf '%s\n' "${rows[@]}" |
fzf --footer="Workspace - Title - Address" --footer-label-pos=center fzf --footer="$columns"
# gum table --columns "$columns" --return-column $ret_column
) )
# remove spaces and quotes from result. # remove spaces and quotes from result.
ret=${ret//\"/} ret=${ret//\"/}
ret=${ret// /} ret=${ret// /}
# revove everything but the address portion.
ret=${ret##*|}
echo "$ret" echo "$ret"
} }
ask_what_to_do_with_selection() { ask_what_to_do_with_selection() {
choice=$(gum choose "Focus window" "Copy to clipboard" "Refresh" "Close window" "Quit") choice=$(printf "Focus Window\nCopy to Clipboard\nRefresh Window List\nClose Window\nQuit" | fzf)
echo "Choice: $choice" echo "Choice: $choice"
if [[ $choice == "Quit" ]]; then if [[ $choice == "Quit" ]]; then
exit 0 exit 0
elif [[ $choice == "Close window" ]]; then elif [[ $choice == "Close Window" ]]; then
close_flag="1" close_flag="1"
elif [[ $choice == "Copy to clipboard" ]]; then elif [[ $choice == "Copy to Clipboard" ]]; then
clipboard_flag="1" clipboard_flag="1"
elif [[ $choice == "Focus window" ]]; then elif [[ $choice == "Focus Window" ]]; then
focus_flag="1" focus_flag="1"
elif [[ $choice == "Refresh" ]]; then elif [[ $choice == "Refresh" ]]; then
eval exec ${BASH_SOURCE[0]} eval exec ${BASH_SOURCE[0]}
@@ -151,6 +152,12 @@ if [[ $launch_flag == "1" ]]; then
--keybind="q=quit" \ --keybind="q=quit" \
-e "${BASH_SOURCE[0]}" "${launch_args[@]}" -e "${BASH_SOURCE[0]}" "${launch_args[@]}"
else else
# Load colors if they haven't been loaded already.
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
[[ -f $SCRIPTS/catppuccin-colors ]] &&
source $SCRIPTS/catppuccin-colors
generate_rows generate_rows
selected_value=$(show_table_return_choice) selected_value=$(show_table_return_choice)
if [[ -n $selected_value ]]; then if [[ -n $selected_value ]]; then
@@ -162,5 +169,6 @@ else
[[ -n $selected_value ]] && handle_selected_value [[ -n $selected_value ]] && handle_selected_value
# If you make it here, We just give up... Don't start an endless loop. # If you make it here, We just give up... Don't start an endless loop.
echo "Giving up without a selection."
fi fi
fi fi