Announcement

Collapse
No announcement yet.

Script won't autostart

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script won't autostart

    I've got a small script (tablet.sh) to configure my Cintiq for GIMP. It works great if I start it manually. I have it marked as executable and have tried to get it to autostart at boot through System Settings>Startup and Shutdown. I've tried to set it to run on "startup" and "pre-KDE startup," but neither works. It's added as a script file, surely it shouldn't be added as a program?

    #2
    Is it showing in your syslog or dmesg? They're might be an error message of use in there somewhere.

    Also, posting the script itself might help trouble shooters.

    It could be that it's running too early in the process to do what you want. I'm not sure when the startup scripts run.

    Have you tried calling it from /etc/rc.local instead? Or even put the contents in rc.local.

    Please Read Me

    Comment


      #3
      Here's the script -

      Code:
      #! /bin/bash
      
      xsetwacom --set "Wacom Cintiq 12WX Pen stylus" MapToOutput "DVI-1-1" 
      xsetwacom --set "Wacom Cintiq 12WX Pen eraser" MapToOutput "DVI-1-1" 
      
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 13 "key tab"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 3 "key +shift q"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 1 "key +ctrl t"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 2 "key +shift +ctrl a"
      #!xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 8 "key tab"
      
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 14 "key +shift +ctrl l"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 9 "key +shift +ctrl n"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 10 "key +ctrl +alt v"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 11 "key +ctrl h"
      xsetwacom set "Wacom Cintiq 12WX Pad pad" Button 12 "key Return"
      
      
      #! xsetwacom set "Wacom Cintiq 12WX Pen stylus" Button 1 "key bracketleft"
      xsetwacom set "Wacom Cintiq 12WX Pen stylus" Button 2 "key bracketleft"
      #!xsetwacom set "Wacom Cintiq 12WX Pen stylus" Button 3 "key bracketright"
      Will it automatically run if I drop it in /etc/rc.local?

      I ran dmesg and searched the results for tablet.sh. Nothing came up.

      I'm not advanced enough to know about syslog.

      Comment


        #4
        Not likely an issue, but for conformity, remove the space between the ! and /bin/bash.

        Is the script actually executable, i.e., did you run: chmod a+x filename

        I also seem to recall, that in 16.04, items that you want to autostart after logging in to the Desktop have to be .desktop files (if not autostarting an actual application), so the above may still not work.
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          When in doubt consult the man pages: man bash
          Here is the relevant part:
          INVOCATION
          A login shell is one whose first character of argument zero is a -, or one started with the --login option.

          An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both con‐
          nected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is interactive,
          allowing a shell script or a startup file to test this state.

          The following paragraphs describe how bash executes its startup files. If any of the files exist but cannot be read, bash reports an
          error. Tildes are expanded in filenames as described below under Tilde Expansion in the EXPANSION section.

          When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes
          commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and
          ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
          The --noprofile option may be
          used when the shell is started to inhibit this behavior.

          When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.

          When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
          these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute com‐
          mands from file instead of /etc/bash.bashrc and ~/.bashrc.

          When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands
          its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following
          command were executed:
          if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
          but the value of the PATH variable is not used to search for the filename.

          If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while
          conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive shell with the --login option,
          it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order.
          The --noprofile option may be used to
          inhibit this behavior. When invoked as an interactive shell with the name sh, bash looks for the variable ENV, expands its value if it is
          defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as sh does not attempt to read and
          execute commands from any other startup files, the --rcfile option has no effect. A non-interactive shell invoked with the name sh does
          not attempt to read any other startup files. When invoked as sh, bash enters posix mode after the startup files are read.

          When bash is started in posix mode, as with the --posix command line option, it follows the POSIX standard for startup files. In this
          mode, interactive shells expand the ENV variable and commands are read and executed from the file whose name is the expanded value. No
          other startup files are read.

          Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote
          shell daemon, usually rshd, or the secure shell daemon sshd. If bash determines it is being run in this fashion, it reads and executes
          commands from ~/.bashrc and ~/.bashrc, if these files exist and are readable. It will not do this if invoked as sh. The --norc option
          may be used to inhibit this behavior, and the --rcfile option may be used to force another file to be read, but neither rshd nor sshd gen‐
          erally invoke the shell with those options or allow them to be specified.
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            It's "sort of" working - the trick is that the Cintiq has to be turned on at startup. In 12.04 I used kde-config-tablet to configure the Cintiq, and I could login with the Cintiq turned off. I suppose kde-config-tablet was phased out for a reason. I don't know if there's a plan to replace it with anything. It wasn't perfect but it had it's advantages.

            Comment


              #7
              IMO, this should not be called from startup at all. Since this is a hardware device, you should have a udev rule under /lib/udev/rules.d (69-wacom.rules is provided by xserver-xorg-input-wacom) that activates when you plug in, power on, or boot with the tablet connected. There's a config file in /usr/share/X11/xorg.conf.d/ named 50-wacom.

              Your settings should be in a config for xorg by creating directory /etc/X11/xorg.conf.d/ and putting a file named 10-wacom.conf in there with your settings - formatted like an xorg.conf stanza, like the ones on this page: http://linuxwacom.sourceforge.net/wi...hp/Xorg.conf.d

              kde-config-tablet was likely phased out as it's now redundant.

              Please Read Me

              Comment


                #8
                Originally posted by oshunluvr View Post

                kde-config-tablet was likely phased out as it's now redundant.
                Not the gui part. I'm having a hard time believing someone made the decision that wacoms should be configured manually again, although evidently that's the case.

                Comment


                  #9
                  Originally posted by Jeremy_Ray View Post
                  Not the gui part. I'm having a hard time believing someone made the decision that wacoms should be configured manually again, although evidently that's the case.
                  Well, you got me wondering. So, I pulled my Watcom Bamboo tablet out of the drawer and plugged it in. I fired up MyPaint and found that I could use it immediately, without having to go to System Settings. This is the first time I have plugged in my Watcom tablet since I installed Xenial. So, yes, for Watcom Bamboo tablets recognition and configuration are immediate and automatic.


                  That written, here are some web pages that deal with Cintiq.
                  http://ragnarb.com/configuring-wacom...-ubuntu-14-04/

                  https://blog.hials.no/schaathun/2013...ntiq-on-linux/

                  But I suspect that you have already found those and many more.
                  Last edited by GreyGeek; Jul 17, 2016, 12:47 PM.
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment


                    #10
                    Here's what I've got for 52-wacom-options so far -

                    Code:
                    Section "InputClass"
                            Identifier "Wacom Cintiq 12WX Pen stylus"        
                    	MatchProduct "Wacom|WACOM"
                            MatchDevicePath "/dev/input/event*"
                            Driver "wacom"
                            
                            Option "TopX" "0"
                    	Option "TopY" "0"
                    	Option "BottomX" "21648"
                    	Option "BottomY" "13530"
                            
                            Option "Button2" "bracketleft"
                    EndSection
                    
                    
                    Section "InputClass"
                            Identifier "Wacom Cintiq 12WX Pen eraser"        
                    	MatchProduct "Wacom|WACOM"
                            MatchDevicePath "/dev/input/event*"
                    EndSection
                    
                    
                    Section "InputClass"
                            Identifier "Wacom Cintiq 12WX Pad pad"        
                    	MatchProduct "Wacom|WACOM"
                            MatchDevicePath "/dev/input/event*"
                            
                            Option "Button13" "tab"
                            Option "Button3" "+shift q"
                            Option "Button1" "+ctrl t"
                            Option "Button2" "+ctrl +shift a"
                            Option "Button14" "+ctrl +shift l"
                            Option "Button9" "+ctrl +shift n"
                            Option "Button10" "+ctrl +alt v"
                            Option "Button11" "+ctrl h"
                            Option "Button12" "Return"
                            
                    EndSection
                    I haven't tried it yet. I know I need to define the position of the Cintiq screen in my 3 monitor setup, but ATM I don't know how to find the coordinates.

                    It's possible the xsetwacom commands for the buttons such as "+ctrl +alt v" won't work in 52-wacom-options. There may not be an equivalent.

                    Comment


                      #11
                      Originally posted by GreyGeek View Post
                      Well, you got me wondering. So, I pulled my Watcom Bamboo tablet out of the drawer and plugged it in. I fired up MyPaint and found that I could use it immediately, without having to go to System Settings. This is the first time I have plugged in my Watcom tablet since I installed Xenial. So, yes, for Watcom Bamboo tablets recognition and configuration are immediate and automatic.
                      O.K., but I've got three monitors including the Cintiq and I need to reassign the buttons on the Cintiq. With kde-config-tablet I could have the job done in moments (although the button reassignment was buggy). Doing it manually - I'm still working on it.

                      Comment

                      Working...
                      X