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

Add Style for Steam Deck #316

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
10 changes: 9 additions & 1 deletion pupgui2/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
APP_NAME = 'ProtonUp-Qt'
APP_VERSION = '2.9.2'
APP_ID = 'net.davidotek.pupgui2'
APP_THEMES = ( 'light', 'dark', 'system', None )
APP_THEMES = ( 'light', 'dark', 'system', 'steam', None )
APP_ICON_FILE = os.path.join(xdg_config_home, 'pupgui/appicon256.png')
APP_GHAPI_URL = 'https://api.github.com/repos/Davidotek/ProtonUp-qt/releases'
DAVIDOTEK_KOFI_URL = 'https://ko-fi.com/davidotek'
Expand Down Expand Up @@ -96,6 +96,14 @@ def PALETTE_DARK():
palette_dark.setColor(QPalette.HighlightedText, Qt.black)
return palette_dark

def PALETTE_STEAMUI():
""" returns a Steam-ui like color palette """
palette_steam = QPalette()
# Needed for theming Qt's Wayland Client Side Decoration
palette_steam.setColor(QPalette.Window, QColor(23, 29, 37)) #171D25
palette_steam.setColor(QPalette.WindowText, Qt.white)
return palette_steam

PROTONDB_COLORS = {'platinum': '#b4c7dc', 'gold': '#cfb53b', 'silver': '#a6a6a6', 'bronze': '#cd7f32', 'borked': '#ff0000', 'pending': '#748472' }

STEAM_API_GETAPPLIST_URL = 'https://api.steampowered.com/ISteamApps/GetAppList/v2/'
Expand Down
2 changes: 1 addition & 1 deletion pupgui2/pupgui2aboutdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setup_ui(self):

self.ui.btnGitHub.clicked.connect(lambda: open_webbrowser_thread(PROTONUPQT_GITHUB_URL))

self.ui.comboColorTheme.addItems([self.tr('light'), self.tr('dark'), self.tr('system (restart required)')])
self.ui.comboColorTheme.addItems([self.tr('light'), self.tr('dark'), self.tr('system (restart required)'), 'Steam Deck'])
self.ui.comboColorTheme.setCurrentIndex(APP_THEMES.index(config_theme()) if config_theme() in APP_THEMES else (len(APP_THEMES) - 1))

self.ui.btnClose.clicked.connect(lambda: self.ui.close())
Expand Down
28 changes: 28 additions & 0 deletions pupgui2/resources/themes/steamdeck.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
QWidget {
color: #EEEEEE;
background-color: #171D25;
font-weight: 300;
}

QPushButton, QListWidget, QComboBox, QToolButton, QLineEdit {
background-color: #282D36;
border: none;
border-radius: 2px;
padding: 8px;
}

QListWidget::item {
padding: 4px;
}

QPushButton:hover {
background-color: #464D58;
}

QPushButton::pressed {
background-color: #393F49;
}

QPushButton::disabled {
background-color: #1D2026;
}
7 changes: 6 additions & 1 deletion pupgui2/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import requests
import zipfile
import tarfile
import pkgutil
import random

import zstandard
Expand All @@ -19,7 +20,7 @@
from PySide6.QtCore import QCoreApplication
from PySide6.QtWidgets import QApplication, QStyleFactory, QMessageBox, QCheckBox

from pupgui2.constants import POSSIBLE_INSTALL_LOCATIONS, CONFIG_FILE, PALETTE_DARK, TEMP_DIR, IS_FLATPAK
from pupgui2.constants import POSSIBLE_INSTALL_LOCATIONS, CONFIG_FILE, PALETTE_DARK, PALETTE_STEAMUI, TEMP_DIR, IS_FLATPAK
from pupgui2.constants import AWACY_GAME_LIST_URL, LOCAL_AWACY_GAME_LIST
from pupgui2.constants import GITHUB_API, GITLAB_API, GITLAB_API_RATELIMIT_TEXT
from pupgui2.datastructures import BasicCompatTool, CTType, Launcher, SteamApp, LutrisGame, HeroicGame
Expand Down Expand Up @@ -93,6 +94,10 @@ def apply_dark_theme(app: QApplication) -> None:
elif theme == 'dark':
app.setStyle('Fusion')
app.setPalette(PALETTE_DARK())
elif theme == 'steam':
app.setPalette(PALETTE_STEAMUI())
stylesheet = pkgutil.get_data(__name__, 'resources/themes/steamdeck.qss')
app.setStyleSheet(stylesheet.decode('utf-8'))
else:
is_plasma = 'plasma' in os.environ.get('DESKTOP_SESSION', '')
darkmode_enabled = False
Expand Down