LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-29-2014, 04:48 PM   #1
BridgeTheMasterBuilder
LQ Newbie
 
Registered: Jul 2014
Distribution: Debian
Posts: 14

Rep: Reputation: 1
Bash script not running properly on XFCE4 startup


I wrote a bash script that opens an instance of xfce4-terminal fullscreened with no borders or menus in Workspace 4 and am having issues getting it to run cleanly when XFCE starts. I've discovered that the issue has to do with whether it is run from a terminal or not, at least, whether the "Run in terminal" option is checked in xfrun4. If I call the script from a terminal emulator or if I use Alt+F2 to run it with the aforementioned option checked it works as intended however if it is run "outside of a terminal" it instead opens a fullscreen terminal instance in the current workstation. Since xfrun4 doesn't seem to accept command-line arguments I can't call it in the script without it being obtrusive. What exactly does xfrun4 do when the "Run in terminal" option is checked? Because I haven't been able to find a way to emulate the behavior.

Here's the script:

Code:
#!/bin/bash

xfce4-terminal -T="fssterm" --fullscreen --hide-menubar --hide-borders --hide-toolbars
wmctrl -r "fssterm" -t 3
Thanks in advance.
 
Old 07-29-2014, 09:10 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Hi,

it looks to me like the wmctrl line won't be run until the terminal exits. So I think you need to run the terminal in the background. Eg
Code:
!/bin/bash

xfce4-terminal -T="fssterm" --fullscreen --hide-menubar --hide-borders --hide-toolbars &
wmctrl -r "fssterm" -t 3
HTH,

Evo2.
 
Old 07-30-2014, 12:20 PM   #3
BridgeTheMasterBuilder
LQ Newbie
 
Registered: Jul 2014
Distribution: Debian
Posts: 14

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by evo2 View Post
it looks to me like the wmctrl line won't be run until the terminal exits.
No, that's not it, because xfce4-terminal doesn't depend on the parent shell like other terminal emulators I tested. Running an instance of xfce4-terminal just brings you back to the prompt. That being said, I tried your method anyway and it didn't cause the script to behave any differently on startup, though it did break its normal functionality (when it's called from a terminal.)

Incidentally I have also tried running bash -c "fssterm; exit 0" on startup instead which seems like it should work but it doesn't for some reason. It does exactly what fssterm does on its own - inside a terminal it works and outside it doesn't.

EDIT: Success! I got it to work by creating a script called fssterm-exec that simply runs fssterm from another instance of xfce4-terminal (via the -x option.) Admittedly not a very elegant solution, but at least it works (bear in mind I did try to nest the fssterm code within a call to xfce4-terminal with the -x option in the main script so as to avoid having two scripts but it didn't work.)

Last edited by BridgeTheMasterBuilder; 07-31-2014 at 02:19 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script works different as startup script - any ideas ? robinaspey Linux - Newbie 2 06-11-2014 02:07 PM
Bash script not working properly in cron Iyyappan Linux - Server 7 12-13-2013 12:21 PM
Bash script not performing a check properly da_667 Programming 15 08-06-2012 03:16 PM
Interface not working on startup - init.d not running properly? yitzle Linux - Software 2 03-18-2008 09:35 AM
Running a bash script at startup linker3000 Linux - Software 2 05-17-2007 10:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration