Sway support removed. Moved I38 specific scripts out of the branch covered by dex.

This commit is contained in:
Storm Dragon committed 2026-05-14 21:18:02 -04:00
1 parent 45eb3ae4fc
commit 3a9c2ab6f1
13 files changed
+147 -449

No files matched your search

+10 -38
View File
@@ -10,53 +10,25 @@
# You should have received a copy of the GNU General Public License along with I38. If not, see <https://www.gnu.org/licenses/>.
# Find out if we're using i3 or sway
if ! [[ -n "${WAYLAND_DISPLAY}" ]]; then
cmd="i3-msg"
scratchConfig="${XDG_CONFIG_HOME:-$HOME/.config}/i3"
usingWayland=false
else
cmd="swaymsg"
scratchConfig="${XDG_CONFIG_HOME:-$HOME/.config}/sway"
usingWayland=true
fi
scratchConfig="${XDG_CONFIG_HOME:-$HOME/.config}/i3"
scratchConfig+="/scratchpad"
touch "${scratchConfig}"
# Get the class name of the focused window
if [[ "$usingWayland" == "true" ]]; then
# Wayland/Sway: use swaymsg to get focused window info
class=$($cmd -t get_tree | jq -r '.. | select(.focused? == true) | .app_id // .window_properties.class' | head -n 1)
else
# X11/i3: use xdotool and xprop
if ! command -v xdotool &> /dev/null || ! command -v xprop &> /dev/null; then
notify-send "Error: xdotool and xprop required for i3"
exit 1
fi
windowId=$(xdotool getactivewindow)
class=$(xprop -id "$windowId" WM_CLASS | awk -F '"' '{print $4}')
if ! command -v xdotool &> /dev/null || ! command -v xprop &> /dev/null; then
notify-send "Error: xdotool and xprop required for i3"
exit 1
fi
windowId=$(xdotool getactivewindow)
class=$(xprop -id "$windowId" WM_CLASS | awk -F '"' '{print $4}')
if [[ -z "$class" ]]; then
notify-send "Unable to move to scratchpad."
exit 1
fi
# Check if it's already in the config
if [[ "$usingWayland" == "true" ]]; then
# Sway uses app_id for Wayland-native apps, class for XWayland apps
if ! grep -q "app_id=\"$class\"" "$scratchConfig" && ! grep -q "class=\"$class\"" "$scratchConfig"; then
echo "for_window [app_id=\"$class\"] move to scratchpad" >> "$scratchConfig"
notify-send "Added window app_id $class to scratchpad"
fi
# Move the window to scratchpad now (try both app_id and class)
$cmd "[app_id=\"$class\"] move to scratchpad" 2>/dev/null || $cmd "[class=\"$class\"] move to scratchpad"
else
# i3 uses class
if ! grep -q "class=\"$class\"" "$scratchConfig"; then
echo "for_window [class=\"$class\"] move to scratchpad" >> "$scratchConfig"
notify-send "Added window class $class to scratchpad"
fi
# Move the window to scratchpad now
$cmd "[class=\"$class\"] move to scratchpad"
if ! grep -q "class=\"$class\"" "$scratchConfig"; then
echo "for_window [class=\"$class\"] move to scratchpad" >> "$scratchConfig"
notify-send "Added window class $class to scratchpad"
fi
i3-msg "[class=\"$class\"] move to scratchpad"