You are not logged in.

#1 2020-05-22 18:39:26

mrsieb
Member
Registered: 2020-05-22
Posts: 2

Customize - Workspace Switcher

Hello to everybody,

After i couple of times installing and reinstalling ARCH (up to know just on VirtualBox)
to get use to it. I want to deep in more and i am going to try to set up my own Desktop.

But for now on i still going on with a default one like Gnome -> Budgie. And want to start with a small modification.
Since i found out how useful Work spaces are ( at least if you just have one 14" Notebook screen and no external Monitors)

First for my understanding the Virtual Workspace is provided
by the Desktop (Budgie) or the Window manager (metacity - Gnome)?

I can switch the Workspace with the know HotKeys CTRL+ALT [left][right] and so on
I see the indication of the actual Workspace on the applet which i added to the panel.
There i have also the possibility to rename it.

I wounder if and how I can add or modify the Indication like this, when i switch the Workspace
the Name of it should be shown as an overlay for 2-3 seconds (fade in and out on  certain location)
Can this be done in a easy way or does this need a complete rewrite of the applet?

The purpose should be to identify the Workspace better if all panels are in autohide mode and the switcher applet is not shown,
i know its more an eyecandy feature... many thx for any hints....

BR

Offline

#2 2020-05-22 18:45:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: Customize - Workspace Switcher

Worspaces are (generally) provided by window managers.  This would be an easy feature to implement within a WM, but I don't if metacity currently has such an option.  Openbox does have this as an option.

Alternatively, if you want to write your own tool, you could listen for the property changes on the root window for changes ing _NET_CURRENT_DESKTOP then display the overlay.

Or another much easier approach would be if you could bind multiple actions to the key press - or bind your own wrapper script - so that first the desktop is changed as usual, then you just read the current desktop (e.g., from `xprop -root`) and display that with something like notify-send.

Last edited by Trilby (2020-05-22 18:47:42)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Online

#3 2020-05-22 20:17:34

mrsieb
Member
Registered: 2020-05-22
Posts: 2

Re: Customize - Workspace Switcher

Trilby wrote:

Or another much easier approach would be if you could bind multiple actions to the key press - or bind your own wrapper script - so that first the desktop is changed as usual, then you just read the current desktop (e.g., from `xprop -root`) and display that with something like notify-send.

Uhhh ah yes thanks for that xprop is very helpful i never used it before, this answers already alto of question i had additionally ;-)
Using the notify bubble is also a clever shortcut I'll give this i try.

xprop -root _NET_CURRENT_DESKTOP to get the workspace Nr
xprop -root _NET_DESKTOP_NAMES to get a array of workspace names

Offline

#4 2020-05-22 21:29:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: Customize - Workspace Switcher

You could use just one call to xprop and use awk to extract what you need.  As I don't use a EWMH wm, I can't test this, but (something like) the following should work:

#!/bin/sh

xprop -root | \
awk '
	/_NET_CURRENT_DESKTOP/ { n=$3; }
	/_NET_DESKTOP_NAMES/ { split($0, names); }
	END { print names[n+2]; }
' | \
{ read desktop; notify-send "$desktop"; }

The awk script should be tested first to see if it properly results in printing the current dekstop name.

The subshell at the end is a bit ugly to me - I suspect notify-send could read text from stdin which could simplify that a bit, but I couldn't find any examples doing so and I also don't have that to test locally.  You'd probably want other flags to notify-send as well to customize it to your liking.

Last edited by Trilby (2020-05-22 21:29:56)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Online

Board footer

Powered by FluxBB