I'm trying to create a process that will start with X11, will be graphical and unkillable by my own user.
More specifically, I have an urxvt drop-down terminal starting at startup and running a tmux session right away. What annoys me, is that I sometimes kill it with Alt+F4 when I forget that it is the drop-down terminal and I'm supposed to hide it instead.
Sure, I'm not losing my tmux session since I can reattach to it from another terminal, but I'd have to re-launch the drop-down terminal (with the exact config) and reattach and that's tedious.
What I would want to do, is to not be able to Alt+F4 kill this specific process.
After reading this: Make a process unkillable on Linux
I understood that I should launch the process as belonging to another user, yet even if I manage to do that within my own X server with:
sudo xhost +local: sudo runuser -l my-secondary-user -c urxvt
I face two unwanted behaviours:
- The process is killable by my main user (the one who owns the X session).
- The virtual terminal starts logged in as my-secondary-user (of course).
The (2) may be rectifiable - just run a command to login as my main user instead - but I have no idea on how to fix the (1).
Is there a way to make this work, or another way to do what I want? I'd rather avoid having to mess with creating kernel modules if possible.
Running Arch Linux with Openbox.
I got thinking that I may be able to make Alt+F4 not work for this specific window. found this: Openbox: disable Alt-F4 on per application basis
and modified my
<keybind key="A-F4"> <action name="If"> <application class="URxvt" title="tmux-session"> </application> <then><!-- Do nothing for urxvt-tmux-session --></then> <else> <action name="Close" /> </else> </action> </keybind>
This works slightly better than before: I cannot Alt+F4 that terminal, but also cannot Alt+F4 any urxvt window now. (Guess this is because new urxvt windows are all run under the same class-name?)
Besides that I can kill everything I need from the menu bar, or right clicking into my tint panel, or, of course, by command. But this approach means that:
- I can still kill my drop-down terminal by right-clicking into the tint2 panel (maybe fixable if I make the drop-down terminal not appearing as an icon to the panel - should be possible with some research).
- I cannot Alt+F4 other terminal windows (not liking it much, but maybe acceptable).