cdown / clipmenu

Clipboard management using dmenu
MIT License
1.14k stars 91 forks source link

again slow opening of the clipboard launcher #144

Closed kristoferus75 closed 4 years ago

kristoferus75 commented 4 years ago

Hi !

Again same problem very slow opening of dmenu launcher but if i

clipdel -d ".*" && systemctl --user restart clipmenud.service

it works again good and fast

but in the clipboard history are only a few text items if it not work !

How can i find out whats the problem ?

systemd service

systemctl --user enable clipmenud.service

[Unit]
Description=Clipmenu daemon

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

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

[Install]
WantedBy=default.target
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 Thu 2020-10-29 18:14:10 CET; 8min ago
   Main PID: 976086 (bash)
     CGroup: /user.slice/user-1000.slice/user@1000.service/clipmenud.service
             ├─976086 bash /usr/bin/clipmenud
             └─979602 clipnotify

launcher

#!/bin/bash
export CM_LAUNCHER=dmenu
export CM_DIR=~/.cache
export CM_HISTLENGTH=90
export CM_MAX_CLIPS=100

case "$1" in
        show)
                /usr/bin/clipmenu -c -l 12 -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
cdown commented 4 years ago
export CM_MAX_CLIPS=100

This is in the wrong place -- you need these passed to clipmenud.

export CM_HISTLENGTH=90

There's no reason to pass this and -l to clipmenu.

You're really going to have to give more information than this, though. Please run with bash -x clipmenu and report which parts are slow.

kristoferus75 commented 4 years ago

ok Thanks i have now modifed the launcher script and also the systemd file -> i will see now !

the problem is that if i use bash -x clipmenu i not see the correct output because the CM_DIR=%h/.cache/ and with command i see a other folder :

bash -x clipmenu

+ : dmenu
+ : /run/user/1000
+ : 8
+ major_version=6
+ shopt -s nullglob
+ cache_dir=/run/user/1000/clipmenu.6.user
+ cache_file=/run/user/1000/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]++'
/usr/bin/clipmenu: Zeile 42: /run/user/1000/clipmenu.6.user/line_cache: file and folder not found
+ chosen_line=
+ [[ -n '' ]]
+ exit 1

ls -la ~/.cache/clipmenu.6.user

.rw-r--r-- 3,0k user 30 Okt 17:33 ├── 2533220 38
.rw-r--r--    2 user 30 Okt 18:15 ├── 25536713 3
.rw-r--r--   12 user 30 Okt 18:11 ├── 216202828 13
etc ...
cdown commented 4 years ago

Ok, so run bash -x clipmenu with the right variables... :-)

kristoferus75 commented 4 years ago

sorry yes ok ;-)

it show now the right folder and opens also dmenu -> that its -> ok paste now this command if its again slow !

Hope that its already solved now !

Thanks !