Skip to content

Commit

Permalink
fixes to support wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
lunarcloud committed Jun 9, 2024
1 parent 6f3501f commit b8313a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions script-dialog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ hasWhiptail=false

if [ -z ${GUI+x} ]; then
GUI=false
if [ ! -e xdpyinfo ] || xdpyinfo | grep X.Org > /dev/null; then
if [ "$terminal" == "false" ] ; then
GUI=true
fi
if [ "$terminal" == "false" ] ; then
GUI=$([ "$DISPLAY" ] || [ "$WAYLAND_DISPLAY" ] || [ "$MIR_SOCKET" ] && echo true || echo false)
fi
fi

Expand Down Expand Up @@ -157,17 +155,14 @@ function updateDialogMaxSize() {
return;
fi

if [ "$GUI" == "true" ] ; then
MAX_HEIGHT=$( xdpyinfo | grep "dimensions" | awk '{ print $2 }' | cut -d'x' -f2)
MAX_WIDTH=$( xdpyinfo | grep "dimensions" | awk '{ print $2 }' | cut -d'x' -f1)
else
if [ "$GUI" == "false" ] ; then
MAX_HEIGHT=$(tput lines)
MAX_WIDTH=$(tput cols)
fi

# Never really fill the whole screen space
MAX_HEIGHT=$(( MAX_HEIGHT / 2 ))
MAX_WIDTH=$(( MAX_WIDTH * 3 / 4 ))
MAX_HEIGHT=$(( MAX_HEIGHT * 3 / 4 ))
MAX_WIDTH=$(( MAX_WIDTH * 6 / 9 ))
}

RECMD_HEIGHT=10
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ relaunchIfNotVisible

APP_NAME="Test Script"
#WINDOW_ICON="$SCRIPT_DIR/icon.png" # if not set, it'll use standard ones
#INTERFACE="zenity" #force an interface, but only do this for testing
INTERFACE="zenity" #force an interface, but only do this for testing

if [ "$NO_SUDO" == true ]; then
messagebox "No SUDO is available on this system."
Expand Down

0 comments on commit b8313a6

Please sign in to comment.