How can I permanently change the default audio output device to speakers if bluetooth headphones connect/disconnect frequently on 18.0.4?

I’m using pulseaudio 11.1 and Ubuntu 18.0.4.

My audio devices include: monitor (HDMI), docking station’s 3.5mm jack (analog), speakers (analog; connected directly to mobo), and Bluetooth headphones that connect/disconnect frequently.

My preferred setup is, if the headphones are connected via Bluetooth, use them. If disconnected, use my speakers.

Right now, headphones do take priority if connected. But when it disconnects or if I reboot my system, it falls back to the docking station as default.


I can change the default device temporarily with:

$   pacmd set-default-sink alsa_output.pci-0000_28_00.3.analog-stereo 

This gets cumbersome because I connect/disconnect my headphoens frequently so I need to run that command every single time.


Things I’ve done:

1) I followed ArchLinux docs on PulseAudio in which it says “To set a system wide default, add the source name in the default.pa file:”

set-default-sink alsa_output.pci-0000_04_01.0.analog-stereo 

So I did that with my preferred sink at the bottom of /etc/pulse/default.pa. Then, I rebooted and it still didn’t work.

2) This answer was not a permanent solution when I tried it.

3) This answer is the closest I’ve come to what I want. When I boot up, it uses the speakers as default. If I connect my headphones, it uses them.

But, the problem is, if I disconnect my headphones, it goes back to the docking station as fallback.


I’ve wasted hours and hours on this issue. Please give me some ideas on how I can achieve my preferred setup.

keyboard reconfigure permanently

Recently upgraded to 18.04; I have a Sun Type 6 Keyboard (lots of useful extra keys such as Copy, Cut, Paste) and the installation configured it in an acceptable manner. A recent upgrade caused it to be reconfigured in a shambolic manner.

After much Googling, I found many suggested cures, all of which turned out to apply to other systems. Generally speaking, there are three ways to configure a keyboard

  1. xmodmap – but this is now just a poor frontend to the xkb system
  2. setxkbmap – which I believe to be a frontend to xkbcomp
  3. xkbcomp

But all three suffer from the problem that their changes disappear on logout/login or on sleep/wakeup (and presumably hibernate as well). Also, it is recommended to construct a ‘conf’ file, but there are three formats for these, one to work with xorg.conf (which no longer exists), one to use with setxkbmap, and /etc/default/keyboard (which has miserable documentation, and does not appear to work anyway).

So here is my file clerew3.conf for setxkbmap:

Rules = "evdev" Model = "sun-type-unix-usb" Layout = "gb" Symbols = "pc+gb+inet(evdev)+clerew" 

Note that ‘clerew’ is a custom-tweak kept in /usr/local/share/X11/xkb/symbols (I don’t like putting customized stuff under /usr). So I call this with

$   setxkbmap -I /usr/local/share/X11/xkb -option '' -config .../clerew3.conf -print xkb_keymap {     xkb_keycodes  { include "evdev+aliases(qwerty)" };     xkb_types     { include "complete"  };     xkb_compat    { include "complete"  };     xkb_symbols   { include "pc+gb+inet(evdev)+clerew"};     xkb_geometry  { include "pc(pc104)" }; }; 

So the output looks good (apart from the geometry, which can wait), and if I put it into a file clerew.xkb I can compile it into a complete .xkb file wich indeed shows exactly what I wanted.

So now to compile it for use in the Display (which is :0, of course). So here is the ‘official’ way to do it (observe maximum verbosity set):

$   setxkbmap -v 10 -I /usr/local/share/X11/xkb -option '' -config /usr/local/share/X11/xorg.conf.d/clerew3.conf Setting verbose level to 10 locale is C Found file /usr/local/share/X11/xorg.conf.d/clerew3.conf After config file: rules:      evdev model:      sun-type-unix-usb layout:     gb variant:    , symbols:    pc+gb+inet(evdev)+clerew Trying to load rules file ./rules/evdev... Trying to load rules file /usr/share/X11/xkb/rules/evdev... Success. Warning! Multiple definitions of symbols          Using config file, ignoring rules file Applied rules from evdev: rules:      evdev model:      sun-type-unix-usb layout:     gb Trying to build keymap using the following components: keycodes:   evdev+aliases(qwerty) types:      complete compat:     complete symbols:    pc+gb+inet(evdev)+clerew geometry:   pc(pc104) Error loading new keyboard description 

So why the Error? I suspect it had trouble finding my customized ‘clerew’, in spite of the -I … .

But I still had the ‘clerew.xkb’ file which had compiled corectly before with xkbcomp, so I compiled it again directly into :0 :

xkbcomp -I/usr/local/share/X11/xkb .../clerew3.xkb :0 

and there it was! All my keys worked correctly: Libreoffice, Firefox, Thunderbird et al all understood my Copy/Cut/Paste etc, and so did any GTK aplication (with the aid of a suitable css file). Perfect!

Until I Slepped or Logged Out, whereupon it reverted to the shambolic keymap as before.

So that leaves two questions:

  1. Exactly where does the system store the permanent keymap (presumably a .kvm file, though I looked for such a file in the root partition with ‘find’). Is it in dconf (there is a smattering of xkb stuff in there, but I cannot see anything large enough)? Is it in xorg.conf (which doesn’t exist anymore)? It has to be somewhere, because it keeps getting resurrected when I re-Login or Wakeup).
  2. How do I cause it to be overwritten by the new version? My researches have turned up much advice , mostly applicable to other Linux Distributions, or earlier versions of Ubuntu. some suggest the use of localectl (with insufficient information how to use it); others mumble about dpkg-reconfigure (but I don’t believe dconf is really involved); and some suggest running a script (such as my xkbcomp) in .profile, or .xinitrc or .config, or other dottish places (but I have verified that .profile does not work).

Help!

New Website 301 Moved Permanently to /default url

Trying to setup a new website on existing Magento installation on Apache server on a subdomain like website2.mysite.com.

Have done the following steps:

1) Created Website, Store and StoreViews in Magento admin. Created a new root category and linked to the new website.

2) Set up base URL and secure base URL to http://website2.mysite.com and https://website2.mysite.com in store > web > Base URLs for the new website and also the new store view

3) Created a new Apache virtual host for the subdomain, enabled it with a2ensite and restarted the server.

4)Set the following environment variables in .htaccess as well as in individual vhost files -:

SetEnvIf Host website2.mysite.com* MAGE_RUN_CODE=website2 SetEnvIf Host website2.mysite.com* MAGE_RUN_TYPE=website 

However now if I visit website2.mysite.com it adds a URL default to my main website and redirects to mysite.com/default – showing me the default home page. A wget request shows a 301 permanent redirection.

The HTTP request sent, awaiting a response... 301 Moved Permanently 

I fail to understand **why this could be redirecting **? Any possible reason or debugging tip would be appreciated.

Websocket proxy_pass with nginx gets “301 Moved Permanently”

I’m trying to proxy_pass to a websocket with nginx but I get “301 Moved Permanently” instead.

Nginx:

server { listen 80; server_name eg.example.com;  location / {     include proxy_params;     proxy_pass http://localhost:8000/; }  location ~* /chatclientws/[\w\-]+ {     include proxy_params;     proxy_http_version 1.1;     proxy_set_header Upgrade $  http_upgrade;     proxy_set_header Connection "Upgrade";     proxy_pass "http://localhost:8000/chatclientws/$  1/";    } } 

Proxy_params:

proxy_set_header Host $  http_host; proxy_set_header X-Real-IP $  remote_addr; proxy_set_header X-Forwarded-For $  proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $  scheme; proxy_set_header X-NginX-Proxy true; 

A lot of solutions say to remove or add the trailing backslash in the proxy_pass. When I remove it I get 404. When I leave it in I get 301.

Console says:

WebSocket connection to 'ws://eg.example.com/chatclientws/07928444-3bbc-47e8-afae-9c378ba1dc29' failed: Error during WebSocket handshake: Unexpected response code: 301 

Developer tools says:

Request URL: ws://eg.example.com/chatclientws/07928444-3bbc-47e8-afae-9c378ba1dc29 Request Method: GET Status Code: 301 Moved Permanently 

The request URL is correct.

Everything works fine in development, of course.

What am I missing?

How Do I Permanently Disable Hot Corners on Mac?

I have a work computer, and every time I turn it on and log in, hot corners are enabled where when I move my mouse to a corner inadvertently, it locks my screen. This happens all the time in the middle of my work.

Every time, this annoys me, and I go into System Preferences and set all the hot corners options to none. But, the next day or whenever I restart my computer, they come back! I am wondering if anyone knows how to permanently disable them so I don’t need to manually disable them every time I restart my work MacBook.

Is there a terminal command or something I can set to stop Hot Corners settings from resetting back on constantly? I’m guessing my company has defaults that they apply that override the settings on restart.

Would casting banishment on a Revenant permanently send it away to another plane?

In my campaign I’m being chased by a revenant and I’m about to reach level 7. I was thinking of taking banishment to cast on the revenant. The spell states that it brings creatures native to my plane back after a minute but if the creature belongs to another plane it goes there. So because the revenant is dead would it go back to the land of the dead?