Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two different config directory in my homedir on Linux #39

Closed
fmarier opened this issue Oct 15, 2022 · 5 comments
Closed

Two different config directory in my homedir on Linux #39

fmarier opened this issue Oct 15, 2022 · 5 comments

Comments

@fmarier
Copy link
Contributor

fmarier commented Oct 15, 2022

Describe the bug
I see two different directories being used for the buskill app on my machine using two different names:

  • ~/.buskill (just for the cache)
  • ~/.kivy (everything else)

Expected behavior
I would expect to see the same name for that app. I didn't know what "kivy" was, "buskill" on the other hand is exactly what I was expecting to see.

Additionally, I would suggest using the standard locations:

  • $XDG_CACHE_HOME/buskill, falling back to $HOME/.cache/buskill
  • $XDG_CONFIG_HOME/buskill, falling back to $HOME/.config/buskill

Versions (please complete the following information):

  • OS: Debian unstable
  • BusKill: 0.5.0
@maltfield
Copy link
Member

Thanks for the report! We'll look into it :)

@maltfield
Copy link
Member

I actually wasn't aware of the fact that kivy was creating its own config file at all, but this came-up again as I was working on adding a "settings" screen to the GUI in #14, which depends on #16. Interestingly, I discovered that kivy has a built-in module named Settings that we can use:

It simply uses kivy's Config module, which itself extends Python's ConfigParser.

This is a very powerful and robust design. If we use it for implementing the BusKill config file, then we might be able to combine both into the same file.

@maltfield
Copy link
Member

Here's what the existing file looks like on my dev system

user@buskill:~$ cat .kivy/config.ini 
[kivy]
keyboard_repeat_delay = 300
keyboard_repeat_rate = 30
log_dir = logs
log_enable = 1
log_level = info
log_name = kivy_%y-%m-%d_%_.txt
window_icon = 
keyboard_mode = 
keyboard_layout = qwerty
desktop = 1
exit_on_escape = 1
pause_on_minimize = 0
kivy_clock = default
default_font = ['Roboto', 'data/fonts/Roboto-Regular.ttf', 'data/fonts/Roboto-Italic.ttf', 'data/fonts/Roboto-Bold.ttf', 'data/fonts/Roboto-BoldItalic.ttf']
log_maxfiles = 100
window_shape = data/images/defaultshape.png
config_version = 21

[graphics]
display = -1
fullscreen = 0
height = 600
left = 0
maxfps = 60
multisamples = 2
position = auto
rotation = 0
show_cursor = 0
top = 0
width = 800
resizable = 1
borderless = 0
window_state = visible
minimum_width = 0
minimum_height = 0
min_state_time = .035
allow_screensaver = 1
shaped = 0
vsync = 
verify_gl_main_thread = 1
custom_titlebar = 0
custom_titlebar_border = 5

[input]
mouse = mouse
%(name)s = probesysfs

[postproc]
double_tap_distance = 20
double_tap_time = 250
ignore = []
jitter_distance = 0
jitter_ignore_devices = mouse,mactouch,
retain_distance = 50
retain_time = 0
triple_tap_distance = 20
triple_tap_time = 375

[widgets]
scroll_timeout = 250
scroll_distance = 20
scroll_friction = 1.
scroll_stoptime = 300
scroll_moves = 5

[modules]

[network]
useragent = curl

user@buskill:~$ 

This is actually really cool, as it looks like the user can tweak stuff in the GUI app directly, like font size. That may help provide a workaround for strange bugs like #37

@maltfield
Copy link
Member

In addition to above, to solve this issue, I'd have to move the whole .kivy dir to be the same as the buskill data dir, which includes many other files

user@buskill:~$ find .kivy/
.kivy/
.kivy/icon
.kivy/icon/kivy-icon-16.png
.kivy/icon/kivy-icon-256.png
.kivy/icon/kivy-icon-24.png
.kivy/icon/kivy-icon-128.png
.kivy/icon/kivy-icon-32.png
.kivy/icon/kivy-icon-64.png
.kivy/icon/kivy-icon-25.png
.kivy/icon/kivy-icon-512.png
.kivy/icon/kivy-icon-48.png
.kivy/mods
.kivy/logs
.kivy/logs/kivy_22-11-07_34.txt
.kivy/logs/kivy_22-11-06_9.txt
.kivy/logs/kivy_22-11-07_8.txt
.kivy/logs/kivy_22-11-07_27.txt
.kivy/logs/kivy_22-11-07_25.txt
.kivy/logs/kivy_22-11-07_7.txt
.kivy/logs/kivy_22-11-01_13.txt
.kivy/logs/kivy_22-11-07_5.txt
.kivy/logs/kivy_22-11-01_110.txt
.kivy/logs/kivy_22-11-07_6.txt
.kivy/logs/kivy_22-11-07_9.txt
.kivy/logs/kivy_22-11-07_33.txt
.kivy/logs/kivy_22-11-01_21.txt
.kivy/logs/kivy_22-11-07_1.txt
.kivy/logs/kivy_22-11-06_2.txt
.kivy/logs/kivy_22-11-06_16.txt
.kivy/logs/kivy_22-11-06_21.txt
.kivy/logs/kivy_22-11-06_30.txt
.kivy/logs/kivy_22-11-06_19.txt
.kivy/logs/kivy_22-11-06_29.txt
.kivy/logs/kivy_22-11-07_37.txt
.kivy/logs/kivy_22-11-07_18.txt
.kivy/logs/kivy_22-11-07_44.txt
.kivy/logs/kivy_22-11-07_23.txt
.kivy/logs/kivy_22-11-07_26.txt
.kivy/logs/kivy_22-11-06_6.txt
.kivy/logs/kivy_22-11-06_36.txt
.kivy/logs/kivy_22-11-07_32.txt
.kivy/logs/kivy_22-11-01_17.txt
.kivy/logs/kivy_22-11-06_17.txt
.kivy/logs/kivy_22-11-06_26.txt
.kivy/logs/kivy_22-11-06_0.txt
.kivy/logs/kivy_22-11-01_115.txt
.kivy/logs/kivy_22-11-01_109.txt
.kivy/logs/kivy_22-11-07_45.txt
.kivy/logs/kivy_22-11-06_32.txt
.kivy/logs/kivy_22-11-06_1.txt
.kivy/logs/kivy_22-11-07_30.txt
.kivy/logs/kivy_22-11-06_24.txt
.kivy/logs/kivy_22-11-07_13.txt
.kivy/logs/kivy_22-11-01_23.txt
.kivy/logs/kivy_22-11-07_4.txt
.kivy/logs/kivy_22-11-01_12.txt
.kivy/logs/kivy_22-11-01_20.txt
.kivy/logs/kivy_22-11-07_10.txt
.kivy/logs/kivy_22-11-07_14.txt
.kivy/logs/kivy_22-11-01_117.txt
.kivy/logs/kivy_22-11-07_35.txt
.kivy/logs/kivy_22-11-06_15.txt
.kivy/logs/kivy_22-11-07_19.txt
.kivy/logs/kivy_22-11-06_11.txt
.kivy/logs/kivy_22-11-07_16.txt
.kivy/logs/kivy_22-11-01_18.txt
.kivy/logs/kivy_22-11-07_38.txt
.kivy/logs/kivy_22-11-01_22.txt
.kivy/logs/kivy_22-11-01_7.txt
.kivy/logs/kivy_22-11-07_42.txt
.kivy/logs/kivy_22-11-01_118.txt
.kivy/logs/kivy_22-11-01_16.txt
.kivy/logs/kivy_22-11-06_22.txt
.kivy/logs/kivy_22-11-07_48.txt
.kivy/logs/kivy_22-11-01_10.txt
.kivy/logs/kivy_22-11-01_11.txt
.kivy/logs/kivy_22-11-06_7.txt
.kivy/logs/kivy_22-11-07_3.txt
.kivy/logs/kivy_22-11-01_24.txt
.kivy/logs/kivy_22-11-06_13.txt
.kivy/logs/kivy_22-11-06_28.txt
.kivy/logs/kivy_22-11-01_111.txt
.kivy/logs/kivy_22-11-07_2.txt
.kivy/logs/kivy_22-11-01_114.txt
.kivy/logs/kivy_22-11-01_25.txt
.kivy/logs/kivy_22-11-01_116.txt
.kivy/logs/kivy_22-11-06_23.txt
.kivy/logs/kivy_22-11-07_28.txt
.kivy/logs/kivy_22-11-07_12.txt
.kivy/logs/kivy_22-11-07_29.txt
.kivy/logs/kivy_22-11-06_25.txt
.kivy/logs/kivy_22-11-06_27.txt
.kivy/logs/kivy_22-11-07_41.txt
.kivy/logs/kivy_22-11-07_0.txt
.kivy/logs/kivy_22-11-07_40.txt
.kivy/logs/kivy_22-11-07_11.txt
.kivy/logs/kivy_22-11-01_113.txt
.kivy/logs/kivy_22-11-06_8.txt
.kivy/logs/kivy_22-11-07_17.txt
.kivy/logs/kivy_22-11-06_3.txt
.kivy/logs/kivy_22-11-01_112.txt
.kivy/logs/kivy_22-11-07_47.txt
.kivy/logs/kivy_22-11-07_31.txt
.kivy/logs/kivy_22-11-06_20.txt
.kivy/logs/kivy_22-11-06_10.txt
.kivy/logs/kivy_22-11-07_22.txt
.kivy/logs/kivy_22-11-06_31.txt
.kivy/logs/kivy_22-11-07_39.txt
.kivy/logs/kivy_22-11-07_36.txt
.kivy/logs/kivy_22-11-06_5.txt
.kivy/logs/kivy_22-11-06_37.txt
.kivy/logs/kivy_22-11-06_18.txt
.kivy/logs/kivy_22-11-07_24.txt
.kivy/logs/kivy_22-11-01_9.txt
.kivy/logs/kivy_22-11-06_33.txt
.kivy/logs/kivy_22-11-01_14.txt
.kivy/logs/kivy_22-11-06_12.txt
.kivy/logs/kivy_22-11-07_46.txt
.kivy/logs/kivy_22-11-01_119.txt
.kivy/logs/kivy_22-11-07_15.txt
.kivy/logs/kivy_22-11-06_4.txt
.kivy/logs/kivy_22-11-07_21.txt
.kivy/logs/kivy_22-11-06_34.txt
.kivy/logs/kivy_22-11-12_0.txt
.kivy/logs/kivy_22-11-06_35.txt
.kivy/logs/kivy_22-11-01_19.txt
.kivy/logs/kivy_22-11-07_20.txt
.kivy/logs/kivy_22-11-01_15.txt
.kivy/logs/kivy_22-11-06_14.txt
.kivy/logs/kivy_22-11-07_43.txt
.kivy/logs/kivy_22-11-01_120.txt
.kivy/config.ini
user@buskill:~$ 

maltfield added a commit that referenced this issue Nov 13, 2022
…rser object and the App's build_config() method

 * #16

TODO: update the `setupDatDir()` to prioritize $XDG_CONFIG_HOME on linux systems

 * https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
 * #39
maltfield added a commit that referenced this issue Nov 13, 2022
 * on linux, we prioritize trying to use the XDG data dir to contain our buskill DATA_DIR by first trying to use dirs defined in the XDG_DATA_HOME env var (with final fallback on $HOME/.local/share)
 * this commit also adds logic to place the kivy config.ini in the buskill DATA_DIR and creates a buskill section in that config.ini file.

 * #39

TODO: make sure it doesn't create the '.kivy/config.ini' before build_config() is called (so it just makes an copy as is not desired). If it does, see if you can pre-empt its creation (or at least clean it up after)
TODO: see if you can make the [buskill] section appear above all the other [kivy] sections
@maltfield
Copy link
Member

I downloaded the latest version of the app today to see if this ticket is complete.

Before I executed the BusKill app, I confirmed that my fresh new DispVM had no directories named *kivy*

user@disp6165:~$ find . | grep -i kivy
user@disp6165:~$

After opened & closed the app, I found that all the kivy-related dirs & files were located inside the same .buskill dir, which now uses $XDG_DATA_HOME

user@disp6165:~$ find . | grep -i kivy
./.local/share/.buskill/logs/kivy_23-06-17_0.txt
./.local/share/.buskill/icon/kivy-icon-128.png
./.local/share/.buskill/icon/kivy-icon-64.png
./.local/share/.buskill/icon/kivy-icon-256.png
./.local/share/.buskill/icon/kivy-icon-24.png
./.local/share/.buskill/icon/kivy-icon-48.png
./.local/share/.buskill/icon/kivy-icon-512.png
./.local/share/.buskill/icon/kivy-icon-25.png
./.local/share/.buskill/icon/kivy-icon-32.png
./.local/share/.buskill/icon/kivy-icon-16.png
user@disp6165:~$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants