From 7db42d741576d694ef3d4934ebe9a78277de67b1 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 25 Jan 2024 19:51:27 +0700 Subject: [PATCH] more sway compatibility --- .config/ags/scripts/color_generation/switchwall.sh | 4 ++-- .config/ags/scripts/sway/swayToRelativeWs.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.config/ags/scripts/color_generation/switchwall.sh b/.config/ags/scripts/color_generation/switchwall.sh index 254ddce8..64bb4a03 100755 --- a/.config/ags/scripts/color_generation/switchwall.sh +++ b/.config/ags/scripts/color_generation/switchwall.sh @@ -8,8 +8,8 @@ else cd "$HOME/Pictures" imgpath=$(yad --width 1200 --height 800 --file --title='Choose wallpaper') screensizey=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2 | head -1) - cursorposx=$(hyprctl cursorpos -j | gojq '.x') - cursorposy=$(hyprctl cursorpos -j | gojq '.y') + cursorposx=$(hyprctl cursorpos -j | gojq '.x' 2>/dev/null) || cursorposx=960 + cursorposy=$(hyprctl cursorpos -j | gojq '.y' 2>/dev/null) || cursorposy=540 cursorposy_inverted=$(( screensizey - cursorposy )) if [ "$imgpath" == '' ]; then diff --git a/.config/ags/scripts/sway/swayToRelativeWs.sh b/.config/ags/scripts/sway/swayToRelativeWs.sh index d4800190..557b385e 100755 --- a/.config/ags/scripts/sway/swayToRelativeWs.sh +++ b/.config/ags/scripts/sway/swayToRelativeWs.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # Get the current workspace number current=$(swaymsg -t get_workspaces | gojq '.[] | select(.focused==true) | .num') @@ -16,4 +16,8 @@ if [[ $new_workspace -lt 1 ]]; then fi # Switch to the new workspace -swaymsg workspace $new_workspace \ No newline at end of file +if [[ $2 == 'move' ]]; then + swaymsg move container to workspace $new_workspace +else + swaymsg workspace $new_workspace +fi \ No newline at end of file