You are not logged in.
It came up a while ago that you can move any window, including conkies, with an Alt-drag, but the window (of course) comes back to its default position after a logout/in.
Since none of the Conkystadores chimed in with a fix, I assumed there wasn't one, but thinking suggests it might be possible to make a "fix_conkys" script which a user could run to read the new window positions and edit the config files accordingly.
There are some hurdles to be passed, but before I scratch my head over this any more (when I should have been doing more important things) I thought I'd throw some code in here in case anyone else can suggest stuff.
Get basic info on each conky with wmctrl. This while loop will probably hold the whole script:
#get id and geometry of conky windows
while read id desktop xoffset yoffset width height client title
do
[[ $title = Conky* ]] || continue
echo "id: $id
x-offset: $xoffset
y-offset: $yoffset
width: $width
height: $height" # in practice we'll do stuff with these variables
done < <(wmctrl -lG)
With the X id we can use xprop to find out the launching command for a particular conky, and so pin down the config file - it's the next argument after '-c':
cfg=$(xprop -id $id WM_COMMAND | awk -F '"' '{for (i=1;i<=NF;i++)if($i=="-c"){i=i+2;print $i}}')
Knowing where the file is, we can put all the config values in an array:
parse_conkyfile()
{
[[ -f $1 ]] || { echo "$1 is not a file." >&2;return 1;}
unset config
declare -Ag config
local name value
while read name value
do
[[ $name ]] || continue
[[ $name = TEXT* ]] && break
config["$name"]="$value"
done < <(sed 's/\#.*$//' "$1")
}
parsecfg "$cfg"
Now we can do eg ${config[gap_x]} to read what's in the file.
Hurdle: if the conky is not launched from $HOME then we'll need the PWD to find the config file.
It's possible to get the working directory of a process, if you've got its PID:
readlink -e /proc/$PID/cwd
But going from X window ID to PID is very difficult with conky. (Anyone?)
For now, let's just skip that issue.
What remains is to compare eg $xoffset with ${config[gap_x]} to calculate if and by how much the x and y settings have changed (not hard) and write the new figures into the config file (likewise).
Last edited by johnraff (2015-10-17 08:51:23)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
This was something I was going to get round to next, so thanks for getting the ball rolling
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Well, this conkystador doesn't mix well with "scripts" I can tweak them a bit, but creating them isn't my thing.
But you may be onto something. Conky has quite a few CLI switches - two of which are:
-x X_COORDINATE
X position
-y Y_COORDINATE
Y position
Using the individual conky killer line, by Grouchy Gaijin, with the -x -y addition and commenting them out in the conky you have a way to start/stop individual conkys and of course I'm sure you can manipulate those lines. It also gives you the ability to have the conkys anywhere - mine are on a different partition even:
11 Oct 15 | 08:57:51 ~
$ conky -q -x 10 -y 10 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin &
[1] 13736
11 Oct 15 | 08:58:17 ~
$ pkill -xf "conky -q -x 10 -y 10 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin" &
[2] 14069
[1] Done conky -q -x 10 -y 10 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin
[2]+ Done pkill -xf "conky -q -x 10 -y 10 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin"
11 Oct 15 | 08:58:32 ~
$ conky -q -x 60 -y 60 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin &
[1] 14116
11 Oct 15 | 08:58:53 ~
$ pkill -xf "conky -q -x 60 -y 60 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin" &
[2] 14546
[1] Done conky -q -x 60 -y 60 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin
[2]+ Done pkill -xf "conky -q -x 60 -y 60 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin"
11 Oct 15 | 08:59:28 ~
$ conky -q -x 100 -y 20 -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin &
[1] 14643
11 Oct 15 | 09:00:14 ~
$
Check line #13 of every BL conky I did - the individual conky killer line is there.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Actually no need to comment out the x_gap & y_gap calls in the conky:
Options
Command line options override configurations defined in configuration file.
-v | -V | --version
Prints version and exits
-q | --quiet
Run Conky in 'quiet mode' (ie. no output)
-D | --debug
Increase debugging output, ie. -DD for more debugging
-a | --alignment= ALIGNMENT
Text alignment on screen, {top,bottom,middle}_{left,right,middle} or none. Can also be abbreviated with first chars of position, ie. tr for top_right.
-b | --double-buffer
Use double buffering (eliminates "flicker")
-c | --config= FILE
Config file to load instead of $HOME/.conkyrc
-C | --print-config
Print builtin default config to stdout. See also the section EXAMPLES for more information.
-d | --daemonize
Daemonize Conky, aka fork to background
-f | --font= FONT
Font to use
-h | --help
Prints command line help and exits
-o | --own-window
Create own window to draw
-t | --text= TEXT
Text to render, remember single quotes, like -t ' $uptime '
-p | --pause= SECONDS
Time to pause before actually starting Conky
-u | --interval= SECONDS
Update interval
-w | --window-id= WIN_ID
Window id to draw
-X | --display= DISPLAY
X11 display to use
-x X_COORDINATE
X position
-y Y_COORDINATE
Y position
-i COUNT
Number of times to update Conky (and quit)
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@Sector11 you're suggesting to edit the command line that launches that particular conky, instead of editing the config file I guess? That would substitute the task of finding the file where the command lies for that of finding the config file. Have to look into it - whichever task turns out to be easier.
The goal is to have the change persist after logout or reboot.
@damo do you want to grab the ball now, or should I try and take it a bit further?
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
Not suggesting anything ... just showing that it is possible from a command in a terminal, therefore the two variables could be "tweaked" in a bash script. How is way over my head.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
the two variables could be "tweaked" in a bash script.
Yes, but when the script closed (on logout) the data would be lost. We need to preserve the new conky position somewhere. I'm suggesting (for now) for the script to edit the config file itself. It would probably be best to keep the original entries though, commented-out.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
....
@damo do you want to grab the ball now, or should I try and take it a bit further?
Not right away - it's next on the to-do list now. ("BLOB Configuration Manager" is nearly ready, but there are endless tweaks I keep having to do )
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Sounds like me with my rss parser. I'm getting there with it though. I will work on it some more this week and post some updates as I have sorted a lot of the initial issues I was having. Just a few more such as ending bbcode tags breaking conky formatting. Once, I get the formatting part done, I will rebuild it to be a command-line tool, then look at the possibility of translating it to object-oriented code, in case someone wanted to inherit and extend it for use in something else. Funny how something that sounds so simple can end up like "Holy cow, there's a lot more to this than I thought."
Offline
@damo OK I'll turn down the gas a bit. Maybe post up a function if I make one...
Anyway, I'm thinking the flow (should have put this in the first post) would be:
For each running conky:
Find its current location.
Find its config file. (This might be the trickiest bit, at least to make robust, cope with non-standard paths etc.)
Compare its location with what's in the config file.
If it's different, calculate the necessary change to gap_x etc, and
Edit the config file.
One major difficulty is that, unlike most other apps but like tint2, conky does not report its PID to the window manager, so you can't get it from wmctrl, xprop etc. For most of the above work, though, the X window id is enough, and xprop can give us the command line with WM_COMMAND from which we can grab the argument after -c ( or --config= ) to get the config file location.
But... if someone had a script which cd'd into a directory of config files and executed conky from there, then the command would be 'conky ./filename' and we'd have no idea where the directory was. It's possible to find the working directory of a process only if you have the PID.
The only workaround I've thought of to date would be to use 'pgrep -a conky' to get all the PIDs and command lines, then compare those command lines with what xprop had given us to try to match PIDs with X id's. That would still fail, though, if two conkys had config files with the same names but launched from different directories.
With a default BL setup that wouldn't be the case, but it would still be nice for it to be solid and failsafe if possible...
Funny how something that sounds so simple can end up like "Holy cow, there's a lot more to this than I thought."
...sigh...
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
Of course, you could always pass it back to the user and let them supply the path to the conky via cli. ]:D I guess you were hoping for more automation than that though.
Offline
^Well, yes. Just a "pin conkys" item in the conky submenu to make Alt-drags persistent.
Still, if we didn't try to cope with non-bunsen-standard setups it wouldn't be so hard.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
FWIW, I have voluntarily accepted BL's conky standards as they just make sense and provide benefits, such as them being accessible to conky chooser, etc. Not trying to suggest you make it specific to BL and I certainly understand wanting scripts to be a bit more universally applicable. HOwever, I like it when stuff makes sense
Offline
but you can get conkys PID:
11 Oct 15 | 23:03:06 ~
$ ps ax | grep conky
11682 ? Sl 0:01 conky -q -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin
13432 pts/2 S+ 0:00 grep conky
31131 ? S 0:03 conky -q -c /media/5/Conky/S12/S12_time_L.conky
31132 ? Sl 1:27 conky -q -c /media/5/Conky/S12/S12_time_tm.conky
31133 ? S 0:03 conky -q -c /media/5/Conky/S12/S12_time_R.conky
31361 ? Sl 0:55 conky -q -c /media/5/Conky/S11_Rem_Cal.conky
31480 ? Sl 0:48 conky -q -c /media/5/Conky/S11_Dates.conky
31711 ? Sl 0:16 conky -q -c /media/5/Conky/S11_MD_Cal-br.conky
31713 ? Sl 0:38 conky -q -c /media/5/Conky/S11_thin_r_side.conky
32043 ? S 0:15 conky -q -c /media/5/Conky/S11_Email_01.conky
32055 ? S 0:03 conky -q -c /media/5/Conky/Eagle.conky
32190 ? S 0:38 conky -q -c /media/5/Conky/S12/S12_L_n_B.conky
11 Oct 15 | 23:03:35 ~
$ ps ax | grep /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin
11682 ? Sl 0:01 conky -q -c /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin
13511 pts/2 S+ 0:00 grep /media/5/Conky/1b2_accuweather_conkyweather_font/conkyrc_1b2_int_s11_thin
11 Oct 15 | 23:04:05 ~
$ ps ax | grep /media/5/Conky/S12/S12_time_L.conky
13576 pts/2 S+ 0:00 grep /media/5/Conky/S12/S12_time_L.conky
31131 ? S 0:03 conky -q -c /media/5/Conky/S12/S12_time_L.conky
11 Oct 15 | 23:04:21 ~
$ ps ax | grep /media/5/Conky/S12/S12_L_n_B.conky
13626 pts/2 S+ 0:00 grep /media/5/Conky/S12/S12_L_n_B.conky
32190 ? S 0:38 conky -q -c /media/5/Conky/S12/S12_L_n_B.conky
11 Oct 15 | 23:04:43 ~
$
Or am I missing something?
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Nice:
tknomanzr@wtfbox-bl:~/bin$ ps ax | grep conky
9100 ? Sl 21:55 conky -c /home/tknomanzr/.config/conky/wtfbox-rss.conkyrc
9104 ? Sl 23:28 conky -c /home/tknomanzr/.config/conky/wtfbox_conky.conkyrc
9117 ? Sl 30:25 conky -c /home/tknomanzr/.config/conky/wtfbox_processes.conkyrc
12514 pts/0 S+ 0:00 grep conky
the three conky's I have running atm.
Offline
You can get the PIDs of running conkys with ps or pgrep, but to get the X window information (x-offset etc) you need the X id which is different. 'wmctrl -l' will list all the open windows, with the info and the X id's so that bit's good. What is very difficult is tying a certain PID to a certain X id.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
In conky 1.10 at least, it is possible to set a window_id when you start the conky:
-w | --window-id= WIN_ID
Window id to draw
which still doesn''t solve your problem. It looks like all of the matching arguments will fail because we don't usually set own_window_class to be anything but conky, nor do we set it's title, id, etc. I am beginning to think it might be wise for me to rethink those particular arguments, because it would certainly make isolating one conky out of several running easier.
Offline
The problem with conky (and tint2) is that it doesn't report its PID to the window manager, so none of those x-window type tools are able to get it. Most other apps set _NET_WM_PID.
Still, if we just assume that the conky is launched from $HOME, and/or the absolute path to the config file appears in the command line, then we can manage without the PID.
Last edited by johnraff (2015-10-12 04:58:52)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
Ok. That actually makes sense as you dont want the WM picking it up and attempting to decorate it, etc. The only two ways I can think of to run a conky are from $HOME with a single default conky or using a -c config. I definitely would not consider running it from a root directory to be a good idea.
Offline
1) Get conky command which was used, from...
ps aux | grep [c]conky
2) Extract the `own_window_title` from the conkyrc - eg "Bunsen Labs Left Conky"
3)
xwininfo -name "Bunsen Labs Left Conky"
...and get the window positions
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline