diff --git a/env/.config/hypr/keybinds.conf b/env/.config/hypr/keybinds.conf index f748e38..b466e7e 100644 --- a/env/.config/hypr/keybinds.conf +++ b/env/.config/hypr/keybinds.conf @@ -19,6 +19,7 @@ $pwa = $scripts/launch-webapp $tmuxSessionator = ~/.local/scripts/tmux-sessionator $clipboardHistory = com.ghostty.clipse $terminal --class=com.ghostty.clipse -e clipse $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 # 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, Y, [Y]ouTube, exec, $pwa --or-focus "https://youtube.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, W, Close current window, killactive, bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/close-windows --active-workspace diff --git a/env/.config/utils-launcher/config.json b/env/.config/utils-launcher/config.json index b460ce9..757143f 100644 --- a/env/.config/utils-launcher/config.json +++ b/env/.config/utils-launcher/config.json @@ -22,5 +22,13 @@ { "name": "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" } ] diff --git a/env/.local/scripts/hypr/toggle-waybar b/env/.local/scripts/hypr/toggle-waybar index d2a8cda..c53580d 100755 --- a/env/.local/scripts/hypr/toggle-waybar +++ b/env/.local/scripts/hypr/toggle-waybar @@ -7,5 +7,5 @@ if [ -n "$WAYBAR_PID" ]; then kill "$WAYBAR_PID" else # start waybar in the background. - waybar & + setsid uwsm app -- waybar >/dev/null 2>&1 & fi diff --git a/env/.local/scripts/hypr/window-table b/env/.local/scripts/hypr/window-table index 22c8f8d..24c27b9 100755 --- a/env/.local/scripts/hypr/window-table +++ b/env/.local/scripts/hypr/window-table @@ -44,6 +44,8 @@ rows=() selected_value="" window_data=$(hyprctl clients -j | jq 'sort_by(.workspace.name)') +SCRIPTS=${SCRIPTS} + while [[ $# -gt 0 ]]; do if [[ $launch_flag == "1" ]]; then launch_args+=("$1") @@ -77,43 +79,42 @@ generate_rows() { # Zip into a new comma separated values for i in "${!addresses[@]}"; do 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 - rows+=("${workspaces[i]}, ${titles[i]}, ${addresses[i]}") + rows+=("${workspaces[i]} | ${titles[i]} | ${addresses[i]}") fi done } show_table_return_choice() { - local columns="Workspace, Title, Address" - local ret_column=3 + local columns="Workspace | Title | Address" if [[ $show_window_class_flag == "1" ]]; then - columns="Workspace, Title, Class, Address" - ret_column=4 + columns="Workspace | Title | Class | Address" fi local ret=$( printf '%s\n' "${rows[@]}" | - fzf --footer="Workspace - Title - Address" --footer-label-pos=center - # gum table --columns "$columns" --return-column $ret_column + fzf --footer="$columns" ) # remove spaces and quotes from result. ret=${ret//\"/} ret=${ret// /} + # revove everything but the address portion. + ret=${ret##*|} echo "$ret" } 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" if [[ $choice == "Quit" ]]; then exit 0 - elif [[ $choice == "Close window" ]]; then + elif [[ $choice == "Close Window" ]]; then close_flag="1" - elif [[ $choice == "Copy to clipboard" ]]; then + elif [[ $choice == "Copy to Clipboard" ]]; then clipboard_flag="1" - elif [[ $choice == "Focus window" ]]; then + elif [[ $choice == "Focus Window" ]]; then focus_flag="1" elif [[ $choice == "Refresh" ]]; then eval exec ${BASH_SOURCE[0]} @@ -151,6 +152,12 @@ if [[ $launch_flag == "1" ]]; then --keybind="q=quit" \ -e "${BASH_SOURCE[0]}" "${launch_args[@]}" else + + # Load colors if they haven't been loaded already. + [[ -z ${FZF_DEFAULT_OPTS} ]] && + [[ -f $SCRIPTS/catppuccin-colors ]] && + source $SCRIPTS/catppuccin-colors + generate_rows selected_value=$(show_table_return_choice) if [[ -n $selected_value ]]; then @@ -162,5 +169,6 @@ else [[ -n $selected_value ]] && handle_selected_value # If you make it here, We just give up... Don't start an endless loop. + echo "Giving up without a selection." fi fi