Skip to content

Instantly share code, notes, and snippets.

@axzxc1236
Last active February 28, 2024 09:41
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axzxc1236/1d1b737a8b2d5c2a3e2026e4cf9d332a to your computer and use it in GitHub Desktop.
Save axzxc1236/1d1b737a8b2d5c2a3e2026e4cf9d332a to your computer and use it in GitHub Desktop.
My mitigation to Wine bug 43030
#How to setup:
#1. Have systemd and xdotool installed
#2. store the script (Line_helper.sh) as $HOME/.local/script/Line_helper.sh
#3. store this service file as $HOME/.config/systemd/user/line-helper.service
#4. chmod +x $HOME/.local/script/Line_helper.sh
#5. start line-helper.service before you start line
[Unit]
Description=Automatically minimize Line
After=graphical.target
[Service]
ExecStart=%h/.local/script/Line_helper.sh
Restart=always
RestartSec=30
[Install]
WantedBy=default.target
#! /bin/sh
if [[ $(which xdotool) = "" ]]; then
echo "xdotool is required to run this script."
exit
fi
if [[ $(which xwininfo) = "" ]]; then
echo "xwininfo is required to run this script."
exit
fi
while true
do
xwininfo -tree -root |
grep 'has no name.*"line.*\.exe"' |
awk '{ print $1 }' |
xargs -rl xdotool windowclose
sleep 10
done
@axzxc1236
Copy link
Author

axzxc1236 commented Jan 24, 2021

What does the script do?
In order to mitigate https://bugs.winehq.org/show_bug.cgi?id=43030 I decided to create a script that minimizes Line windows when it loses focus.

con:

  1. Another program needs to run in the background
  2. Maximal delay of (1+execution overhead) seconds before window gets minimized.
    (timer can be adjusted to something like 0.5 to reduce delay)
  3. User needs to create some sort of cron job that runs at startup
  4. Sometimes Line window gets minimized as soon as it shows up... I believe that the chance of this happening multiple times in a row is very small.

@axzxc1236
Copy link
Author

When I was writing this script, I experimented with approach of

xdotool search --sync ...... behave %@ blur windowminimize

It only works well if (1) You run that script when main line window is open and (2) You don't close Line window, like minimize it to icon
As that approach don't register new line windows.

@axzxc1236
Copy link
Author

axzxc1236 commented Jan 26, 2021

A example on how to start systemd service with Line. (I use Lutris to setup Line)

screenshot

@agguser
Copy link

agguser commented Feb 17, 2024

I use this script to kill LINE's borders:

xwininfo -tree -root |
   grep 'has no name.*"line.*\.exe"' |
   awk '{ print $1 }' |
   xargs -rl xdotool windowclose

@axzxc1236
Copy link
Author

That works very well without the need to minimize Line, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment