It appears that tym.get_config_path() does not work when I state --use explicitly
It should be reproducible like this:
$ cat $XDG_CONFIG_HOME/tym/config.lua
local tym = require('tym')
function profile_path()
local path = tym.get_config_path()
return path:gsub("(.+)/[^/]+$", "%1")
end
tym.set_hook('clicked', function(btn)
if btn == 3 then
print(string.format('\n---\npath=%q\n---\n', profile_path()))
return true --is this necessary in this case?
end
end)
$ selene $XDG_CONFIG_HOME/tym/config.lua
Results:
0 errors
0 warnings
0 parse errors
(I am a beginner in writing Lua code therefore I often use the selene tool to validate what I have written) Let's run tym without arguments:
$ tym
[tym.c : 15 I] start
[app.c : 20 F] app_init()
[option.c : 15 F] option_init()
[option.c : 54 F] option_parse()
[app.c :111 F] app_start()
[app.c :420 F] on_local_options()
[app.c :544 F] on_command_line()
[option.c : 15 F] option_init()
[option.c : 54 F] option_parse()
[app.c :137 F] app_spawn_context()
[context.c : 92 I] init context id=0
** Message: 23:49:04.977: [id=0] Started.
[config.c :108 F] config_restore_default()
[context.c :301 F] context_load_theme()
[context.c :308 I] theme path: `/home/user/.config/tym/theme.lua`
** Message: 23:49:04.979: [id=0] Theme file `/home/user/.config/tym/theme.lua` loaded.
[context.c :355 I] load theme end
[context.c :259 F] context_load_config()
[context.c :269 I] config path: `/home/user/.config/tym/config.lua`
[hook.c : 89 I] hook 'clicked' is registered. ref: 3
** Message: 23:49:04.979: [id=0] Config file `/home/user/.config/tym/config.lua` loaded.
[context.c :296 I] load config end
[app.c :453 F] _subscribe_dbus()
** Message: 23:49:04.979: [id=0] DBus: object_path='/me/endaaman/tym_dev0' interface_name:'me.endaaman.tym_dev'
[app.c :279 F] on_vte_click()
[hook.c :107 I] perform custom hook: clicked
---
path="/home/user/.config/tym"
---
[app.c :242 F] on_vte_child_exited()
[app.c :170 F] app_quit_context()
** Message: 23:49:17.773: [id=0] Quit.
[context.c :108 I] close context id=0
[app.c : 28 F] app_close()
It worked as expected: pressing the right mouse button with the tym window in focus, the value corresponds to $XDG_CONFIG_HOME/tym was retrieved.
But running tym again making the configuration path -whatever it is- explicit with the --use option, the behavior changes (to highlight the finding, I move first to ~/downloads)...
$ cd downloads
$ tym --use=$XDG_CONFIG_HOME/tym/config.lua
[tym.c : 15 I] start
[app.c : 20 F] app_init()
[option.c : 15 F] option_init()
[option.c : 54 F] option_parse()
[app.c :111 F] app_start()
[app.c :420 F] on_local_options()
[app.c :544 F] on_command_line()
[option.c : 15 F] option_init()
[option.c : 54 F] option_parse()
[app.c :137 F] app_spawn_context()
[context.c : 92 I] init context id=0
** Message: 23:50:35.563: [id=0] Started.
[config.c :108 F] config_restore_default()
[context.c :301 F] context_load_theme()
[context.c :308 I] theme path: `/home/user/.config/tym/theme.lua`
** Message: 23:50:35.566: [id=0] Theme file `/home/user/.config/tym/theme.lua` loaded.
[context.c :355 I] load theme end
[context.c :259 F] context_load_config()
[context.c :269 I] config path: `/home/user/.config/tym/config.lua`
[hook.c : 89 I] hook 'clicked' is registered. ref: 3
** Message: 23:50:35.566: [id=0] Config file `/home/user/.config/tym/config.lua` loaded.
[context.c :296 I] load config end
[app.c :453 F] _subscribe_dbus()
** Message: 23:50:35.566: [id=0] DBus: object_path='/me/endaaman/tym_dev0' interface_name:'me.endaaman.tym_dev'
[app.c :279 F] on_vte_click()
[hook.c :107 I] perform custom hook: clicked
---
path="/home/user/downloads"
---
[app.c :242 F] on_vte_child_exited()
[app.c :170 F] app_quit_context()
** Message: 23:50:46.293: [id=0] Quit.
[context.c :108 I] close context id=0
Segmentation fault
Two unexpected events occur:
- the value assigned to path=
no longer is $XDG_CONFIG_HOME/tymbut it is the path where the terminal is located at the time of running tym - closing tym by exit, a
Segmentation faultis raised most of the times I try again
This with tym 3.5.0 master git cloned today and lua-devel 5.3.6 on Void Linux
Thanks again! I fixed that. Maybe ok.
Why "maybe"? everything is working perfectly now! :-)
I had forgotten to report that opening more than one tym instances, closing one would close all of them before, sort of crashing.
Now it doesn't happen anymore and I can create different profiles anywhere, even outside of XDG_CONFIG_HOME.
What I was trying to achieve without succeeding is perfectly workable now.
I have repeated my tests several times and, in addition, the warning messages in the logs that I used to see before have also disappeared now.
As far as I am concerned I would already close the issue now but since you are apparently left in doubt, do it yourself as soon as it seems appropriate to you :)
Because I wrote the fix with my drunk brain, haha...
By default, tym's all instances(windows) are spawned from the single primary process. So, if tym encounters a fatal error, the process goes down and all instances will be collapsed.
The error of this issue may have been the reason why "closing one would close all of them before, sort of crashing." .
The --isolated option make tym spawn a new process by each instance and would avoid "chained destruction" when this kind of problem occurs.
Yes yes, it is clear to me now and I had also observed it via the task manager with which I visually observed the birth of a new process by declaring --isolated.
Enjoy your good and well-deserved drink!!! ;-)