leftwm: Theme is not applied

Describe the bug I have followed the wiki to create a minimal theme, but it is not applied to leftwm.

To Reproduce

  1. Structure your leftwm config in the following structure:
.
├── config.toml
└── themes
    └── current
        ├── down
        ├── theme.toml
        └── up
  1. Insert content into the theme/current directory down
echo "UnloadTheme" > $XDG_RUNTIME_DIR/leftwm/commands.pipe

up

leftwm-command "LoadTheme $HOME/.config/leftwm/themes/current/theme.toml"

config.toml

border_width = 10
margin = 5
  1. Make down and up executable
chmod +x down
chmod +x up
  1. Restart leftwm

Expected behavior I expect I am able to apply setting that I have made in config.toml to leftwm. But everything is unchanged.

Environment:

  • OS/Distro: [e.g. Manjaro] Nixos
  • Output of leftwm-check
:: LeftWM version: 0.2.8
:: LeftWM git hash: NONE
:: Loading configuration . . .
    -> Configuration loaded OK
:: Checking keybinds . . .
    -> All keybinds OK
:: Checking environment . . .
    -> Environment OK

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (15 by maintainers)

Most upvoted comments

I’ve tried to create a bare minimum theme my self now: up script:

#!/usr/bin/env bash

leftwm command "UnloadTheme"

leftwm command "LoadTheme $HOME/.config/leftwm/themes/current/theme.toml"

Note: as a convention unloading a theme should happen with a down script, which undos all of the things the upscript launches and that is symlinked or copied to /tmp/leftwm-down-theme with the following snippet:

# Down the last running theme
if [ -f "/tmp/leftwm-theme-down" ]; then
    /tmp/leftwm-theme-down
    rm /tmp/leftwm-theme-down
fi
ln -s $HOME/.config/leftwm/themes/current/down /tmp/leftwm-theme-down

down script:

#!/usr/bin/env bash

leftwm command "UnloadTheme"

theme.toml:

default_border_color = '#000000'
floating_border_color = '#000000'
focused_border_color = '#FF0000'
border_width = 10
margin = 5

Important: it appears, that this is the absolute minimum a theme file needs to contain, otherwise parsing will fail. If this does not solve the issue, I don’t know what else could be the culprit.

I’d like to hear some opinions, whether all fields in theme.toml should be optional, or if we want the above to stay the bare minimum.

I added those infos to the wiki

Ok this is finally working now! Not the permission issue, but the shebang!!!. Even thought I don’t have anything in my /usr/bin/, the up script is only running, if the shebang is either #!/usr/bin/env bash or #!/usr/bin/env sh

This is my /usr/bin:

❯ ls /usr/bin
 .   ..   env

Is this the expected behavior, where it is strictly requiring the shebang of bash or env?

Closing this as it is solved, but I think the discussion can go on.

I’ve tried to create a bare minimum theme my self now: up script:

#!/usr/bin/env bash

leftwm command "UnloadTheme"

leftwm command "LoadTheme $HOME/.config/leftwm/themes/current/theme.toml"

Note: as a convention unloading a theme should happen with a down script, which undos all of the things the upscript launches and that is symlinked or copied to /tmp/leftwm-down-theme with the following snippet:

# Down the last running theme
if [ -f "/tmp/leftwm-theme-down" ]; then
    /tmp/leftwm-theme-down
    rm /tmp/leftwm-theme-down
fi
ln -s $HOME/.config/leftwm/themes/current/down /tmp/leftwm-theme-down

down script:

#!/usr/bin/env bash

leftwm command "UnloadTheme"

theme.toml:

default_border_color = '#000000'
floating_border_color = '#000000'
focused_border_color = '#FF0000'
border_width = 10
margin = 5

Important: it appears, that this is the absolute minimum a theme file needs to contain, otherwise parsing will fail. If this does not solve the issue, I don’t know what else could be the culprit.

I’d like to hear some opinions, whether all fields in theme.toml should be optional, or if we want the above to stay the bare minimum.

I added those infos to the wiki

I may be mistaken, but I believe the shebang has to be the first line of a document, as the rest of the document basically is just arguments to the command following the shebang.

I would Test #!/usr/bin/bash, #!/bin/bash and #!/usr/bin/env bash and return Ok as this should suffice to indicate the script should work. #!/ for a shebang like #!/usr/fish will WARNING: Usage of non-standard shebang '#!/usr/bin/fish' in 'up' script. Proper execution cannot be checked. And if the script fails for other reasons, there’s other places then leftwm-check to debug this IMO.

I see what the issue is with Soothe in particular. LeftWM-Theme needs to link to Soothe/theme/, not Soothe/. You can manually link in that case; otherwise we’ll need to help LeftWM-Theme with a relative_directory tag.

Could it be something as simple as not declaring #!/usr/bin/env bash at the top of the scripts, other wise I don’t see why there is an issue. Whether it is related or not, it may be good to raise an issue with the devs about user files that are created in the users home tree should be owned be that user. Thanks.