You are not logged in.

#26 2016-04-08 01:15:14

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Pretty cool Xaos. Correct me if I'm wrong, bl-exit is python no? Is your .ini config going to be python as well or bash?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#27 2016-04-08 01:22:55

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Wait... Maybe I'm as thick as a brick here.... but when I'm at the lightdm  the power option at the default top right (as shown in screen shot below)  does indeed have a hibernate function that works... How does it handle this same issue of swap space?  Would it be easier to just "port" the lightdm hibernate to our own usage?

hibernate.jpg


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#28 2016-04-08 01:45:34

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,087
Website

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

xaos52 wrote:

I am thinking of creating a bl-exit.ini config file for the bl-exit script, so that
most of the suggested options can be accommodated for.

The bl-exit script should work with default options in the absence of a config file.

Sounds good Doc!

Working  with a  config file makes it possible to create the configuration file
using questions and answers while running the 'bl-welcome' script.

There have been a number of suggestions recently for more options to be added to the welcome script, but I'm wondering just how much more stuff needs to go there. It could end up as a huge sequence of questions for new users to work through, a lot of them about things they don't care about so much...

My concept of bl-welcome:
*) Things that need fixing right away for any users to get a good experience.
*) Things that are tricky or not obvious to new users, but important.
*) Things that are just a PITA to do manually, but easily automated.

I wonder if editing bl-exit's config file might be something that could be left to the user, like a lot of other text files in BL?


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#29 2016-04-08 02:05:27

damo
....moderator....
Registered: 2015-08-20
Posts: 4,747

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

johnraff wrote:

....
I wonder if editing bl-exit's config file might be something that could be left to the user, like a lot of other text files in BL?

Yes - let's not let the welcome script get too bloated smile

I imagine we will get round to producing a config HowTo for new users which could include things like this.


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#30 2016-04-08 12:00:51

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

@Horizon-Brave

Pretty cool Xaos. Correct me if I'm wrong, bl-exit is python no? Is your .ini config going to be python as well or bash?

Yes, bl-exit is python2.
No, the config will be a text file with the .ini format (originally from windows)
But Python2 has modules to handle such files.
See ConfigParser

Wait... Maybe I'm as thick as a brick here.... but when I'm at the lightdm  the power option at the default top right (as shown in screen shot below)  does indeed have a hibernate function that works... How does it handle this same issue of swap space?  Would it be easier to just "port" the lightdm hibernate to our own usage?

Lightdm works by calling the same dbus calls to login1.Manager that I will be using.
lightdm has the calls implemented in C. I will be using Python.

Problem with the lightdm implementation is that you need to be at the login screen to be able to suspend, hibernate ...
So you first have to log out of your session to be able to hibernate, while one of the attractions of hibernate is to return to your session, with all of your applications as they were before the hibernate.

Or am I missing something?
Is it possible to get to the lightdm login screen without first logging out of your session?

@johnraff & damo
Using the bl-welcome script to customize the bl-exit configuration was not more than suggesting a possibilty that using a config file provides.

Offline

#31 2016-04-08 12:39:46

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

xaos52 wrote:

Problem with the lightdm implementation is that you need to be at the login screen to be able to suspend, hibernate ...
So you first have to log out of your session to be able to hibernate, while one of the attractions of hibernate is to return to your session, with all of your applications as they were before the hibernate.

Or am I missing something?
Is it possible to get to the lightdm login screen without first logging out of your session?
.

Well, if you right click on the desktop, and click lockscreen, it'll send you to the lightdm screen. From there you can click on the power button option in the top right, and choose hibernate, or whatever other power mode you wanted.  When you log back in, your session is how you left it.
Atleast on my machine, when I'm logged into a session, I right click on the desktop, selecting lockscreen brings up lightdm (called by lightlocker I'm assuming). When I logged back in before even choosing one of the power options, my session was still active.


BUT! This is all dependent on the person using lightdm/lightlocker, which i'm sure not everyone does, so I sort of concede my own point... B.L probably needs it's own "in desktop" hibernate function since not everyone will be using lightdm/lightlocker.


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#32 2016-04-08 12:59:47

kozimodo
Member
Registered: 2015-10-04
Posts: 34

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Actually, one does not need to log out to hibernate using lightdm -- light-locker gives the user the option to hibernate as well.

Offline

#33 2016-04-08 14:14:26

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

^and ^^
Thanks. I was missing this.
Must be because I never use the openbox main menu.

Offline

#34 2016-04-08 18:02:40

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

xaos52 wrote:

^and ^^
Thanks. I was missing this.
Must be because I never use the openbox main menu.

heh.  Also, I wanted to bring this up earlier, but I didn't want to diverge the conversation... As of now if you run the bl-exit script from the command line, (perhaps you're not using openbox specifically) it runs the script and you get the options to power off the system.
But if you run this command from a completely non-graphical target (ctrl + alt + f2  for example)  it completely crashes and gives a segmentation fault error, because there is no graphical target/session.   Should there be a better error message displayed or handled for this?   Attached below is a screenshot of the error you get when you try the bl-exit command from a pure login shell and not from any x11 session:

Segerr.jpg

This is probably a non-issue, but something to think about for later perhaps, just so a user won't be greeted with an ugly error message!


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#35 2016-04-08 18:18:09

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

^Good catch.

As bl-exit is now, if it is run without arguments, it is presumed to run in a graphical environment.
It would indeed be better to check whether that presumption can be proven true, and exit with an error message if it is not true.

Thank you for reporting this.

Edit:
Testing if the  DISPLAY environment variable is set should be sufficient, I think.

Offline

#36 2016-04-11 21:44:14

ghorvath
Member
Registered: 2015-10-01
Posts: 130

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Somebody mentioned that they cannot possibly imagine this to be a useful functionality on desktop machines. It is very important if one wants to preserve the current state AND wants to make sure it survives a power loss.

I personally have the suspend button call hybrid-suspend on desktop machines so even if a powerloss happens, they would not lose the state.

Offline

#37 2016-04-12 06:14:25

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,087
Website

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

ghorvath wrote:

(Suspend/Hibernate) It is very important if one wants to preserve the current state AND wants to make sure it survives a power loss.

Good point. Even if power cuts might be rare where you live, there's always the possibility of a plug being pulled out. And desktops don't have batteries.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#38 2016-04-13 10:18:48

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

For anyone interested, I have a working version of the 'configurable bl-exit' script available on github.

Apparently nothing has changed if you run the script without configuration file. You get the same buttons as the previous version.

Under the hood these changes were made:
1. the script can be launched from a console. You need to specify an action.
For instance:

bl-exit --suspend

2. You can now configure it to your taste using a config file:

The script searches for its config file in (in this order. Uses first one if it exists)
1. $XDG_CONFIG_HOME/bl-exit/bl-exitrc
2. $HOME/.config/bl-exit/bl-exitrc

The config script has the ini format.
All sections, options and values shouldbe in lower case.

The 'show' option has as possible values one of:
1. always
2. never
3. maybe

Values always and never should be clear for everyone.
'maybe' means that the script will check if the corrensponding action is available.
If it is available, the corresponding button is shown.
If it is not available the button is shown, but is greyed out and not clickable.

The option 'onerror' can take one of the values
1. novisual
2. visual

This controls whether on error a message is logged to $HOME/.xsession-errors or a popup screen is shown with some explanation of what happened.

For example if you want the 'hibernate' button to show up if it is available, and  see visual feedback on error:

[hibernate]
show = maybe
onerror = visual

Each of the options is optional.

There are 3 levels that determine which options apply:

By default - hardcoded in the script - the cancel,  logout, suspend, reboot and poweroff buttons are shown and onerror is set to novisual.

On the second level you can add a 'default' section. These options apply to all buttons.  They override the hardcoded options. But they can in their turn be overridden by a button specific option. This isecion is optional.

The third level is a button specific section, one of

[logout]
[suspend]
[hibernate]
[hybridsleep]
[reboot]
[poweroff]

to control the options per button.

Each of these sections is optional.

Left to do:
1. Examine use of --force from the command line
2. Add hybridsleep DONE
3. Examining behaviour when inhibitors are active
4. Eventually showing explanation when hovering over a greyed out button
5. ...

Any feedback is welcome.

Edit:
- changed path to config file (thanks damo)

Offline

#39 2016-04-13 12:21:04

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Downloaded the zip, put bl-exit in ~/bin and added it to my OB Menu.  It will not start, but my old s11-exit works fine

		<item label="Debrief">
			<action name="Execute">
				<command>s11-exit</command>
			</action>
		</item>
		<item label="test">
			<action name="Execute">
				<command>bl-exit</command>
			</action>
		</item>
/home/sector11/bin/bl-exit
/home/sector11/bin/s11-exit

So I tried a copy in /usr/bin/ - no go either.  sad

EDIT:  I should add that they had proper permissions to run as a file.

Last edited by Sector11 (2016-04-13 12:24:25)


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#40 2016-04-13 12:51:42

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Paste output of

which -a bl-exit

please.

Offline

#41 2016-04-13 13:17:54

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Here you go:

 13 Apr 16 @ 10:15:52 ~
  $ which -a bl-exit
/home/sector11/bin/bl-exit
/home/sector11/bin/bl-exit
 
 13 Apr 16 @ 10:16:05 ~
  $ 

EDIT: and just because

 13 Apr 16 @ 10:18:36 ~
  $ which -a s11-exit
/home/sector11/bin/s11-exit
/home/sector11/bin/s11-exit
 
 13 Apr 16 @ 10:18:42 ~
  $ 

Last edited by Sector11 (2016-04-13 13:19:19)


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#42 2016-04-13 13:30:43

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Strange that the same path is listed twice.
From a terminal instance, post output of

env | grep PATH

if you don't mind.

Offline

#43 2016-04-13 13:41:50

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Yea, I thought so to until I saw this:

 13 Apr 16 @ 10:33:01 ~
  $ $PATH
bash: /home/sector11/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/sector11/bin: No such file or directory
 
 13 Apr 16 @ 10:33:07 ~
  $ 

which of course raises another Q:  Why twice there? ops

Ahhhh new command - don't mine at all:

 13 Apr 16 @ 10:37:15 ~
  $ env | grep PATH
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
PATH=/home/sector11/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/sector11/bin
 
 13 Apr 16 @ 10:37:26 ~
  $ 

... and again twice.  Well of course $PATH is $PATH no matter how you look at it.  roll

In case you are thinking about asking:  There is no $PATH set in /home/sector11/.config/openbox/autostart.  I recall at one time (#! Statler I think) I had set $PATH in autostart.sh to include ~/bin

Last edited by Sector11 (2016-04-13 13:44:22)


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#44 2016-04-13 13:53:54

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

You have /home/sector11/bin twice in your PATH. Once at the front, and once at the end.

That explains why commands in /home/sector11/bin are listed twice when you run
which -a <command>

It does not explain why bl-exit does not work for you.

Does it work if you launch 'bl-exit' from a terminal window?

Offline

#45 2016-04-13 14:14:33

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

And /etc/login.defs  doesn't have ~/bin at all.

Don't know how to edit $PATH .  sad

Does not work in a terminal:

 13 Apr 16 @ 11:12:36 ~
  $ bl-exit
/home/sector11/.themes/S11-NS-brushed/gtk-2.0/panel.rc:32: Unable to locate image file in pixmap_path: "shadows/window-bg.png"

... but doesn't let the terminal continue to the closing prompt.

Mine works:
2016_04_13_11_15_53_Scrot11.jpg

Last edited by Sector11 (2016-04-13 14:17:14)


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#46 2016-04-13 14:26:20

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Looks like a gtk theming problem? Or else you have an entirely different script in bl-exit.

less /home/sector11/bin/bl-exit 

should start with

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from __future__ import print_function

import os
display = os.environ.get('DISPLAY') != None

import os
import getopt
import getpass
import subprocess
import sys

me = 'bl-exit'
# Default errorMessages dict
# key = result from _can_do_it
# value = string shown in error_message_dialog
canDoItErrorMessages = dict(
    no         = "Action is not allowed.",
    na         = "Action is not available.",
    challenge  = "Action is not authorized."
)

# Translate command-line option to method - command line only
actionToMethod = dict(
    logout    = 'Logout',
    l         = 'Logout',
    suspend   = 'Suspend',
    s         = 'Suspend',
    hybridsleep = 'HybridSleep',
    y           = 'HybridSleep',
    hibernate = 'Hibernate',
/home/me/bin/bl-exit

As to setting PATH, there are different methods to do it.
Here is how I do it to prepend $HOME/bin to PATH:

file $HOME/.profile:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
#
# Modified version provided by bunsen-configs.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# include sbin in PATH
if [ -d "/sbin" ] ; then
    PATH="/sbin:$PATH"
fi
if [ -d "/usr/sbin" ] ; then
    PATH="/usr/sbin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Q: Does the 'official' bl-exit work for you?

Offline

#47 2016-04-13 15:21:10

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

2016_04_13_12_14_00_Scrot11.jpg
Yup, that's what I have - downloaded it this morning after getting an email notification of a new post here; your post #38

These are showing here but need their own thread:

My problem is, as you noticed I have two "~/bin" in my path and I can't find were/what to edit so there is only one.  But that's a different problem.

Yea, my theme is missing some .pngs - must research that some day as well  smile


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#48 2016-04-13 15:27:58

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

Q: Does the 'official' bl-exit work for you?

I edited my previous post to add this question.

Offline

#49 2016-04-13 15:50:19

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

OH sorry ... just a sec ... will go find it.


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#50 2016-04-13 16:04:06

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,247

Re: [OBSOLETE] The bunsenlabs 'exit' menu entry

ops  Don't have it ... where can I get it?

Be right back.

2016_04_13_13_11_57_Scrot11.jpg
OK, I have it, it works.  I used it to make my modified s11-exit script at one time.


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

Board footer

Powered by FluxBB