You are not logged in.

#1 2023-08-25 16:38:24

casperh
Member
From: helvede
Registered: 2009-02-13
Posts: 54

Help with Alacritty, scratchpad and ncmpcpp

Hi

I'm trying to make a scratchpad with Alacritty+ncmpcpp so that it'll open when I press super+m. I'm using bspwm with sxhkd.

sxhkdrc:
https://pastebin.com/EU2967cG

The script itself:
https://pastebin.com/SNKEkSrL

The rule in bspwmrc:
https://pastebin.com/advjcUVk

Offline

#2 2023-08-25 18:13:22

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,455

Re: Help with Alacritty, scratchpad and ncmpcpp

What is not working?

Offline

#3 2023-08-25 19:30:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,104

Re: Help with Alacritty, scratchpad and ncmpcpp

xdotool search --onlyvisible --class scpad_nc windowunmap || xdotool search --class scpad_nc windowmap windowactivate || exec alacritty -e ncmpcpp --class scpad_nc

idk what alacritty sets, you might have to match "--classname" and possibly "--limit 1"

Offline

#4 2023-08-25 22:09:33

casperh
Member
From: helvede
Registered: 2009-02-13
Posts: 54

Re: Help with Alacritty, scratchpad and ncmpcpp

seth wrote:
xdotool search --onlyvisible --class scpad_nc windowunmap || xdotool search --class scpad_nc windowmap windowactivate || exec alacritty -e ncmpcpp --class scpad_nc

idk what alacritty sets, you might have to match "--classname" and possibly "--limit 1"

Do I put that in the script?

Offline

#5 2023-08-25 22:11:26

casperh
Member
From: helvede
Registered: 2009-02-13
Posts: 54

Re: Help with Alacritty, scratchpad and ncmpcpp

Docbroke wrote:

What is not working?

I've made a scratchpad so that Alacritty opens when I press super+u. It works perfectly. Now I want to open Alacritty with ncmpcpp in another scratchpad. But when I press super+m Alacritty opens and immediately closes again.

Offline

#6 2023-08-26 01:16:14

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,455

Re: Help with Alacritty, scratchpad and ncmpcpp

1. Does your script work as intended when run from terminal? You can try running your script with " bash -x <your script>" to check where it is failing.

2. what is xdo?

Last edited by Docbroke (2023-08-26 01:19:22)

Offline

#7 2023-08-26 06:15:21

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,104

Re: Help with Alacritty, scratchpad and ncmpcpp

https://archlinux.org/packages/extra/x86_64/xdo/

casperh wrote:

Do I put that in the script?

Understand what it does, but the main problem is actually sth. else
https://man.archlinux.org/man/extra/ala … tty.1.en#e

xdotool search --onlyvisible --class scpad_nc windowunmap || xdotool search --class scpad_nc windowmap windowactivate || exec alacritty --class scpad_nc -e ncmpcpp

Offline

#8 2023-08-26 19:36:38

casperh
Member
From: helvede
Registered: 2009-02-13
Posts: 54

Re: Help with Alacritty, scratchpad and ncmpcpp

Docbroke wrote:

1. Does your script work as intended when run from terminal? You can try running your script with " bash -x <your script>" to check where it is failing.

2. what is xdo?

No it doesn't work.

bash -x scpad_nc
++ xdotool search --class scpad_nc
+ winclass=
+ '[' -z '' ']'
+ alacritty -e ncmpcpp --class scpad_nc

Maybe it should be xdotool everywhere? I might've misunderstood something. I tried changing it to xdotool but still doesn't work.

Offline

#9 2023-08-26 19:37:55

casperh
Member
From: helvede
Registered: 2009-02-13
Posts: 54

Re: Help with Alacritty, scratchpad and ncmpcpp

Offline

#10 2023-08-26 19:50:35

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,104

Re: Help with Alacritty, scratchpad and ncmpcpp

Stop following idiots on youtube and read post #7 and esp. the linked manpage paragraph to understand why "alacritty -e ncmpcpp --class scpad_nc" won't work but "alacritty --class scpad_nc -e ncmpcpp" will.

You can probably use xdo instead of xdotool (I've never used the former, no idea whether it works) but there's little point in using two tools that effectively do the same on different syntax.

Offline

Board footer

Powered by FluxBB