Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpm #35

Merged
merged 4 commits into from
May 6, 2024
Merged

Rpm #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 110 additions & 96 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ There is a quick settings popup when you right click the icon.
```
git clone https://github.com/wiiznokes/cosmic-clipboard-manager.git
cd cosmic-clipboard-manager
just build-release
just install
```

Expand All @@ -20,7 +21,7 @@ You curently need to activate a setting of the compositor:
sudo nano /etc/cosmic-comp/config.ron
```

And change `data_control_enabled: false` to `true` at the end of the file. Note that you may need to reset the setting at each update you make (at least, i noticied it on Fedora).
And change `data_control_enabled: false` to `true` at the end of the file.

Obiously, a better integration is planned, maybe with a portal that ask the user if they want to activate this protocol (which is insecure since its let an app access the clipboard without receiving an event for it (like ctrl-c) or being focused).

Expand Down
60 changes: 60 additions & 0 deletions cosmic-clipboard-manager.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Generated by rust2rpm 26
%bcond_without check

%global ver 0.1.0
%global commit 876c73d228c24e7a85e1e39ef7265e1e81d106ca
%global date 20240426.18

Name: cosmic-clipboard-manager
Version: %{ver}~git%{date}.%{sub %{commit} 1 7}
Release: %autorelease
Summary: Clipboard manager for the COSMIC Desktop Environment

SourceLicense: MIT
License: MIT

URL: https://github.com/wiiznokes/cosmic-clipboard-manager



BuildRequires: cargo-rpm-macros >= 25
BuildRequires: rustc
BuildRequires: lld
BuildRequires: cargo


%global _description %{expand:
%{summary}.}

%description %{_description}

%prep
%autosetup -n cosmic-comp-%{commit} -p1 -a1
%cargo_prep -N
cat .vendor/config.toml >> .cargo/config

%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%{cargo_vendor_manifest}
sed 's/\(.*\) (.*#\(.*\))/\1+git\2/' -i cargo-vendor.txt

%install
just rootdir=%{buildroot} prefix=%{_prefix} install

%if %{with check}
%check
%cargo_test
%endif

%files
%license LICENSE
%license LICENSE.dependencies
%license cargo-vendor.txt
%{_bindir}/cosmic-clipboard-manager
%{_datadir}/applications/io.github.wiiznokes.cosmic-clipboard-manager.desktop
%{_datadir}/share/icons/hicolor/scalable/apps/io.github.wiiznokes.cosmic-clipboard-manager.svg

%changelog
%autochangelog
50 changes: 45 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,51 @@
name := 'cosmic-clipboard-manager'
export APPID := 'io.github.wiiznokes.cosmic-clipboard-manager'

APP_ID := "com.wiiznokes.CosmicClipboardManager"
rootdir := ''
prefix := '/usr'

base-dir := absolute_path(clean(rootdir / prefix))

export INSTALL_DIR := base-dir / 'share'

bin-src := 'target' / 'release' / name
bin-dst := base-dir / 'bin' / name

desktop-src := 'res' / 'desktop_entry.desktop'
desktop-dst := clean(rootdir / prefix) / 'share' / 'applications' / APPID + '.desktop'

metainfo-src := 'res' / 'metainfo.xml'
metainfo-dst := clean(rootdir / prefix) / 'share' / 'metainfo' / APPID + '.metainfo.xml'

res-src := 'res'
res-dst := clean(rootdir / prefix) / 'share'

# Default recipe which runs `just build-release`
default: build-release


# Compiles with debug profile
build-debug *args:
cargo build {{args}}

# Compiles with release profile
build-release *args:
cargo build --release {{args}}

install:
cargo build -r
sudo install -Dm0755 ./target/release/cosmic-clipboard-manager /usr/bin/cosmic-clipboard-manager
sudo install -Dm0644 resources/{{APP_ID}}.desktop /usr/share/applications/{{APP_ID}}.desktop
sudo install -Dm0644 resources/icons/assignment24.svg /usr/share/{{APP_ID}}/icons/assignment24.svg
install -Dm0755 {{bin-src}} {{bin-dst}}
install -Dm0644 {{desktop-src}} {{desktop-dst}}
install -Dm0644 {{res-src}}/app_icon.svg {{res-dst}}/icons/hicolor/scalable/apps/{{APPID}}.svg

# Uninstalls installed files
uninstall:
rm {{bin-dst}}
rm {{desktop-dst}}
rm {{res-dst}}/icons/hicolor/scalable/apps/{{APPID}}.svg


clean:
cargo clean


pull: fmt prettier fix
Expand Down
File renamed without changes
15 changes: 15 additions & 0 deletions res/desktop_entry.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Desktop Entry]
Name=Clipboard Manager
Comment=A wayland clipboard manager
Keywords=Cosmic;Iced;history;

# translators: do not translate this part
Icon=io.github.wiiznokes.cosmic-clipboard-manager
Categories=Cosmic;Iced;
Type=Application
Exec=cosmic-clipboard-manager
Terminal=false
StartupNotify=true
NoDisplay=true
X-CosmicApplet=true
X-CosmicHoverPopup=true
File renamed without changes
File renamed without changes
File renamed without changes
Empty file added res/metainfo.xml
Empty file.
File renamed without changes
13 changes: 0 additions & 13 deletions resources/com.wiiznokes.CosmicClipboardManager.desktop

This file was deleted.

6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ use std::sync::atomic::{self, AtomicBool};
// todo: converge this 4 strings
pub static QUALIFIER: &str = "com";
pub static ORG: &str = "wiiznokes";
pub static APP: &str = "CosmicClipboardManager";
pub static APP: &str = "cosmic-clipboard-manager";

pub const APP_ID: &str = "com.wiiznokes.CosmicClipboardManager";
pub const APP_ID: &str = "com.wiiznokes.cosmic-clipboard-manager";

pub struct Window {
core: Core,
Expand Down Expand Up @@ -304,7 +304,7 @@ impl cosmic::Application for Window {
let icon = self
.core
.applet
.icon_button("/usr/share/com.wiiznokes.CosmicClipboardManager/icons/assignment24.svg")
.icon_button("io.github.wiiznokes.cosmic-clipboard-manager")
.on_press(AppMessage::TogglePopup);

MouseArea::new(icon)
Expand Down