Skip to content

Instantly share code, notes, and snippets.

@cjbottaro
Last active March 30, 2024 00:46
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 cjbottaro/2596cc4dc919566266d3363638c68139 to your computer and use it in GitHub Desktop.
Save cjbottaro/2596cc4dc919566266d3363638c68139 to your computer and use it in GitHub Desktop.
Linux Desktop (KDE) Setup in 2023

Goal

We all know that MacOS is by far the best, so we're trying to emulate that as much as possible... :)

Keyboard Shortcuts

Here are the ones that I can't live without:

  • Move cursor to beginning/end of line cmd-left cmd-right
  • Move cursor by word opt-left opt-right
  • Move cursor to beginning/end of document cmd-up cmd-down
  • Previous/next tab/item cmd-shift-[ cmd-shift-]
  • Switch between apps cmd-tab
  • Switch between windows of an app cmd-`

We want these to work globally. I couldn't get KDE's shortcut settings to do it, so I had to use keyd.

https://github.com/rvaiya/keyd

Keyd has a neat feature where you can enter a mode/layer that is exited when you release a certain key. For example, you can have alt-tab put you app-switch-mode, and while in that mode the arrow keys do something different than they normally would. This is useful because we're going to map ctrl-right/left to end/home normally, but when in app-switch-mode, they will map to ctrl-tab and ctrl-shift-tab instead. Releasing the ctrl key (after hitting ctrl-tab) will exit app-switch-mode.

/etc/keyd/default.conf

[ids]

*

[control]

left = home
right = end
up = C-home
down = C-end
tab = swap2(app_switch_state, C-tab)
` = swap2(window_switch_state, C-`)

[meta]

left = C-left
right = C-right

[control+shift]

[ = C-pageup
] = C-pagedown

[app_switch_state:C]

left = C-S-tab
right = C-tab

[window_switch_state:C]

left = C-S-`
right = C-`

The magic is in swap2 btw.

I forgot to mention that I'm using a Windows keyboard, so the Windows (meta) key is where the option key would be on a Mac keyboard and I'm using ctrl in place of cmd.

VS Code

VS Code only remembers the first window size when starting up.

code foo # Open window using last position and size
code bar # Opens fullscreen
code baz # Opens fullscreen

This setting is exactly what I want:

Chrome PWA/SSB apps in own group

Make an executable helper script in /usr/local/bin/chrome-pwa.

#!/usr/bin/bash

/opt/google/chrome/google-chrome --new-window --profile-directory=Default --app-id=$1 && xdotool search --sync --classname crx_$1 set_window --class crx_$1

Then edit the .desktop file using this helper script:

The command is the helper script and the argument is just the app id.

High resolution icons in task switcher.

This is a pain in the butt, and the answer comes from:

https://askubuntu.com/questions/864056/low-resolution-icons-in-task-switcher-in-kde

Bluetooth

Do yourself a favor and just use TP-Link UB500. I tried to use my existing Pluggable BT dongle and it kept cutting out and locking up (Xbox controller would stop responding after a few minutes).

Xbox Controller

I had to install xpadneo. https://github.com/atar-axis/xpadneo

Some people suggested killing kdeconnectd, saying that it causes instability with paired BT devices.

Honestly, it's best to use the USB dongle combined with xone-dkms-git. Use the git version, the regular one xone-dkms doesnt' work with latest kernel as of this writing.

Keyboard Firmware Config with Via

https://usevia.app/ does not work because of permissions problems. Find the device:

Then sudo chmod 666 /dev/hidraw7.

USB Preventing Sleep

The USB dongle for Logitech MX Master mouse cause the system to immediately wake from sleep. You can disable it with:

echo XHC0 > /proc/acpi/wakeup

And see what's enabled with:

cat /proc/acpi/wakeup

To make the changes permenant, you have to follow these instructions: https://wiki.archlinux.org/title/Systemd#systemd-tmpfiles_-_temporary_files

KVM+QEMU Virtualization

The kernel modules are already loaded if you have virtualization enabled in the BIOS.

yay libvirt
yay qemu-desktop
yay virt-manager

sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
sudo systemctl start libvirtd

Then just startup Virtual Machine Manager and make a new connection for QEMU/KVM.

Windows will be extremely (unusably slow) without adding guest tools: https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md

The .exe file works fine.

Installing the Spice Guest Tools will make things like copy/paste work, and supposedly optimize video for Spice clients. https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe

The Spice Agent didn't start automatically for me: image

Opening links in Flatpak applications

Gotta install these portal thingies and reboot.

yay xdg-desktop-portal-gtk
yay xdg-desktop-portal-kde
reboot

Now links will open from within Discord and Tuple (which is needed to login).

More to come...

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