cdown / clipmenu

Clipboard management using dmenu
MIT License
1.11k stars 90 forks source link

problem delay if open dmenu and high cpu usage #145

Closed kristoferus75 closed 3 years ago

kristoferus75 commented 3 years ago

Hi !

Again problem with climenu !

if i press the keys to open clipboard agian a delay since dmenu open -> and also i see high cpu usage !

if i clear clipboard -> it work again a time period without problem and then again this issue !

bash -x clipmenu

+ : dmenu
+ : /home/user/.cache
+ : 8
+ major_version=6
+ shopt -s nullglob
+ cache_dir=/home/schuster/.cache/clipmenu.6.user
+ cache_file=/home/schuster/.cache/clipmenu.6.user/line_cache
+ [[ '' == --help ]]
+ [[ '' == -h ]]
+ launcher_args=(-l "${CM_HISTLENGTH}")
+ [[ dmenu == fzf ]]
+ [[ dmenu == rofi ]]
+ [[ dmenu == rofi-script ]]
++ list_clips
++ dmenu -l 8
++ LC_ALL=C
++ sort -rnk 1
++ cut '-d ' -f2-
++ awk '!seen[$0]++'
+ chosen_line=
+ [[ -n '' ]]
+ exit 1

launcher script if i press key combi to open clipboard:

#!/bin/bash

export CM_LAUNCHER=dmenu

case "$1" in
        show)
                /usr/bin/clipmenu -c -p Clipboard: -i -fn Terminus:size=16 ;;
        clean)
                clipdel -d ".*" && systemctl --user restart clipmenud.service \
                && notify-send "Clipboard Content deleted" -u low \
                || notify-send "Errors occurred while Clean Up" ;;
esac

systemd service

 [Unit]
Description=Clipmenu daemon

[Service]
ExecStart=/usr/bin/clipmenud
Restart=always
RestartSec=500ms
Environment=DISPLAY=:0
Environment=CM_DIR=%h/.cache/
Environment=CM_HISTLENGTH=90
Environment=CM_MAX_CLIPS=100

MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=
RestrictRealtime=yes

[Install]
WantedBy=x11.target

systemd status

systemctl --user status clipmenud.service ● clipmenud.service - Clipmenu daemon Loaded: loaded (/usr/lib/systemd/user/clipmenud.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-11-04 16:22:02 CET; 24h ago Main PID: 798565 (bash) CGroup: /user.slice/user-1000.slice/user@1000.service/clipmenud.service ├─ 798565 bash /usr/bin/clipmenud └─1091172 clipnotify

Nov 05 16:02:45 HOME clipmenud[798565]: INFO: Trimming clip cache to CM_MAX_CLIPS (100) Nov 05 16:02:45 HOME clipmenud[798565]: INFO: Vacuumed 9 clip files. Nov 05 16:03:05 HOME clipmenud[798565]: INFO: Trimming clip cache to CM_MAX_CLIPS (100) Nov 05 16:03:05 HOME clipmenud[798565]: INFO: Vacuumed 11 clip files. Nov 05 16:23:43 HOME clipmenud[798565]: INFO: Trimming clip cache to CM_MAX_CLIPS (100) Nov 05 16:23:43 HOME clipmenud[798565]: INFO: Vacuumed 12 clip files. Nov 05 17:06:55 HOME clipmenud[798565]: INFO: Trimming clip cache to CM_MAX_CLIPS (100) Nov 05 17:06:55 HOME clipmenud[798565]: INFO: Vacuumed 10 clip files. Nov 05 17:12:23 HOME clipmenud[798565]: INFO: Trimming clip cache to CM_MAX_CLIPS (100) Nov 05 17:12:23 HOME clipmenud[798565]: INFO: Vacuumed 25 clip files.

cdown commented 3 years ago

Hey,

With respect, you're filing a lot of issues but not really providing a lot of information :-) Last time around, I asked you to tell me which lines are slow when launching under bash -x. Could you please do that?

kristoferus75 commented 3 years ago

Hi !

if i start this command i see all lines immediately

and also i see dmenu immediately but cpu usage is very high and it is slow if i scroll in dmenu

the problem is since i copy lines from libreoffice table like this:

xxxxxxxxxxxxx 20.20.20.20 192.168.29 /24 xxxxx-8P 10.9.68 10.91.68 10.92.68 10.191.68 10.192.68 10.193.68 10.99.68 172.23.68 172.24.68 172.33.68 172.34.68

cdown commented 3 years ago

Realistically, if dmenu is slow, you're going to have to talk to dmenu developers. We already apply restrictions to max clips and max length.

kristoferus75 commented 3 years ago

Sorry i use dmenu for also other functions -> and have no problems -> but ok i can try rofi also with clipmenu -> i will see and give info !

kristoferus75 commented 3 years ago

intressting with rofi :

if i copy one line in libreoffice table -> i see now this line 10 Times in rofi (ok this happen because i mark slowly word by word or column by column -> in dmenu i have not this behavior -> is it possible to change this ?

if i copy only one word i see only one word -> ok

it seems you have right -> with rofi there is no delay and also no high cpu ussage hmmmmm

i try now also an other version of dmenu -> i give info !

Thanks !

kristoferus75 commented 3 years ago

ok same problem with:

dmenu 4.8 dmenu 4.9 dmenu 5.0

also without patches

with rofi -> only the problem with 10 lines if i copy a table word by word or column by column

kristoferus75 commented 3 years ago

i have now also post this problem on reddit:

https://www.reddit.com/r/suckless/comments/jp8jxp/problem_dmenu_with_clipmenu/

kristoferus75 commented 3 years ago

i also have sent a mail to dev@suckless.org

cdown commented 3 years ago

Sure thing. Let me know if anything actionable comes out of it. :-)