this post was submitted on 16 Jun 2023
4 points (100.0% liked)

Linux Questions

10 readers
1 users here now

A place to ask Linux-related questions, post advice and suggestions, etc. Any questions pertaining to Linux from novice to greybeard level are welcome. ---- ### Asking Questions: Please provide enough info to for people to actually help you. While there are some things that are generally the same, there is no one "Linux" - every distro has some things they do different and you'll get better answers if you provide some info. And remember the people here are helping you purely out of their own good will - so be nice! If you are encountering a problem, please include: 1. Which distro you are using 2. A brief summary of the problem 3. Any steps you have attempted 4. Relevant details such as hardware specs (see below), application versions, etc. ---- ### Capturing System Specs In almost all cases, posting output from inxi -Fmz - either as in a code block, as a linked file, or as a screenshot - will be appreciated. Some distros may pre-install inxi but on others (such as Fedora), you may need to install it yourself. But we understand that there will be times when you are unable to provide this info (such as with boot problems). The output from inxi info should be safe (especially with the -z option)... But in general,**YOU SHOULD ALWAYS REVIEW OUTPUT AND REMOVE ANY PRIVATE DATA BEFORE POSTING ONLINE** (e.g. replace "Your Name" with `` or something similar - this helps in preventing doxxing, identity theft, and similar issues). - Some common graphical screenshot apps:gnome-screenshot, ksnip, shutter, and flameshot . There are also terminal-based ones like maim and scrot.

founded 2 years ago
 

I want to create a bash script that I can run when setting up new machines to get KDE "most of the way" how I like it in terms of layout, tweaks, etc. but not sure how to use kwriteconfig5

I am coming from Cinnamon and in the past I could usually automate most user-settings via either gsettings or config files. I also played around on xfce a little. It wasn't for me but it did teach me that I need to be concerned not only about where a setting lives but also worry about if currently loaded settings will overwrite any changes I make to the config files

Since I am new to KDE and not really sure how settings are managed there yet (e.g. is it safe to just edit config files with sed etc or do they get overwritten?), I'm looking for some guidance on how to go about scripting this.

For reference, some things I am trying to do (not asking anyone to do them for me... I just want to know how and am trying to give some concreate example... if anyone wanted to do one of them as an example, I woulnd't say no but i really do want to learn how to do it myself):

  • Change time format on bottom panel to use format %a, %b %e, %_I:%M %P
  • Unpin any and all of the default Task Manager icons like Dolphin, Discover, etc that are on the panel and replace them with Widgets (but only keep Konsole and Dolphin).
  • Change from Icon-only Task Manager on bottom panel to use the full/icon+title Task Manager
  • Add custom hotkey Super+V for launching vlc
  • Turn off all UI sounds, except the sound that gets played when adjusting the volume... actually, KDE might do this by default. not sure. But Cinnamon system sounds it always annoyed me
  • Customize dolphin toolbars
  • Make Konsole font bigger so it easy to see on a TV

I am playing with Fedora KDE rn but would also like the script to work on Endeavour

I saw some stuffs online about kwriteconfig5 but even after looking at kwriteconfig5 --help I am still confused how to actually use it in a batch script and ~~all the examples I found online were for themes and stuff (like here), are old like from kde4, or are in blacked out reddit subs and cant see them (like here and here)~~

edit: just found this which makes me think maybe I can just use sed and edit configs directly? So confused why kwriteconfig5 is mentioned everywhere if I can just edit configs...

Also is there any good tools for tracking down the chagnes? Right now, I am making backup #1 of ~/.config, then making change in GUI, then making backup #2, then comparing #1 and #2 for changes... it works most of the time but is real slow. If there are better ways, I am open.

top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 2 years ago

e.g. is it safe to just edit config files with sed etc or do they get overwritten?)

You shouldn't use shell + sed but a template engine for such a task, e.g. Ansible + jinja2. Then you can always redeploy the config you stored instead of relying that your sed commands still change the lines in the update config correctly.

Or you can use a dotfiles manager like https://chezmoi.io

So confused why kwriteconfig5 is mentioned everywhere if I can just edit configs

KDE settings can change heavily in structure when they replace the startmenu or smth similar.