This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Environment variables missing in Dolphin and Kalarm

Tags: None
(comma "," separated)
User avatar
blue_bullet
Registered Member
Posts
87
Karma
0
OS
I want to include my timezone in datetime stamps in dialogs, but the variable values are blank (or missing) in Dolphin and Kalarm.

I set an environment variable TIMEZONE in ~/.kde/env/path.sh (or ~/.config/plasma-workspace/env/path.sh) as
export TIMEZONE=$(date +%Z)
which resolves to MST (Mountain Standard Time) and in /etc/environment
export TIMESZONE=MDT
(Mountain Daylight Time-hard coded purposely as Daylight since substitutions are forbidden).

When I run a routine in Cron the timezone displays correctly as 2020-11-29 15:42:46 MDT.

In a terminal session attached to Dolphin if I echo $TIMEZONE I get a blank line instead of MST. Same is true in Kalarm scripts. I get a blank.
When I enter
printenv>printenv.txt
and edit printenv.txt TIMEZONE shows as TIMEZONE=blank.
Same thing happens if I issue the same command as a script from Kalarm.

echo $TIMEZONE in Konsole properly shows MST:
Code: Select all
2020-11-29 16:04:06 MST rob@sigma:~$ echo $TIMEZONE
MST
2020-11-29 16:04:14 MST rob@sigma:~$


To further confuse things since $TZ is not created in KDE Neon I created it as
Code: Select all
# TZ will be the time zone spelled out in full, e.g. for MST it would be 'America/Boise'. : Updated 2020-11-27 @ 15:53:44 MST by rob@sigma
TZ=$(cat /etc/timezone)  # TZ is not always initialized as an environment variable in all linux distributions so do it here.
export TZ=$TZ


in the path.sh script and

export TZ=America/Boise
in /etc/environment. TZ shows as America/Boise in Konsole, Dolphin, and Kalarm when using printenv.

Running the following Cron job
27 16 * * * root printenv > /tmp/env.txt
yields /tmp/env.txt:
Code: Select all
DESKTOP_ENVIRONMENT=kde
IN_CRON=This environmental variable was created in /etc/environment by rob (01:17:08 02/06/13) and should appear in the cron environment (kilroy was here).
HOME=/root
MAILTO=rcburness.noreply@gmail.com
USER_HOME_DIR=/home/rob
TIMEZONE=MDT
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/snap/bin:/home/rob/pCloudDrive/Dropbox-Rob_Burness/shared_rcss_complex:/usr/local/share/rcss:/home/rob/pCloudDrive/Dropbox-Rob_Burness/shared_rcss_complex/date_time_rexx_functions:/home/rob/bin:/home/rob/sdk/android-sdk-linux/tools:/home/rob/sdk/android-sdk-linux/platform-tools
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0.0
LANG=en_US.UTF-8
XAUTHORITY=/home/rob/.Xauthority
HOST=sigma
SHELL=/bin/sh
PWD=/root
TZ=America/Boise



Can someone tell me how environment variables are created or made available to Kalarm and Dolphin? I am confused and need some help.

inxi -FC:
Code: Select all
System:    Host: sigma Kernel: 5.4.0-54-generic x86_64 bits: 64 Desktop: KDE Plasma 5.20.3 Distro: KDE neon 20.04 5.20
Machine:   Type: Laptop System: ASUSTeK product: Strix 17 GL703GE v: 1.0 serial: <superuser/root required>
           Mobo: ASUSTeK model: GL703GE v: 1.0 serial: <superuser/root required> UEFI: American Megatrends v: GL703GE.318
           date: 07/19/2019
Battery:   ID-1: BAT1 charge: 52.3 Wh condition: 52.3/64.4 Wh (81%)
CPU:       Topology: 6-Core model: Intel Core i7-8750H bits: 64 type: MT MCP L2 cache: 9216 KiB
           Speed: 3834 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 3962 2: 3481 3: 3440 4: 3981 5: 3980 6: 3852 7: 3596
           8: 3652 9: 3800 10: 3974 11: 3912 12: 3410
Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel
           Device-2: NVIDIA GP107M [GeForce GTX 1050 Ti Mobile] driver: N/A
           Device-3: IMC Networks USB2.0 HD UVC WebCam type: USB driver: uvcvideo
           Display: x11 server: X.Org 1.20.8 driver: modesetting unloaded: fbdev,vesa resolution: 1920x1080~120Hz
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.0.8
Audio:     Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel
           Sound Server: ALSA v: k5.4.0-54-generic
Network:   Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi
           IF: wlo1 state: up mac: 94:b8:6d:2a:05:f8
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169
           IF: enp2s0 state: down mac: 18:31:bf:97:1b:fd
Drives:    Local Storage: total: 1.14 TiB used: 103.49 GiB (8.8%)
           ID-1: /dev/sda vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB
           ID-2: /dev/sdb vendor: Seagate model: ST1000LM035-1RK172 size: 931.51 GiB
Partition: ID-1: / size: 54.75 GiB used: 18.73 GiB (34.2%) fs: ext4 dev: /dev/sda5
           ID-2: /home size: 118.67 GiB used: 76.05 GiB (64.1%) fs: ext4 dev: /dev/sdb2
Swap:      ID-1: swap-1 type: partition size: 13.97 GiB used: 34.7 MiB (0.2%) dev: /dev/sdb3
Sensors:   System Temperatures: cpu: 79.0 C mobo: 27.8 C
           Fan Speeds (RPM): cpu: 0
Info:      Processes: 451 Uptime: 1d 2h 21m Memory: 15.49 GiB used: 9.84 GiB (63.5%) Shell: bash inxi: 3.1.00


I


Migrated from Linux Mint 17.3/18.3 KDE to KDE neon User Edition.
User avatar
blue_bullet
Registered Member
Posts
87
Karma
0
OS
I learned that autostarting kalarm does not load the correct path nor the entire set of environment variables, but if I run kalarm from konsole the correct path and all environment variables are present. That leads me to believe the issue lies with autostart. I will try removing kalarm from autostart and running a startup script that is delayed 15 seconds to see if that fixes the problem.

Any help/comments would be appreciated.


Migrated from Linux Mint 17.3/18.3 KDE to KDE neon User Edition.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, mesutakcan, sandyvee, Sogou [Bot]