You are not logged in.

#1 2021-12-17 16:49:56

pepper
Member
Registered: 2017-12-09
Posts: 135

[SOLVED] Mousepad open in different desktop XFCE

Hello, I've xfce installed, if I have a mousepad instance opened in desktop workspace X, and I open a text file (with double click) in workspace Y, the file is opened in a second tab of the previous opened mousepad, and mousepad itself is moved in the current workspace. I want to open a new instance of mousepad automatically if I'm in a workspace where there isn't a mousepad instance, and I don't want that mousepad get moved automatically across workspaces. Is therea a way to do it?

Last edited by pepper (2021-12-20 12:38:16)

Offline

#2 2021-12-17 19:33:46

toz
Member
Registered: 2011-10-28
Posts: 513

Re: [SOLVED] Mousepad open in different desktop XFCE

Here is an option. You can use this script to determine whether a mousepad instance is running on a given workspace and if so, open the file in the running instance. Otherwise open the file in a new instance.

#!/bin/bash
# requires wmctrl
# set as /usr/local/bin/mousepad and make executable or as thunar custom action

CDESK=$(wmctrl -d | grep \* | awk '{print $1}')

[[ $(wmctrl -l | grep " $CDESK " | grep Mousepad$) ]] && /usr/bin/mousepad "$@" || /usr/bin/mousepad -o window "$@"

You can put this script in /usr/local/bin and name it "mousepad" so it overrides the existing executable in /usr/bin (assuming that /usr/local/bin is first in your PATH), or you can use it to create a thunar custom action.

This solution might not address all edge cases, but it works with the limited testing here.

Note: You can also prevent applications from jumping workspaces via Settings Manager > Window Manager Tweaks > Focus tab, and setting "When a window raises itself" to None.

Offline

Board footer

Powered by FluxBB