Reply
Thread Tools
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#21
dont try. you cant remove pending window in switcher.
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 2 Users Say Thank You to coderus For This Useful Post:
Posts: 15 | Thanked: 15 times | Joined on Jan 2014 @ Estonia
#22
Dont want to steal the thread but i have some questions.

I would like to run a bash script :

!#/bin/bash

mac=`echo $RANDOM$RANDOM | md5sum | sed -r 's/(..)/\1:/g; s/^(.{17}).*$/\1/;'`

ifconfig wlan0 hw ether $mac

#end

but when i run ./script from terminal it says : ./script: line 1: !#/bin/sh: No such file or directory

Could someone point me to the right direction ? I am more of a hardware guy so sorry for the dumb question
 
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#23
Shouldn't the shebang line be #!/bin/sh instead of !#/bin/sh
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#24
#!/bin/bash
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, España
#25
A little help required please guys. I have read the rest of this thread. I have tried Schturman's suggestions on different commands used in either script or desktop file, but after 3 evenings or so, I'm not getting the effect I would like.

Basically, my script tells mcetool to 'disable flipover detection' from a launcher icon, then when icon is executed again, it 'enables flipover detection'. (All of my files are currently in /home/nemo/.local/share/applications).

My script does definitely work, I can check mcetool status output after each execution and I can see the setting is either 'disabled' or 'enabled'.

Thing is, when the enabling or disabling is done, I would like to see fingerterm close, as it opens to display 'flip-detection - enabled/disabled'. (I realise there are other ways to show notifications to user, but I would like to understand this approach first).
I have tried so many different commands and variations within my desktop file and sh file, but to be honest, I don't fully know what I'm doing and am now going round in ever decreasing circles!, I just know what I want to achieve! (closing fingerterm automatically after command/execution is done).

Code from my 'flipdisabled.desktop' file;

Code:
#!/usr/bin/env xdg-open

[Desktop Entry]
Type=Application
Terminal=false
Name=Flip Disabled
Icon=/home/nemo/.local/share/applications/flipdisabled.png
Exec=fingerterm -e /home/nemo/.local/share/applications/flipdisabled.sh
and my 'flipdisabled.sh' file;

Code:
#!/bin/sh
#toggle mcetool flipover-gesture detection
#Markkyboy 2016

TOGGLE=$HOME/.toggle

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
    mcetool --set-flipover-gesture-detection=disabled
    echo flip-detection - disabled
else
    rm $TOGGLE
    mcetool --set-flipover-gesture-detection=enabled
    echo flip-detection - enabled
fi
Where and how do I tell the terminal/script to wait 5 seconds, then close fingerterm back to desktop?

All info appreciated
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..

Last edited by Markkyboy; 2016-04-01 at 19:55.
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#26
Originally Posted by Markkyboy View Post
A little help required please guys. I have read the rest of this thread. I have tried Schturman's suggestions on different commands used in either script or desktop file, but after 3 evenings or so, I'm not getting the effect I would like.

Basically, my script tells mcetool to 'disable flipover detection' from a launcher icon, then when icon is executed again, it 'enables flipover detection'. (All of my files are currently in /home/nemo/.local/share/applications).

My script does definitely work, I can check mcetool status output after each execution and I can see the setting is either 'disabled' or 'enabled'.

Thing is, when the enabling or disabling is done, I would like to see fingerterm close, as it opens to display 'flip-detection - enabled/disabled'. (I realise there are other ways to show notifications to user, but I would like to understand this approach first).
I have tried so many different commands and variations within my desktop file and sh file, but to be honest, I don't fully know what I'm doing and am now going round in ever decreasing circles!, I just know what I want to achieve! (closing fingerterm automatically after command/execution is done).

Code from my 'flipdisabled.desktop' file;

Code:
#!/usr/bin/env xdg-open

[Desktop Entry]
Type=Application
Terminal=false
Name=Flip Disabled
Icon=/home/nemo/.local/share/applications/flipdisabled.png
Exec=fingerterm -e /home/nemo/.local/share/applications/flipdisabled.sh
and my 'flipdisabled.sh' file;

Code:
#!/bin/sh
#toggle mcetool flipover-gesture detection
#Markkyboy 2016

TOGGLE=$HOME/.toggle

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
    echo rootme | devel-su -c exit
    mcetool --set-flipover-gesture-detection=disabled
    echo flip-detection - disabled
else
    rm $TOGGLE
    mcetool --set-flipover-gesture-detection=enabled
    echo flip-detection - enabled
fi
Where and how do I tell the terminal/script to wait 5 seconds, then close fingerterm back to desktop?

All info appreciated
I don't understand, you need fingerterm to be opened ?
If no... Just create helper if you need to run you script as ROOT...

P.S. Also to detect if it enabled or disabled, you can use this command (as root):
Code:
if [[ $(mcetool --status|grep Flipover|awk '{print $4}') == enabled ]]; then
//do something
else
//do something
fi

Last edited by Schturman; 2016-04-01 at 14:18.
 
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, España
#27
Originally Posted by Schturman View Post
I don't understand, you need fingerterm to be opened ?
If no... Just create helper if you need to run you script as ROOT...

P.S. Also to detect if it enabled or disabled, you can use this command (as root):
Code:
if [[ $(mcetool --status|grep Flipover|awk '{print $4}') == enabled ]]; then
//do something
else
//do something
fi
Thanks Schturman, but all you have done is confuse me more than I already am!

So, okay, I don't necessarily need fingerterm to be opened, it was something I had stumbled across and thought it was suitable at this point to use as notification that the service is enabled/disabled.

One of the reasons I went with terminal opening and displaying enabled/disabled was so I didn't have to see the cover with the busy indicator on it - which stays on screen from around 12 seconds..?, yet the process is done as soon as the command/script is executed, so why the lengthy wait for cover/indicator to close. I'm to understand this cannot be avoided or closed, it has to run til its finished.

So, you are saying I should replace my Toggle script with your 'helper' script, yes?,
(if so, I tried it, I also removed 'fingerterm -e' from 'Exec=' in desktop file just leaving /path/to/file/blah.sh). But when exectued, this just shows cover and busy indicator/cover for 12 seconds again. I'd like to not see that cover! (Yes, the service is still getting switched, but I had that happening anyway).
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#28
Originally Posted by Markkyboy View Post
Thanks Schturman, but all you have done is confuse me more than I already am!

So, okay, I don't necessarily need fingerterm to be opened, it was something I had stumbled across and thought it was suitable at this point to use as notification that the service is enabled/disabled.

One of the reasons I went with terminal opening and displaying enabled/disabled was so I didn't have to see the cover with the busy indicator on it - which stays on screen from around 12 seconds..?, yet the process is done as soon as the command/script is executed, so why the lengthy wait for cover/indicator to close. I'm to understand this cannot be avoided or closed, it has to run til its finished.

So, you are saying I should replace my Toggle script with your 'helper' script, yes?,
(if so, I tried it, I also removed 'fingerterm -e' from 'Exec=' in desktop file just leaving /path/to/file/blah.sh). But when exectued, this just shows cover and busy indicator/cover for 12 seconds again. I'd like to not see that cover! (Yes, the service is still getting switched, but I had that happening anyway).
It can't be done without seeing the cover (as far as I know).
About helper.c, I mean if you need to run your script as root, you can create this file:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
   setuid( 0 );
   system( "/path/to/your/script.sh");

   return 0;
}
Now convert it:
Code:
gcc /path/to/helper.c -o /path/to/your/script-root
Give permisdion 4755 to your script.sh and script-root files.
In desktop file:
Code:
Exec=/path/to/your/script-root

Last edited by Schturman; 2016-04-01 at 16:13.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 15:54.