Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

TIP ! Clipboard for Sway / Waybar - comfortable way

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
CooSee
Veteran
Veteran
User avatar
Posts: 1617
Joined: Sat Nov 20, 2004 10:38 pm
Location: right here !

TIP ! Clipboard for Sway / Waybar - comfortable way

  • Quote

Post by CooSee » Thu Jul 21, 2022 8:43 pm

hello,

you need to emerge dev-lang/go, gui-apps/wl-clipboard and gui-apps/rofi-wayland <<< from guru overlay.

additional info howto handle multiple repositories look here: https://forums.gentoo.org/viewtopic-p-8 ... ml#8659032

and download cliphist source code from (you need dev-vcs/git) :

git clone https://github.com/sentriz/cliphist.git

installing cliphist is easy >>> go install go.senan.xyz/cliphist

copy just generated cliphist (bin) from ~/go/bin to /usr/bin

or you can try with downloadable binary at (never tried myself):

download from https://github.com/sentriz/cliphist/releases/tag/v0.5.0

or via go install go.senan.xyz/cliphist@latest

---

entries for sway config:

! thanks to Manjaro - best implementation, imho !

# if-exists autostarts

Code: Select all

    exec {

    '[ -x "$(command -v wl-paste)" ] && [ -x "$(command -v cliphist)" ] && wl-paste --watch cliphist store'
    '[ -x "$(command -v wl-paste)" ] && [ -x "$(command -v cliphist)" ] && wl-paste --watch pkill -RTMIN+9 waybar'
    }

# Launch // Clipboard ##

Code: Select all

bindsym $mod+y exec $clipboard

change it to whatever available key you want !

# clipboard history

Code: Select all

    set $clipboard cliphist list | rofi -dmenu -m -1 -font "Ubuntu Mono Nerd Font 9" -p "Select item to copy" -lines 10 -width 35 | cliphist decode | wl-copy
    set $clipboard-del cliphist list | rofi -dmenu -m -1 primary -font "Ubuntu Mono Nerd Font 9" -p "Select item to delete" -lines 10 -width 35 | cliphist delete

---

entries for waybar config:

Code: Select all

"custom/clipboard",
to enable custom entry

and (icon hex is f0ea):

Code: Select all

"custom/clipboard": {
    "format": "",
    "interval": "once",
    "return-type": "json",
    "on-click": "swaymsg -q exec '$clipboard'; pkill -RTMIN+9 waybar",
    "on-click-right": "swaymsg -q exec '$clipboard-del'; pkill -RTMIN+9 waybar",
    "on-click-middle": "rm -f ~/.cache/cliphist/db; pkill -RTMIN+9 waybar",
    "exec": "printf '{\"tooltip\":\"%s\"}' $(cliphist list | wc -l)' item(s) in the clipboard\r(Mid click to clear)'",
    "exec-if": "[ -x \"$(command -v cliphist)\" ] && [ $(cliphist list | wc -l) -gt 0 ]",
    "signal": 9
    },
---

this is my rofi (user) config in .config/rofi/config.rasi:

Code: Select all

configuration {

  timeout {
      action: "kb-cancel";
      delay:  0;
  }
  filebrowser {
      directories-first: true;
      sorting-method:    "name";
  }
}

@import "paper-float"
that's it :!:

now you get an icon on waybar - middle click will delete the history - it'll look like this:

https://0x0.st/s/lN5FTfA_FzePBGW7zzzKyw/H4Vs.png

sway/waybar sometimes doesn't work correctly after reloading config via mod+shift+c - better restart your computer and you're good to go :!:

EDIT:

this is my first ebuild :!: - works for me, i hope it'll work for you too, no guarantee :D

Code: Select all

# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module git-r3

EGIT_REPO_URI="https://github.com/sentriz/cliphist"

DESCRIPTION="ClipBoard History Manager for Wayland"
HOMEPAGE="https://github.com/sentriz/cliphist"

LICENSE="GPL3"
SLOT="0"
KEYWORDS="~amd64"

BDEPEND=">=dev-lang/go-1.19"

RDEPEND="gui-apps/wl-clipboard x11-misc/xdg-utils"

DEPEND="${RDEPEND}"

RESTRICT+="strip"

src_unpack() {
   git-r3_src_unpack
   go-module_live_vendor
}

src_compile() {
   go build || die
}

src_install() {
dobin cliphist
}
save it as cliphist-9999.ebuild

placed the ebuild in gui-apps/cliphist/cliphist-9999.ebuild in my local overlay >>> https://wiki.gentoo.org/wiki/Creating_a ... repository

greetings (...programs) 8)
Last edited by CooSee on Thu Feb 22, 2024 2:28 am, edited 16 times in total.
" Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier "
Top
fedeliallalinea
Administrator
Administrator
User avatar
Posts: 31977
Joined: Sat Mar 08, 2003 11:15 pm
Location: here
Contact:
Contact fedeliallalinea
Website

  • Quote

Post by fedeliallalinea » Fri Jul 22, 2022 4:32 am

Moved from Desktop Environments to Documentation, Tips & Tricks.
Questions are guaranteed in life; Answers aren't.

"Those who would give up essential liberty to purchase a little temporary safety,
deserve neither liberty nor safety."
- Ben Franklin
https://www.news.admin.ch/it/nsb?id=103968
Top
Post Reply

2 posts • Page 1 of 1

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy