You are not logged in.
Hi all,
I bought a bluetooth keyboard that let me to switch between different devices.
When I switch from my llinux laptop to my work laptop, the audio on the linux one go in mute, so I have to manually unmute the audio.
Maybe it's a Gnome functionality (?) but I didn't managed how to disable it.
I'm writing in the newbie corner because I'm quite new on linux and especially on arch, thank you in advance to anyone will take care of my problem ![]()
Offline
Hello Mr./Mrs. mcluke.
Welcome to Arch Linux world!
There are a lot reasons for your problem. Maybe you need to define your audio card for 'ALSA'.(Audio program)
You can install this tools (You've to use 'yay' package manager. If you don't know what is that, you can see https://www.makeuseof.com/install-and-u … rch-linux/. It's easy!):
yay -S asoundconfFor better management, you can use:
sudo pacman -S alsa-utilsOkay, now you are able to see your cards:
asoundconf listSet your Card, using:
asoundconf set-default-card <your-card>You can get information using 'amixer':
amixer sget MasterUnmute it!:
amixer sset Master unmuteFor pulesaudio, You can edit '/etc/pulse/default.pa'. (I use 'vim', you can use 'nano' or whatever you like!):
sudo vim /etc/pulse/default.paFind this line in file:
# load-module module-alsa-source device=hw:1,0It's a comment. Remove '#' sign in the line.
And restart pulseaudio.
pulseaudio -k; pulseaudio -DIt usually works, but if it doesn't, tell us.
Use Arch and have fun !
Last edited by Paradoxer32 (2023-09-14 08:41:15)
Offline
Hi, thanks for your welcome!
I followed your step but the issue is still there.
When I switch the keyboard to the other laptop (basically, the bluetooth device is disconnected), the audio goes into mute.
Offline
Could you post output of:
arecord -lAnd output of:
amixerLast edited by Paradoxer32 (2023-09-14 09:08:46)
Offline
output of arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC255 Analog [ALC255 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0output of amixer
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 30148 [46%] [on]
Front Right: Playback 30148 [46%] [on]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 17948 [27%] [on]
Front Right: Capture 17948 [27%] [on]Offline
Output of:
cat /etc/pulse/default.pa | grep hwOutput of:
bluetoothctl showOutput of:
amixer | grep -i muteLast edited by Paradoxer32 (2023-09-14 09:26:58)
Offline
Output of cat /etc/pulse/default.pa | grep hw :
load-module module-alsa-source device=hw:1,0Output of bluetoothctl show:
Controller D4:6D:6D:59:9C:1D (public)
Name: arch-swift3
Alias: arch-swift3
Class: 0x007c010c (8126732)
Powered: yes
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: IrMC Sync (00001104-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (00005005-0000-1000-8000-0002ee000001)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0545
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-nameNo output from amixer | grep -i mute
Last edited by mcluke (2023-09-14 09:28:33)
Offline
Sir/ma'am,
You said '...I have to manually unmute the audio...'.
How do you do that ?
Offline
I press on the function key on the laptop keyboard to turn up the volume and then the audio is unmuted
p.s. I'm a man
Last edited by mcluke (2023-09-14 09:36:31)
Offline
When is it mute, sir?
After boot?
After change monitor?
After connect to Keyboard?
After ...?
Offline
When I disconnect my bluetooth keyboard, audio goes in mute.
Actually, I just find out that when I disconnect the keyboard the audio change its state (if it was mute it goes unmute, if it was unmute it goes mute).
Nothing happens when I connect the bluetooth keyboard
Last edited by mcluke (2023-09-14 09:46:55)
Offline
A dumb solution!
You can use a shell script for auto disconnect and change audio mode!
It's fun.
Create a file called in '/usr/bin'. (I call it 'damnkeyboard'! But you can call it whatever you like!)
sudo touch /usr/bin/damnkeyboardNow, let's code.
#!/bin/sh
echo "Disconnect keyboard..."
bluetoothctl disconnect <your-device>
echo "Setup again..."
amixer sset Master toggle 1> /dev/null
echo "Done!"Make it executable:
sudo chmod +x /usr/bin/damnkeyboardNow, you can disconnect your keyboard, with executing our script:
[ Me@Host ~ ]$ damnkeyboard It's a unusual solution! Try it.
Last edited by Paradoxer32 (2023-09-14 09:57:10)
Offline
Your idea is good, I really appreciate your support.
I was thinking, is there a way to keep a script running that detects when the keyboard is disconnected and unmute the audio?
something like:
was_keyboard_connected = ""
while true:
is_keyboard_connected = bluetoothctl info my_keyboard | grep -e "Connected: yes"
if is_keyboard_connected != was_keyboard_connected then:
was_keyboard_connected = is_keyboard_connected
if is_keyboard_connected == "" then:
amixer sset Master toggle 1> /dev/null
endif
endif
endwhileP.S. I made the question but I just realized I can search how to do something like that, you can avoid to answer
Last edited by mcluke (2023-09-14 10:37:47)
Offline
Hello again, sir.
I wrote a python script for you!
You need to write it in your file. (Do you remember '/usr/bin/damnkeyboard'?)
You need to add your keyboard address in 'keyboard_addrs' variable.
#!/usr/bin/env python
keyboad_addrs = "<your-address>"
from sys import stderr
from subprocess import check_output
from os import system
def GetnRun(cmd=''):
try:
return check_output(cmd.split(' ')).decode('utf-8')
except:
print(f"[ERROR] Something went wrong! Check script and try again!...\n Wrong command: '{cmd}'")
exit()
def OnlyRun(cmd=''):
return system(cmd)
print("[LOG] Check bluetooth connection...")
bluestatus = GetnRun('bluetoothctl show')
powered = [i for i in bluestatus.split('\n') if 'Powered' in i][0]
if 'yes' in powered:
print("[PASS] Bluetooth has already started...")
elif 'no' in powered:
print("[LOG] Bluetooth is off...")
print("[LOG] Turn it on...")
OnlyRun('bluetoothctl power on')
status = GetnRun(f'bluetoothctl info {keyboad_addrs}')
if 'Connected: yes' in status:
print("[LOG] Keyboard is connected...")
print("[LOG] Disconnect...")
OnlyRun(f'bluetoothctl disconnect {keyboad_addrs}')
print("[LOG] Set audio...")
OnlyRun(f'amixer sset Master toggle')
else:
print("[LOG] Keyboard isn't connected...")
print("[LOG] Connect...")
OnlyRun(f'bluetoothctl pair {keyboad_addrs}')
print("[LOG] Trust...")
OnlyRun(f'bluetoothctl trust {keyboad_addrs}')Make it executable:
sudo chmod +x /usr/bin/damnkeyboardSo, you can run it, easily! (You need to install 'python'. Easy.)
It works like this:
-> Is bluetooth on? Pass.
-> Is bluetooth off? Turn it on!
-> Is keyboard connected? Disconnect!
-> Is keyboard disconnected? Connect!
Everything is automatic.
I don't have any keyboard for try it.
If you like it, you can run it and tell me errors for improve it!
Offline
Okay.
You write do what script you like.
I'm happy for helped you.
Have a nice time.
Bye.
Use Arch and have fun !
Offline
You helped me a lot!
Thank you very much for your effort.
The script is a workaround but doesn't properly solve the issue, I wanted to disable the feature where the audio toggle when the bluetooth keyboard is disconnected.
I keep the topic open
Offline
Hello, again, Mr. mcluke.
I think I got what's your problem, actually.
I think when you disconnect your keyboard, your keyboard automatically presses 'F1'. (Which a function key for audio toggle!)
I don't know is it a bug in your keyboard, your linux-firmware or it's a usual configuration for your keyboard.
A solution is this:
You can disable your function keys. But, don't worry! I mean your 'action' of function keys.
For example:
'F1' means 'audio toggle'.
'F2' means 'volume down'.
'F3' means 'volume up'.
etc.
After disable their action, 'F1' only means 'F1', 'F2' only means 'F2', 'F3' only means 'F3'.
And you can't manage your monitor birghtness using 'F11' and 'F12', etc.
But it isn't really bad. You can use their alternatives.
For example, if you want to be pro, you can use your own shortcut keys for your actions. (I think you use 'Gnome'.)
Or you can use terminal or additional softwares. They can make you more professional than ever.
e.g. for manage your brightness you can use 'brightnessctl' in your terminal, etc.
After that, it depends what do you want to do with your keyboard?
Have a nice time.
Offline
Actually you could be right.
To be sure what you're saying it's true, is there a way to make keyboard logging?
In order to understand if the keyboard send the mute signal when I disconnect it.
I'm using gnome 44.4 on wayland
Offline
I'm not sure about that. (Because I don't use Gnome or Wayland.)
But you can search about that.
We've two good tools for check keyboard keys.
-> Screenkey:
https://snapcraft.io/install/screenkey/arch
-> Key-mon:
https://aur.archlinux.org/packages/key-mon?O=40
-> Useful forums:
https://askubuntu.com/questions/1197651 … -real-time
https://superuser.com/questions/248517/ … d-in-linux
Offline