Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picom --invert-color-include fails when the HOME env is unset #1148

Closed
milahu opened this issue Nov 20, 2023 · 7 comments · Fixed by #1157
Closed

picom --invert-color-include fails when the HOME env is unset #1148

milahu opened this issue Nov 20, 2023 · 7 comments · Fixed by #1157
Labels

Comments

@milahu
Copy link

milahu commented Nov 20, 2023

when i run picom in an environment where HOME is unset
then this does not work = the colors of chromium are not inverted

picom --invert-color-include 'class_g="Chromium-browser"'

fixed by setting HOME to an empty tempdir

picom version 10.2

test-picom.py

im calling picom from python, so this looks like

#!/usr/bin/env python3

# required packages: tigervnc picom chromium

import os
import subprocess
import tempfile
import time

vnc_display = ":2"

args = [
    "Xvnc",
    # dont require a password
    "-SecurityTypes", "none",
    "-geometry", "1024x768", # default: 1024x768
    "-depth", "16", # default: 24
    "-FrameRate", "10", # maximum frame rate. default: 60
    "-localhost", # accept connections only from localhost
    vnc_display,
]
proc_xvnc = subprocess.Popen(
    args,
)
time.sleep(1)

args = ["vncviewer", vnc_display]
proc_vncviewer = subprocess.Popen(
    args,
)
time.sleep(1)

# minimal env: only PATH is set
custom_env = {
    "PATH": os.environ["PATH"],
    "DISPLAY": vnc_display,
    # setting HOME is required to fix "picom --invert-color-include"
    #"HOME": tempfile.mkdtemp(suffix="-temp_home"),
}

args = [
    "picom",

    # invert colors of chromium window
    "--invert-color-include", 'class_g="Chromium-browser"',

    # invert colors of all windows, also "save file" dialogs
    #"--invert-color-include", 'name ~= "."',

    # dont invert colors for the "feh" image viewer
    #"--invert-color-include", 'class_g != "feh"',

    # fix "picom --invert-color-include" with unset HOME
    "--config", "/dev/null",
]
proc_picom = subprocess.Popen(
    args,
    env=custom_env,
)
time.sleep(1)

args = ["chromium"]
proc_chromium = subprocess.Popen(
    args,
    env=custom_env,
)
time.sleep(5)

proc_vncviewer.kill()
proc_chromium.kill()
proc_picom.kill()
proc_xvnc.kill()
@yshui
Copy link
Owner

yshui commented Dec 19, 2023

can you run picom with --config /dev/null? to make sure it's indeed the command line option being affected.

@milahu
Copy link
Author

milahu commented Dec 20, 2023

yes that works. i have updated the code in my first comment

@absolutelynothelix
Copy link
Collaborator

absolutelynothelix commented Dec 21, 2023

can't reproduce:
image

btw, the class_g of chromium is Chromium for me, not Chromium-browser.

@milahu
Copy link
Author

milahu commented Dec 21, 2023

can't reproduce

remove --config /dev/null
then invert-color-include should fail

the class_g of chromium is Chromium for me, not Chromium-browser

im using ungoogled-chromium...
use --invert-color-include 'name ~= "."' to invert colors of all windows

chromium darkmode is controlled by the XDG_DATA_DIRS env

@absolutelynothelix
Copy link
Collaborator

absolutelynothelix commented Dec 21, 2023

remove --config /dev/null
then invert-color-include should fail

still can't reproduce:
image

maybe unset HOME isn't enough to emulate an environment without the HOME environment variable set? 🤔

btw, this is how it looks normally for a reference:
image

@milahu
Copy link
Author

milahu commented Dec 21, 2023

whatabout the python script from #1148 (comment)

@absolutelynothelix
Copy link
Collaborator

oh, it actually causes a segfault 😅

does #1157 fix the issue for you? btw, thanks for the script, it helped a lot in triggering the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants