You are not logged in.

#1 2014-05-11 22:19:37

timelaw
Member
Registered: 2013-02-04
Posts: 30

Script to put laptop in suspension mode when using Notion wm

Hey!

I'm using KDE mostly but since trying to revert back to nVidias 334 drivers to stop the corruption of the display on resume and the often occuring background image corruption, KDE will not start anymore. I get KDM to start so I can pick Notion which works fine. But I don't have any script to suspend the computer when closing the lid. Or resuming for that matter.

I wish to learn how to do so. How do I achieve this and can it be done in any language of choice or is there a specific one for these hooks or whatever they are? smile

EDIT: I'm interested in trying to do my own scripts so that I can customize my window manager even more later on. I can program in some languages but I have no experience with lua (Notion, I think) or Python which is quite commonly used.

Last edited by timelaw (2014-05-11 22:37:29)

Offline

#2 2014-05-12 10:54:43

Chazza
Wiki Maintainer
Registered: 2013-06-02
Posts: 506

Re: Script to put laptop in suspension mode when using Notion wm

systemctl suspend

should work in almost all cases.

Offline

#3 2014-05-12 14:06:13

timelaw
Member
Registered: 2013-02-04
Posts: 30

Re: Script to put laptop in suspension mode when using Notion wm

Chazza wrote:
systemctl suspend

should work in almost all cases.

Well, that's not what I'm looking for. I'm looking for a script where I can do something once the lid closes and once the lid opens again.

Or as an alternative, manually suspending with some hotkey. I checked it out a bit on the arch wiki and I found some shell scripts to do this through ACPI events.

Anyway, why I posted this question was to get some help with the first thing to do. I want to learn how to actually script to customize my Notion and the general behaviour of my laptop when using Notion.

Offline

#4 2014-05-12 15:21:03

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Script to put laptop in suspension mode when using Notion wm

You need to clarify what you want. This was your initial requirement:

timelaw wrote:

I don't have any script to suspend the computer when closing the lid. Or resuming for that matter.

You don't need a script for this - just configure your system accordingly. See the logind.conf man page for the systemd way fo doing it, and check out the "Suspend and Hibernate" wiki page for other options.

Then you added this:

timelaw wrote:

I'm looking for a script where I can do something once the lid closes and once the lid opens again.

Again, that wiki page will get you started.

And now you've added this:

timelaw wrote:

I want to learn how to actually script to customize my Notion and the general behaviour of my laptop when using Notion.

That covers a lot, wouldn't you agree? Way more than just suspending anyway. I'm not familiar with Notion at all, but if it was me, I'd start with whatever documentation is provided with it. If they have a forum/wiki/mailing list/irc/whatever, that could be useful to you also.

Offline

#5 2014-05-12 17:38:57

timelaw
Member
Registered: 2013-02-04
Posts: 30

Re: Script to put laptop in suspension mode when using Notion wm

tomk wrote:

You need to clarify what you want. This was your initial requirement:

timelaw wrote:

I don't have any script to suspend the computer when closing the lid. Or resuming for that matter.

You don't need a script for this - just configure your system accordingly. See the logind.conf man page for the systemd way fo doing it, and check out the "Suspend and Hibernate" wiki page for other options.

Then you added this:

timelaw wrote:

I'm looking for a script where I can do something once the lid closes and once the lid opens again.

Again, that wiki page will get you started.

And now you've added this:

timelaw wrote:

I want to learn how to actually script to customize my Notion and the general behaviour of my laptop when using Notion.

That covers a lot, wouldn't you agree? Way more than just suspending anyway. I'm not familiar with Notion at all, but if it was me, I'd start with whatever documentation is provided with it. If they have a forum/wiki/mailing list/irc/whatever, that could be useful to you also.


The first quote covers the second quote. And also, in that same post (the initial one) I stated that why I wish to learn how to to it with scripts because I may, later on, wish to hotkey these things more dynamically for other reasons.

And I am reading the wiki page and the Notion manual, but I don't want to necessarily make this Notion specific. I want to make this script for instance, separate, and I basically just gave you the backstory of why I need it. Since Notion doesn't handle it itself. So this question isn't about customising Notion, but more like how can I make a script in whatever language (so I can change/port/reuse for later usage. Basically a wrapper) to perform this task.

Either way, at the start I just wanted to delete my post since I didn't really know what to ask but I couldn't find a way to delete it (can you not delete threads?) so I thought I would just try to do something with the thread since apparently it has to stay...

Offline

#6 2014-05-13 05:15:06

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Script to put laptop in suspension mode when using Notion wm

timelaw wrote:

Either way, at the start I just wanted to delete my post since I didn't really know what to ask but I couldn't find a way to delete it (can you not delete threads?) so I thought I would just try to do something with the thread since apparently it has to stay...

You can use the "Report" button in the lower-left corner to request a thread be closed, if you feel that's necessary.

And I am reading the wiki page and the Notion manual, but I don't want to necessarily make this Notion specific.

As tomk said, suspending the system on lid close is configured in /etc/systemd/logind.conf and should work regardless of which environment you're using.

Offline

Board footer

Powered by FluxBB