Page 1 of 2
Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 6:10 am
by Bulat
Hi, people,
There is a minimalist Bash script to save your currently open applications into
autostart .desktop entries for the next login.
It filters out background and duplicate processes and simplifies known launchers (like Chromium).
Just run
save_session.sh, and enjoy your resurrected desktop next time you log in!
Code: Select all
#!/bin/bash
AUTOSTART_DIR=~/.config/autostart
mkdir -p "$AUTOSTART_DIR"
mkdir -p ~/.session
SESSION_FILE=~/.session/saved_programs.txt
> "$SESSION_FILE"
echo "Saving session to $SESSION_FILE"
wmctrl -lp | while read -r line; do
pid=$(echo "$line" | awk '{print $3}')
cmd=$(ps -p "$pid" -o args= 2>/dev/null | grep -v "xfce4-session")
# Skip service and background processes
[[ "$cmd" =~ xfce4-panel ]] && continue
[[ "$cmd" =~ xfdesktop ]] && continue
[[ "$cmd" =~ "--daemon" ]] && continue
[[ "$cmd" =~ save_session.sh ]] && continue
# Simplify Chromium command
[[ "$cmd" =~ /usr/lib/chromium/chromium ]] && cmd="chromium"
echo "$cmd" >> "$SESSION_FILE"
done
# Remove duplicates
sort -u "$SESSION_FILE" -o "$SESSION_FILE"
# Generate .desktop files for each command
n=0
while IFS= read -r cmd; do
((n++))
name="custom_session_$n"
file="$AUTOSTART_DIR/$name.desktop"
echo "[Desktop Entry]" > "$file"
echo "Type=Application" >> "$file"
echo "Exec=$cmd" >> "$file"
echo "Hidden=false" >> "$file"
echo "NoDisplay=false" >> "$file"
echo "X-GNOME-Autostart-enabled=true" >> "$file"
echo "Name=$name" >> "$file"
done < "$SESSION_FILE"
echo "✅ Done! The session will be restored at next login."
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 6:11 am
by Bulat
This item
viewtopic.php?t=84609 inspired me! :)
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 6:16 am
by Bulat
Actually, default Suspend options do not work for me. :(
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 6:30 am
by j2mcgreg
QSI please.
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 7:17 am
by Bulat
j2mcgreg wrote: Mon Jun 30, 2025 6:30 amQSI please.
QSI means?
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 8:22 am
by j2mcgreg
Bulat wrote: Mon Jun 30, 2025 7:17 am
j2mcgreg wrote: Mon Jun 30, 2025 6:30 amQSI please.
QSI means?
We are going to need your computer’s complete profile before we can proceed, so you need to post the output from the QSI utility. The Quick System Info (QSI) utility is located in MX Tools and its output is automatically formatted for use here in the forum. Run the QSI utility, click “Copy for Forum” at the bottom and then just paste it here in your thread.
Forum Rules
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 8:46 am
by Eadwine Rose
Ok.. is this a help topic or what? Because then it is in the wrong forum.
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 9:30 am
by Bulat
j2mcgreg wrote: Mon Jun 30, 2025 6:30 amQSI please.
Code: Select all
Snapshot created on: 20250518_1833
System:
Kernel: 6.14.10-2-liquorix-amd64 [6.14-13~mx23ahs] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0 parameters: audit=0
intel_pstate=disable amd_pstate=disable BOOT_IMAGE=/boot/vmlinuz-6.14.10-2-liquorix-amd64
root=UUID=<filter> ro quiet splash resume=UUID=<filter> resume_offset=93614080
Desktop: Xfce v: 4.20.0 tk: Gtk v: 3.24.38 info: xfce4-panel wm: xfwm v: 4.20.0 vt: 7
dm: LightDM v: 1.32.0 Distro: MX-23.6_ahs_x64 Libretto April 13 2025 base: Debian GNU/Linux 12
(bookworm)
Machine:
Type: Laptop System: ASUSTeK product: ASUS TUF Gaming F15 FX506LH_FX506LH v: 1.0
serial: <superuser required>
Mobo: ASUSTeK model: FX506LH v: 1.0 serial: <superuser required> UEFI: American Megatrends
v: FX506LH.309 date: 02/02/2021
Battery:
ID-1: BAT1 charge: 30.1 Wh (100.0%) condition: 30.1/48.1 Wh (62.7%) volts: 12.2 min: 11.7
model: ASUS A32-K55 type: Li-ion serial: N/A status: full
CPU:
Info: model: Intel Core i5-10300H bits: 64 type: MT MCP arch: Comet Lake gen: core 10 level: v3
note: check built: 2020 process: Intel 14nm family: 6 model-id: 0xA5 (165) stepping: 2
microcode: 0x100
Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache: L1: 256 KiB
desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 8 MiB desc: 1x8 MiB
Speed (MHz): avg: 1575 high: 2459 min/max: 800/2501 boost: enabled scaling:
driver: acpi-cpufreq governor: ondemand cores: 1: 2371 2: 2133 3: 1959 4: 2459 5: 800 6: 1079
7: 1000 8: 800 bogomips: 39999
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities:
Type: gather_data_sampling mitigation: Microcode
Type: ghostwrite status: Not affected
Type: indirect_target_selection mitigation: Aligned branch/return thunks
Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
Type: old_microcode status: Not affected
Type: reg_file_data_sampling status: Not affected
Type: retbleed mitigation: Enhanced IBRS
Type: spec_rstack_overflow status: Not affected
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Enhanced / Automatic IBRS; IBPB: conditional; PBRSB-eIBRS: SW
sequence; BHI: SW loop, KVM: SW loop
Type: srbds mitigation: Microcode
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: Intel CometLake-H GT2 [UHD Graphics] vendor: ASUSTeK driver: i915 v: kernel
arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1 empty: none bus-ID: 00:02.0
chip-ID: 8086:9bc4 class-ID: 0300
Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] vendor: ASUSTeK driver: nvidia
v: 575.57.08 alternate: nouveau,nvidia_drm non-free: 530.xx+ status: current (as of 2023-03)
arch: Turing code: TUxxx process: TSMC 12nm FF built: 2018-22 pcie: gen: 1 speed: 2.5 GT/s
lanes: 16 link-max: gen: 3 speed: 8 GT/s ports: active: none empty: DP-1,HDMI-A-1
bus-ID: 01:00.0 chip-ID: 10de:1f99 class-ID: 0300
Device-3: Sonix USB2.0 HD UVC WebCam type: USB driver: uvcvideo bus-ID: 1-7:3
chip-ID: 322e:202c class-ID: 0e02
Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.20.0 driver: X:
loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa alternate: nv dri: iris gpu: i915
display-ID: :0.0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 509x286mm (20.04x11.26") s-diag: 584mm (22.99")
Monitor-1: eDP-1 model: Najing CEC Panda 0x004d built: 2019 res: 1920x1080 hz: 144 dpi: 142
gamma: 1.2 size: 344x194mm (13.54x7.64") diag: 395mm (15.5") ratio: 16:9 modes: 1920x1080
API: OpenGL v: 4.6 Mesa 24.2.8-1mx23ahs renderer: Mesa Intel UHD Graphics (CML GT2)
direct-render: Yes
Audio:
Device-1: Intel Comet Lake PCH cAVS vendor: ASUSTeK driver: snd_hda_intel v: kernel
alternate: snd_soc_avs,snd_sof_pci_intel_cnl bus-ID: 00:1f.3 chip-ID: 8086:06c8 class-ID: 0403
Device-2: NVIDIA vendor: ASUSTeK driver: snd_hda_intel v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 16 link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.1 chip-ID: 10de:10fa class-ID: 0403
API: ALSA v: k6.14.10-2-liquorix-amd64 status: kernel-api tools: alsamixer,amixer
Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse status: active
2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: MEDIATEK MT7921 802.11ax PCI Express Wireless Network Adapter vendor: AzureWave
driver: mt7921e v: kernel modules: wl pcie: gen: 2 speed: 5 GT/s lanes: 1 bus-ID: 03:00.0
chip-ID: 14c3:7961 class-ID: 0280
IF: wlan0 state: up mac: <filter>
Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
vendor: ASUSTeK RTL8111/8168/8411 driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
port: 3000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: eth0 state: down mac: <filter>
Bluetooth:
Device-1: IMC Networks Wireless_Device type: USB driver: btusb v: 0.8 bus-ID: 1-14:4
chip-ID: 13d3:3563 class-ID: e001 serial: <filter>
Report: hciconfig ID: hci0 rfk-id: 1 state: down bt-service: N/A rfk-block: hardware: no
software: yes address: <filter>
Info: acl-mtu: 1021:6 sco-mtu: 240:8 link-policy: rswitch sniff link-mode: peripheral accept
Drives:
Local Storage: total: 2.29 TiB used: 1.72 TiB (75.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Micron model: 2210 MTFDHBA512QFD size: 476.94 GiB
block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: P6MA001 temp: 39.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Crucial model: CT2000MX500SSD1 size: 1.82 TiB block-size:
physical: 4096 B logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 023 scheme: MBR
Partition:
ID-1: / raw-size: 476.69 GiB size: 468.13 GiB (98.21%) used: 83.47 GiB (17.8%) fs: ext4
dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 256 MiB size: 252 MiB (98.46%) used: 274 KiB (0.1%) fs: vfat
dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: file size: 19.46 GiB used: 0 KiB (0.0%) priority: -2 file: /swap/swap
Sensors:
System Temperatures: cpu: 57.0 C pch: 59.0 C mobo: N/A
Fan Speeds (RPM): cpu: 0
Repos:
Packages: pm: dpkg pkgs: 3326 libs: 1572 tools: apt,apt-get,aptitude,nala,synaptic pm: rpm
pkgs: 0 pm: flatpak pkgs: 0
No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/cuda-debian12-x86_64.list
1: deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/ /
Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
Active apt repos in: /etc/apt/sources.list.d/debian.list
1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
Active apt repos in: /etc/apt/sources.list.d/mx.list
1: deb https://mirror.kku.ac.th/mx-packages/mx/repo/ bookworm main non-free
2: deb https://mirror.kku.ac.th/mx-packages/mx/repo/ bookworm ahs
Info:
Processes: 326 Uptime: 3h 58m wakeups: 4 Memory: 15.47 GiB used: 4.2 GiB (27.1%) Init: SysVinit
v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: UEFI
Re: Simple XFCE Session Saver
Posted: Mon Jun 30, 2025 3:35 pm
by atomick
#1 Bulat : how did you keyboard enter in your session script - the "Green Check mark" ?
is that a particular Font installed ?
Re: Simple XFCE Session Saver
Posted: Tue Jul 01, 2025 12:28 am
by Bulat
atomick wrote: Mon Jun 30, 2025 3:35 pm
#1 Bulat : how did you keyboard enter in your session script - the "Green Check mark" ?
is that a particular Font installed ?
No need to install (extra) font(s).
Just run the script and enjoy! :)