niri icon indicating copy to clipboard operation
niri copied to clipboard

Copy valid every two times

Open The-Lost-Light opened this issue 11 months ago • 9 comments

When copy text in firefox-developer-edition(), every two times only succeed one with wl-clip-persist

niri config
input  {
	keyboard  {
		xkb  {
			options "caps:ctrl_modifier"
		}
	}

	touchpad  {
		natural-scroll
		tap
		dwt
		drag true
		disabled-on-external-mouse
	}

	warp-mouse-to-focus mode="center-xy"
	focus-follows-mouse max-scroll-amount="33%"
}


output "eDP-1"  {
	scale 1.25
	variable-refresh-rate
}
output "HDMI-A-1"  {
	mode "2560x1440"
	scale 1.25
	variable-refresh-rate
	focus-at-startup
}


binds  {
	/* Global */
	Mod+Tab               { toggle-overview; }
	Mod+Q                 { close-window; }
	Mod+Slash             { show-hotkey-overlay; }
	// Focus
	Mod+Left              { focus-column-left; }
	Mod+Right             { focus-column-right; }
	Mod+Up                { focus-window-or-workspace-up; }
	Mod+Down              { focus-window-or-workspace-down; }
	Mod+WheelScrollUp     { focus-column-left; }
	Mod+WheelScrollDown   { focus-column-right; }
	Mod+MouseForward      { focus-window-or-workspace-up; }
	Mod+MouseBack         { focus-window-or-workspace-down; }
	Mod+Shift+Left        { focus-monitor-left; }
	Mod+Shift+Right       { focus-monitor-right; }
	Mod+C                 { center-column; }
	// Move
	Mod+Ctrl+Left         { move-column-left; }
	Mod+Ctrl+Right        { move-column-right; }
	Mod+Ctrl+Up           { move-window-up-or-to-workspace-up; }
	Mod+Ctrl+Down         { move-window-down-or-to-workspace-down; }
	Mod+Shift+Ctrl+Left   { move-column-to-monitor-left; }
	Mod+Shift+Ctrl+Right  { move-column-to-monitor-right; }
	Mod+BracketLeft       { consume-or-expel-window-left; }
	Mod+BracketRight      { consume-or-expel-window-right; }
	Mod+S                 { toggle-column-tabbed-display; }
	// Resize
	Mod+R                 { switch-preset-column-width; }
	Mod+Shift+R           { switch-preset-window-height; }
	Mod+G                 { maximize-column; }
	Mod+Shift+G           { fullscreen-window; }
	Mod+Ctrl+G            { expand-column-to-available-width; }
	Mod+Ctrl+R            { reset-window-height; }
	Mod+Minus             { set-column-width "-10%"; }
	Mod+Equal             { set-column-width "+10%"; }
	Mod+Shift+Minus       { set-window-height "-10%"; }
	Mod+Shift+Equal       { set-window-height "+10%"; }
	Mod+F                 { switch-focus-between-floating-and-tiling; }
	Mod+Shift+F           { toggle-window-floating; }
	// Screenshot
	Print                 { screenshot; }
	Mod+Print             { screenshot-window; }
	Alt+Print             { screenshot-screen; }

	/* Applications */
	Mod+Space             { spawn "kitty"; }
	Mod+A                 { spawn "nwg-drawer"; }
	Mod+E                 { spawn "kitty" "yazi"; }

	/* System */
	// Change volume
	XF86AudioRaiseVolume  allow-when-locked=true { spawn "~/.config/niri/scripts/audio.nu" "speaker" "increase"; }
	XF86AudioLowerVolume  allow-when-locked=true { spawn "~/.config/niri/scripts/audio.nu" "speaker" "decrease"; }
	XF86AudioMute         allow-when-locked=true { spawn "~/.config/niri/scripts/audio.nu" "speaker" "toggle"; }
	XF86AudioMicMute      allow-when-locked=true { spawn "~/.config/niri/scripts/audio.nu" "microphone" "toggle"; }
	// Change brightness
	XF86MonBrightnessUp   allow-when-locked=true { spawn "~/.config/niri/scripts/brightness.nu" "increase"; }
	XF86MonBrightnessDown allow-when-locked=true { spawn "~/.config/niri/scripts/brightness.nu" "decrease"; }
	XF86KbdBrightnessUp   allow-when-locked=true { spawn "~/.config/niri/scripts/brightness.nu" "increase" "--keyboard"; }
	XF86KbdBrightnessDown allow-when-locked=true { spawn "~/.config/niri/scripts/brightness.nu" "decrease" "--keyboard"; }
	// Media control
	XF86AudioPlay         allow-when-locked=true { spawn "playerctl" "--player" "playerctld" "play-pause"; }
	XF86AudioPause        allow-when-locked=true { spawn "playerctl" "--player" "playerctld" "pause"; }
	XF86AudioStop         allow-when-locked=true { spawn "playerctl" "--player" "playerctld" "stop"; }
	XF86AudioNext         allow-when-locked=true { spawn "playerctl" "--player" "playerctld" "next"; }
	XF86AudioPrev         allow-when-locked=true { spawn "playerctl" "--player" "playerctld" "previous"; }
	// G14
	XF86Launch1           { spawn "rog-control-center"; }
	XF86Launch4           { spawn "asusctl" "profile" "-n"; }
}


layer-rule {
    match namespace="^wallpaper$"
    place-within-backdrop true
}


layout  {
	gaps 16
	always-center-single-column
	empty-workspace-above-first
	default-column-display "tabbed"
	tab-indicator  {
		hide-when-single-tab
		place-within-column
		gaps-between-tabs 10
		corner-radius 10
	}
	preset-window-heights  {
		proportion 0.5
		proportion 1.0
	}
	focus-ring  {
		width 2
		active-color "#f5c2e7cc"
		inactive-color "#00000000"
		urgent-color "#9b0000"
	}
	shadow  {
		on
		softness 20
		spread 8
		color "#f5c2e744"
		inactive-color "#00000000"
	}
}


prefer-no-csd
screenshot-path "~/Pictures/screenshot/%Y-%m-%d %H-%M-%S.png"


environment {
	DISPLAY ":0"
}


cursor  {
	hide-when-typing
	hide-after-inactive-ms 5000
}


overview {
    backdrop-color "#243454"
}


clipboard  {
	disable-primary
}


hotkey-overlay  {
	skip-at-startup
}


window-rule  {
	geometry-corner-radius 16
	clip-to-geometry true
	draw-border-with-background false
	open-maximized true
}


window-rule {
    match is-active=false
    opacity 0.9
}

window-rule  {
	match app-id=r#"firefox-developer-edition$"# title="^子母畫面$" //Picture-in-Picture
	open-floating true
}

window-rule {
    match app-id="steam" title=r#"^notificationtoasts_\d+_desktop$"#
    default-floating-position x=10 y=10 relative-to="bottom-right"
}


gestures  {
	dnd-edge-view-scroll  {
		max-speed 2000
	}
	dnd-edge-workspace-switch  {
		max-speed 2000
	}
	hot-corners  {
		off
	}
}


spawn-at-startup "swaybg" "--image" "~/.config/niri/assets/wallpaper-blur.jpg"

System Information

  • niri version: niri 25.05 (ae89cb6)
  • Distro: Arch
  • GPU: Nvidia RTX 2060 max-q
  • CPU: AMD Ryzen 4900hs

The-Lost-Light avatar May 22 '25 14:05 The-Lost-Light

Why do you think it's a niri issue? Does it happen on other compositors?

YaLTeR avatar May 22 '25 15:05 YaLTeR

Why do you think it's a niri issue? Does it happen on other compositors?

try in Hyprland its work fine.

Not sure if it's related (since this is irrelevant whether wl-clip-persist is executed), but when using helix in niri I can't paste from the clipboard (Space-P, Space-R ...) and it also work in Hyprland

The-Lost-Light avatar May 22 '25 15:05 The-Lost-Light

This sounds like on Hyprland it might be using xclip or something. You need wl-copy/paste, then it should work.

For wl-clip-persist could you try on sway or cosmic-comp?

YaLTeR avatar May 22 '25 15:05 YaLTeR

This sounds like on Hyprland it might be using xclip or something. You need wl-copy/paste, then it should work.

For wl-clip-persist could you try on sway or cosmic-comp?

It is indeed because of this reason, sorry I didn't notice that I had wl-clipboard installed before and now it's not installed.

wl-clip-persist is still trying, don't know why cosmic can't start

The-Lost-Light avatar May 22 '25 16:05 The-Lost-Light

I try in sway it works fine.

In cosmic when run wl-clip-persist --clipboard regular it return

2025-05-23T00:12:39.896 ERROR main > Failed to get clipboard manager (ZwlrDataControlManagerV1)
  Error: global with interface "zwlr_data_control_manager_v1" not found

The-Lost-Light avatar May 22 '25 16:05 The-Lost-Light

I think you need some config option in cosmic to enable wlr-data-control

YaLTeR avatar May 22 '25 16:05 YaLTeR

Or maybe also COSMIC_DATA_CONTROL_ENABLED=1 env?

YaLTeR avatar May 22 '25 16:05 YaLTeR

Had the same problem on cosmic, so it could be smithay's problem?

The-Lost-Light avatar May 22 '25 16:05 The-Lost-Light

Yes, it would be Smithay. Or maybe it's in wl-clip-persist

YaLTeR avatar May 22 '25 16:05 YaLTeR

I'll close here in favor of the Smithay issue

YaLTeR avatar May 25 '25 08:05 YaLTeR