Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-12-01 07:12:32

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

which workspace

you have and can use multiple workspaces.  you are asked to write a function in some programing language that returns the workspace number.  should this be the workspace the caller is running in or the workspace that is actively displaying?

Last edited by Skaperen (2022-12-01 07:13:05)

Offline

#2 2022-12-01 11:45:42

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: which workspace

Depends on the function (programming language) or tool you are using to display the information. For example, both "wmctrl -d" and "xdotool get_desktop" return the currently displayed.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-12-02 00:10:43

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: which workspace

the problem i think i have been running into was a tool giving me the currently displayed number for some scripts that needed the workspace number it was running in to decide which application to run while another concurrently running script was changing the current workspace.

one script changed workspaces (usually in incremental sequence but not always) to run terminal in many.  shell initialization was deciding what command line program to run based on what it got as the workspace number, which was the number being currently displayed, not the workspace that process was in.  there two of these running in parallel in some cases.

you can imagine the mess and how difficult to debug until i realized the workspace selection issue.  so, now i am working on some tools to deal with this better.

1. currws will output the currently displayed workspace based on "wmctrl -d" output.

2. procws will output to workspace this process is "in".  this is determined by stepping through the parent processes until one is in the list from "wmctrl -lp".  if the process is a command or script in a shell session, that process it finds in the list will be the terminal emulator being run to start that session.  if it reaches the end of parents (at the system init prcess (PID 1) it figures this process is not in any workspace and just returns -1.

an alternative is a "ws -c" for "currws and "ws -p" for "procws".

Offline

#4 2022-12-02 18:42:08

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: which workspace

i have decided to change the names:

1.  currws is now aliased as ws and has added the ability to change the currently displayed workspace by giving its number as an argument.

2.  procws is now thisws.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 528.76 KiB (Peak: 530.04 KiB) ]