3

Since Ubuntu has no options to save and restore desktop sessions on shutdown of the computer, I want to write a shell script which helps to setup a customized workspace on a single command. I've found similiar questions on the web. However, I tried gDevilspie and was absolutely lost with that application. Nor do I want to use Compiz as I have made really bad experiences with this software messing up my system several times in the past.

I am looking for a clean an simple shell script which can be called as a command via the Dash. For example, the "office scenario" command would do this:

  • start Atom editor in workspace 1
  • start Terminator in workspace 1
  • start Firefox browser in workspace 3
  • start Slack in workspace 4
  • start Trello (Chromium application shortcut) in workspace 4
  • start Sunrise Calendar (Chromium application shortcut) in workspace 4

Is a shell script the proper way to achieve this goal? If so, what would the shell script need to look like (I have no shell scripting experience so far) and where would it belong to be called as a single command via the Dash?

I appreciate your help very much.

Bunjip
  • 815
  • 2
  • As this answer http://askubuntu.com/a/621811/72216 explains, simply chain the commands to open multiple windows/applications on multiple viewports. – Jacob Vlijm Jun 01 '16 at 08:39
  • @JacobVlijm thanks for pointing me to this posting and your comprehensive answer there. I'll try to get your solution to work with my system. However, the question on how to open an app fullscreen-wise is still open in the comments ;). Got a hint? – Bunjip Jun 01 '16 at 19:05
  • Ah, never noticed the comment! should be no problem, using xdotool, and an exclusive argument : fscr or so, *BUT*, would need an edit of the script. Working on something at the moment. If I finish, I will post an edit tomorrow or the day after :) – Jacob Vlijm Jun 01 '16 at 19:09
  • Cool! So, I will not yet ask how to call a Chrome Application Shortcut via this script (as I have some important apps as Chrome shortcuts only)...? ;) – Bunjip Jun 01 '16 at 19:21
  • Chrome shortcuts?? what are those? – Jacob Vlijm Jun 01 '16 at 19:23
  • Chrome and Chromium make it possible to run a specific websites or web app in a headless browser window, thus, making it available from the desktop or the launcher or even the dash just like a native app. See more here https://support.google.com/chrome/answer/3060053 or here https://mrwweb.com/power-user-tip-chrome-application-shortcuts/ – Bunjip Jun 01 '16 at 19:32
  • So what you're asking ( at least the way I understand it ) is run one command, which will open several apps, and spread them out to an assigned workspace ( specific to each app ) . Correct ? – Sergiy Kolodyazhnyy Jun 09 '16 at 10:07
  • @Serg yes, that's correct. – Bunjip Jun 17 '16 at 11:04
  • Look up a package named devilspie2. It can be used to do this, but it's not a perfect answer since it can be tricky to configure and isn't 100% bug free. – DonGar Apr 06 '17 at 21:35

1 Answers1

0

Start several applications with one command

Write a shell script:

#! /bin/bash
atom &
terminator &
firefox

Save it as e. g. “myscript”, do chmod a+x myscript and create a shortcut to your start menu (depends on what you're using, just search the web for instructions how to do that).

Open an application in a specific workspace

This is a little bit tricky. Assuming you're using GNOME Shell, try these instructions to bind a .desktop file to a specific workspace. If it works you can define which applications should start where.

Edit: wmctrl is able to send a program to a specific workspace, e. g.

wmctrl -r :ACTIVE: -t 3 # sends the currently active window to workspace 3

You can combine it like

( firefox && wmctrl -r firefox -t 3 ) &
( atom && wmctrl -r atom -t 2 ) &
…
dessert
  • 39,982