~pvsr/qpm

2d92897d958a8f0dd536c8ea1cf8ddd7dc6bdca3 — Peter Rice 3 months ago f7707a4
include profile name in window title
2 files changed, 12 insertions(+), 11 deletions(-)

M qpm/profiles.py
M tests/test_profiles.py
M qpm/profiles.py => qpm/profiles.py +8 -8
@@ 62,13 62,13 @@ def create_profile(profile: Profile) -> bool:
    return True


def create_config(profile_root: Path) -> None:
    with (profile_root / "config" / "config.py").open(mode="x") as config:
        # print(
        #     "c.window.title_format = '{perc}{current_title}{title_sep}"
        #     + f"{profile_root}'",
        #     file=config,
        # )
def create_config(profile: Profile) -> None:
    with (profile.root / "config" / "config.py").open(mode="x") as config:
        print(
            "c.window.title_format = '{perc}{current_title}{title_sep}"
            + f"qutebrowser ({profile.name})'",
            file=config,
        )
        print(f"config.source('{main_config_dir / 'config.py'}')", file=config)




@@ 86,6 86,6 @@ def ensure_profile_exists(profile: Profile, create: bool = True) -> bool:

def new_profile(profile: Profile) -> bool:
    if create_profile(profile):
        create_config(profile.root)
        create_config(profile)
        return True
    return False

M tests/test_profiles.py => tests/test_profiles.py +4 -3
@@ 58,9 58,10 @@ def test_create_profile_nested_conflict(tmp_path: Path):

def test_create_config(tmp_path: Path):
    config.profiles_dir = tmp_path
    config_dir = tmp_path / "config"
    config_dir.mkdir()
    profiles.create_config(tmp_path)
    profile = Profile("test")
    config_dir = profile.root / "config"
    config_dir.mkdir(parents=True)
    profiles.create_config(profile)
    assert list(config_dir.iterdir()) == [config_dir / "config.py"]