Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reboot to windows option #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fabian-thomas
Copy link

This only works for systemd-boot. Tell me what you think about adding this to master. I mean we could add it to a second branch too.

@ohxxm
Copy link

ohxxm commented Apr 26, 2022

Since this only works for systemd-boot at the moment, adding this to another branch is more sufficient. When available with other bootloaders such as GRUB, rEFInd, etc, this should be added to the main branch, that is if the owner allows it.

@fabian-thomas
Copy link
Author

I guess the best option for now is to just keep this PR unmerged. But I agree, that this feature should live on it's own branch until other bootloaders work as well.

@ohxxm
Copy link

ohxxm commented May 23, 2022

This can be added to one of the forks such as mine(https://github.com/Spaxly/rofi-power-menu) as a separate branch. I will start development on this soon.

Comment on lines 18 to 19
# By default, show all (i.e., just copy the array)
show=("${all[@]}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# By default, show all (i.e., just copy the array)
show=("${all[@]}")
# By default, show all others except "Reboot to Windows"
show=(shutdown reboot suspend hibernate logout lockscreen)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, makes sense. Then this windows option should get added to the readme for visibility.

@@ -45,9 +47,10 @@ actions[suspend]="systemctl suspend"
actions[hibernate]="systemctl hibernate"
actions[reboot]="systemctl reboot"
actions[shutdown]="systemctl poweroff"
actions[windows]="systemctl reboot --boot-loader-entry=auto-windows --boot-loader-menu=0.5"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a generic way to reboot to Windows?

Also, why doesn't normal reboot work? I suppose you can choose which OS to launch during the boot time, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is quite old. I learned a lot since opening this, so I can explain more what would be the right way to do things.

Is this a generic way to reboot to Windows?

As noted above by Spaxly, this systemctl reboot --boot-loader... command only works when you use both systemd (as init) and systemd-boot (as bootloader).

Because setting the next entry is bootloader specific, one would need to add special commands for each bootloader. As I can see it, grub also supports rebooting into another entry. See the manpage. You can specify an entry there.

Using another init (i.e. no systemd) completely breaks the entire script, as there is no systemctl when using other inits. This is also discussed in #11.

Covering all the cases would be hard I guess, so a decision needs to be taken on which inits and boot loaders should be supported. I guess we could also just start with some inits and bootloaders and then extend if people are interested.

Also, why doesn't normal reboot work? I suppose you can choose which OS to launch during the boot time, right?

Yes, you are right. Usually when you use dual booting, your bootloader shows a screen where you can select the boot entry for a few seconds. What this command does though, is that it preselects the chosen entry. No user intervention is needed until the other entry/OS is booted up. That is somewhat convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants