leftwm / leftwm

A tiling window manager for Adventurers
http://leftwm.org
MIT License
2.87k stars 189 forks source link

Changes to theme.toml file not reflected #252

Closed bmclean2 closed 3 years ago

bmclean2 commented 3 years ago

I've spent two weeks implementing leftwm and leftwm-theme on my machine, and I love the project. One thing I have not been able to get to work is the theme.toml file. Any changes to the file are not reflected on the screen. I've checked over the "up" script and it appears that all of the correct info is getting directed into "commands.pipe". Any ideas on why this wouldn't be working?

mautamu commented 3 years ago

Do

cat ~/.config/leftwm/themes/current/up
cat ~/.config/leftwm/themes/current/theme.toml 
cat ~/.config/leftwm/themes/current/down

return what you're expecting?

LeftWM also doesn't watch for changes, so leftwm-theme apply yourthemenamehere or mod+shift+r is required after each change.

bmclean2 commented 3 years ago

Yes, I've viewed the content of those files many times and have done mod+shift+r countless times. It might be worth mentioning that the theme.toml file didn't work from the very first time I changed it (before installing leftwm-theme). Is there any way to view a leftwm log or debug mode so that I can figure out what's happening when those commands are written to commands.pipe? I don't know any of the flags because there is no man page.

mautamu commented 3 years ago

What are the contents of your theme.toml / up files (if you don't mind sharing)?

If you recompile leftwm/leftwm-worker with --features=journald, there will be some logging to journalctl -xe (if on systemd-type systems). You're looking for entries beginning with "Theme loading failed: {reason}". I think there's also regular logging without --features, but I'm not sure how to capture it.

bmclean2 commented 3 years ago

theme.toml

border_width = 2
margin = [8, 8]
default_border_color = "#bd93f9"
floating_border_color = "#bd93f9"
focused_border_color = "#fe8019"

up

#!/bin/bash
export SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

#down the last running theme
if [ -f "/tmp/leftwm-theme-down" ]; then
    /tmp/leftwm-theme-down
    rm /tmp/leftwm-theme-down
fi
ln -s $SCRIPTPATH/down /tmp/leftwm-theme-down

#Boot compton or picom if it exists
if [ -x "$(command -v compton)" ]; then
  compton &> /dev/null & 
elif [ -x "$(command -v picom)" ]; then
  picom &> /dev/null & 
fi

#set the theme.toml config
echo "LoadTheme $SCRIPTPATH/theme.toml" > $XDG_RUNTIME_DIR/leftwm/commands.pipe

#set background
if [ -x "$(command -v nitrogen)" ]; then
  nitrogen --restore
fi

lxsession &
dunst &
killall plank &

index=0
monitor="$(polybar -m | grep +0+0 | sed s/:.*// | tac)"
leftwm-state -q -n -t $SCRIPTPATH/sizes.liquid | sed -r '/^\s*$/d' | while read -r width x y
do 
  barname="mainbar$index"
  monitor=$monitor offsetx=$x width=$width polybar -c $SCRIPTPATH/polybar.config $barname &> /dev/null &
  let index=index+1
done

If you don't see anything incorrect in here, I may recompile with journald to trace the problem.

mautamu commented 3 years ago

Those both work for me. I'm assuming you've already checked that all those programs are installed to have included them.

Are you able to get other themes to work with leftwm-theme? Or is it just this theme that it's upset about?

bmclean2 commented 3 years ago

OK, I found the issue. It wasn't working with my own personal theme, nor with the community theme "Dracula Rounded." Both have the margin = [x, x] format in theme.toml. The theme "Soothe" was working, and it has the margin = x format, so somehow the WM is not correctly handling the first form. Is this a bug?

mautamu commented 3 years ago

Probably a degradation. Will need to look into why that is. Does the long form [x, y, z, a] work?

Also could depend on the version you’re running. That was a relatively recent addition.

Are you perchance using the AUR (non-git) package? leftwm-state -V (maybe -v icrc) will tell you which version you’re on. If it’s 0.2.6 it doesn’t have the margin array capabilities. If it’s 0.2.7 it still might now if it was before #196.

bmclean2 commented 3 years ago

I built using the March 11th commit e56d49f, so #196 should be implemented. leftwm-state -V returns 0.2.6. [x, y, z, a] does not work either.

mautamu commented 3 years ago

Hmm, is e56d49f installed properly? It should return 0.2.7. You might go in to the build folder and ./target/release/leftwm-state -V and ./target/debug/leftwm-state -V. Might be possible that one artifact got built but another installed?

AethanFoot commented 3 years ago

Ill update my theme to say leftwm-git is required, is it possible to add something to leftwm-theme to check that the right version of leftwm is installed for the theme?

mautamu commented 3 years ago

@AethanFoot Yeah, just make a PR against leftwm/leftwm-community-themes : known.toml, set leftwm_versions to "^0.2.7":

[[theme]]
name = "Dracula Rounded"
repository = "https://github.com/AethanFoot/leftwm-theme-dracula-rounded/"
commit = "*"
version = "0.0.2"
leftwm_versions = "^0.2.7"

I will work on having leftwm-theme also check a theme's theme.toml, but I've been waiting on #201 for that.

bmclean2 commented 3 years ago

@mautamu I think what happened was that I had previously installed 0.2.6 via crates.io, and the location of those binaries superceded the compiled version in my $PATH. All is working now.

mautamu commented 3 years ago

Ah, cool! Thanks for the follow up! Glad it’s working now!! :)

bmclean2 commented 3 years ago

Thank you! Great project by the way...this is my first WM apart from using a full DE, and I'm very happy with it.