This forum has been archived. All content is frozen. Please use KDE Discuss instead.

switching between plasma desktop and netbook workspaces

Tags: None
(comma "," separated)
User avatar
sadi
Registered Member
Posts
24
Karma
0
OS
Hi,

I use a netbook often with an external 19" monitor, which means that I have to frequently switch back and forth between plasma netbook and desktop workspaces.

Thanks to the information I've found in another thread, I've created 2 launchers (with 2 icons plus 2 *.desktop files executing 2 scripts including the command strings "kquitapp plasma-netbook" and "plasma-desktop" and vice versa...

However, I would appreciate very much if someone could perhaps provide a short script that would simply toggle the plasma workspace by querying and finding out the current plasma workspace, and then terminating it, followed by activating the other plasma workspace.
zenyatta
Registered Member
Posts
1
Karma
0
OS
How about this?
Code: Select all
#!/bin/bash
DESKTOP=`ps ax | grep plasma-desktop | grep -v grep`
NETBOOK=`ps ax | grep plasma-netbook | grep -v grep`

if [ "x$DESKTOP" != "x" ]; then
  kquitapp plasma-desktop && plasma-netbook
elif [ "x$NETBOOK" != "x" ]; then
  kquitapp plasma-netbook && plasma-desktop
else
  echo "Sorry, couldn't detect any plasma workspace"
fi

z.
User avatar
einar
Administrator
Posts
3402
Karma
7
OS
A simpler alternative using pgrep:

Code: Select all
#!/bin/bash

DESKTOP=$(pgrep plasma-desktop)
NETBOOK=$(pgrep plasma-netbook)

if [ "x$DESKTOP" != "x" ]; then
  kquitapp plasma-desktop && plasma-netbook
elif [ "x$NETBOOK" != "x" ]; then
  kquitapp plasma-netbook && plasma-desktop
else
  echo "Sorry, couldn't detect any plasma workspace"
fi


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
User avatar
sadi
Registered Member
Posts
24
Karma
0
OS
Thanks a million to zenyatta and einar !!!

I knew it was very easy, although I'm too ignorant about scripting.

Both scripts worked well in switching back and forth between desktop and netbook workspaces now ;-)

Sadi
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS
Another option that doesn't require scripting is to use this plasmoid: http://kde-apps.org/content/show.php/On ... ent=116323


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
User avatar
sadi
Registered Member
Posts
24
Karma
0
OS
The scripts suggested by zenyatta and einar (actually the commands plasma-desktop and plasma-netbook) change the screen but leave the setting in System Settings/Workspace Behaviour/Workspace in the last manually selected position which results in behaviours like "BorderlessMaximizedWindows=false" (~/.kde/share/config/kwinrc) in Netbook mode.

Therefore, it needs to be complemented at least with a command to toggle the value for "BorderlessMaximizedWindows" in ~/.kde/share/config/kwinrc between "true" and "false"


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]