LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-30-2020, 02:05 AM   #1
Flexico
Member
 
Registered: Aug 2015
Distribution: Mint MATE
Posts: 153

Rep: Reputation: Disabled
Panel and Window Control Script Behaving Strangely


[Linux Mint 20 Mate]
[Dell Vostro 5590 Laptop]

This is a bit of a strange situation, but my code seems to freeze at a certain point, and is only able to continue if I run another copy of itself in a different terminal.

I've had a bit of trouble with running certain programs in full screen mode, so to make a kind of "pseudo-fullscreen" I wrote a script that hides window decoration and my panels, or toggles them back on, and is triggered by pressing Super+F. It works for the most part, but when I press it once, it just hides the window decoration, and I have to press it a second time for it to hide the panels. Same with restoring everything; I have to press it twice. Not a huge inconvenience, but I really want to understand *why* my code does what it does.

Code:
#!/bin/bash

state=`dconf read /org/mate/panel/toplevels/toplevel-0/auto-hide`;
echo $state

if [[ $state == false ]]; then # panels are visible
	# hide panels
	echo "1a";
	gtk-window-decorator --replace --minimal;
	echo "1b";
	dconf write /org/mate/panel/toplevels/bottom/auto-hide true;
	echo "1c";
	dconf write /org/mate/panel/toplevels/toplevel-0/auto-hide true;
	echo "1d";
else
	# show panels
	echo "2a";
	gtk-window-decorator --replace;
	echo "2b";
	dconf write /org/mate/panel/toplevels/bottom/auto-hide false;
	echo "2c";
	dconf write /org/mate/panel/toplevels/toplevel-0/auto-hide false;
	echo "2d";
fi

echo "Done!"
(I put in a bunch of "echo" commands to let me know exactly where the code freezes.)

I ran the command from a terminal, and it hid the window decor and printed "1a" but then stopped. I ran it again in a second terminal window, and that too printed "1a" and stopped, but the original terminal finished and printed "Done!" Running it a third time caused it to un-hide the window decor and print "2a", but then it stopped while the second terminal finished and printed "Done!" Ran it again in the second terminal and the first one finished restoring the panels, but then the second one was stuck at "2a".

I assume the same thing is happening when I press the key combo; the output just doesn't display anywhere I can see it. What on earth is going on?
 
Old 07-30-2020, 07:07 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Code:
gtk-window-decorator --replace
You have to find out what that command does and why it waits indefinitely.
 
Old 08-18-2020, 06:30 AM   #3
Flexico
Member
 
Registered: Aug 2015
Distribution: Mint MATE
Posts: 153

Original Poster
Rep: Reputation: Disabled
After a couple of weeks feeling like tapping the button twice was less of an inconvenience than fixing the code, I found a solution by googling "bash threads" which didn't technically teach me multithreading, but told me how to run simultaneous commands. The gtk-window-decorator is what controls the title bar and minimize/close buttons, and when it runs, it doesn't move on to the next line in the script until something else closes it. So, just add " &" to the end of that line and it runs it in a separate instance so the script can continue!

Hope someone else finds this helpful~
 
  


Reply

Tags
bash, laptop, panels, scripts



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
pullinig psu switch = usb behaving strangely > switching port sides NonSumPisces Linux - Hardware 0 07-31-2004 07:26 PM
BitTorrent Tracker Behaving Strangely When Run Through Linux Iptables Firewall tvynr Linux - Networking 0 04-07-2004 03:54 PM
ATI Drivers (or something) behaving strangely... doxxan Linux - Hardware 3 02-19-2004 02:37 PM
GTK-based Apps Behaving Strangely After Upgrading to Kernel 2.6.2 johnleemk Linux - Software 2 02-08-2004 07:46 AM
Unix/Perl/Sendmail behaving strangely! stephbock Linux - General 6 01-21-2003 03:56 PM

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

All times are GMT -5. The time now is 05:56 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