You are not logged in.
TL;DR: How can I create a custom sddm button to execute a simple 2 commands script instead of opening an actual Desktop Environment?
So, I have a Microsoft Surface with Windows/Linux dual boot, which I use mostly with touch controls only (no physical keyboard).
Linux is my main OS but sometimes I need to boot to Windows. Since this device's bios does not have a simple touch-only boot menu, whenever I want to boot into windows, I must log into linux, open a terminal and run
efibootmgr --bootnext <windows boot entry>and then
reboot nowI am looking for a way to run these commands straight from sddm without the need to login and open a terminal, just like I have the reboot and shutdown buttons. I was thinking maybe creating a new Xsession that executes a bash script somewhere instead of the usual startplasma or whatever, but I don't know where this file would exist or what format it would have.
Does anyone know if that is even possible or how this can be achieved, please?
Thank you.
Last edited by tvidal (2023-02-13 10:47:18)
Offline
See https://wiki.archlinux.org/title/displa … figuration
So something like this at /usr/local/share/xsessions/boot_windows.desktop might work:
[Desktop Entry]
Name=Reboot into Windows
Comment=Set Windows boot entry as first
Exec=/usr/local/bin/boot_windows
TryExec=/usr/local/bin/boot_windows
Icon=Windows.png
Type=ApplicationWith a corresponding executable script at /usr/local/bin/boot_windows containing the necessary commands.
EDIT: place the Windows icon at /usr/local/share/pixmaps/windows.png
Last edited by Head_on_a_Stick (2023-02-12 21:21:13)
Jin, Jîyan, Azadî
Offline
See https://wiki.archlinux.org/title/displa … figuration
So something like this at /usr/local/share/xsessions/boot_windows.desktop might work:
(...)
Thank you for your response, that got me a bit closer I think.
Using /usr/local/share/xsessions did not work, but when I moved the .desktop file to /usr/share/xsessions I can see a dropdown prompt to select the session on the bottom left corner of the screen.
I am not considering other options, like creating a specific passwordless user to boot straight into windows or creating a custom theme with a button to execute this script next to reboot/shutdown, etc... but your solution was by far the easiest and has got me going in the short term.
Thank you.
btw, here's the reboot-windows zsh script for future google results of this topic:
#!/usr/bin/env zsh
set -x
[ $UID -eq 0 ] || exec sudo ${0:A}
efibootmgr | awk '$2 == "Windows" {print substr($1, 5, 4)}' | xargs efibootmgr --bootnext
rebootOffline
Using /usr/local/share/xsessions did not work
Oops, sorry about that. I don't use a display manager myself so I didn't test. Seems like /usr/local/share/xsessions/ should work though, but perhaps that's just me.
Jin, Jîyan, Azadî
Offline