Skip to content

Instantly share code, notes, and snippets.

@paulozullu
Last active May 7, 2022 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulozullu/b6815e45e19e9cf56623f07750f3d556 to your computer and use it in GitHub Desktop.
Save paulozullu/b6815e45e19e9cf56623f07750f3d556 to your computer and use it in GitHub Desktop.
Linux tips

Fixes and tips for Linux

1 - Headset mic not recognized

$ sudo nano /etc/modprobe.d/alsa-base.conf

Add bottom:

options snd-hda-intel model=laptop-dmic

Save and reboot

2 - Install kvantum in KDE

$ sudo add-apt-repository ppa:papirus/papirus
$ sudo apt-get update
$ sudo apt-get install --install-recommends adapta-kde   

3 - Reload bashrc without logging out

$ source ~/.bashrc

4 - Install powerline-shell

  • Install fonts
sudo apt-get install fonts-powerline
  • Install powerline
$ sudo pip install powerline-shell
  • Edit file ~.bashrc and add:
function _update_ps1() {
    PS1=$(powerline-shell $?)
}

if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
  • Reload bashrc
source .bashrc
  • Config File Powerline-shell is customizable through the use of a config file. This file is expected to be located at ~/.config/powerline-shell/config.json. You can generate the default config at this location using:
$ mkdir -p ~/.config/powerline-shell && \
powerline-shell --generate-config > ~/.config/powerline-shell/config.json

5 - Create webapp

Install nativefier

npm install nativefier -g

Install app

nativefier --name "nome_app" app_url -i icon_path --internal-urls "."

Update app

nativefier app_url --electron-version n.n.n
Open DevTools (Ctrl+Shift+i)
Application
Service Workers
Bypass for network
Reload (Ctrl+r)
Close DevTools

6 - supervisor

6.1 - Load new config

supervisorctl reread

6.2 - Restart managed applications

supervisorctl update

7 - WiFi waiting for authorization in KDE

7.1 Run the following commands

sudo nmcli dev wifi 
sudo nmcli dev wifi connect <your ssid> password <your pass>

7.2 Disable KWallet running

kwriteconfig5 --file kwalletrc --group 'Wallet' --key 'Enabled' 'false'
kwriteconfig5 --file kwalletrc --group 'Wallet' --key 'First Use' 'false'

8 - Choose splash screen

sudo update-alternatives --config default.plymouth
sudo update-initramfs -u

9 - Change behaviour on closing lid

sudo gedit /etc/systemd/logind.conf

When the files opens, uncomment the line #HandleLidSwitch=suspend by removing **# in the beginning, and change the value to:

  • HandleLidSwitch=poweroff, shutdown / power off when lid is closed.
  • HandleLidSwitch=hibernate, hibernate when lid is closed (need to test if hibernate works).
  • HandleLidSwitch=ignore, do nothing.
  • HandleLidSwitch=suspend, suspend laptop when lid is closed.
systemctl restart systemd-logind.service

10 - Restart Gnome Shell

killall -3 gnome-shell

11 - Fix ALT+TAB not working

Run gnome-control-center aka the Settings application.

Remove the shortcut for Switch applications by clicking on it and deleting it with the backspace key, now press the Set button.

Now set Switch windows by clicking on it, then press Alt + Tab and click the Set button.

12 - Create application launcher

gnome-desktop-item-edit ~/.local/share/applications --create-new

13 - Avoid duplicated icons in dock

You need to add a proper StartupWMClass line to the .desktop launcher corresponding to the application. Follow these steps:

  • Open Files and go to your /usr/share/applications folder. Look for the "Nightly" file (i.e. the launcher for the application you want to fix) and copy it.

  • Paste the file in ~/.local/share/applications. It should look like a file with the name <filename>.desktop.

  • Right click on this .desktop file and open with Text Editor.

  • Launch "Nightly" (i.e. the application you want to fix) from "Activities".

  • Run xprop WM_CLASS in Terminal.

  • Place the cursor over the opened "Nightly" window. The cursor should turn into a crosshair already. Click. You should get a WM_CLASS string for "Nightly" in Terminal.

  • In the .desktop file opened in Text Editor and add the following line

    StartupWMClass=OBTAINED-VALUE
    

    In place of OBTAINED-VALUE put a value you got from step 6 without any quotes.

  • Save the .desktop file.

14 - Convert another images to virt-manager

$ VBoxManage clonehd disk.vdi disk.raw --format raw
qemu-img convert -f raw disk.raw -O qcow2 disk.qcow2
qemu-img convert -O qcow2 System.vmdk /<kvm_Guest_repo>/OL7U2.qcow2

15 - Avoid some programs to start at boot

Remove them from:

/etc/xdg/autostart/

16 - Disable ipv6

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

To re-enable just change the above commands with 0 in the place of 1

17 - Format pendrive in terminal

sudo su
mount
  • Repare que na lista de dispositivos acima, o pen drive é o último item da lista. Após identificar o seu dispositivo, você deverá desmontá-lo:
umount “diretorio/dispositivo” (ex.: umount /dev/sdc1 ou umount /mnt/angel)
mkfs.vfat “diretorio/dispositivo”

18 - Increase nginx timeout

Edit the file /var/nginx/nginx.conf and in the http directive add:

proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;

19 - Restart budgie desktop

nohup budgie-panel --replace&

20 - View jobs in cron

  • For root:
crontab -l
  • For other user:
crontab -u username -l

21 - Find a file

sudo find / -iname 'filename.ext' -print

22 - Fix error on running pip, easy_install and openning the terminal

sudo rm -rf /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so 

23 - Neo4j Desktop doesn't open in KDE

sudo apt install gnome-keyring

24 - Restart plasmashell (KDE)

plasmashell --replace

25 - Allow change energy performance

sudo apt install linux-tools-generic linux-tools-`uname -r`

26 - Calibrate battery

sudo apt install power-calibrate
power-calibrate  -R -r 20 -d 5 -s 21 -n 0 -p

27 - Superkey in KDE to open menu

kwriteconfig5 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.lattedock,/Latte,org.kde.LatteDock,activateLauncherMenu"

qdbus org.kde.KWin /KWin reconfigure

28 - OpenDrive systray icon missing

You need to change the Exec= in order to work.

Open terminal and paste this

nano ~/.local/share/applications/odrive.desktop

[Desktop Entry]
Name=Open Drive
Comment=Simple google drive client
Exec=env XDG_CURRENT_DESKTOP=Unity odrive %U
Terminal=false
Type=Application
Icon=odrive
Categories=Network;

kill odrive and launch it again

29 - Enable bluetooth adapter without reboot

m ufuncionar. Esse m
o rmmod/modprobe.

30 - Droidcam (can't install v4l2loopback)

Entrar senha e reiniciar. Na reinicialização, repetir a senha digitada anteriormente.

sudo update-secureboot-policy --enroll-key

31 - Parallel downloads

axel -n <connections> <URL>

32 - Change .ssh/ folder permission

chmod -R go-rwx /home/$USER/.ssh

33 - Access and add samba share in Dolphin

sudo apt-get install kdenetwork-filesharing libsmbclient samba smbclient

34 - Remove pulseaudio and install pipewire

Open your terminal and follow these steps:

We will use a PPA for adding Pipewire to Ubuntu 20.04, which is maintained regularly:

sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream
To update the PPA packages in your system do:

sudo apt update
Install the package:

sudo apt install pipewire
There is also a dependency needed to be installed with Pipewire, otherwise you will face the issue of “Bluetooth headset won’t connect after installing pipewire”. Install the dependency by:

sudo apt install libspa-0.2-bluetooth
Now, to install the client libraries:

sudo apt install pipewire-audio-client-libraries
Reload the daemon:

systemctl --user daemon-reload
Disable PulseAudio:

systemctl --user --now disable pulseaudio.service pulseaudio.socket
If you are on Ubuntu 20.04, you also need to “mask” the PulseAudio by:

systemctl --user mask pulseaudio
I am not sure but, if possible, you can try to run this on other versions too.
9. After a new update of Pipewire, you also need to enable pipewire-media-session-service:

   systemctl --user --now enable pipewire-media-session.service
You can ensure that Pipewire is now running through:

pactl info
This command will give the following output, in Server Name you can see:

PulseAudio (on PipeWire 0.3.28)
Things should be working by now and you can see your microphone.

If it doesn’t show up, then try restarting Pipewire by this command:

systemctl --user restart pipewire
If it’s still not showing your microphone, you can try rebooting once and remove and pair your Bluetooth device again to check if it works now.

I hope I have helped you solve your problem.

If you want to rollback all the changes we did, you can do it by using:

systemctl --user unmask pulseaudio
systemctl --user --now enable pulseaudio.service pulseaudio.socket

35 - Import openvpn conection to network manager

sudo nmcli connection import type openvpn file <file.opvpn>

36 - Active Window maximized borders (KDE)

Q: Latte v0.8 deactivates Borderless Maximized Windows from Active Window Control plasmoid, what can I do ?
A: Latte v0.8 supports BorderLess Maximized Windows per layout simultaneously. In order for this to work it had to support that feature internally. You can try the following:

Disable BorderLess Maximized Windows from "Active Window Control"
Go to Latte Settings -> Layouts -> Choose tab (Preferences) and enable "Support borderless maximized windows in different layouts"
Return to your layouts and a new column called "Borderless" must have been added, add a check mark in that column for the layout you want that feature and click Apply
@vic-torr
Copy link

Vlw man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment