You are not logged in.
I'm trying to setup bspwm and I have to use sxhkd for all the keybindings, which means sxhkd will have to be run everytime I boot. I know how to use .xinitrc and .bashrc, but I was looking through the wiki and saw you could use systemd for these purposes as well. Unfortunately desktop entries won't work without a DE and if I want to do something similar I'd have to make xorg a user service. I'm not really sure how systemd services, xorg, and user services all relate to each other so setting this up seems a bit cumbersome right now.
Could someone break down the process for me?
Last edited by polgesteirg (2020-12-11 23:36:09)
Offline
Can't you just put sxhkd in your bspwmrc and that's it? It seems like the most reasonable way.
Offline
Here's a fairly comprehensive write-up about systemd from Digital Ocean: https://www.digitalocean.com/community/ … unit-files
Here are the systemd unit docs: https://www.freedesktop.org/software/sy … .unit.html
I think putting the call into
~/.xinitrcseems like a reasonable solution. That way it will work only for your user. As you said, you can also use systemd for this and place your .service file in
/etc/systemd/userthen do:
systemctl enable <path_to_service>
systemctl start <name_of_service>Have a look at other .service systemd units to see how they launch and allow supervision of binaries/daemons. Especially database servers. But that might be a little too heavy-handed approach for your use case, unless the extra goal is to learn systemd
.
Offline
Have you read through Systemd/User#Xorg_as_a_systemd_user_service and the limitations of the approach?
Offline
I'm trying to setup bspwm and I have to use sxhkd for all the keybindings, which means sxhkd will have to be run everytime I boot.
No, it will have to be run everytime you start X. No more, no less. If you restart X without rebooting, you'll have to restart sxhkd. If you boot without starting X, you will not need to / be able to run sxhkd.
I know how to use .xinitrc and .bashrc, but I was looking through the wiki and saw you could use systemd for these purposes as well.
Bashrc? No, that's not relevant here. But xinitrc is the right way to do this (if you start X with xinit/startx). The fact that you can (attempt to) shoehorn this into a complex and error-prone systemd user service approach is no reason to consider it.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
polgesteirg, bspwm is normally started from a file like .xinitrc in your home. There you can also put other applications you want to start, like sxhkd. .bashrc (not Bashrc, because Linux is case sensitive) is not relevant for starting a window manager with Xorg.
Systemd is not recommended here.
A dog is a man's best friend.
Offline
Sorry for the late response everyone. I've been a little busy with school. I did manage to setup bspwm and sxhkd via the recommended way. I'm mostly trying to learn about daemons, systemd, and how default programs actually work.
Here's a fairly comprehensive write-up about systemd from Digital Ocean: https://www.digitalocean.com/community/ … unit-files
Here are the systemd unit docs: https://www.freedesktop.org/software/sy … .unit.htmlI think putting the call into
~/.xinitrc
seems like a reasonable solution. That way it will work only for your user. As you said, you can also use systemd for this and place your .service file in
/etc/systemd/user
then do:
systemctl enable <path_to_service>
systemctl start <name_of_service>Have a look at other .service systemd units to see how they launch and allow supervision of binaries/daemons. Especially database servers. But that might be a little too heavy-handed approach for your use case, unless the extra goal is to learn systemd smile.
I'll look into those resources! On the topic of starting daemons and config, I remember reading on the emacs wiki that starting it as a daemon saves configs or something along those lines. Is there any benefit to starting programs as daemons on boot if you're going to use them every time?
polgesteirg wrote:I'm trying to setup bspwm and I have to use sxhkd for all the keybindings, which means sxhkd will have to be run everytime I boot.
No, it will have to be run everytime you start X. No more, no less. If you restart X without rebooting, you'll have to restart sxhkd. If you boot without starting X, you will not need to / be able to run sxhkd.
polgesteirg wrote:I know how to use .xinitrc and .bashrc, but I was looking through the wiki and saw you could use systemd for these purposes as well.
Bashrc? No, that's not relevant here. But xinitrc is the right way to do this (if you start X with xinit/startx). The fact that you can (attempt to) shoehorn this into a complex and error-prone systemd user service approach is no reason to consider it.
You helped me understand some things better for sure, thank you!
Right now I have one more question: how does arch know which programs to use as default for certain actions? I know from a terminal you can define environment variables, but when inside other applications how do they figure out what to use by default?
Offline
On the topic of starting daemons and config, I remember reading on the emacs wiki that starting it as a daemon saves configs or something along those lines. Is there any benefit to starting programs as daemons on boot if you're going to use them every time?
The differences between daemonised startup and none daemonised startup would be unique to each application.
Offline
how does arch know which programs to use as default for certain actions?
That's phrased as a question, but it has not actual content. What do you mean? "Arch" does not "know" anything. What actions are you talking about?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
polgesteirg wrote:how does arch know which programs to use as default for certain actions?
That's phrased as a question, but it has not actual content. What do you mean? "Arch" does not "know" anything. What actions are you talking about?
Say I was using dolphin to open a pdf file. You can usually double click it and it will open the file with a default program. Can software like dolphin look for global specification that one can set or does it have to be set up in every program separately?
polgesteirg wrote:polgesteirg wrote:
On the topic of starting daemons and config, I remember reading on the emacs wiki that starting it as a daemon saves configs or something along those lines. Is there any benefit to starting programs as daemons on boot if you're going to use them every time?
The differences between daemonised startup and none daemonised startup would be unique to each application.
I see. Apparently starting emacs as a daemon allows it to skip loading your config every time. That's good to know.
Offline
Say I was using dolphin to open a pdf file. You can usually double click it and it will open the file with a default program. Can software like dolphin look for global specification that one can set or does it have to be set up in every program separately?
man xdg-mimeAlso see the wiki
Last edited by skunktrader (2020-12-16 05:54:59)
Offline
polgestreig, you are talking about mimetypes!
A dog is a man's best friend.
Offline
polgesteirg wrote:Say I was using dolphin to open a pdf file. You can usually double click it and it will open the file with a default program. Can software like dolphin look for global specification that one can set or does it have to be set up in every program separately?
man xdg-mimeAlso see the wiki
Awesome! This look like it's exactly what I was looking for. I wish I'd found a link to that page in the wiki before. Thanks.
Offline