You are not logged in.

#1 2019-03-06 12:59:47

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

[SOLVED] Turn off compositor globally with one app?

I've got this game which has lag spikes with compositor on. I tried doing this unknown.png
but I've still got the lag spikes.
The game runs flawlessly with compositor being "globally" turned down.
Is there a way to automatically disable compositor "globally" when a game is launched and to activate it again when it's closed? Or even better, to activate compositor when it's not the main windows and disable it when I'm playing the game?

Last edited by Shinwoir (2019-03-14 15:55:31)

Offline

#2 2019-03-06 19:38:08

SteveK
Member
Registered: 2010-06-11
Posts: 80

Re: [SOLVED] Turn off compositor globally with one app?

Screenshot looks like kwin.  Assuming that's your compositor, you can sandwich the command to run your game between two qdbus commands:

qdbus org.kde.KWin /Compositor suspend

and

qdbus org.kde.KWin /Compositor resume

I use this on the exec line of a *.desktop file.

Offline

#3 2019-03-06 19:44:24

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] Turn off compositor globally with one app?

Several WM / DE disable compositing for fullscreen applications, others have a setting to achieve the same.

What WM / DE are you using ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2019-03-06 19:47:47

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

SteveK wrote:

Screenshot looks like kwin.  Assuming that's your compositor, you can sandwich the command to run your game between two qdbus commands:

qdbus org.kde.KWin /Compositor suspend

and

qdbus org.kde.KWin /Compositor resume

I use this on the exec line of a *.desktop file.

How does it know to do this only while the game is open?

Lone_Wolf wrote:

Several WM / DE disable compositing for fullscreen applications, others have a setting to achieve the same.

What WM / DE are you using ?

KDE Plasma w/ KWIN
And this game seems to be the only one which isn't affected by this, its fullscreen mode is weird

Offline

#5 2019-03-06 20:01:59

SteveK
Member
Registered: 2010-06-11
Posts: 80

Re: [SOLVED] Turn off compositor globally with one app?

How does it know to do this only while the game is open?

You can change the Exec line in the *.desktop file to launch your game like this:

qdbus org.kde.KWin /Compositor suspend;CommandToRunYourGame;qdbus org.kde.KWin /Compositor resume

When you launch the game from this *.desktop, the compositor switches off, the game runs and after you quit the game, the compositor switches on again.

Last edited by SteveK (2019-03-06 20:02:52)

Offline

#6 2019-03-07 11:15:13

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

SteveK wrote:

How does it know to do this only while the game is open?

You can change the Exec line in the *.desktop file to launch your game like this:

qdbus org.kde.KWin /Compositor suspend;CommandToRunYourGame;qdbus org.kde.KWin /Compositor resume

When you launch the game from this *.desktop, the compositor switches off, the game runs and after you quit the game, the compositor switches on again.

That sounds cool, but I've got a problem with my desktop file. It doesn't launch anything when running from the start menu, though when double clicking the desktop file directly it works.

Offline

#7 2019-03-07 19:56:07

SteveK
Member
Registered: 2010-06-11
Posts: 80

Re: [SOLVED] Turn off compositor globally with one app?

Well that's strange.  Check the command in the start menu by running kmenuedit.

Offline

#8 2019-03-08 11:29:09

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

SteveK wrote:

Well that's strange.  Check the command in the start menu by running kmenuedit.

I checked it and it seems alright. It works under XFCE though

Offline

#9 2019-03-08 12:05:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: [SOLVED] Turn off compositor globally with one app?

Run

journalctl -f

in a terminal, do you see any messages when you click on your launcher? FWIW you might also want to post

loginctl session-status

Offline

#10 2019-03-08 15:30:49

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

https://pastebin.com/pHktRtEr this is what happens with journalctl -f

Here's for the session status https://pastebin.com/aK1dKYLQ

Offline

#11 2019-03-09 20:41:26

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: [SOLVED] Turn off compositor globally with one app?

Looks alright, can you post your desktop file? FWIW depending on how you added it to the menu you could try and run

kbuildsycoca5 --noincremental

to rebuild KDEs desktop file index.

FWIW custom desktop files work just fine here.

Offline

#12 2019-03-10 14:29:46

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

V1del wrote:

Looks alright, can you post your desktop file? FWIW depending on how you added it to the menu you could try and run

kbuildsycoca5 --noincremental

to rebuild KDEs desktop file index.

FWIW custom desktop files work just fine here.

Here's the desktop file https://a.uguu.se/FC1nMlkhz1pM_osu-wine.desktop

Here are its contents https://pastebin.com/WTYMdDQZ

Edit: I tried the command but nothing happened

Last edited by Shinwoir (2019-03-10 14:40:54)

Offline

#13 2019-03-12 17:23:26

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

Up?

Offline

#14 2019-03-12 18:32:54

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: [SOLVED] Turn off compositor globally with one app?

Don't do that.

Doesn't look inherently wrong. What happens if you remove the Wine category? That one is a bit special, and might cause issues.

Can you create your desktop file directly in KMenuEdit, and does that one work properly?

FWIW after a launch attempt, can you post a complete

journalctl -b

there might be something off happening earlier that didn't get caught in the -f output.

Last edited by V1del (2019-03-12 18:34:44)

Offline

#15 2019-03-14 15:33:34

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

Here's the journalctl https://pastebin.com/7ApgdB4R

And I tried creating one with kmenuedit, didn't work, when I checked run in terminal, I got this

Warning: Could not start program '/home/shinwoir/.local/bin/osu' with arguments '/home/shinwoir/.local/bin/osu'.



Warning: execve: Erreur de format pour exec()

Also I have no idea why french seems to be my locale, the top language on the list is English

Edit: here's the script triggered by "osu" just in case 

/bin/sh
export WINEPREFIX="$HOME/.wine_osu"
export STAGING_AUDIO_DURATION=25000

# Arch Linux/wine-osu users should uncomment next line
# for the patch to be effective
export PATH=/opt/wine-osu/bin:$PATH

cd /home/shinwoir/Games/osu!/ # Or wherever you installed osu! in
wine osu!.

Last edited by Shinwoir (2019-03-14 15:36:39)

Offline

#16 2019-03-14 15:40:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: [SOLVED] Turn off compositor globally with one app?

Remove the %U from your desktop file. Also that file is executable?

Edit And you need a shebang #! in front of the /bin/sh

Last edited by V1del (2019-03-14 15:41:25)

Offline

#17 2019-03-14 15:49:27

Shinwoir
Member
Registered: 2018-01-20
Posts: 40

Re: [SOLVED] Turn off compositor globally with one app?

V1del wrote:

Remove the %U from your desktop file. Also that file is executable?

Edit And you need a shebang #! in front of the /bin/sh

The %U is used by most people playing this game.
The file is executable, since just typing osu or double clicking the desktop file from the explorer works.
I'll try putting a # before the /bin/sh

Edit: seems like the !bin/sh was the problem, I'll try the compositor thing now

Edit 2: The command line for the compositor worked, thanks to everyone who helped me!

Last edited by Shinwoir (2019-03-14 15:54:24)

Offline

#18 2019-03-14 16:01:07

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: [SOLVED] Turn off compositor globally with one app?

Glad to hear, fwiw regarding the %U you shouldn't just do things because others are doing it but understand what and why you are doing it %U expands a list of files (if your desktop file is used with open with from a file manager for example) even if osu would do something with a list of files, your script currently doesn't do anything with the passed in argument, so if it isn't needed you should remove it.

Offline

Board footer

Powered by FluxBB