Skip to content

Commit

Permalink
Windows support (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
Foldex authored Jun 19, 2023
1 parent 46ce3e4 commit b032bd6
Show file tree
Hide file tree
Showing 5 changed files with 339 additions and 22 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ A skin to make Steam look more like a native GNOME app

## Requirements

* [Python 3](https://www.python.org/downloads/)
* [Cantarell fonts](https://gitlab.gnome.org/GNOME/cantarell-fonts): An option to install these is included in the install script, but fonts packaged by your distro are preferred.
* The skin was created for the Linux version of Steam and wasn't tested on Windows or macOS. It will work with some visual problems.
* The skin is created and tested mostly on the Linux version of Steam. Steam's new UI has largely unified platform differences, so other platforms should work, but are not a priority.

## Previews

Expand Down Expand Up @@ -66,6 +67,10 @@ A skin to make Steam look more like a native GNOME app

![Kate](/colorthemes/kate/preview.png?raw=true)

### Metro

![Metro](/colorthemes/metro/preview.png?raw=true)

### Nord

![Nord](/colorthemes/nord/preview.png?raw=true)
Expand Down Expand Up @@ -123,6 +128,12 @@ cd Adwaita-for-Steam
./install.py -c nord -fi -p windowcontrols/right-all -we login/hide_qr -we library/hide_whats_new
```

#### Windows

- Download the [Latest Release](https://github.com/tkashkin/Adwaita-for-Steam/releases)
- Ensure you have [Python](#requirements) installed
- Double click the `install_windows` bat script and follow the prompts

### With graphical installer

Use the [graphical installer](https://github.com/Foldex/AdwSteamGtk) by [@Foldex](https://github.com/Foldex).
Expand Down
76 changes: 76 additions & 0 deletions colorthemes/metro/metro.theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[general]
bg = #1A1A1AFF
fg = #FFFFFFFF

[window]
border = #FFFFFF26
window_bg = #1A1A1AFF
window_fg = #FFFFFFFF

[headerbar]
headerbar_backdrop = #1A1A1AFF
headerbar_bg = #141414FF
headerbar_fg = #FFFFFFFF
headerbar_shade = #00000061

[popover]
popover_bg = #262626FF
popover_fg = #FFFFFFFF

[toast]
toast_bg = #000000B3
toast_fg = #FFFFFFFF

[view]
view_bg = #1E1E1EFF
view_fg = #FFFFFFFF

[accent]
accent = #0073C6FF
accent_bg = #0073C6FF
accent_fg = #FFFFFFFF
accent_disabled = #0073C680
accent_hover_bg = #0073C612
accent_active_bg = #0073C629

[destructive]
destructive = #F17079FF
destructive_bg = #E81224FF
destructive_fg = #FFFFFFFF
destructive_disabled = #F1707980
destructive_hover_bg = #F1707912
destructive_active_bg = #F1707929

[error]
error = #F17079FF
error_bg = #E81224FF
error_fg = #FFFFFFFF

[success]
success = #82BA00FF
success_bg = #82BA00FF
success_fg = #FFFFFFFF

[warning]
warning = #FFFF63FF
warning_bg = #FFF63FFF
warning_fg = #FFFFFFFF

[button]
button_bg = #FFFFFF0D
button_fg = #FFFFFFFF

[label]
dim_label_fg = #FFFFFF8C

[card]
card_bg = #FFFFFF0D
card_solid_bg = #262626FF

[focusring]
focusring = #0073C6FF

[scrollbar]
scrollbar = #FFFFFF33
scrollbar_hover = #FFFFFF66
scrollbar_active = #FFFFFF99
Binary file added colorthemes/metro/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 70 additions & 21 deletions install.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
from pathlib import Path
from sys import platform
from tempfile import TemporaryDirectory, NamedTemporaryFile
from typing import NoReturn
import configparser
Expand All @@ -9,17 +10,36 @@
import time
import os

TEXT_BOLD = "\033[1m"
TEXT_BLUE = "\033[1;34m"
TEXT_GREEN = "\033[1;32m"
TEXT_PURPLE = "\033[1;35m"
TEXT_RED = "\033[1;31m"
TEXT_RESET = "\033[0m"

TEXT_ARROW="→"
TEXT_CHECK="✓"
TEXT_CROSS="✖"
TEXT_INFO="✦"
# Platform Specific
if platform == "win32":
import winreg
WINDOWS_RUN = True

TEXT_BOLD = ""
TEXT_BLUE = ""
TEXT_GREEN = ""
TEXT_PURPLE = ""
TEXT_RED = ""
TEXT_RESET = ""

TEXT_ARROW = ""
TEXT_CHECK = ""
TEXT_CROSS = ""
TEXT_INFO = ""
else:
WINDOWS_RUN = False

TEXT_BOLD = "\033[1m"
TEXT_BLUE = "\033[1;34m"
TEXT_GREEN = "\033[1;32m"
TEXT_PURPLE = "\033[1;35m"
TEXT_RED = "\033[1;31m"
TEXT_RESET = "\033[0m"

TEXT_ARROW = "→"
TEXT_CHECK = "✓"
TEXT_CROSS = "✖"
TEXT_INFO = "✦"

COLOR_THEME_DIR = "colorthemes"
FONTS_DIR = "fonts"
Expand All @@ -30,8 +50,10 @@

TARGET_NORMAL = "~/.steam/steam"
TARGET_FLATPAK = "~/.var/app/com.valvesoftware.Steam/.steam/steam"
TARGET_WINDOWS = "C:/Program Files (x86)/Steam"

TARGET_FONTS = "~/.local/share/fonts"
TARGET_FONTS_WIN = "AppData/Local/Microsoft/Windows/Fonts"

STEAM_LOOPBACK = "https://steamloopback.host"
STEAM_PATCHED_HEADER = "/*patched*/"
Expand Down Expand Up @@ -132,17 +154,38 @@ def list_options(type: str, options: list[Path], suffix: str, sourcedir: Path, a
print(f"{TEXT_PURPLE}{TEXT_INFO} No {type} available\n{TEXT_RESET}")

# Fonts
def install_font(name: str, ext: str):
font = fontdir / name / ext
if font.exists():
print(f"\n{TEXT_BLUE}{TEXT_ARROW} Installing font {TEXT_BOLD}{name}{TEXT_RESET}{TEXT_BLUE}...{TEXT_RESET}")
files = font.glob(f"*.{ext}")
target = Path(TARGET_FONTS).expanduser().resolve()
target.mkdir(exist_ok = True)
for f in files:
shutil.copy(f, target)
def install_font(name: str):
if WINDOWS_RUN:
target = Path.home() / TARGET_FONTS_WIN
ext = "ttf"
else:
target = Path(TARGET_FONTS).expanduser().resolve()
ext = "otf"

font = fontdir / name / ext

if not font.is_dir():
print(f"{TEXT_PURPLE}{TEXT_INFO} Font: {TEXT_BOLD}{name}{TEXT_RESET}{TEXT_PURPLE} not found!{TEXT_RESET}")
return

print(f"\n{TEXT_BLUE}{TEXT_ARROW} Installing font {TEXT_BOLD}{name}{TEXT_RESET}{TEXT_BLUE}...{TEXT_RESET}")
files = font.glob(f"*.{ext}")
target.mkdir(exist_ok = True)
for f in files:
target_file = target / f.name

if target_file.is_file():
print(f" {TEXT_BLUE}{TEXT_ARROW} Font {TEXT_BOLD}{f.name}{TEXT_RESET}{TEXT_BLUE} exists. Skipping...{TEXT_RESET}")
continue

shutil.copy(f, target)
if WINDOWS_RUN:
win_reg_font(f.name, target_file)

def win_reg_font(name: str, target: Path):
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", 0, winreg.KEY_ALL_ACCESS)
winreg.SetValueEx(key, str(name), 0, winreg.REG_SZ, str(target))
winreg.CloseKey(key)

# Webkit CSS
def find_web_extras() -> list[Path]:
Expand Down Expand Up @@ -280,6 +323,7 @@ def dev_reload(target: Path):
tmpfile.write(b"")
time.sleep(3)

# Run
if __name__ == "__main__":
if not webthemedir.exists():
raise SystemExit(f"{TEXT_RED}{TEXT_CROSS} Web Theme directory {TEXT_BOLD}{WEB_THEME_DIR}{TEXT_RESET}{TEXT_RED} does not exist. Make sure you're running the installer from its root directory{TEXT_RESET}")
Expand All @@ -297,13 +341,16 @@ def dev_reload(target: Path):
parser.add_argument("-we", "--web-extras", nargs = "+", action = "extend", help = "Enable one or multiple web theme extras")
args = parser.parse_args()

if WINDOWS_RUN:
args.target = ["windows"]

if args.list_options:
list_options("color themes", find_color_themes(), ".theme", colorthemedir, "color-theme")
list_options("web extras", find_web_extras(), ".css", webextrasdir, "web-extras")
exit(0)

if args.font_install:
install_font("Cantarell", "otf")
install_font("Cantarell")

selected_theme = None
if args.color_theme:
Expand Down Expand Up @@ -342,6 +389,8 @@ def dev_reload(target: Path):
targets.add(Path(TARGET_NORMAL).expanduser().resolve())
elif t == "flatpak":
targets.add(Path(TARGET_FLATPAK).expanduser().resolve())
elif t == "windows":
targets.add(Path(TARGET_WINDOWS))
else:
targets.add(Path(t).expanduser().resolve())

Expand Down
Loading

0 comments on commit b032bd6

Please sign in to comment.