commit 5632b0ef09917e2fe725a94df31f8af53b38e9a1
parent 018aa0117c99e9b07244c0a96ff126fcafb7f296
Author: Naveen Narayanan <zerous@nocebo.space>
Date: Wed, 10 Jul 2024 04:14:49 +0200
Implement get_param
Diffstat:
M | xfce4wm | | | 70 | +++++++++++++++++++++++++--------------------------------------------- |
1 file changed, 25 insertions(+), 45 deletions(-)
diff --git a/xfce4wm b/xfce4wm
@@ -1,5 +1,10 @@
#!/bin/bash
+x=0
+y=0
+w=0
+h=0
+
function get_workspace {
if [[ "$DTOP" == "" ]] ; then
DTOP=`xdotool get_desktop`
@@ -24,6 +29,14 @@ function get_desktop_dim {
fi
}
+function get_param {
+ eval $(xwininfo -id $(xdotool getactivewindow) |
+ sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
+ -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
+ -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
+ -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+}
+
function win_showdesktop {
get_workspace
get_visible_window_ids
@@ -40,52 +53,31 @@ function win_showdesktop {
}
function win_growvert {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+ get_param
#echo -n "$x $y $w $h"
xdotool getactivewindow windowsize $w $((h+100))
}
function win_shrinkvert {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+ get_param
#echo -n "$x $y $w $h"
xdotool getactivewindow windowsize $w $((h-100))
}
-
function win_shrinkhoriz {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+ get_param
#echo -n "$x $y $w $h"
xdotool getactivewindow windowsize $((w-100)) $h
}
function win_growhoriz {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+ get_param
#echo -n "$x $y $w $h"
xdotool getactivewindow windowsize $((w+100)) $h
}
function win_moveright {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
+ get_param
#echo -n "$x $y $w $h"
k=$((x-1))
z=$((y-22))
@@ -93,36 +85,24 @@ function win_moveright {
}
function win_moveleft {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
- echo -n "$x $y $w $h"
+ get_param
+ #echo -n "$x $y $w $h"
k=$((x-1))
z=$((y-22))
xdotool getactivewindow windowmove --sync $((k-25)) $z
}
function win_moveup {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
- echo -n "$x $y $w $h"
+ get_param
+ #echo -n "$x $y $w $h"
k=$((x-1))
z=$((y-22))
xdotool getactivewindow windowmove --sync $k $((z-25))
}
function win_movedown {
- eval $(xwininfo -id $(xdotool getactivewindow) |
- sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
- -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
- -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
- -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
- echo -n "$x $y $w $h"
+ get_param
+ #echo -n "$x $y $w $h"
k=$((x-1))
z=$((y-22))
xdotool getactivewindow windowmove --sync $k $((z+25))
@@ -144,7 +124,6 @@ for command in ${@} ; do
elif [[ "$command" == 'shrinkvertical' ]]
then
win_shrinkvert
- fi
elif [[ "$command" == 'moveright' ]]
then
win_moveright
@@ -157,4 +136,5 @@ for command in ${@} ; do
elif [[ "$command" == 'movedown' ]]
then
win_movedown
+ fi
done