Using brightness/volume keys in tty/virtual console?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm wondering if it's possible to adjust (increment/decrement) brightness or volume with a laptop keyboard's dedicated brightness/volume keys in the virtual console.
Can the system be configured to perform a background operation in response to a single keypress, or is the only mode of interaction via the command line? (I have already found ways to make the adjustments via the command line.)
The only comparable example I can think of is the power button signaling an immediate system halt. However, I suspect that operates on a different level, since when I tried pressing it at the showkey
prompt, it still shut down the system (rather than returning a keycode).
EDIT: Actually, while I've figured out how to do these things purely by the command line, I haven't figured out how to do them without root access. Any further insight on the matter would be greatly appreciated.
bash keyboard-shortcuts console brightness volume
add a comment |Â
up vote
1
down vote
favorite
I'm wondering if it's possible to adjust (increment/decrement) brightness or volume with a laptop keyboard's dedicated brightness/volume keys in the virtual console.
Can the system be configured to perform a background operation in response to a single keypress, or is the only mode of interaction via the command line? (I have already found ways to make the adjustments via the command line.)
The only comparable example I can think of is the power button signaling an immediate system halt. However, I suspect that operates on a different level, since when I tried pressing it at the showkey
prompt, it still shut down the system (rather than returning a keycode).
EDIT: Actually, while I've figured out how to do these things purely by the command line, I haven't figured out how to do them without root access. Any further insight on the matter would be greatly appreciated.
bash keyboard-shortcuts console brightness volume
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm wondering if it's possible to adjust (increment/decrement) brightness or volume with a laptop keyboard's dedicated brightness/volume keys in the virtual console.
Can the system be configured to perform a background operation in response to a single keypress, or is the only mode of interaction via the command line? (I have already found ways to make the adjustments via the command line.)
The only comparable example I can think of is the power button signaling an immediate system halt. However, I suspect that operates on a different level, since when I tried pressing it at the showkey
prompt, it still shut down the system (rather than returning a keycode).
EDIT: Actually, while I've figured out how to do these things purely by the command line, I haven't figured out how to do them without root access. Any further insight on the matter would be greatly appreciated.
bash keyboard-shortcuts console brightness volume
I'm wondering if it's possible to adjust (increment/decrement) brightness or volume with a laptop keyboard's dedicated brightness/volume keys in the virtual console.
Can the system be configured to perform a background operation in response to a single keypress, or is the only mode of interaction via the command line? (I have already found ways to make the adjustments via the command line.)
The only comparable example I can think of is the power button signaling an immediate system halt. However, I suspect that operates on a different level, since when I tried pressing it at the showkey
prompt, it still shut down the system (rather than returning a keycode).
EDIT: Actually, while I've figured out how to do these things purely by the command line, I haven't figured out how to do them without root access. Any further insight on the matter would be greatly appreciated.
bash keyboard-shortcuts console brightness volume
edited Oct 22 '17 at 14:52
asked Oct 14 '17 at 21:46
Ryan Lue
1997
1997
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
It depends on which shell you use in your tty, but generally: Yes, you can. The readline library is the software component that makes these keyshortcuts possible.
I only happen to know how it works with zsh
, so I'll give an example with it. In case you use bash
, try reading the "Readline Key Bindings" section in the manual - it looks like this is what you're looking for.
With zsh
:
myfunc()
echo 'It works!'
zle -N mywidget myfunc
bindkey "^[OQ" mywidget
The zle -N
command is used to define something called a "zsh widget". Widgets can be used to call functions. The bindkey
command let's you specify a keycode and a widget that will be executed whenever the key is pressed. The keycode ^[OQ
happens to refer to the F2
key in my case. To find out what keycode your volume key has, press Ctrl+V
and then hit the volume key (in my case, I would hit Fn+F2
, which gives me ^[[26~
).
1
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro withbind -x
, which still outputs to the terminal.
â Ryan Lue
Oct 15 '17 at 4:33
add a comment |Â
up vote
0
down vote
This is not a generalized solution to the problem, but after a couple days of troubleshooting, I discovered pommed, which is specifically for managing hotkeys on Apple laptops (which is what I have).
In addition to allowing you to increment/decrement brightness/keyboard backlight/audio volume, it also automatically sets brightness when AC power is connected/disconnected (among other things). Way nicer than trying to write my own scripts for it.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
It depends on which shell you use in your tty, but generally: Yes, you can. The readline library is the software component that makes these keyshortcuts possible.
I only happen to know how it works with zsh
, so I'll give an example with it. In case you use bash
, try reading the "Readline Key Bindings" section in the manual - it looks like this is what you're looking for.
With zsh
:
myfunc()
echo 'It works!'
zle -N mywidget myfunc
bindkey "^[OQ" mywidget
The zle -N
command is used to define something called a "zsh widget". Widgets can be used to call functions. The bindkey
command let's you specify a keycode and a widget that will be executed whenever the key is pressed. The keycode ^[OQ
happens to refer to the F2
key in my case. To find out what keycode your volume key has, press Ctrl+V
and then hit the volume key (in my case, I would hit Fn+F2
, which gives me ^[[26~
).
1
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro withbind -x
, which still outputs to the terminal.
â Ryan Lue
Oct 15 '17 at 4:33
add a comment |Â
up vote
1
down vote
It depends on which shell you use in your tty, but generally: Yes, you can. The readline library is the software component that makes these keyshortcuts possible.
I only happen to know how it works with zsh
, so I'll give an example with it. In case you use bash
, try reading the "Readline Key Bindings" section in the manual - it looks like this is what you're looking for.
With zsh
:
myfunc()
echo 'It works!'
zle -N mywidget myfunc
bindkey "^[OQ" mywidget
The zle -N
command is used to define something called a "zsh widget". Widgets can be used to call functions. The bindkey
command let's you specify a keycode and a widget that will be executed whenever the key is pressed. The keycode ^[OQ
happens to refer to the F2
key in my case. To find out what keycode your volume key has, press Ctrl+V
and then hit the volume key (in my case, I would hit Fn+F2
, which gives me ^[[26~
).
1
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro withbind -x
, which still outputs to the terminal.
â Ryan Lue
Oct 15 '17 at 4:33
add a comment |Â
up vote
1
down vote
up vote
1
down vote
It depends on which shell you use in your tty, but generally: Yes, you can. The readline library is the software component that makes these keyshortcuts possible.
I only happen to know how it works with zsh
, so I'll give an example with it. In case you use bash
, try reading the "Readline Key Bindings" section in the manual - it looks like this is what you're looking for.
With zsh
:
myfunc()
echo 'It works!'
zle -N mywidget myfunc
bindkey "^[OQ" mywidget
The zle -N
command is used to define something called a "zsh widget". Widgets can be used to call functions. The bindkey
command let's you specify a keycode and a widget that will be executed whenever the key is pressed. The keycode ^[OQ
happens to refer to the F2
key in my case. To find out what keycode your volume key has, press Ctrl+V
and then hit the volume key (in my case, I would hit Fn+F2
, which gives me ^[[26~
).
It depends on which shell you use in your tty, but generally: Yes, you can. The readline library is the software component that makes these keyshortcuts possible.
I only happen to know how it works with zsh
, so I'll give an example with it. In case you use bash
, try reading the "Readline Key Bindings" section in the manual - it looks like this is what you're looking for.
With zsh
:
myfunc()
echo 'It works!'
zle -N mywidget myfunc
bindkey "^[OQ" mywidget
The zle -N
command is used to define something called a "zsh widget". Widgets can be used to call functions. The bindkey
command let's you specify a keycode and a widget that will be executed whenever the key is pressed. The keycode ^[OQ
happens to refer to the F2
key in my case. To find out what keycode your volume key has, press Ctrl+V
and then hit the volume key (in my case, I would hit Fn+F2
, which gives me ^[[26~
).
answered Oct 14 '17 at 22:44
PawkyPenguin
696110
696110
1
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro withbind -x
, which still outputs to the terminal.
â Ryan Lue
Oct 15 '17 at 4:33
add a comment |Â
1
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro withbind -x
, which still outputs to the terminal.
â Ryan Lue
Oct 15 '17 at 4:33
1
1
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
This is great! For anyone coming to this thread in the future, this is the closest link I could find: Bash Reference Manual: Readline Init File.
â Ryan Lue
Oct 14 '17 at 23:27
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro with
bind -x
, which still outputs to the terminal.â Ryan Lue
Oct 15 '17 at 4:33
Upon closer inspection, custom readline functions cannot be exposed to the shell directly, and can only be written into a program via Readline's API in C. In bash, it appears the best you can do is define a macro with
bind -x
, which still outputs to the terminal.â Ryan Lue
Oct 15 '17 at 4:33
add a comment |Â
up vote
0
down vote
This is not a generalized solution to the problem, but after a couple days of troubleshooting, I discovered pommed, which is specifically for managing hotkeys on Apple laptops (which is what I have).
In addition to allowing you to increment/decrement brightness/keyboard backlight/audio volume, it also automatically sets brightness when AC power is connected/disconnected (among other things). Way nicer than trying to write my own scripts for it.
add a comment |Â
up vote
0
down vote
This is not a generalized solution to the problem, but after a couple days of troubleshooting, I discovered pommed, which is specifically for managing hotkeys on Apple laptops (which is what I have).
In addition to allowing you to increment/decrement brightness/keyboard backlight/audio volume, it also automatically sets brightness when AC power is connected/disconnected (among other things). Way nicer than trying to write my own scripts for it.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This is not a generalized solution to the problem, but after a couple days of troubleshooting, I discovered pommed, which is specifically for managing hotkeys on Apple laptops (which is what I have).
In addition to allowing you to increment/decrement brightness/keyboard backlight/audio volume, it also automatically sets brightness when AC power is connected/disconnected (among other things). Way nicer than trying to write my own scripts for it.
This is not a generalized solution to the problem, but after a couple days of troubleshooting, I discovered pommed, which is specifically for managing hotkeys on Apple laptops (which is what I have).
In addition to allowing you to increment/decrement brightness/keyboard backlight/audio volume, it also automatically sets brightness when AC power is connected/disconnected (among other things). Way nicer than trying to write my own scripts for it.
answered Oct 22 '17 at 16:00
Ryan Lue
1997
1997
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398163%2fusing-brightness-volume-keys-in-tty-virtual-console%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password