Skip to content

Commit a934c66

Browse files
CryoByte33skaluzkatdomhan
authored
OLED model compatibility! (#165)
* 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]>
1 parent 1c80d08 commit a934c66

File tree

5 files changed

+49
-56
lines changed

5 files changed

+49
-56
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Scripts and utilities to improve performance and manage storage on the Steam Dec
77

88
## Update
99

10+
### Notes on the Steam Deck OLED
11+
The latest update resolves the scaling issues on the new OLED Deck, and I figured I should provide an update here:
12+
1. **This (CU2) is still fully compatible with the new OLED models.**
13+
2. Performance improvements should be similar (or possibly slightly better) than on the LCD model (thorough testing pending)
14+
1015
### General Linux Compatibility
1116
As of the latest update, this _should_ be compatible with most Linux systems, with the following limitations:
1217
1. This will not operate on swap partitions, only files.
@@ -55,7 +60,7 @@ new features and how they work.
5560
* Storage Manager
5661
* Sync shadercache and compatdata to the same location the game is installed
5762
* Delete shadercache and compatdata for whichever games you select
58-
* **NEW** Delete the shadercache and compatdata for all uninstalled games with a single click
63+
* Delete the shadercache and compatdata for all uninstalled games with a single click
5964
* Full CLI mode
6065

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

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

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

docs/manual-install.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ cd .cryo_utilities
88
```
99
2. Go to [the releases page](https://github.com/CryoByte33/steam-deck-utilities/releases/tag/latest) and download cryo_utilities.
1010
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.
11-
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.
12-
5. Move all 3 downloaded files to `/home/deck/cryo_utilities`.
11+
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`.
12+
5. Move all 3 downloaded files to `/home/deck/.cryo_utilities`.
1313
6. Open Konsole and paste the entire block below, then press Enter/Return:
1414
```bash
1515
cd ~/.cryo_utilities
@@ -27,58 +27,59 @@ Type=Application
2727
StartupNotify=false' >"$HOME"/Desktop/CryoUtilitiesUninstall.desktop
2828
chmod +x "$HOME"/Desktop/CryoUtilitiesUninstall.desktop
2929
rm -rf "$HOME"/Desktop/CryoUtilities.desktop 2>/dev/null
30-
echo "#!/usr/bin/env xdg-open
30+
echo '#!/usr/bin/env xdg-open
3131
[Desktop Entry]
3232
Name=CryoUtilities
3333
Exec=bash $HOME/.cryo_utilities/launcher.sh
3434
Icon=cryo-utilities
3535
Terminal=false
3636
Type=Application
37-
StartupNotify=false" >"$HOME"/Desktop/CryoUtilities.desktop
37+
StartupNotify=false' >"$HOME"/Desktop/CryoUtilities.desktop
3838
chmod +x "$HOME"/Desktop/CryoUtilities.desktop
3939
rm -rf "$HOME"/Desktop/UpdateCryoUtilities.desktop 2>/dev/null
40-
echo "#!/usr/bin/env xdg-open
40+
mkdir -p "$HOME"/.local/share/applications
41+
echo '#!/usr/bin/env xdg-open
4142
[Desktop Entry]
4243
Name=Update CryoUtilities
4344
Exec=curl https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/install.sh | bash -s --
4445
Icon=bittorrent-sync
4546
Terminal=false
4647
Type=Application
47-
StartupNotify=false" >"$HOME"/Desktop/UpdateCryoUtilities.desktop
48+
StartupNotify=false' >"$HOME"/Desktop/UpdateCryoUtilities.desktop
4849
chmod +x "$HOME"/Desktop/UpdateCryoUtilities.desktop
4950
rm -rf "$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop 2>/dev/null
50-
echo "#!/usr/bin/env xdg-open
51+
echo '#!/usr/bin/env xdg-open
5152
[Desktop Entry]
5253
Name=CryoUtilities - Uninstall
5354
Exec=curl https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/uninstall.sh | bash -s --
5455
Icon=delete
5556
Terminal=false
5657
Type=Application
5758
Categories=Utility
58-
StartupNotify=false" >"$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop
59+
StartupNotify=false' >"$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop
5960
chmod +x "$HOME"/.local/share/applications/CryoUtilitiesUninstall.desktop
6061
rm -rf "$HOME"/.local/share/applications/CryoUtilities.desktop 2>/dev/null
61-
echo "#!/usr/bin/env xdg-open
62+
echo '#!/usr/bin/env xdg-open
6263
[Desktop Entry]
6364
Name=CryoUtilities
6465
Exec=bash $HOME/.cryo_utilities/launcher.sh
6566
Icon=cryo-utilities
6667
Terminal=false
6768
Type=Application
6869
Categories=Utility
69-
StartupNotify=false" >"$HOME"/.local/share/applications/CryoUtilities.desktop
70+
StartupNotify=false' >"$HOME"/.local/share/applications/CryoUtilities.desktop
7071
chmod +x "$HOME"/.local/share/applications/CryoUtilities.desktop
7172
rm -rf "$HOME"/.local/share/applications/UpdateCryoUtilities.desktop 2>/dev/null
72-
echo "#!/usr/bin/env xdg-open
73+
echo '#!/usr/bin/env xdg-open
7374
[Desktop Entry]
7475
Name=CryoUtilities - Update
7576
Exec=curl https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/install.sh | bash -s --
7677
Icon=bittorrent-sync
7778
Terminal=false
7879
Type=Application
7980
Categories=Utility
80-
StartupNotify=false" >"$HOME"/.local/share/applications/UpdateCryoUtilities.desktop
81+
StartupNotify=false' >"$HOME"/.local/share/applications/UpdateCryoUtilities.desktop
8182
chmod +x "$HOME"/.local/share/applications/UpdateCryoUtilities.desktop
8283
update-desktop-database ~/.local/share/applications
8384
```
84-
Now, you should be all set to use CryoUtilities as normal!
85+
Now, you should be all set to use CryoUtilities as normal!

internal/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
)
2424

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

2828
// Get home Directory
2929
var HomeDirectory, _ = os.UserHomeDir()

internal/ui_screen.go

+24-35
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,15 @@
1616

1717
package internal
1818

19-
/*
20-
#cgo LDFLAGS: -lX11
21-
#include <X11/Xlib.h>
22-
*/
23-
import "C"
2419
import (
2520
"fmt"
21+
"github.com/go-gl/glfw/v3.3/glfw"
2622
"os"
2723
)
2824

2925
const (
30-
smallScreen = 1280
31-
mediumScreen = 1920
32-
)
33-
34-
const (
35-
defaultSteamDeckScreenWidth = 1280
36-
defaultSteamDeckScreenHeight = 800
26+
smallScreenSize = 100
27+
mediumScreenSize = 200
3728
)
3829

3930
const scaleEnvKey = "FYNE_SCALE"
@@ -44,8 +35,8 @@ type ScreenSizer struct {
4435
}
4536

4637
type screen struct {
47-
name string
48-
width, height int
38+
name string
39+
widthPhysical, heightPhysical int
4940
}
5041

5142
func NewScreenSizer() *ScreenSizer {
@@ -54,40 +45,38 @@ func NewScreenSizer() *ScreenSizer {
5445

5546
func getDefaultScreen() screen {
5647

57-
display := C.XOpenDisplay(nil)
58-
if display == nil {
59-
CryoUtils.InfoLog.Println("Can't get info on display")
60-
return screen{name: defaultScreenName, width: defaultSteamDeckScreenWidth, height: defaultSteamDeckScreenHeight}
61-
}
62-
defer C.XCloseDisplay(display)
63-
64-
displayScreen := C.XDefaultScreenOfDisplay(display)
65-
displayScreenName := C.GoString(C.XDisplayString(display))
66-
width := int(C.XWidthOfScreen(displayScreen))
67-
height := int(C.XHeightOfScreen(displayScreen))
68-
if width == 0 || height == 0 {
69-
CryoUtils.InfoLog.Println("Default monitor not detected")
70-
return screen{name: defaultScreenName, width: defaultSteamDeckScreenWidth, height: defaultSteamDeckScreenHeight}
48+
var primaryScreen screen
49+
50+
err := glfw.Init()
51+
if err != nil {
52+
return defaultScreen()
7153
}
72-
return screen{displayScreenName, width, height}
54+
defer glfw.Terminate()
55+
56+
monitor := glfw.GetPrimaryMonitor()
57+
primaryScreen.name = monitor.GetName()
58+
primaryScreen.widthPhysical, primaryScreen.heightPhysical = monitor.GetPhysicalSize()
59+
return primaryScreen
7360
}
7461

7562
func (s ScreenSizer) UpdateScaleForActiveMonitor() {
76-
defaultScreen := getDefaultScreen()
7763

78-
if defaultScreen.width <= smallScreen {
64+
if s.screen.widthPhysical <= smallScreenSize {
7965
s.setScale(0.25)
80-
} else if defaultScreen.width > smallScreen && defaultScreen.width <= mediumScreen {
66+
} else if s.screen.widthPhysical > smallScreenSize && s.screen.widthPhysical <= mediumScreenSize {
67+
s.setScale(0.75)
68+
} else if s.screen.widthPhysical > mediumScreenSize {
8169
s.setScale(1)
82-
} else if defaultScreen.width > mediumScreen {
83-
s.setScale(2)
8470
}
8571
}
8672

8773
func (s ScreenSizer) setScale(f float32) {
8874
err := os.Setenv(scaleEnvKey, fmt.Sprintf("%f", f))
89-
CryoUtils.InfoLog.Printf("Setting scale %f", f)
9075
if err != nil {
9176
CryoUtils.ErrorLog.Println(err)
9277
}
9378
}
79+
80+
func defaultScreen() screen {
81+
return screen{name: defaultScreenName, widthPhysical: 60, heightPhysical: 100}
82+
}

launcher.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
#!/bin/bash
2-
if [ "$(xrandr | grep ' connected' | wc -l)" -eq 1 ]; then
3-
export FYNE_SCALE=0.25
4-
fi
5-
6-
"$HOME"/.cryo_utilities/cryo_utilities gui
2+
# Author: CryoByte33 and contributors to the CryoUtilities project
3+
"$HOME/.cryo_utilities/cryo_utilities" gui

0 commit comments

Comments
 (0)