prasanthrangan / hyprdots

// Aesthetic, dynamic and minimal dots for Arch hyprland
GNU General Public License v3.0
7.4k stars 863 forks source link

[Feature Request]: Add emulator games to gamelaucher.sh #866

Closed enzzodani closed 7 months ago

enzzodani commented 9 months ago

Feature Request

Description

I don't know if this is already possible, but i think it'll be great if the gamelaucher.sh add the emulator library. Is this possible?

Use Case

This will unified the games in one simple script, all the games, citra, xmu, dolphin, steam.

Proposed Solution

I don't know much of bash and scripts, but if anyone knows anything about this feature, it'll be such a nice feature.

prasanthrangan commented 8 months ago

Hi, This should be possible in theory. But I've no idea how the metadata looks like for these emulators as i don't have emulated games (only have steam library). But i can try to implement it if someone can help me with the metadata.

Skerse commented 8 months ago

Yeah i'm not sure, i use emulators and with the amount of configuration vs just something like steam where it's almost always the same for everyone, that's pretty difficult to make something work for everyone. If someone makes something, i wouldn't be apposed to helping out though.

Enigma1309 commented 8 months ago

i was thinking the same, maybe add lutris games to gamelaunch.sh, they have well defined directory structure

enzzodani commented 8 months ago

i was thinking the same, maybe add lutris games to gamelaunch.sh, they have well defined directory structure

I had forgotten about lutris lol, really, it might be more interesting based on lutris, I'll look at the scripts too, but I don't know much about shell yet unfortunately

Enigma1309 commented 8 months ago

Hey i've tried to write my script (with the help of ai) , that can pull lutris games to display and run them, this is working but i can't seem to find the way to integrate it using existing steam launch script, cause both of the steam and lutirs seems to provide a different method of launching, so it's quite complex to analyze the case whether the app user selected is from steam or lutris.(it's quite hard to explain unless you try building your own solution)

One solution which i found was to use only lutris for displaying games, now you might think how are we gonna see steam games? it's simple lutris already adds the steam and other games library like retro-arch, gog, wine, etc into it's library. so that we can display lutris games and it will automatically load the games from other platform respectively.

Here is the script which does the same. (if anyone is interested then you can replace gamelaunch.sh with this)

#!/bin/sh
# Retrieve the list of games from Lutris in JSON format
GAMES=$(lutris -j -l)

# Extract and display game names using rofi
CHOICE=$(echo "$GAMES" | jq -r '.[]["name"]' | rofi -dmenu -p Lutris)

# Check if a game was selected
if [ -n "$CHOICE" ]; then
    # Extract the slug of the selected game
    SLUG=$(echo "$GAMES" | jq -r --arg choice "$CHOICE" '.[] | select(.name == $choice).slug')

    # Open the selected game using Lutris
    exec xdg-open "lutris:rungame/$SLUG"
fi

note that im a noob in bash and i have still not figured out a way to gey images, ik they are stored in .local/share/lutris/coverart/{slug}.jpg Im still working on images but the above script may help anyone

enzzodani commented 8 months ago

Hey i've tried to write my script (with the help of ai) , that can pull lutris games to display and run them, this is working but i can't seem to find the way to integrate it using existing steam launch script, cause both of the steam and lutirs seems to provide a different method of launching, so it's quite complex to analyze the case whether the app user selected is from steam or lutris.(it's quite hard to explain unless you try building your own solution)

One solution which i found was to use only lutris for displaying games, now you might think how are we gonna see steam games? it's simple lutris already adds the steam and other games library like retro-arch, gog, wine, etc into it's library. so that we can display lutris games and it will automatically load the games from other platform respectively.

Here is the script which does the same. (if anyone is interested then you can replace gamelaunch.sh with this)

#!/bin/sh
# Retrieve the list of games from Lutris in JSON format
GAMES=$(lutris -j -l)

# Extract and display game names using rofi
CHOICE=$(echo "$GAMES" | jq -r '.[]["name"]' | rofi -dmenu -p Lutris)

# Check if a game was selected
if [ -n "$CHOICE" ]; then
  # Extract the slug of the selected game
  SLUG=$(echo "$GAMES" | jq -r --arg choice "$CHOICE" '.[] | select(.name == $choice).slug')

  # Open the selected game using Lutris
  exec xdg-open "lutris:rungame/$SLUG"
fi

note that im a noob in bash and i have still not figured out a way to gey images, ik they are stored in .local/share/lutris/coverart/{slug}.jpg Im still working on images but the above script may help anyone

It worked very well on mine, however only the game icons didn't appear, but it's amazing, man, congratulations, I found it really cool. I think with time it's possible to refine it even more, but you were incredible, I'm using it until an update comes out that integrates this into the code.

kRHYME7 commented 8 months ago

Sounds cool!

however only the game icons didn't appear,

I think I can help you guys with this. Can you recommend some easy/lightweight to install games using lutris ? Also, I think we can integrate it with the gamelaunch. or maybe a separe lutris launcher

Using lutris lib image

Enigma1309 commented 8 months ago

you can add your steam games to lutris library too, for lightweight games try supertuxkart, or any retro games

kRHYME7 commented 8 months ago

https://gist.github.com/kRHYME7/204c5c6aa36be4937f14376bd67d0822

@Enigma1309 Thanks I don't usually play as I am using a small laptop (Now I am starting to play emulator games)😁

supertuxkart, or any retro games

I will.

Can you try this version? This from your script I just added another entry

kRHYME7 commented 8 months ago

https://gist.github.com/kRHYME7/204c5c6aa36be4937f14376bd67d0822

This works now on my machine. image

Enigma1309 commented 8 months ago

i've seen an problem images are not stored in cache dir, i may have cleaned them , permanent images are actually present in .local/share/lutris/coverart/slug.jpg edit:- i messed up with directory

kRHYME7 commented 8 months ago

i've seen an problem images are not stored in cache dir, i may have cleaned them , permanent images are actually present in .local/share/lutris/slug.jpg

does the script work when you change this icon_path="${HOME}/.cache/lutris/coverart" to the .local path?

I find it strange too as mine is still on cache and no images on .local. This is a fresh install of lutris and 0 knowledge about gaming.

Look the .local do not have covers. image

I installed lutris through the pacman

Enigma1309 commented 8 months ago

i've also installed using yay, image

try to install any other tools in lutris like libretro and see image

kRHYME7 commented 8 months ago

in .local/share/lutris/coverart/slug.jpg edit:- i messed up with directory

I see!

I installed apps without an account, hence it is stores inside ~/.cache. I tried reinstalling lutris on 2 other machine then logged in, JPGs are now in .local. What do you think should we merge this into the gamelauncher or make a separate script ?

I updated the gist

Preview for mode 5

image

Enigma1309 commented 8 months ago

adding in gamelauncher.sh would be a good choice but at the same time what if user didn't have lutris? maybe we have to add an check whether the user have lutris installed.

EDIT:- What if we made a gamelauncher.sh script standalone and transfer it's current content to launchsteamgames.sh and for lutris make a script launchlutrisgames.sh and let the gameluncher.sh to choose the preferred script using if/else to see wheter user have any of those...

kRHYME7 commented 8 months ago

We can definitely merge it. Lutris/Steam executions relatively needs few lines

My main concern for now is the rofi gamelauncher.sh's scaling is not dynamic.

Example mode 5 here looks like this image

We need to fix it first at least scale it to the monitor

Like this image

I'll be drafting something, I hope you guys can test it.

Enigma1309 commented 8 months ago

i've fixed my scaling by editing a line in the config, although this isn't a big concern since the default launch argument is 1 by default. Although if you are fixing it then i would suggest to not make it cover the whole screen instead do something like this

image

it will look better

kRHYME7 commented 8 months ago

Can you share what config you changed ? Mine shows a duplicate picture as my monitor is 2:3 (preview shows the default image) image

What I did with mine is convert the image into my screen monitor size/scale.

Enigma1309 commented 8 months ago
// Config //
configuration {
    modi:                        "drun";
    show-icons:                  true;
    drun-display-format:         "{name}";
    font:                        "JetBrainsMono Nerd Font 8";
}

@theme "~/.config/rofi/themes/theme.rasi"

// Main //
window {
    enabled:                     true;
    fullscreen:                  false;
    width:                       1500px; // 2155 //
    height:                      590px; // 850 // 
    transparency:                "real";
    cursor:                      "default";
    spacing:                     0px;
    padding:                     0px;
    border:                      0px;
    border-radius:               0px;
    border-color:                transparent;
    background-image:            url("~/.config/rofi/assets/steamdeck_holographic.png", width);
    background-color:            transparent;
}
mainbox {
    enabled:                     true;
    children:                    [ "listview" ];
    background-color:            transparent;
    orientation:                 horizontal;
    spacing:                     0px;
    padding:                     42px 320px 50px 330px;
}

// Lists //
listview {
    enabled:                     true;
    columns:                     5;
    rows:                        2;
    flow:                        horizontal;
    spacing:                     25px;
    padding:                     20px 50px 20px 50px;
    cycle:                       true;
    dynamic:                     true;
    scrollbar:                   false;
    reverse:                     true;
    fixed-height:                false;
    fixed-columns:               false;
    cursor:                      "default";
    background-color:            @main-bg;
    text-color:                  @main-fg;
    border-radius:               8px;
}

// Elements //
element {
    enabled:                     true;
    orientation:                 vertical;
    spacing:                     0px;
    padding:                     5px;
    border-radius:               0px;
    cursor:                      pointer;
    background-color:            transparent;
    text-color:                  @main-fg;
}
@media(max-aspect-ratio: 1.8) {
    element {
        orientation:             horizontal;
    }
}
element selected.normal {
    background-color:            @select-bg;
    text-color:                  @select-fg;
}
element-icon {
    size:                        300px;
    spacing:                     0px;
    padding:                     0px;
    cursor:                      inherit;
    border-radius:               0px;
    background-color:            transparent;
    text-color:                  inherit;
}
element-text {
    vertical-align:              0.5;
    horizontal-align:            0.5;
    spacing:                     0px;
    padding:                     10px;
    cursor:                      inherit;
    background-color:            transparent;
    text-color:                  inherit;
}
kRHYME7 commented 7 months ago

Hey, it's merged now. Closing this as complete.