How can I make a startscript which also moves a window?  [Solved]

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
leanLux
Posts: 10
Joined: Tue Jul 01, 2025 10:02 am

How can I make a startscript which also moves a window?

#1 Post by leanLux »

Code: Select all

My system is::
  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
  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: Acer product: Aspire A517-53G v: V2.02 serial: <superuser required>
  Mobo: ADL model: Amalthea_ADU v: V2.02 serial: <superuser required> UEFI: Insyde v: 2.02
    date: 08/01/2023
Battery:
  ID-1: BAT1 charge: 29.5 Wh (100.0%) condition: 29.5/47.8 Wh (61.8%) volts: 12.5 min: 11.2
    model: LGC AP18C8K type: Li-ion serial: <filter> status: full
CPU:
  Info: model: 12th Gen Intel Core i7-1260P bits: 64 type: MST AMCP arch: Alder Lake level: v3
    note: check built: 2021+ process: Intel 7 (10nm ESF) family: 6 model-id: 0x9A (154) stepping: 3
    microcode: 0x437
  Topology: cpus: 1x cores: 12 mt: 4 tpc: 2 st: 8 threads: 16 smt: enabled cache: L1: 1.1 MiB
    desc: d-8x32 KiB, 4x48 KiB; i-4x32 KiB, 8x64 KiB L2: 9 MiB desc: 4x1.2 MiB, 2x2 MiB L3: 18 MiB
    desc: 1x18 MiB
  Speed (MHz): avg: 652 high: 1132 min/max: 400/2501 boost: enabled scaling: driver: acpi-cpufreq
    governor: ondemand cores: 1: 726 2: 549 3: 913 4: 901 5: 625 6: 400 7: 400 8: 700 9: 725 10: 500
    11: 500 12: 400 13: 467 14: 1132 15: 1100 16: 400 bogomips: 79872
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: ghostwrite status: Not affected
  Type: indirect_target_selection status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: old_microcode status: Not affected
  Type: reg_file_data_sampling mitigation: Clear Register File
  Type: retbleed status: Not affected
  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: BHI_DIS_S
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Alder Lake-P GT2 [Iris Xe Graphics] vendor: Acer Incorporated ALI driver: i915
    v: kernel alternate: xe arch: Gen-12.2 process: Intel 10nm built: 2021-22+ ports:
    active: HDMI-A-1,eDP-1 empty: DP-1,DP-2 bus-ID: 0000:00:02.0 chip-ID: 8086:46a6 class-ID: 0300
  Device-2: NVIDIA GA107M [GeForce RTX 2050] vendor: Acer Incorporated ALI driver: N/A
    alternate: nouveau non-free: 530.xx+ status: current (as of 2023-03) arch: Turing code: TUxxx
    process: TSMC 12nm FF built: 2018-22 bus-ID: 0000:01:00.0 chip-ID: 10de:25a9 class-ID: 0302
  Device-3: Quanta ACER HD User Facing type: USB driver: uvcvideo bus-ID: 3-7:3
    chip-ID: 0408:4033 class-ID: fe01 serial: <filter>
  Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.20.0 driver: X:
    loaded: modesetting unloaded: fbdev,vesa dri: iris gpu: i915 display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 3840x1617 s-dpi: 96 s-size: 1017x428mm (40.04x16.85")
    s-diag: 1103mm (43.44")
  Monitor-1: HDMI-A-1 mapped: HDMI-1 pos: top-right model: Philips FTV serial: <filter>
    built: 2009 res: 1920x1080 hz: 60 dpi: 38 gamma: 1.2 size: 1280x720mm (50.39x28.35")
    diag: 1469mm (57.8") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  Monitor-2: eDP-1 pos: primary,bottom-l model: LG Display 0x0671 built: 2019 res: 1920x1080
    hz: 60 dpi: 128 gamma: 1.2 size: 382x215mm (15.04x8.46") diag: 438mm (17.3") ratio: 16:9
    modes: 1920x1080
  API: OpenGL v: 4.6 Mesa 24.2.8-1mx23ahs renderer: Mesa Intel Graphics (ADL GT2)
    direct-render: Yes
Audio:
  Device-1: Intel Alder Lake PCH-P High Definition Audio vendor: Acer Incorporated ALI
    driver: sof-audio-pci-intel-tgl alternate: snd_hda_intel, snd_soc_avs, snd_sof_pci_intel_tgl
    bus-ID: 0000:00:1f.3 chip-ID: 8086:51c8 class-ID: 0401
  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: Lite-On
    driver: mt7921e v: kernel modules: wl bus-ID: 0000:2b: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: Acer
    Incorporated ALI RTL8111/8168/8411 driver: r8169 v: kernel port: 3000 bus-ID: 0000:2c:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: eth0 state: down mac: <filter>
Bluetooth:
  Device-1: Lite-On Wireless_Device type: USB driver: btusb v: 0.8 bus-ID: 3-10:5
    chip-ID: 04ca:3802 class-ID: e001 serial: <filter>
  Report: hciconfig ID: hci0 rfk-id: 3 state: up address: <filter> bt-v: 3.0 lmp-v: 5.2
    sub-v: 2411 hci-v: 5.2 rev: 615
  Info: acl-mtu: 1021:6 sco-mtu: 240:8 link-policy: rswitch sniff link-mode: peripheral accept
    service-classes: rendering, capturing, object transfer, audio, telephony
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd v: 0.6 port: N/A
    bus-ID: 0000:00:0e.0 chip-ID: 8086:467f rev: class-ID: 0104
Drives:
  Local Storage: total: 953.87 GiB used: 23.31 GiB (2.4%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Micron model: 2450 MTFDKBA1T0TFK size: 953.87 GiB
    block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: V5MA010 temp: 30.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 953.62 GiB size: 937.58 GiB (98.32%) used: 23.31 GiB (2.5%) 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: 4 GiB used: 0 KiB (0.0%) priority: -2 file: /swap/swap
Sensors:
  System Temperatures: cpu: 60.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Repos:
  Packages: pm: dpkg pkgs: 2167 libs: 1083 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/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 http://ftp.lip6.fr/pub/linux/distributions/mxlinux/packages/mx/repo/ bookworm main non-free
    2: deb http://ftp.lip6.fr/pub/linux/distributions/mxlinux/packages/mx/repo/ bookworm ahs
Info:
  Processes: 355 Uptime: 1h 35m wakeups: 62097 Memory: 15.33 GiB used: 4.2 GiB (27.4%)
  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
I did trigger startup apps like
* Thunderbird , but also a custom script like:
* /home/myUserName/tools/start_firefox.sh
In there I had the simple line:

Code: Select all

#!/bin/bash
while ! ping -c1 1.1.1.1 &>/dev/null; do
  sleep 2
done
firefox &
which worked until I yesterday tried to add in the Genie editor:

Code: Select all

#!/bin/bash
while ! ping -c1 1.1.1.1 &>/dev/null; do
  sleep 2
done
firefox &
wmctrl -r "Thunderbird" -e 0,0,0,-1,-1
And now nothing works anymore.
Explanation: Thunderbird is already running through my other prompt, Firefox opened perfectly after a while when it was connected,
and so the thunderbird window on my right external monitor should be moved to the left one at the end of all processes. (the prompt itself moves the window, but together they won't work) - but "thunderbird &" does not work.
What went wrong?

User avatar
CharlesV
Global Moderator
Posts: 7628
Joined: Sun Jul 07, 2019 5:11 pm

Re: How can I make a startscript which also moves a window?

#2 Post by CharlesV »

Try thunderbird (ie all lower case )
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
leanLux
Posts: 10
Joined: Tue Jul 01, 2025 10:02 am

Re: How can I make a startscript which also moves a window?

#3 Post by leanLux »

Thank you Charles, for your help - it worked!
Also thank you for your appreciation for my previous idea to manually hide the smaller screen with a demorun of a screensaver.

I improved the script now in 3 ways:
#1: sleep until Firefox gets an address, else we open the browser with unreached websites I have to reload
done
#2: I used individual coordinates which you may adjust to fit your screen

Code: Select all

#!/usr/bin/env bash
#3: I paused again, until the windows did load their titles, which are used to detect my streaming tabs
while ! /bin/ping -c1 1.1.1.1 >/dev/null 2>&1; do
  sleep 2 # 1 wait for a connection
/usr/bin/firefox &
wmctrl -r "thunderbird" -e 0,-25,515,-1,-1 
sleep 5 #3 wait for the titles to load
wmctrl -r "Disney+" -e 0,1920,0,-1,-1 #2
wmctrl -r "Disney+" -b add,maximized_vert,maximized_horz # fullscreen that window
So this now opens firefox and thunderbird, moves the tunderbird to my smaller main monitor for me to write mails,
but moves the streaming window (with your chosen streaming service) to the large screen and turns it fullscreen.
However, there is still one minor weakness to this script (which I don't mind)
It only works if one of the many tabs contains a link to disney AND this tab is the first one of all tabs.
To make it perfect would be not worth the tiny improvement.

User avatar
CharlesV
Global Moderator
Posts: 7628
Joined: Sun Jul 07, 2019 5:11 pm

Re: How can I make a startscript which also moves a window?  [Solved]

#4 Post by CharlesV »

leanLux wrote: Tue Jul 22, 2025 2:26 pm Thank you Charles, for your help - it worked!
Also thank you for your appreciation for my previous idea to manually hide the smaller screen with a demorun of a screensaver.

I improved the script now in 3 ways:
#1: sleep until Firefox gets an address, else we open the browser with unreached websites I have to reload
done
#2: I used individual coordinates which you may adjust to fit your screen

Code: Select all

#!/usr/bin/env bash
#3: I paused again, until the windows did load their titles, which are used to detect my streaming tabs
while ! /bin/ping -c1 1.1.1.1 >/dev/null 2>&1; do
  sleep 2 # 1 wait for a connection
/usr/bin/firefox &
wmctrl -r "thunderbird" -e 0,-25,515,-1,-1 
sleep 5 #3 wait for the titles to load
wmctrl -r "Disney+" -e 0,1920,0,-1,-1 #2
wmctrl -r "Disney+" -b add,maximized_vert,maximized_horz # fullscreen that window
So this now opens firefox and thunderbird, moves the tunderbird to my smaller main monitor for me to write mails,
but moves the streaming window (with your chosen streaming service) to the large screen and turns it fullscreen.
However, there is still one minor weakness to this script (which I don't mind)
It only works if one of the many tabs contains a link to disney AND this tab is the first one of all tabs.
To make it perfect would be not worth the tiny improvement.
Excellent glad that worked for you... and your very welcome!

On the 'Disney' part .. you could load a local html page at startup, a custom, local HTML page that changed the document.title (or using tags) to something like <Title>StartPage</title> and then you could just replace "Disney+" to "StartPage" .

To make that REALLY slick ... you might design that "StartPage" to have the links to all of your stream pages and outfit it with their logo or an Image for each one. (A menu if you will - done in HTML / and css ) .. you could make it look like anything you like.. and even setup a 'timeout' so that if the user doesnt pick one within say 5 min .. it defaults to one, changes the page and starts up the stream.

Something that looks like this:

Image

or

Image
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
Eadwine Rose
Administrator
Posts: 14886
Joined: Wed Jul 12, 2006 2:10 am

Re: How can I make a startscript which also moves a window?

#5 Post by Eadwine Rose »

And that is where you navigate into the tab starting pages that extensions offer ;)


Moved to the help area, since there was no theme shared, nor was this a screenshot.
MX-23.6_x64 July 31 2023 * 6.1.0-37amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.247.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030

Post Reply

Return to “MX Help”