Giter Site home page Giter Site logo

Comments (35)

soreau avatar soreau commented on July 3, 2024 1

To exit wayfire, you can use Ctrl+Alt+Backspace.

There is not a way to do this with wf-shell yet as far as I know.

from wf-shell.

soreau avatar soreau commented on July 3, 2024 1

@nwg-piotr I just asked how a compositor should be exited from a panel or whatever, and I was told that the following can be done:

1. Open the wayland socket which is typically `$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY`

2. Use SO_PEERCRED to get the PID of the compositor on that socket

3. Send SIGINT to the compositor

All of this can happen in a small C program, or maybe a python script.

On a side note, wayfire doesn't handle SIGINT properly, but that is a problem with Wayfire itself.

I have created https://github.com/soreau/wayland-logout based on this.

from wf-shell.

epsilon-0 avatar epsilon-0 commented on July 3, 2024 1

@soreau's based script is dank af.
I give it a 5/7

from wf-shell.

ericonr avatar ericonr commented on July 3, 2024

To exit wayfire, you can use Ctrl+Alt+Backspace.

Is this documented anywhere? I couldn't find it.

Even so, I believe it would be a good idea if wf-shell could be used to exit a session (or even turn off a system), because it seems like it's a system designed in a way that can be used primarily by mouse as well.

It's open to discussion how this might be best implemented.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

To exit wayfire, you can use Ctrl+Alt+Backspace.

Is this documented anywhere? I couldn't find it.

I don't think so. I also couldn't find any documentation on how to start wayfire. Perhaps it could be added somewhere like the wiki.

Even so, I believe it would be a good idea if wf-shell could be used to exit a session (or even turn off a system), because it seems like it's a system designed in a way that can be used primarily by mouse as well.

It's open to discussion how this might be best implemented.

Perhaps we could have string options that point to scripts for logout, reboot and shutdown. If the option is set, a button is created in the menu for it. By default the options would not be set so the buttons wouldn't exist but we could add some example scripts to the wiki and when used, the buttons would automatically show and execute the respective script. @ammen99 what do you think?

from wf-shell.

ammen99 avatar ammen99 commented on July 3, 2024

The biggest problem with such a feature is that if you have multiple Wayfire instances, you want to only close the current one. So Wayfire and wf-shell would need to communicate via either DBus or via a Wayland protocol. I can imagine that we can have a small wayland protocol plugin in Wayfire which accepts such commands, and a small widget in wf-shell which uses this protocol.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

@ammen99 True indeed, I had considered a protocol first but thought this might be too complex. Do we have any example of a plugin implementing a protocol yet?

from wf-shell.

ammen99 avatar ammen99 commented on July 3, 2024

No, but it is not hard to do. Just create a singleton plugin like autostart, and in the constructor set up the wl_global and callbacks.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

@ericonr If you feel like this is something you'd like to do, you probably should join #wayfire on irc.freenode.net where we can chat. I must say that for a newcomer, this task might be a bit daunting, though we should be able to help you through it.

from wf-shell.

ericonr avatar ericonr commented on July 3, 2024

Yeah, the task seems to have increased in scope a bit. I felt the IPC interface on sway, using a socket, works pretty well overall. Is there any reason in particular this project doesn't use that?

Is making a wayland protocol exclusively for wayfire logout a "sustainable" endeavor? I don't know much about this, so I could be talking nonsense, though. Any reason you thought about implementing a protocol instead of a DBus interface?

I just joined your channel on freenode as well!

from wf-shell.

soreau avatar soreau commented on July 3, 2024

Is making a wayland protocol exclusively for wayfire logout a "sustainable" endeavor? I don't know much about this, so I could be talking nonsense, though. Any reason you thought about implementing a protocol instead of a DBus interface?

As @ammen99 outlined, there must be some sort of IPC, whether it be DBus, protocol or another socket. I assume wayland protocol by default since it's native and wayfire doesn't currently use DBus or any other IPC.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

#30 offers an option, which I've added to the wiki.

from wf-shell.

ammen99 avatar ammen99 commented on July 3, 2024

Actually if you don't run multiple Wayfire sessions on the same machine, you can also just add a launcher which does pkill wayfire

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

I first installed Wayfire last night, and got to this thread in search of solution to this issue. While answering, I did not yet know that there was no command to exit the session, apart from the built-in key binding. It would be really useful. @ericonr , if you know a reasonable workaround, join the thread, please.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

There is no integrated logout button in wf-shell but there is Ctrl+Alt+Backspace to end the wayfire session or you can look here for wlogout.

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

or you can look here for wlogout

I know, but this is not a solution to this certain issue. To have a "Logout" button in nwgbar, a command is necessary, not another set of buttons.

from wf-shell.

epsilon-0 avatar epsilon-0 commented on July 3, 2024

@soreau isn't wf-shell just an application that is started by wayfire? So exiting wf-shell shouldn't be the goal (I think).
From the minimal look over nwgbar, it seems to be using swaymsg to send a command (or is it an api call??) to sway to logout.
Something like an invoker for wayfire api would be the desirable outcome, @nwg-piotr correct me if I am wrong.
I guess the dbus thing mentioned above is aiming to solve this.

I defer judgements and decisions.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

@soreau isn't wf-shell just an application that is started by wayfire? So exiting wf-shell shouldn't be the goal (I think).

I don't understand what you mean by this. Why would you only want to shutdown the shell apps? I thought the goal was to run a command that either a) exits wayfire immediately, or b) start a gui app that allows you to choose shutdown/logout/etc. I thought wlogout provides b.

From the minimal look over nwgbar, it seems to be using swaymsg to send a command (or is it an api call??) to sway to logout.

Can't it just call wlogout instead of swaymsg or whatever?

Something like an invoker for wayfire api would be the desirable outcome, @nwg-piotr correct me if I am wrong.
I guess the dbus thing mentioned above is aiming to solve this.

I defer judgements and decisions.

from wf-shell.

epsilon-0 avatar epsilon-0 commented on July 3, 2024

@soreau isn't wf-shell just an application that is started by wayfire? So exiting wf-shell shouldn't be the goal (I think).

I don't understand what you mean by this. Why would you only want to shutdown the shell apps? I thought the goal was to run a command that either a) exits wayfire immediately, or b) start a gui app that allows you to choose shutdown/logout/etc. I thought wlogout provides b.

I am actually agreeing with what you said, I don't know if I phrased it weirdly.
OTOH, I don't think even wlogout provides (b) as even wlogout needs the logout button to be mapped to a command (though I haven't tested this theory out).

From the minimal look over nwgbar, it seems to be using swaymsg to send a command (or is it an api call??) to sway to logout.

Can't it just call wlogout instead of swaymsg or whatever?

What the result would be
Open nwgbar > Press logout button > Opens wlogout > Press logout button (which does nothing, as there's still no logout command)

Both wlogout and nwgbar need some command to map the buttons to.

Something like an invoker for wayfire api would be the desirable outcome, @nwg-piotr correct me if I am wrong.
I guess the dbus thing mentioned above is aiming to solve this.
I defer judgements and decisions.

from wf-shell.

wb9688 avatar wb9688 commented on July 3, 2024

If using logind, you could use loginctl terminate-user $USER, which is also set by default as logout command in wlogout.

Edit: loginctl terminate-session $XDG_SESSION_ID is superior as it will only terminate your current session, instead of all sessions of the current user.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

What the result would be
Open nwgbar > Press logout button > Opens wlogout > Press logout button (which does nothing, as there's still no logout command)

Ah, I didn't realize wlogout doesn't actually do anything.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

If using logind, you could use loginctl terminate-user $USER, which is also set by default as logout command in wlogout.

Then again, maybe it does?

from wf-shell.

epsilon-0 avatar epsilon-0 commented on July 3, 2024

@soreau interesting workaround, then this should work similarly for nwgbar, both are basically similar for end user command configuration.
Though this still has the same aforementioned issues

As @ammen99 outlined, there must be some sort of IPC, whether it be DBus, protocol or another socket. I assume wayland protocol by default since it's native and wayfire doesn't currently use DBus or any other IPC.

from wf-shell.

soreau avatar soreau commented on July 3, 2024

And there is a dbus plugin now, though it isn't upstreamed to wayfire. Maybe wayfire-plugins-extra could house it but I'm not sure how @ammen99 would feel about this..

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

you could use loginctl terminate-user $USER

On my machine this ends the wayfire / sway session, but it hangs afterwards.

Finally - nwgbar is just a button bar, nothing else. It's up to the user which commands to use. As far as I know, the same problem appears on dwm.

from wf-shell.

ammen99 avatar ammen99 commented on July 3, 2024

@nwg-piotr I just asked how a compositor should be exited from a panel or whatever, and I was told that the following can be done:

  1. Open the wayland socket which is typically $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
  2. Use SO_PEERCRED to get the PID of the compositor on that socket
  3. Send SIGINT to the compositor

All of this can happen in a small C program, or maybe a python script.

On a side note, wayfire doesn't handle SIGINT properly, but that is a problem with Wayfire itself.

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

One way or another, the nwgbar command, a part of nwg-launchers, is just a configurable button bar, which does nothing else but displays a horizontal or vertical row of buttons assigned to user-defined commands. The sample template, which comes preinstalled, creates the exit menu for sway on Arch Linux:

[
  {
    "name": "Lock screen",
    "exec": "swaylock -f -c 000000",
    "icon": "system-lock-screen"
  },
  {
    "name": "Logout",
    "exec": "swaymsg exit",
    "icon": "system-log-out"
  },
  {
    "name": "Reboot",
    "exec": "systemctl reboot",
    "icon": "system-reboot"
  },
  {
    "name": "Shutdown",
    "exec": "systemctl -i poweroff",
    "icon": "system-shutdown"
  }
]

However, this may be ANY set of buttons with ANY commands. Whatever could be called here to exit Wayfire, must be an external command/script.

image

from wf-shell.

ammen99 avatar ammen99 commented on July 3, 2024

I understand, that's why I said the above steps can be executed by a small script which can then be put as a command there. I will try to put something together in the next few days and see how well it works.

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

Thanks in advance! Also on behalf of @epsilon-0 , I believe. :)

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

I have created https://github.com/soreau/wayland-logout based on this.

It would be great to make it available to users in some way.

At least I'll give it a try. Tomorrow, as it's almost 4 am in my place. I was working on displays detection in Azote for it to work on Wayfire. Seems to be all right now (not yet merged).

from wf-shell.

soreau avatar soreau commented on July 3, 2024

Also I have pushed a python version as well.

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

Even better!

from wf-shell.

nwg-piotr avatar nwg-piotr commented on July 3, 2024

@soreau While at the office, I tested the python version. Works perfectly well.

from wf-shell.

ammen99 avatar ammen99 commented on July 3, 2024

Fixed in #71

from wf-shell.

epsilon-0 avatar epsilon-0 commented on July 3, 2024

thanks @soreau @ammen99

from wf-shell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.