klricks
Posts: 5595
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Need terminal command to open maximised terminal and run script in it

Sun Jun 17, 2018 2:24 pm

seanspotatobusiness wrote:
Sun Jun 17, 2018 12:01 pm
...
and I'm guessing it's the && which it doesn't like so I'm back to square one :'(
...
Did you try the xdotool method I mentioned above?
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

seanspotatobusiness
Posts: 101
Joined: Tue May 22, 2012 11:19 pm

Re: Need terminal command to open maximised terminal and run script in it

Fri Jun 22, 2018 9:02 am

I did need to create a new thread because this thread reached the conclusion it set out to. The solution to this thread is:

Code: Select all

lxterminal --geometry=126x45 -e tmux && /home/pi/Mining/atmuxScript.sh
But what works in a terminal doesn't work in any of the start-up solutions I described in my new thread. My question has changed from how do I run my script in a single command from a terminal to how do I start my script automatically when the Pi logs on? Please unlock my new thread.
klricks wrote:
Sun Jun 17, 2018 2:24 pm
seanspotatobusiness wrote:
Sun Jun 17, 2018 12:01 pm
...
and I'm guessing it's the && which it doesn't like so I'm back to square one :'(
...
Did you try the xdotool method I mentioned above?
Unfortunately, no, I can't even start the script in any size of window let alone a maximised one. None of the start-up options are working.

This is what happens when I run my script from the command line: a new window opens with everything I want inside of it.
https://youtu.be/9gq0ZkL0r4A

This is what happens when I try to run the script from ~/.config/lxsession/LXDE-pi/autostart
https://youtu.be/2GjXIPy49FQ
Raspberry Pi 3 B and B+
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

klricks
Posts: 5595
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Starting a tmux script in lxterminal automatically after log-in

Sat Jun 23, 2018 12:37 am

OK I downloaded tmux and got this to work for me.
It opens up a 9 window pane in the lxterminal.

First I made a bash file which is a subset of your script:

Code: Select all

#!/bin/bash
sleep 10  #<<<<<<<<<<<<< adjust as needed.
SESSION=$USER

lxterminal --geometry=126x45 -e tmux && tmux -2 new-session -d -s $SESSION


# Setup a window for monitoring TO/Sam, TO/Sean, TO/Sam+Sean, C/Sean, C/Sam, C/$

tmux split-window -h
tmux split-window -h
tmux split-window -v
tmux split-window -v
tmux split-window -v
tmux select-pane -t 0
tmux split-window -v
tmux split-window -v
tmux split-window -v
tmux select-layout tiled
tmux set pane-border-status

xdotool windowsize $(xdotool getactivewindow) 100% 100%
My entry in autostart:

Code: Select all

@lxterminal -e bash /home/pi/tm
What made it work is the sleep 10 command at the beginning. The time may need to be adjusted.
The xdotool command at the end maximizes the terminal.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

klricks
Posts: 5595
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Starting a tmux script in lxterminal automatically after log-in

Sat Jun 23, 2018 4:53 am

A simplified script that works for me. Opens 6 tiled consoles then goes full screen.
Works from CL and autostart @ loggin or reboot. Didn't try full power on reset......
If more complex you may need to add sleep commands between the tmux statements.

Code: Select all

#!/bin/bash

lxterminal --geometry=126x45 -e tmux

sleep 1  # <<< important

tmux select-pane -t 0

tmux split-window -h

tmux select-pane -t 1

tmux split-window -h

tmux select-pane -t 2

tmux split-window -h

tmux select-pane -t 0

tmux split-window -h

tmux split-window -h
tmux select-layout tiled
tmux set pane-border-status

xdotool windowsize $(xdotool getactivewindow) 100% 100%

Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

seanspotatobusiness
Posts: 101
Joined: Tue May 22, 2012 11:19 pm

Re: Starting a tmux script in lxterminal automatically after log-in

Sun Jun 24, 2018 4:24 am

Thanks very much; this works perfectly! All I needed was that sleep and to add "lxterminal -e bash" to my entry in autostart. I must've restarted my Pi 100 disappointing times trying to get this to work. Thanks again.
Raspberry Pi 3 B and B+
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

Return to “Beginners”

Who is online

Users browsing this forum: jbudd and 44 guests