Post here if you are a new Porteus member and you're looking for some help.
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#16
by Ed_P » 12 Jan 2014, 20:47
brokenman wrote:This sounds good, but the other night i was tired and after 6 hours of coding i mindlessly typed the shutdown command before saving my work. I realized i hadn't saved as my finger was falling helplessly towards the enter button. Time slowed down for a brief second and my catlike reflexes kicked into action. My finger clipped the enter button, and i blinked twice. Too late, all was lost. Damn you Pooorteusss!

Sorry you lost your work but I do like your literary style.

Ed
Ed_P
-
tome
- Contributor

- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
-
Contact:
Post#17
by tome » 12 Jan 2014, 21:31
Ed_P
maybe you should create launcher for suspend and eventually assign some keys to execute this, you can see also:
forum.porteus.org/viewtopic.php?f=39&t=2839
brokenman
I had fear of this (we do sth quicker than we think about this out of habit) and now I use fresh mode for settings but for other folders or files I have links to real filesystem. If one of main maintainers has done such damned thing, everyone can do this. Some ideas are to change keys for skipping, always wait 3 sec - time for cancel - and then save or skip, always saved changes - 3 sec time for sure only if you exit by executing shutdown without changes, launchers (see my above link) but guest should have on/off folder that content should decide about shutdown script way - if there is on file then save if only off then skip else ask and wait 3 sec, additional alert (are you sure?) if you have more than 50 MB in changes or session is longer than 2 hours, etc...
You have mind and feelings. Be wise and clever.
tome
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#18
by Ed_P » 13 Jan 2014, 04:50
I tried the steps shown in your link to create a Hibernate icon on my desktop. But it doesn't work for me.

The desktop icon has no name under it and dbl clicking on it does nothing.
I used the hibernate code posted on the link, named the file Hibernate.desktop and located it in my /home/guest/desktop folder. I assumed that was what you meant when you said "Create new choose -name.desktop file on your desktop".
Thoughts?
Ed
Ed_P
-
tome
- Contributor

- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
-
Contact:
Post#19
by tome » 13 Jan 2014, 06:23
if you want hibernate you need swap partition or file, try suspend. You can also change Name= and Icon= parameters if you need some other for your qt desktop.
You have mind and feelings. Be wise and clever.
tome
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#20
by Ed_P » 14 Jan 2014, 00:37
I changed the name of the file from Hibernate.desktop to just Hibernate. This resulted in the name Hibernate appearing under the icon on the desktop, the icon changing to a page from a spiral notebook and dbl clicking on the icon opening the text in Firefox.
Something isn't right.
Ed
Ed_P
-
phhpro
- Full of knowledge

- Posts: 543
- Joined: 10 Nov 2013, 20:35
- Distribution: .
Post#21
by phhpro » 14 Jan 2014, 01:52
...
Last edited by
phhpro on 04 Feb 2016, 00:41, edited 1 time in total.
phhpro
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#22
by Ed_P » 14 Jan 2014, 06:10
fanthom wrote:i have given you a fishing rod and not a fish itself. dont be lazy and read linked doc then create proper action in your /etc/acpi/acpi_handler.sh file.
I tried both commands in 1st link, the 1st command, journalctl -f, did nothing regardless which keys I tried and the only way I could exit it was to restart LXTerminal. The 2nd command produced an error:
Code: Select all
guest@porteus:~$ su
Password:
root@porteus:/home/guest# acpi_listen
acpi_listen: can't open socket /var/run/acpid.socket: Connection refused
root@porteus:/home/guest#
In reviewing this link it refers to files in /etc/acpi/events and /etc/acpi/actions folders. In the RazorQT system there exist files that appear to address the lid shutdown situation, lm_lid and lm_lid.sh. And the lm-lid.sh file appears to be set to run a file named laptop_mode which is in the /usr/sbin folder.
So doesn't this mean that code to handle the closing of the lid is already present but not working?
Ed
Ed_P
-
tome
- Contributor

- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
-
Contact:
Post#23
by tome » 14 Jan 2014, 23:17
Ed_P
in Spacefm execute Hibernate.desktop by right clicking on it and execute, or move this file to /home/guest/.local/share/applications or /usr/share/applications
You have mind and feelings. Be wise and clever.
tome
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#24
by Ed_P » 15 Jan 2014, 07:31
tome wrote:in Spacefm execute Hibernate.desktop by right clicking on it and execute,
Ok, I replaced the Hibernate file with one name Suspend, since you said Hibernate required a file. With the file named Suspend right clicking on it in SpaceFM does not have Execute as an option. I renamed the file to be Suspect.desktop, then the desktop icon changed to a gear but the label under the icon became blank. However,
right clicking on it in SpaceFM does have the Execute option. Selecting Execute opens an Error window stating Command not found.
The other two files in the /home/guest/Desktop/ folder, Home and System, do not have .desktop appended to their names but do have Execute option when right clicking on them.
Ed
Ed_P
-
tome
- Contributor

- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
-
Contact:
Post#25
by tome » 17 Jan 2014, 09:27
tested in Razor fresh mode and it works so go to:
https://www.dropbox.com/sh/ui4ydoh3j34x ... /launchers download suspend.desktop to your desktop (eventually change permissions - right mouse button -> Properties -> Permissions and set similar to home.desktop shortcut) and try.
You can also try
Code: Select all
/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
in terminal.
You have mind and feelings. Be wise and clever.
tome
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#26
by Ed_P » 17 Jan 2014, 22:44
Wow!!
tome it works!!

Both before and after the permission changes and in terminal mode.
Code: Select all
guest@porteus:~$ /usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
method return sender=:1.14 -> dest=:1.22 reply_serial=2
guest@porteus:~$ su
Password:
root@porteus:/home/guest# leafpad /etc/acpi/acpi_handler.sh
I also tried it in the /etc/acpi/acpi_handler.sh file with somewhat strange results.
Code: Select all
#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
lid) /usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac
I close the lid and the system suspends just like when I click on the desktop icon. I open the lid and reactivate the system, it activates and then 2 seconds later re-suspends!!

I re-activate again and it's fine. Do not understand the secondary suspension,
Ed
Ed_P
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#27
by Ed_P » 18 Jan 2014, 18:48

journalctl -f doesn't work under 3.0 rc1 either. But acpi_listen does.
Code: Select all
guest@porteus:~$ acpi_listen
button/lid LID close
button/lid LID open
Unfortunately my acpi_handler.sh code change doesn't work.
Code: Select all
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
lid) if [ "$3" != "open" ]; then
/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
fi
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac
I tried if [ "$2" != "open" ]; also but it didn't work either.

Ed
Ed_P
-
tome
- Contributor

- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
-
Contact:
Post#28
by tome » 19 Jan 2014, 16:40
For previous (default) acpi_handler.sh (or for '/etc/acpi/actions/lm_lid.sh') add at end this:
Code: Select all
case $(cat /proc/acpi/button/lid/LID/state | awk '{print $2}') in
closed) echo -n mem >/sys/power/state
;;
esac
You have mind and feelings. Be wise and clever.
tome
-
Ed_P
- Contributor

- Posts: 7671
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#29
by Ed_P » 20 Jan 2014, 05:37
tome wrote:For previous (default) acpi_handler.sh (or for '/etc/acpi/actions/lm_lid.sh') add at end this:
Code: Select all
case $(cat /proc/acpi/button/lid/LID/state | awk '{print $2}') in
closed) echo -n mem >/sys/power/state
;;
esac
This isn't working for me
tome.
Code: Select all
#!/bin/sh
# Default acpi script that takes an entry for all actions
# /etc/acpi/
#
# Modified by Ed_P 1/20/14 to support auto suspend when lid closed
# using command provided by @tome.
# http://forum.porteus.org/viewtopic.php?f=81&t=3018&p=21384#p21384
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac
case $(cat /proc/acpi/button/lid/LID/state | awk '{print $2}') in closed) echo -n mem >/sys/power/state
;;
esac
Ed
Ed_P
-
tome
- Contributor

- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
-
Contact:
Post#30
by tome » 20 Jan 2014, 05:51
go to
/proc/acpi/button/lid/
or similar, find and add correct path for state to this script
You have mind and feelings. Be wise and clever.
tome