Possible to make a Settings GUI for i3

So I would love to learn how to make apps but clearly not skilled enough to do this on my own. I have always wanted a single GUI app for i3 to control system settings (much like other DEs offer). This would be a pretty significant endeavor (punz) but I bet there would be interest.

2 Likes

will be quite a challenge I would say.
You could start ti collect settings you would like to put in… as there are too many possible settings…

1 Like

I agree. I need to gather the settings I would like to have access to, setup groups for those settings, and then locate where they are stored? But then comes coding… and while I would LOVE to know how to code, I dont think I could do it.

The important part, as Joe suggested, is to gather all relevant data (what settings, what to do with them, and where they are stored) that is supposed to be manipulated.
That’s already almost half of the whole job! :wink:

1 Like

Just out of curiosity, what language would this app be coded with?

You could write the logic with any mainstream language - C/C++, Rust, Python. For GUI, GTK and Qt are the major frameworks on Linux. (I’m mot sure if Qt bindings are available for Rust and Python, but Gtk is available for all three)

Of course you could use any other language as long as GUI bindings are available.

For a simpler approach, you could make a terminal user interface. The code will be much cleaner, but it won’t be as easy to use as a proper GUI. It’s your choice :slightly_smiling_face:

PS. I’m available for help/collaboration if you decide to make one.

1 Like

Thank you so much! I am going to compile the settings I think would be useful and make some notes. I will try my best to locate their place in the OS and if I hit a wall (surely will) I def will be reaching out lol

1 Like

My sketch of what is probably needed :

  1. Read the config file
  2. Iterate line by line
  3. See the first word of each line and segregate the different commands into different maps/ dictionaries, like
    • exec_always
    • exec
    • bindsym
    • set (for variable maps)
    • mode (this is multiline, but can be detected by the curly braces)
    • client.* for styling

and so on…

For each of these commands, there is a specific format. Like for bindsym, the next phrase is the keybinding (which itself is delimited by +). If the third phrase is exec then the rest of the line is a shell command, otherwise, third phrase to end of line is an i3wm command.

Basically we are creating a parser for the config. You might see if you can get it from the i3wm source code, but I’d personally prefer writing from scratch.

1 Like

Aaaaaaand Im lost lol - that was fast. I need to learn alot before tackling this - but def interested.

1 Like

lol, apologies if the text came out too confusing…

I’ve made a simple parser in python to store bindsym and set commands in a dict, and exec/exec_always commands in a list

import os.path
homedir = os.path.expanduser("~")

i3_config_file = open(homedir + "/.config/i3/config", "r")

bindsym_dict = {}
set_dict = {}
exec_list = []
exec_always_list = []

for line in i3_config_file:
    line = line.strip()
    phrases = line.split(sep=" ")

    if phrases[0].strip() == "bindsym":
        bindsym_dict[phrases[1]] = phrases[2:]
    elif phrases[0].strip() == "set":
        set_dict[phrases[1]] = phrases[2]
    elif phrases[0].strip() == "exec":
        if phrases[1] == "--no-startup-id":
            exec_list.append((phrases[2:], True))
        else:
            exec_list.append((phrases[1:], False))
    elif phrases[0] == "exec_always":
        if phrases[1] == "--no-startup-id":
            exec_always_list.append((phrases[2:], True))
        else:
            exec_always_list.append((phrases[1:], False))


print(bindsym_dict, end="\n\n")
print(set_dict, end="\n\n")
print(exec_list, end="\n\n")
print(exec_always_list, end="\n\n")

Yes, only 35 lines, 30 if you don’t print them at the end :wink:

For a context, this code reads the existing config.

After making changes to the config via the to-be-built GUI app, we can output the same dict/list formatted as i3wm config commands.

You may give this a go. It has settings and i3.

4 Likes

Oooooo I need to look this over - learning coding aside, this could get me what I want faster then lol

1 Like

You can always learn coding after. What you’re asking for is a lot of the reason I set it up in the f first place.

2 Likes

I am going to give this a try. I already have XFCE installed along with i3 (which I use currently). Should be pretty straight forward based on the tut. I totally appreciate your work and @flyingcakes for the guidance!

2 Likes

If you did not install them together in the first place there is more work involved making sure you get all the config files in the correct places. My totorial will help but it probably won’t come out exactly the same unless you do the entire install together collectively.

1 Like

I installed both at the same time. Should be on par with your tut.

1 Like

Good luck! I tried to make it as comprehensive as possible.

2 Likes

Hey! Retrospectively, is anyone interested in the development of a GUI wrapper around i3/config ? I could try something. Seems doable. Parsing the default config is super easy.

I could do a “shortcut” menu similar to xfce’s one where all the bindsym/bindcode could be mapped to arbitrary things in a GUIish way (maybe drag and drop i3 primitives + an option to write arbitrary command), same for assignments/for_windows, tickboxes for enabling/disabling global settings, etc. It would generate a .config/i3/generated_config file that would be included in the main config. Maybe there’ll be some weird corner case to handle but if some other people feel like brainstorming with me, I think we could do something usable in order to lower a bit the i3 entry barrier.

4 Likes

Hi! Count me in :slight_smile:

What GUI framework do you prefer? I’ve used Gtk+Python for some 30 minutes.

Seems fine to me. I’m a bit more familiar with Qt (at least 30 minutes more :p) but it pulls heavier dependencies, so both are fine to me. Anyway if that ever get serious, we can do both+TUI so everyone is happy with it ^^

I’ll be available for this project at the end of the month (I have a busy September as most people), I’ll let you know!

1 Like