Hi all!
I have been very sick for a week in covid and finally I can breath again (at least a bit and I am starting to have hope that I will survive this time)
I was wondering if there is a way to use that scratch.sh script with alacritty or urxvt instead of st?
I am very interested in scripting but my knowledge is still very weak. (slow and old learner but I hopefully have time!)
# these can be edited by the user to be any window, just make sure to set the class
# to our title using whatever flag is needed: --class, -c, etc.
title="scratchpad"
cmd=(
st -c "$title"
)
Change:
st -c "$title"
to whatever the equivalent flag would be to set the class for your terminal of choice. The man pages for urxvt and alacritty will have the information you need to define the class.
and in dkrc created a rule for alacritty opening as floating.
dkcmd rule class=alacritty float=true w=650 h=400
Alacritty is working very well as scratch now! It’s also very fast and working scrollback without patching.
Now I will try to get urxvt to work as a scratch.
Got to rest a bit more first though.
I saw yesterday that AL has a new “edition”! I downloaded and installed it on a very old workstation. I built it myself 5-6 years ago (from spare parts) but it was old aldready then. 1st gen Intel-I-5 and a very old Nvidia card. (I go with nouveau)
I installed just for running dkwm (and maybe dwm).
The motherboard is partially broken so I have to use a wifi-dongle.
AL picked up everything and installation went very smooth and fast. It took not more than 10 minutes and there are no SSDs.
I had some minor problems setting up dkwm on reboot but after switching to polybar (and one of “my own” configs) it’s running very well! Dkwm is now top of the list. It took me about 10-15 minutes to setup dkwm and still have most of the fancy stuff that other wms have. My old “no-name” workstation (org. Vista-machine) is alive!
Run the command with its command-line arguments in the urxvt window; also sets the window title and icon name to be the basename of the program being executed if neither -title (-T) nor -n are given on the command line. If this option is used, it must be the last on the command-line. If there is no -e option then the default is to run the program specified by the SHELL environment variable or, failing that, sh(1).
Please note that you must specify a program with arguments. If you want to run shell commands, you have to specify the shell, like this:
sxhkdrc
super + shift + d
kitty --class ~/.config/dk/scripts/scratch.sh
#!/bin/bash
# basic scratchpad functionality for dk
# spawns a set command with a known title if not already open
# if open toggle between the current workspace and the last
# written by Nathaniel Maia - 2021
# example rule for the below script to be placed in your dkrc
# dkcmd rule class="^scratchpad$" float=true
# these can be edited by the user to be any window, just make sure to set the class
# to our title using whatever flag is needed: --class, -c, etc.
title="scratchpad"
cmd=(
kitty --class "$title"
)
# window ID, we need to printf it as 8 hex digits to later match with dk status
win=$(printf '0x%08x' "$(xwininfo -root -children | awk '/'"$title"'/ {print $1}')")
if (( win != 0 )); then
# window is already open so toggle it
stat=$(dkcmd status num=1 type=full)
ws=$(awk '/^workspaces:/ { for (i = 1; i <= NF; i++) { if ($i ~ "*") print i - 1 } }' <<< "$stat")
wins=$(sed -n '/^windows:/,/^$/p' <<< "$stat")
win_ws=$(grep "^\s*${win}" <<< "$wins" | awk -F'" ' '{print $4}' | cut -d' ' -f1)
if (( win_ws == ws )); then
# hide it
# we could create a new workspace and place it there instead to not mess with the users existing workspaces
dkcmd ws send "$win" "$(awk '/numws/{print $2}' <<< "$stat")"
else
# show it
dkcmd ws send "$win" "$ws"
fi
else
# the window is not yet spawned so do so
"${cmd[@]}" &>/dev/null & disown
fi