ImTheOrly
Posts: 2
Joined: Mon May 20, 2019 4:41 pm

How to disable Alt-F4 on Rasperry

Tue May 21, 2019 5:07 am

Hi, I want to make a Web kiosk with my raspberry pi. I achieved that by modifying the autostart file (I added the chromium --kiosk command in it), and it works, but someone can simply press alt+F4 to get rid of the kiosk. My goal is to disable the alt-f4 shortcut so that people can't close the kiosk, but I've no clue on how to do that
I'm desperate, by the way, looking for hours into Google and nothing works.
PS: There's no openbox directory in the .config folder
Last edited by ImTheOrly on Fri May 24, 2019 5:26 pm, edited 1 time in total.

User avatar
topguy
Posts: 5464
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to disable Alt-F4 on Rasperry

Tue May 21, 2019 11:31 am

Do you need to run openbox ? The app should be able to run borderless without any window manager.

klricks
Posts: 6359
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to disable Alt-F4 on Rasperry

Tue May 21, 2019 12:42 pm

ImTheOrly wrote:
Tue May 21, 2019 5:07 am
Hi, I want to make a Web kiosk with my raspberry pi. I achieved that by modifying the autostart file (I added the chromium --kiosk command in it), and it works, but someone can simply press alt+F4 to get rid of the kiosk.
I'mdesperate, by the way, looking for hours into Google and nothing works.
PS: There's no openbox directory in the .config folder
I don't know the answer but there are several other shortcuts as well:

[Ctrl] [Alt] t
[Ctrl] [Alt] [F2]
[Alt] [Tab]
[Super Key] (Windows logo key)
Probably some others...........
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

ImTheOrly
Posts: 2
Joined: Mon May 20, 2019 4:41 pm

Re: How to disable Alt-F4 on Rasperry

Fri May 24, 2019 5:28 pm

klricks wrote:
Tue May 21, 2019 12:42 pm
ImTheOrly wrote:
Tue May 21, 2019 5:07 am
Hi, I want to make a Web kiosk with my raspberry pi. I achieved that by modifying the autostart file (I added the chromium --kiosk command in it), and it works, but someone can simply press alt+F4 to get rid of the kiosk.
I'mdesperate, by the way, looking for hours into Google and nothing works.
PS: There's no openbox directory in the .config folder
I don't know the answer but there are several other shortcuts as well:

[Ctrl] [Alt] t
[Ctrl] [Alt] [F2]
[Alt] [Tab]
[Super Key] (Windows logo key)
Probably some others...........
Well, I forgot to put the last sentence in my post. I probably deleted it accidentally.
My problem is pn how to disable the alt-f4 shortcut

Andyroo
Posts: 2827
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How to disable Alt-F4 on Rasperry

Fri May 24, 2019 6:59 pm

The shortcut has nothing to do with Chromium (its window manager / OS somewhere but I have not got that far into the system yet) so I think you are going to have to tackle it this way (no Pi handy with a GUI at the mo):

Try using

Code: Select all

xmodmap -pke
and see if you can find the code for left and right ALT keys, then use a couple of lines like

Code: Select all

xmodmap -e "keycode xx = "
where xx is the data from above before starting Chromium in a script.

This then stops ALT-F4 from working by disabling the ALT keys

The other way (as seen in certain public buildings that shall remain nameless) is to use a keyboard where the ALT keys have been filled underneath with hot snot glue :lol:
Need Pi spray - these things are breeding in my house...

klricks
Posts: 6359
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to disable Alt-F4 on Rasperry

Sat May 25, 2019 2:41 am

Andyroo wrote:
Fri May 24, 2019 6:59 pm
The shortcut has nothing to do with Chromium (its window manager / OS somewhere but I have not got that far into the system yet) so I think you are going to have to tackle it this way (no Pi handy with a GUI at the mo):

Try using

Code: Select all

xmodmap -pke
and see if you can find the code for left and right ALT keys, then use a couple of lines like

Code: Select all

xmodmap -e "keycode xx = "
where xx is the data from above before starting Chromium in a script.

This then stops ALT-F4 from working by disabling the ALT keys

The other way (as seen in certain public buildings that shall remain nameless) is to use a keyboard where the ALT keys have been filled underneath with hot snot glue :lol:
These commands work for most Desktop applications such as Filemanager, LXterminal etc....

Code: Select all

xmodmap -e "keycode 64 = "  # Disable Left Alt
xmodmap -e "keycode 108 = " # Disable Right Alt
xmodmap -e "keycode 133 = " # Disable Left "Super" Key
But [Alt] [F4] still persists in Chromium.... So [Alt] [F4] appears to be hardcoded into the Chromium browser software itself. Google turned up others asking the same question with no solutions.

Note that the above commands do prevent the "Super" key menu and prevents [CTRL][Alt] t from opening a terminal window on top of the browser....

Also note that the default keycodes will be restored on reboot.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

Return to “Advanced users”