Skip to content

Commit

Permalink
OLED model compatibility! (#165)
Browse files Browse the repository at this point in the history
* Improve launcher.sh script (#155)

Use grep with -c flag instead of wc -l command.
Additionally, change quotation of path pointing to cryo_utilities
binary.

Signed-off-by: skaluzka <[email protected]>

* Single quotes for manual installation script. (#125)

* Single quotes

For me echo only worked with single quotes.

* Make sure "$HOME"/.local/share/applications exists

* Update scaling logic for OLED

---------

Signed-off-by: skaluzka <[email protected]>
Co-authored-by: skaluzka <[email protected]>
Co-authored-by: Tobias Domhan <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2023
1 parent 1c80d08 commit a934c66
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 56 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Scripts and utilities to improve performance and manage storage on the Steam Dec

## Update

### Notes on the Steam Deck OLED
The latest update resolves the scaling issues on the new OLED Deck, and I figured I should provide an update here:
1. **This (CU2) is still fully compatible with the new OLED models.**
2. Performance improvements should be similar (or possibly slightly better) than on the LCD model (thorough testing pending)

### General Linux Compatibility
As of the latest update, this _should_ be compatible with most Linux systems, with the following limitations:
1. This will not operate on swap partitions, only files.
Expand Down Expand Up @@ -55,7 +60,7 @@ new features and how they work.
* Storage Manager
* Sync shadercache and compatdata to the same location the game is installed
* Delete shadercache and compatdata for whichever games you select
* **NEW** Delete the shadercache and compatdata for all uninstalled games with a single click
* Delete the shadercache and compatdata for all uninstalled games with a single click
* Full CLI mode

Look below for common questions and answers, or go check out my [YouTube Channel](https://www.youtube.com/@cryobyte33)
Expand All @@ -66,7 +71,8 @@ for examples on how to use this and what performance you can expect.
### Simple

[Download this link](https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/InstallCryoUtilities.desktop)
to your desktop (right click and save file) on your Steam Deck, then double-click it.
to your desktop (right click and save file) on your Steam Deck, remove the `.download` from the end of the file name,
then double-click it.

This will install the program, create desktop icons, and create menu entries.

Expand Down
27 changes: 14 additions & 13 deletions docs/manual-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ cd .cryo_utilities
```
2. Go to [the releases page](https://github.com/CryoByte33/steam-deck-utilities/releases/tag/latest) and download cryo_utilities.
3. Go to [launcher.sh](https://github.com/CryoByte33/steam-deck-utilities/blob/main/launcher.sh), right click on "Raw" and "Save Link As" to the downloads folder.
4. Go to [icon.png](https://github.com/CryoByte33/steam-deck-utilities/blob/main/icon.png), right click on "Raw" and "Save Link As" to the downloads folder.
5. Move all 3 downloaded files to `/home/deck/cryo_utilities`.
4. Go to [icon.png](https://github.com/CryoByte33/steam-deck-utilities/blob/main/icon.png), right click on "Raw" and "Save Link As" to the downloads folder naming it `cryo-utilities.png`.
5. Move all 3 downloaded files to `/home/deck/.cryo_utilities`.
6. Open Konsole and paste the entire block below, then press Enter/Return:
```bash
cd ~/.cryo_utilities
Expand All @@ -27,58 +27,59 @@ Type=Application
StartupNotify=false' >"$HOME"/Desktop/CryoUtilitiesUninstall.desktop
chmod +x "$HOME"/Desktop/CryoUtilitiesUninstall.desktop
rm -rf "$HOME"/Desktop/CryoUtilities.desktop 2>/dev/null
echo "#!/usr/bin/env xdg-open
echo '#!/usr/bin/env xdg-open
[Desktop Entry]
Name=CryoUtilities
Exec=bash $HOME/.cryo_utilities/launcher.sh
Icon=cryo-utilities
Terminal=false
Type=Application
StartupNotify=false" >"$HOME"/Desktop/CryoUtilities.desktop
StartupNotify=false' >"$HOME"/Desktop/CryoUtilities.desktop
chmod +x "$HOME"/Desktop/CryoUtilities.desktop
rm -rf "$HOME"/Desktop/UpdateCryoUtilities.desktop 2>/dev/null
echo "#!/usr/bin/env xdg-open
mkdir -p "$HOME"/.local/share/applications
echo '#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Update CryoUtilities
Exec=curl https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/install.sh | bash -s --
Icon=bittorrent-sync
Terminal=false
Type=Application
StartupNotify=false" >"$HOME"/Desktop/UpdateCryoUtilities.desktop
StartupNotify=false' >"$HOME"/Desktop/UpdateCryoUtilities.desktop
chmod +x "$HOME"/Desktop/UpdateCryoUtilities.desktop
rm -rf "$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop 2>/dev/null
echo "#!/usr/bin/env xdg-open
echo '#!/usr/bin/env xdg-open
[Desktop Entry]
Name=CryoUtilities - Uninstall
Exec=curl https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/uninstall.sh | bash -s --
Icon=delete
Terminal=false
Type=Application
Categories=Utility
StartupNotify=false" >"$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop
StartupNotify=false' >"$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop
chmod +x "$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop
rm -rf "$HOME"/.local/share/applications/CryoUtilities.desktop 2>/dev/null
echo "#!/usr/bin/env xdg-open
echo '#!/usr/bin/env xdg-open
[Desktop Entry]
Name=CryoUtilities
Exec=bash $HOME/.cryo_utilities/launcher.sh
Icon=cryo-utilities
Terminal=false
Type=Application
Categories=Utility
StartupNotify=false" >"$HOME"/.local/share/applications/CryoUtilities.desktop
StartupNotify=false' >"$HOME"/.local/share/applications/CryoUtilities.desktop
chmod +x "$HOME"/.local/share/applications/CryoUtilities.desktop
rm -rf "$HOME"/.local/share/applications/UpdateCryoUtilities.desktop 2>/dev/null
echo "#!/usr/bin/env xdg-open
echo '#!/usr/bin/env xdg-open
[Desktop Entry]
Name=CryoUtilities - Update
Exec=curl https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/install.sh | bash -s --
Icon=bittorrent-sync
Terminal=false
Type=Application
Categories=Utility
StartupNotify=false" >"$HOME"/.local/share/applications/UpdateCryoUtilities.desktop
StartupNotify=false' >"$HOME"/.local/share/applications/UpdateCryoUtilities.desktop
chmod +x "$HOME"/.local/share/applications/UpdateCryoUtilities.desktop
update-desktop-database ~/.local/share/applications
```
Now, you should be all set to use CryoUtilities as normal!
Now, you should be all set to use CryoUtilities as normal!
2 changes: 1 addition & 1 deletion internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

// CurrentVersionNumber Version number to build with, Fyne can't support build flags just yet.
var CurrentVersionNumber = "2.2.0"
var CurrentVersionNumber = "2.2.1"

// Get home Directory
var HomeDirectory, _ = os.UserHomeDir()
Expand Down
59 changes: 24 additions & 35 deletions internal/ui_screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,15 @@

package internal

/*
#cgo LDFLAGS: -lX11
#include <X11/Xlib.h>
*/
import "C"
import (
"fmt"
"github.com/go-gl/glfw/v3.3/glfw"
"os"
)

const (
smallScreen = 1280
mediumScreen = 1920
)

const (
defaultSteamDeckScreenWidth = 1280
defaultSteamDeckScreenHeight = 800
smallScreenSize = 100
mediumScreenSize = 200
)

const scaleEnvKey = "FYNE_SCALE"
Expand All @@ -44,8 +35,8 @@ type ScreenSizer struct {
}

type screen struct {
name string
width, height int
name string
widthPhysical, heightPhysical int
}

func NewScreenSizer() *ScreenSizer {
Expand All @@ -54,40 +45,38 @@ func NewScreenSizer() *ScreenSizer {

func getDefaultScreen() screen {

display := C.XOpenDisplay(nil)
if display == nil {
CryoUtils.InfoLog.Println("Can't get info on display")
return screen{name: defaultScreenName, width: defaultSteamDeckScreenWidth, height: defaultSteamDeckScreenHeight}
}
defer C.XCloseDisplay(display)

displayScreen := C.XDefaultScreenOfDisplay(display)
displayScreenName := C.GoString(C.XDisplayString(display))
width := int(C.XWidthOfScreen(displayScreen))
height := int(C.XHeightOfScreen(displayScreen))
if width == 0 || height == 0 {
CryoUtils.InfoLog.Println("Default monitor not detected")
return screen{name: defaultScreenName, width: defaultSteamDeckScreenWidth, height: defaultSteamDeckScreenHeight}
var primaryScreen screen

err := glfw.Init()
if err != nil {
return defaultScreen()
}
return screen{displayScreenName, width, height}
defer glfw.Terminate()

monitor := glfw.GetPrimaryMonitor()
primaryScreen.name = monitor.GetName()
primaryScreen.widthPhysical, primaryScreen.heightPhysical = monitor.GetPhysicalSize()
return primaryScreen
}

func (s ScreenSizer) UpdateScaleForActiveMonitor() {
defaultScreen := getDefaultScreen()

if defaultScreen.width <= smallScreen {
if s.screen.widthPhysical <= smallScreenSize {
s.setScale(0.25)
} else if defaultScreen.width > smallScreen && defaultScreen.width <= mediumScreen {
} else if s.screen.widthPhysical > smallScreenSize && s.screen.widthPhysical <= mediumScreenSize {
s.setScale(0.75)
} else if s.screen.widthPhysical > mediumScreenSize {
s.setScale(1)
} else if defaultScreen.width > mediumScreen {
s.setScale(2)
}
}

func (s ScreenSizer) setScale(f float32) {
err := os.Setenv(scaleEnvKey, fmt.Sprintf("%f", f))
CryoUtils.InfoLog.Printf("Setting scale %f", f)
if err != nil {
CryoUtils.ErrorLog.Println(err)
}
}

func defaultScreen() screen {
return screen{name: defaultScreenName, widthPhysical: 60, heightPhysical: 100}
}
7 changes: 2 additions & 5 deletions launcher.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/bash
if [ "$(xrandr | grep ' connected' | wc -l)" -eq 1 ]; then
export FYNE_SCALE=0.25
fi

"$HOME"/.cryo_utilities/cryo_utilities gui
# Author: CryoByte33 and contributors to the CryoUtilities project
"$HOME/.cryo_utilities/cryo_utilities" gui

0 comments on commit a934c66

Please sign in to comment.