Results 1 to 4 of 4

Thread: enter shortcut into a bash script

  1. #1
    Join Date
    Mar 2020
    Beans
    4

    enter shortcut into a bash script

    Hi everyone..i am new here.

    I have Ubuntu 18.04 and 4 workspaces (0-3). What i want to do is to run a simple bash script with wmctrl that opens Vivaldi browser with 3 tabs in workspace 1.

    So i made this:

    #!/bin/bash
    wmctrl -s 1 #Switches to workspace 1 [workspaces are numbered from 0]
    &vivaldi url1 &vivaldi url2 &vivaldi url3 & #Opens tabs with specific urls.

    The problem is that if i have vivaldi allready opened at workspace 0 and not in workspace 1, then this script creates those tabs in workspace 0.

    To start a new instance of Vivaldi in workspace 1 i can however use Ctrl+n. And then off course run the script.

    So how can i enter the shortcut "Ctrl + n" into this script?

    Thanks

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    19,820
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: enter shortcut into a bash script

    i doubt it will help, but xdotool is how to accomplish this.
    A different WM, like fvwm, will control placement of windows onto specific workspaces if the one you are using doesn't support that.

    BTW, &vivaldi is incorrect. Remove the &. it belongs on the end of the prior line.

  3. #3
    Join Date
    Jun 2015
    Beans
    4

    Re: enter shortcut into a bash script

    "setting" -> "keyboard" could set shortcuts to open vivaldi.
    "tweaks" -> "extensions" - "auto move windows" could set default workspace when software open.

  4. #4
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    7,644
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: enter shortcut into a bash script

    Assuming Vivaldi accepts the same command line options as chromium, you could add the --new-window switch to your first invocation of Vivaldi. If you haven't got Vivaldi running, you'll be opening a new window anyway, and if it is already running a new window is what you want. It's possible that the command line option is called something different with Vivaldi, but it's a pretty standard function for browsers.
    None but ourselves can free our minds

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •