Enable wayland clipboard support by default on supported platforms (#869)

* Added possibility to Follow/Unfollow artists via the context menu

* Formatted code properly.

* Wayland support is now automatically built on supported platforms.

* Revert "Formatted code properly."

This reverts commit ec057f9716574d0a7912ba8b5308c73bb0342f84.

* Revert "Added possibility to Follow/Unfollow artists via the context menu"

This reverts commit 9ac20514a640b9150fcfa38630d338ad6f097689.

* Removed need for separate wayland_clipboard feature.
Possibly fixed windows build.

* Added more cfg conditions to sharing.rs.
This possibly fixes the windows build.

* Changed to only build wayland clipboard feature on linux by default.
This commit is contained in:
Bettehem
2022-07-26 00:05:13 +03:00
committed by GitHub
parent ddc2e41177
commit 5158a13e19
2 changed files with 12 additions and 9 deletions

View File

@@ -45,6 +45,7 @@ tokio-stream = "0.1.9"
toml = "0.5"
unicode-width = "0.1.9"
url = "2.2"
[target.'cfg(target_os = "linux")'.dependencies]
wl-clipboard-rs = {version = "0.6", optional = true}
[dependencies.rspotify]
@@ -73,10 +74,9 @@ pancurses_backend = ["cursive/pancurses-backend", "pancurses/win32"]
portaudio_backend = ["librespot-playback/portaudio-backend"]
pulseaudio_backend = ["librespot-playback/pulseaudio-backend"]
rodio_backend = ["librespot-playback/rodio-backend"]
share_clipboard = ["clipboard"] # Share a link to the system clipboard
share_selection = ["clipboard", "wl-clipboard-rs"] # Use the primary selection for sharing - linux only
share_clipboard = ["clipboard", "wl-clipboard-rs"] # Share a link to the system clipboard
share_selection = ["clipboard", "wl-clipboard-rs"] # Use the primary selection for sharing - linux and bsd only
termion_backend = ["cursive/termion-backend"]
wayland_clipboard = ["wl-clipboard-rs"] # Support wayland clipboard - linux only
[package.metadata.deb]
assets = [

View File

@@ -1,7 +1,7 @@
#![cfg(feature = "share_clipboard")]
use std::env;
#[cfg(feature = "wayland_clipboard")]
#[cfg(all(feature = "wl-clipboard-rs", target_os = "linux"))]
use {
std::io::Read,
wl_clipboard_rs::{
@@ -14,7 +14,10 @@ use {
#[cfg(feature = "share_selection")]
use clipboard::{x11_clipboard, x11_clipboard::X11ClipboardContext};
#[cfg(all(feature = "share_selection", feature = "wayland_clipboard"))]
#[cfg(all(
feature = "share_selection",
all(feature = "wl-clipboard-rs", target_os = "linux")
))]
use wl_clipboard_rs::utils::{is_primary_selection_supported, PrimarySelectionCheckError};
#[cfg(not(feature = "share_selection"))]
@@ -39,7 +42,7 @@ pub fn read_share() -> Option<String> {
if is_wayland() {
#[allow(unused_mut, unused_assignments)]
let mut string = None;
#[cfg(feature = "wayland_clipboard")]
#[cfg(all(feature = "wl-clipboard-rs", target_os = "linux"))]
{
//use wayland clipboard
let result = get_contents(
@@ -77,7 +80,7 @@ pub fn read_share() -> Option<String> {
if is_wayland() {
#[allow(unused_mut, unused_assignments)]
let mut string = None;
#[cfg(feature = "wayland_clipboard")]
#[cfg(all(feature = "wl-clipboard-rs", target_os = "linux"))]
{
//use wayland clipboard
string = match is_primary_selection_supported() {
@@ -138,7 +141,7 @@ pub fn write_share(url: String) -> Option<()> {
if is_wayland() {
#[allow(unused_mut, unused_assignments)]
let mut option = None;
#[cfg(feature = "wayland_clipboard")]
#[cfg(all(feature = "wl-clipboard-rs", target_os = "linux"))]
{
//use wayland clipboard
let opts = Options::new();
@@ -167,7 +170,7 @@ pub fn write_share(url: String) -> Option<()> {
if is_wayland() {
#[allow(unused_mut, unused_assignments)]
let mut option = None;
#[cfg(feature = "wayland_clipboard")]
#[cfg(all(feature = "wl-clipboard-rs", target_os = "linux"))]
{
//use wayland clipboard
let mut opts = Options::new();