mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
feat: Updates windowctl subcommands, fixes some logging bugs. Need to remove old files and update keybinds to use windowctl subcommands.
This commit is contained in:
@@ -7,6 +7,7 @@ set -o pipefail
|
||||
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||
THIS_FILE=${BASH_SOURCE[0]}
|
||||
LOG_LABEL=$(basename "$THIS_FILE")
|
||||
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||
THIS=${THIS:-$LOG_LABEL}
|
||||
|
||||
address=""
|
||||
@@ -17,7 +18,7 @@ if [[ $# == 1 ]]; then
|
||||
else
|
||||
# If an address not supplied then read from stdin, which allows us to pipe the address into
|
||||
# this command.
|
||||
read -r address
|
||||
read -p "Window address: " address
|
||||
fi
|
||||
|
||||
# Logging utility function, use in place of echo.
|
||||
@@ -41,21 +42,6 @@ hypr_dispatch() {
|
||||
return $?
|
||||
}
|
||||
|
||||
focus_window() {
|
||||
log "Focusing window, selection: $address"
|
||||
|
||||
local name=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$address\") | .workspace.name")
|
||||
local active_workspace=$(hyprctl activewindow -j | jq -r ".workspace.name")
|
||||
|
||||
log "Window workspace: '$name', active workspace: '$active_workspace'"
|
||||
if [[ $name =~ ^special ]] && [[ ! $active_workspace == $name ]]; then
|
||||
log "Toggling special workspace prior to focusing window."
|
||||
name="${name#special:*}"
|
||||
hypr_dispatch togglespecialworkspace $name
|
||||
fi
|
||||
hypr_dispatch focuswindow "address:$address"
|
||||
}
|
||||
|
||||
parse_workspace_id() {
|
||||
local workspace_name=""
|
||||
read -r workspace_name
|
||||
@@ -141,7 +127,7 @@ handle_selection() {
|
||||
log "Copied window address to the clipboard."
|
||||
echo $address | wl-copy
|
||||
elif [[ $choice == "Focus window" ]]; then
|
||||
focus_window
|
||||
"$SCRIPTS/hypr/utils/windows/focus-window" $address
|
||||
elif [[ $choice == "Move to workspace" ]]; then
|
||||
move_to_workspace
|
||||
elif [[ $choice == "Move to workspace - silent" ]]; then
|
||||
@@ -162,7 +148,7 @@ handle_selection() {
|
||||
|
||||
# Setup logging file and label.
|
||||
source "$SCRIPTS/hypr/logging"
|
||||
setup-logging "$LOG_LABEL"
|
||||
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||
|
||||
if [[ -z $address ]]; then
|
||||
log --error "Address not set."
|
||||
|
||||
Reference in New Issue
Block a user