Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-05-22 00:39:40

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Changing panel layouts when changing workspaces

This script changes the panel layout with xfce panel switch when the current workspace is changed.
Works with xev from at least debian oldstable (jessie)

Save the script, and make it executable.

Preparation: - open the xfpanel-switch and export a couple panel layouts. https://bluesabre.org/2015/10/12/xfce-p … roduction/
                     - change the path to the exported panel layouts (e.g. /home/misko/Desktop/Untitled.tar.bz2) in the saved script

#!/bin/bash

   # xev monitors the root window events
   xev -root -event property |  # <-- this is the watching process
        while IFS=$',' read -a W;do
            if [[ "${W[0]}" =~ '_NET_CURRENT_DESKTOP' ]]; then

                #Gets the current workspace
	        CURRENT_DESKTOP=$(xprop -root -notype _NET_CURRENT_DESKTOP)
                CURRENT_DESKTOP=${CURRENT_DESKTOP:(-1)}

                    if [[ "$CURRENT_DESKTOP" -eq "0" ]]; then
                       # sets the panel layout
                       python3 /usr/local/share/xfpanel-switch/xfpanel-switch/xfpanel-switch.py load /home/misko/Desktop/Untitled.tar.bz2
                    elif [[ "$CURRENT_DESKTOP" -eq "1" ]]; then
                       # sets the panel layout
                       python3 /usr/local/share/xfpanel-switch/xfpanel-switch/xfpanel-switch.py load /home/misko/Desktop/Untitled2.tar.bz2
                    fi
             fi

             W=()
        done

When the workspace is changed the panel layout will change.

Note that workspace 0 in the script is "Workspace 1", workspace 1 in the script is "Workspace 2", etc...

Last edited by Misko_2083 (2018-05-22 01:15:28)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

Board footer

Powered by FluxBB