pop-os / cosmic-idle

GNU General Public License v3.0
3 stars 0 forks source link

Missing usage instructions; non-fatal errors when launching from terminal #1

Closed BrandonDenisSmith closed 2 hours ago

BrandonDenisSmith commented 3 hours ago

I installed cosmic-idle via the package manager on Pop!_OS 24.04 alpha. There does not appear to be any way to configure it via the GUI, which is expected for a (pre-?) alpha release. However, I also can't seem to find any instructions for setting up via the terminal. Peeking at the source code, I determined that there are three configuration options:

each with units of ms. So, following the same pattern as other COSMIC components, I created a file named screen_off_time:

brandon@pop-os:~/.config/cosmic$ tree com.system76.CosmicIdle/
com.system76.CosmicIdle/
└── v1
    └── screen_off_time

2 directories, 1 file
brandon@pop-os:~/.config/cosmic$ cat com.system76.CosmicIdle/v1/screen_off_time
1000

I created the file with echo -n 1000 > screen_off_time, so there is no trailing newline character. I then tried launching cosmic-idle from the command line:

brandon@pop-os:~/.config/cosmic$ cosmic-idle
[2024-10-26T19:57:58Z ERROR cosmic_idle] Loading config: 1:1: Expected option

Note that this error is non-fatal. cosmic-idle appears to continue running with no noticeable effect. If I add files for the other two configuration options, then I see one error line per option. If I put a file of any other name in the cosmic-idle configuration directory, then it appears to be ignored:

brandon@pop-os:~/.config/cosmic$ tree com.system76.CosmicIdle/
com.system76.CosmicIdle/
└── v1
    ├── foo
    └── screen_off_time

2 directories, 2 files
brandon@pop-os:~/.config/cosmic$ cosmic-idle
[2024-10-26T20:00:11Z ERROR cosmic_idle] Loading config: 1:1: Expected option

which suggests to me that cosmic-idle sees the right config files and just fails to load them for some reason. So:

  1. What is the right way to use cosmic-idle from a terminal?
  2. Is the Loading config: 1:1:Expected option error a bug, or a result of my misuse of the application?
l-const commented 3 hours ago

Hey @BrandonDenisSmith , this is to be enabled from the cosmic-settings, this is ongoing work , the corresponding PR is still in draft here: https://github.com/pop-os/cosmic-settings/pull/704 . All the config files follow the RON format: https://github.com/ron-rs/ron?tab=readme-ov-file#ron-syntax-overview and since the type is an Option it would be something like: Some(number). There is no bug here you are trying to use something ahead of time , still the value I just mentioned might work already . Essentially, when there is an Option , you can have Some(T) or None.

BrandonDenisSmith commented 2 hours ago

Hey @BrandonDenisSmith , this is to be enabled from the cosmic-settings, this is ongoing work , the corresponding PR is still in draft here: pop-os/cosmic-settings#704 . All the config files follow the RON format: https://github.com/ron-rs/ron?tab=readme-ov-file#ron-syntax-overview and since the type is an Option it would be something like: Some(number). There is no bug here you are trying to use something ahead of time , still the value I just mentioned might work already . Essentially, when there is an Option , you can have Some(T) or None.

Aha! Changing the value to "Some(1000)" clears the error and causes the screen to start dimming after 1 second, as expected.

I've bookmarked that RON syntax page for future reference. Until the cosmic-settings entry is available I can use a service to launch cosmic-idle on boot. I believe both of my problems have been addressed, so I am closing this issue.

I and my OLED monitor thank you, @l-const!

l-const commented 2 hours ago

Yeah , those values are in ms , you can see some default values here: https://github.com/pop-os/cosmic-idle/blob/master/cosmic-idle-config/src/lib.rs#L17-L19