A script for Xfce scripting

Here you can exchange scripts that you created or have permission to share with other users.
Message
Author
Jakob77
Posts: 651
Joined: Thu Feb 09, 2023 3:09 am

A script for Xfce scripting

#1 Post by Jakob77 »

In MX23 Xfce we don't have this file:

Code: Select all

~/.config/xfce4/xinitrc
but we can create it and it can sometimes do some useful things.

It is a start up script so it is executed at every boot up.

One of the useful things it can do is to set a very good PATH to "~/bin" that is the most common place for private user scripts.



What does PATH mean.?

PATH is a line of directories where the computer looks for the filename (script name) you use for a command in the Terminal.

And it will look in the same order as they are lined up.

It can go like this:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

All the folders are installed by system or software but you can see important system folders in the beginning and games are put in the end.
There can be exceptions but as done here I believe it is a good common rule to put the most important files first to make sure they can always be found correctly.
Before we make scripts we naturally always do a test in Terminal so we know the filename is available but just to decrease the risk I choose to put "~/bin" (:/home/my_user_name/bin) in the end, and PATH then goes like this:


/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/my_user_name/bin



In order to do that I just need a xinitrc like this, and give it permission to run as a program:



Code: Select all

#!/bin/sh
# This file: ~/.config/xfce4/xinitrc
# Script for setting user PATH in MX 23.6 Xfce
# This file might later be overwritten by MX update or a MX-tool.
# You can read more here: https://forum.mxlinux.org/viewtopic.php?t=75245
# In order to work, this script needs to be in the right folder and have permission to run like a program
# ( chmod +x ~/.config/xfce4/xinitrc  or  chmod 755 ~/.config/xfce4/xinitrc or Thunar right click file -> prop -> perm )


# ***** Personal config begin *********** 


# Section 1:

# Setting PATH



# The 3 lines below will include ~/bin in the end of PATH only if the folder exist 
	if [ -d "$HOME/bin" ] ; then
	PATH="$PATH:$HOME/bin"
	fi



# ***** Personal config end *********** 

	exec /etc/xdg/xfce4/xinitrc



So if you give "~/.config/xfce4/xinitrc" that content and also create ~/bin (don't forget permissions if you want) then you will have a very fine PATH for ~/bin after next boot up.
In fact after all I have seen about this one as one out of at least four solutions for PATH it beats all the others on at least the term or functionality.

And of course MX Xfce users deserve the very best.! :-)


In the script I write: "# This file might later be overwritten by MX update or a MX-tool."
That is extremely unlikely, and we all keep backups. I mostly wrote it to make sure this script is not in the way for it.


Edit1: Path to the file we don't have has been corrected to make it easier to understand.
Last edited by Jakob77 on Fri Jun 06, 2025 5:56 pm, edited 1 time in total.

Jakob77
Posts: 651
Joined: Thu Feb 09, 2023 3:09 am

Re: A script for Xfce scripting

#2 Post by Jakob77 »

This post is reserved for more xinitrc section contributions that I am using and testing. :-)

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

Re: A script for Xfce scripting

#3 Post by Eadwine Rose »

Just a note to our users who are new here that Jakob77 is in no way, shape, or form associated with the MX Team.
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

User avatar
siamhie
Global Moderator
Posts: 3337
Joined: Fri Aug 20, 2021 5:45 pm

Re: A script for Xfce scripting

#4 Post by siamhie »

Jakob77 wrote: Fri Jun 06, 2025 4:53 pm In MX23 Xfce we don't have this file:

Code: Select all

/home/dellc/.config/xfce4/xinitrc
That's because the .xinitrc file resides in the users home folder. https://wiki.debian.org/Xinitrc
but we can create it and it can sometimes do some useful things.

It is a start up script so it is executed at every boot up.

One of the useful things it can do is to set a very good PATH to "~/bin" that is the most common place for private user scripts.
This is never going to happen and you have been told this on the other threads you start.
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.

Jakob77
Posts: 651
Joined: Thu Feb 09, 2023 3:09 am

Re: A script for Xfce scripting

#5 Post by Jakob77 »

siamhie

Thank you for bringing the path to the file we don't have to my attention. :thumbup:
Now that you have done it and I have changed it, it will be nice if you remove my user name from your quote.


siamhie wrote: Fri Jun 06, 2025 5:50 pm
but we can create it and it can sometimes do some useful things.

It is a start up script so it is executed at every boot up.

One of the useful things it can do is to set a very good PATH to "~/bin" that is the most common place for private user scripts.
This is never going to happen and you have been told this on the other threads you start.
I don't recall that, and if just one more script happy Xfce user picks it up then we are a "we" :-)

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

Re: A script for Xfce scripting

#6 Post by CharlesV »

Jakob77, as you have been told before... Debian does not include ~/bin in the default $PATH for security reasons, as it can lead to potential conflicts with system binaries as well as "bin attacks". Users can manually add it to their $PATH if they want to use it for personal scripts or executables.

Three out of hundreds of posts...

https://everything2.com/title/Why+putti ... a+bad+idea

https://unix.stackexchange.com/question ... idea#67522

https://www.linuxbash.sh/post/bash-shel ... -practices
*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
Jerry3904
Administrator
Posts: 23192
Joined: Wed Jul 19, 2006 6:13 am

Re: A script for Xfce scripting

#7 Post by Jerry3904 »

Closing
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

Locked

Return to “Scripts”