CopyQ icon indicating copy to clipboard operation
CopyQ copied to clipboard

CachyOS - KDE 6.5.2 - Wayland - some settings don't work

Open xchatter opened this issue 1 month ago • 4 comments

Hi guys,

CopyQ version: 13.0.0-1.1 from AUR.

Some settings don't seem to work like:

  • Paste to current window <- I tried disabling this, reenabling it, in different windows, but never works.
  • Always on top <- seems to only bring it on top one time as I turn it on but then never works.

I am just starting to use the app so there might be more, but those are settings that I wanted so I focused on them.

Image Image

xchatter avatar Nov 11 '25 17:11 xchatter

Check out:

  • https://copyq.readthedocs.io/en/latest/known-issues.html
  • https://github.com/hluk/copyq-commands/tree/master/Scripts#wayland-support

danicc097 avatar Nov 16 '25 10:11 danicc097

I checked them already but they don't seem very useful at least for not very experienced user like me. I tried installing the required packages mentioned for Wayland but didn't help and also the page seems to be mixing tool requirements for different DEs unless I am not understanding it very well. There are no details unless something is super obvious like "gnome-screenshot" which is probably something that I don't need.

If someone is running copyq on Arch and KDE with Wayland, it would be useful to provide some directions on how it should be used or if it is just not supported at the moment. :)

xchatter avatar Nov 17 '25 03:11 xchatter

I use arch + KDE 6.5.2 as well, and it just works once the support script is installed and enabled in the commands tab, and the dependencies work (particularly kdotool and ydotool binaries in your PATH and the 'ydotoold' daemon running). I don't remember doing anything extra to make it work

ydotool setup is the trickiest by far. I ended up concocting an installation script to set it up a while ago with systemd services instead, though there might be simpler ways. You should also be aware of the security implications of adding yourself to the "input" group, which are needed for automation. Else you'd have to enter your password on every ydotool call.

If you need some inspiration:

https://gabrielstaples.com/ydotool-tutorial/

and my partially vibecoded complete setup script:

#!/bin/bash
set -euo pipefail # Exit on error, unset variable, or pipe failure

# --- Configuration ---
YDOTOCL_GIT_REPO="https://github.com/ReimuNotMoe/ydotool.git"
YDOTOCL_INSTALL_DIR_NAME="ydotool_source_build" # Temporary directory for building
UDEV_RULE_FILE="/etc/udev/rules.d/80-uinput-ydotool.rules"

# --- Helper Functions ---
info() { echo "[INFO] $*"; }
warn() { echo "[WARN] $*" >&2; }
error() {
  echo "[ERROR] $*" >&2
  exit 1
}
prompt_sudo() {
  if ! sudo -v; then
    error "Superuser privileges are required. Please run with sudo or ensure sudo access."
  fi
  info "Superuser privileges verified."
}

# --- Main Installation Logic ---

# 1. Check if ydotool is already installed and ydotoold service is active
if command -v ydotool &>/dev/null && systemctl --user is-active --quiet ydotoold.service; then
  info "ydotool appears to be installed and the ydotoold.service is active."
  info "Checking udev rule and input group membership..."
  if [ -f "$UDEV_RULE_FILE" ]; then
    info "Udev rule $UDEV_RULE_FILE exists."
  else
    warn "Udev rule $UDEV_RULE_FILE seems to be missing. This might cause issues."
    warn "Consider re-running the script or manually creating the udev rule."
  fi
  if groups "$(whoami)" | grep -q '\binput\b'; then
    info "User $(whoami) is in the 'input' group."
  else
    warn "User $(whoami) is NOT in the 'input' group."
    warn "This is often required for ydotool. Consider: sudo usermod -aG input $(whoami)"
    warn "You would need to re-login for group changes to take effect."
  fi
  info "Skipping ydotool build and installation."
  exit 0
fi
info "ydotool not found or ydotoold.service not active. Proceeding with installation."

# Ensure we have sudo upfront for operations that need it
prompt_sudo

# 2. Install build dependencies using yay (will ask for confirmation by default)
info "Installing build dependencies: cmake, scdoc, pkg-config, git, base-devel, make..."
if ! yay -S --noconfirm --needed cmake scdoc pkg-config git base-devel make; then
  error "Failed to install build dependencies. Please ensure yay is configured and try again."
fi
info "Build dependencies installed successfully."

# 3. Clone ydotool repository
TEMP_BUILD_ROOT=$(mktemp -d) # Create a temporary root for all build files
info "Cloning ydotool from $YDOTOCL_GIT_REPO into $TEMP_BUILD_ROOT/$YDOTOCL_INSTALL_DIR_NAME..."
if ! git clone --depth=1 "$YDOTOCL_GIT_REPO" "$TEMP_BUILD_ROOT/$YDOTOCL_INSTALL_DIR_NAME"; then
  error "Failed to clone ydotool repository."
fi
cd "$TEMP_BUILD_ROOT/$YDOTOCL_INSTALL_DIR_NAME"
info "Successfully cloned ydotool."

# 4. Build ydotool (which includes ydotoold)
info "Creating build directory and starting compilation..."
mkdir -p build
cd build

info "Running CMake..."
if ! cmake ..; then
  error "CMake configuration failed."
fi

info "Building with make -j$(nproc)..."
if ! make -j"$(nproc)"; then
  error "Build process (make) failed."
fi
info "Build successful."

# 5. Install ydotool and ydotoold
# This typically installs binaries, man pages, and systemd service files if provided by the project
info "Installing ydotool and ydotoold using 'sudo make install'..."
if ! sudo make install; then
  error "Installation (sudo make install) failed."
fi
info "ydotool and ydotoold installed."

# Check if ydotoold.service was installed where systemd user can find it
# Common paths: /usr/lib/systemd/user/ or /usr/local/lib/systemd/user/
SERVICE_FILE_PATH=$({ systemd-analyze --user unit-paths | grep -oP '^[^ ]+/ydotoold\.service$' | head -n1; } || true)
if [ -z "$SERVICE_FILE_PATH" ] || ! sudo test -f "/usr/lib/systemd/user/ydotoold.service"; then # Check a common location explicitly
  # Attempt to find it more broadly from make install output or common paths
  if sudo find /usr/local/lib/systemd/user/ /usr/lib/systemd/user/ -name ydotoold.service -print -quit | grep -q .; then
    info "ydotoold.service file seems to be installed."
    # Ensure systemd reloads user daemon configurations
    systemctl --user daemon-reload
  else
    warn "ydotoold.service file was not found in typical systemd user directories after 'make install'."
    warn "You might need to manually install or link the service file (usually found in the build/source directory) to ~/.config/systemd/user/ or /usr/lib/systemd/user/ and run 'systemctl --user daemon-reload'."
    warn "Without the service file, 'systemctl --user enable/start ydotoold' will fail."
    # The script will proceed, but enabling the service might fail.
  fi
else
  info "ydotoold.service found at $SERVICE_FILE_PATH. Reloading systemd user daemon."
  systemctl --user daemon-reload
fi

# 6. Setup udev rule for /dev/uinput permissions
# This rule grants access to /dev/uinput to users in the 'input' group.
# TAG+="uaccess" is a more modern way that uses systemd-logind for session-based access.
UDEV_RULE_CONTENT='KERNEL=="uinput", MODE="0660", GROUP="input", TAG+="uaccess"'
info "Creating udev rule at $UDEV_RULE_FILE..."
echo "$UDEV_RULE_CONTENT" | sudo tee "$UDEV_RULE_FILE" >/dev/null
info "Reloading udev rules..."
if ! sudo udevadm control --reload-rules || ! sudo udevadm trigger; then
  warn "Failed to reload udev rules. A reboot might be necessary for the rule to take effect."
else
  info "Udev rules reloaded and triggered."
fi

# 7. Ensure current user is in the 'input' group (if not already)
if ! groups "$(whoami)" | grep -q '\binput\b'; then
  info "User $(whoami) is not in the 'input' group."
  info "Adding user $(whoami) to the 'input' group. This requires a re-login to take full effect."
  if ! sudo usermod -aG input "$(whoami)"; then
    warn "Failed to add user to 'input' group. Manual intervention may be needed."
  else
    info "User $(whoami) added to 'input' group. PLEASE RE-LOGIN for this change to take effect."
  fi
else
  info "User $(whoami) is already in the 'input' group."
fi

# 8. Enable and start ydotoold user service
info "Enabling ydotoold.service for the current user..."
if ! systemctl --user enable ydotoold.service; then
  warn "Failed to enable ydotoold.service. This might be due to the service file not being found or an issue with the 'input' group permissions (re-login might be needed)."
  warn "Attempting to start it anyway..."
else
  info "ydotoold.service enabled."
fi

info "Starting ydotoold.service for the current user..."
if ! systemctl --user start ydotoold.service; then
  error "Failed to start ydotoold.service.
  Please check its status with: systemctl --user status ydotoold.service
  And logs with: journalctl --user -u ydotoold.service -e
  Ensure you have re-logged in if you were just added to the 'input' group and that the udev rule is active."
fi

if systemctl --user is-active --quiet ydotoold.service; then
  info "ydotoold.service is now active for user $(whoami)."
else
  warn "ydotoold.service started but reported as not active immediately. Double-check status."
fi

# 9. Cleanup build directory
info "Cleaning up build directory: $TEMP_BUILD_ROOT..."
rm -rf "$TEMP_BUILD_ROOT"
info "Build directory cleaned up."

# 10. YDOTOOL_SOCKET environment variable reminder (usually not needed)
EXPECTED_SOCKET_PATH_1="/run/user/$(id -u)/ydotool.socket"
EXPECTED_SOCKET_PATH_2="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/ydotool.socket"

if [ -S "$EXPECTED_SOCKET_PATH_1" ] || [ -S "$EXPECTED_SOCKET_PATH_2" ]; then
  info "ydotool socket found at a standard location. YDOTOOL_SOCKET env var should not be needed."
else
  warn "ydotool socket not found at standard locations ($EXPECTED_SOCKET_PATH_1 or $EXPECTED_SOCKET_PATH_2)."
  warn "If ydotool commands fail, you might need to find the correct socket path (check 'systemctl --user cat ydotoold.service') and set YDOTOOL_SOCKET environment variable in your shell's rc file (e.g., ~/.bashrc, ~/.zshrc)."
  warn "Example: export YDOTOOL_SOCKET=/run/user/\$UID/ydotool.socket"
fi

echo ""
info "--- ydotool setup process finished. ---"
info "IMPORTANT: If you were added to the 'input' group, you MUST RE-LOGIN for all permissions to apply correctly before ydotool can function."
info "After re-login (if necessary), your main script should be able to use ydotool."


danicc097 avatar Nov 17 '25 10:11 danicc097

Please tell me, is there a simple solution to make CopyQ work correctly in cachyOS? For example, in Ubuntu, I can select the item I need in the CopyQ window using the keyboard and press Enter, and it will be pasted into the program I need, but in CachyOS (KDE Plasma v6.5.4), unfortunately, this does not work :(

online avatar Dec 10 '25 16:12 online

The same in Fedora 43 with KDE and Wayland. The item selected by enter or two clicks is not pasted.

wagrod avatar Dec 18 '25 17:12 wagrod

AFAIK, "Always on Top" is not supported on Wayland - apps cannot request for normal windows to stay above others by itself.

Clipboard should work on Wayland, if the desktop environment supports ext_data_control_v1 protocol. I think the protocol is still unsupported on GNOME (there is no way to access clipboard unless the app has focus), but I don't have any issues with the app/clipboard on Fedora 43 with KDE 6.5.4.

hluk avatar Dec 19 '25 12:12 hluk

I do not know if there is a better way than using the ydotool to get the "Paste to current window" working. I do not use it anymore since the ydotool configuration is somewhat complex - but the Wayland Support command will use it if available.

hluk avatar Dec 19 '25 12:12 hluk

I do not know if there is a better way than using the ydotool to get the "Paste to current window" working. I do not use it anymore since the ydotool configuration is somewhat complex - but the Wayland Support command will use it if available.

Thank you for your response. The problem is that when I tried to use ydotool on CachyOS (Arch Linux), unfortunately it didn't work for me. Could someone perhaps explain in more detail how to use it properly?

online avatar Dec 19 '25 14:12 online