Score:2

Is there a way to change the display monitor with a keyboard shortcut?

bn flag

I have Ubuntu installed on my laptop and when I at home I connect it to an external monitor through an HDMI cable. If I press the f4 key on my laptop, a graphic pops up and I can cycle through the display options Mirror, Join displays, External only, and Built in only without having to open settings and change it there. When my laptop is connected to my monitior, I use a wireless usb keyboard. My usb keyboard's f4 key does not have the same functionality as the f4 key on my laptop's built in keyboard. I noticed that it was possible to add custom keyboard shortcuts that can run commands. Is there a way to change the display settings or bring up that graphic with a command? Or is there some other way to simulate pressing the f4 key on my laptop when I press a key on my usb keyboard?

ChanganAuto avatar
us flag
Function keys are functions keys everywhere. F4 is always F4 regardless of the keyboard. Probably your wireless keyboard have additional functions in those keys and, "for your convenience", the primary and secondary functions have been inverted. That being the case use FN+F4 instead.
UnoriginalName369636 avatar
bn flag
Fn+F4 on my wireless keyboard does not seem to do anything. The only thing the Fn key seems to change is that Fn+F7 seems to disable and enable the touchpad, while F7 alone seems to do nothing. On my laptop keyboard, every function key also has a secondary function like changing the volume or brightness. Pressing Fn plus the Function keys on my wireless keyboard does not have the same effect that pressing the function keys on my laptop's keyboard has. My wireless keyboard has dedicated keys for many of these functions, but not for changing the display.
UnoriginalName369636 avatar
bn flag
I am a computer science student and I know how to write visual programs in java using javafx. When I write the line "System.out.println("" + keyEvent.getCode());" into one of my existing projects it prints out the key code for every key that I press. When I press a key like F3 on my wireless keyboard, it prints out "F3", but when I press F3 on my laptop's keyboard it does not print anything, and just increases the brightness. I do not know whether that is actually useful, but it makes me think that the change displays key on my laptop is not really acting like a function key.
Levente avatar
cn flag
The `Super+P` answer is brilliant. I just wanted to suggest in general, that if you can figure out how to do a specific task on the command line, then you can save that command / those commands as a shell script file (the ones with the `.sh` extension), set up its permission as executable, and then in the regular settings app you can create a new keyboard shortcut, and assign your shell script file as the action for it. You can then orchestrate a whole bunch of things through your keyboard-invoked script files.
Score:1
bn flag

I found out that the key combination Super+P does the exact same thing that F4 on my built in laptop does. I cannot find it under the keyboard shortcuts menu in settings though, so I do not know how to change it. I also discovered that holding down the super key after pressing P leaves the menu open while the super key is held, which is super convenient. Before I discovered this I would have to press the key F4 on my keyboard over and over again to keep the menu open and cycle through the options until my brain processed where the options were in the menu and which one I wanted and I could stop on the one I wanted.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.