You are not logged in.
Pages: 1
the panel (work space switcher plug-in) is able to know what the current workspace number is. is that because it is actually doing the work of keeping track of it when it changes?
what i want to do is have my script find out the current workspace number reliably even if that workspace currently has no windows open, e.g. "wmctrl -l" output, which i have been using to discover the current workspace by assuming the the script is in the current workspace and looking for the pid of xfce4-terminal the script is running under (i find out the term pid by chasing parent process ids back as gotten from "ps -ef").
the assumptions have changed. i now need to run this script away from the current workspace. it needs to know what the current workspace being displayed is, even though it is not running there.
Last edited by Skaperen (2022-11-22 07:25:34)
Offline
the panel (work space switcher plug-in) is able to know what the current workspace number is. is that because it is actually doing the work of keeping track of it when it changes?
It uses/relies on libwnck to give it this information
it needs to know what the current workspace being displayed is, even though it is not running there.
You can get the current workspace with "wmctrl -d" - it will have an "*" in the second column, or:
wmctrl -d | grep \* | awk '{print $1}'
...where workspace numbering starts at 0.
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
@ToZ Thanks!
Offline
in case anyone wants a script to use that command and get the current workspace, such as for other scripts, i wrote a little one in python:
#!/usr/bin/env python3
from subprocess import PIPE,Popen
with Popen(['wmctrl','-d'],stdout=PIPE,universal_newlines=True) as proc:
for o in proc.stdout.read().splitlines():
p = o.split()
if len(p) < 3:continue
w,f = p[:2]
if f == "*":print(w)
name it anything you want. i named mine "currws".
Offline
Pages: 1
[ Generated in 0.010 seconds, 8 queries executed - Memory usage: 528.24 KiB (Peak: 529.52 KiB) ]