From dd9c018f99996d3313a62fbfd0d418a8fcb607d2 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Tue, 7 Oct 2025 15:50:57 -0400 Subject: [PATCH] fix: Fixes logging errors in switch-to-workspace --- env/.local/scripts/hypr/switch-to-workspace | 6 ++- .../hypr/utils/windows/window-toggle-floating | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/env/.local/scripts/hypr/switch-to-workspace b/env/.local/scripts/hypr/switch-to-workspace index b501f9a..d871b34 100755 --- a/env/.local/scripts/hypr/switch-to-workspace +++ b/env/.local/scripts/hypr/switch-to-workspace @@ -1,7 +1,9 @@ #!/usr/bin/env bash THIS_FILE=${BASH_SOURCE[0]} -THIS=$(basename "$THIS_FILE") +LOG_LABEL=$(basename $THIS_FILE) +LOG_FILE=${LOG_FILE:-/tmp/$LOG_LABEL.log} +THIS=${THIS:-$LOG_LABEL} usage() { cat <
+ +FLAGS: + -a | --active: Toggle floating on the currently active window. + -w | --width : Set a width of the floating window. + -h | --height : Set a height of the floating window. + --help: Show this help page. + +EOF + +} + +# Suppress output of hyprctl +hypr_dispatch() { + hyprctl dispatch "$@" >/dev/null 2>&1 && return $? +} + +toggle_floating() { + local address="$1" + hypr_dispatch togglefloating + echo "$address" +} + +center_window() { + local address="" + read -r address + hypr_dispatch centerwindow + echo "$address" +} + # Float's a window, setting it's height and width and centering. # The percentage of the screen size for the floating window.