You are not logged in.

#1 2024-08-06 10:56:10

gaming
Member
Registered: 2024-04-14
Posts: 25

[RESOLVED] Tools To help open the default terminal in linux

Hello, I am working on dwm i want know if there are any tools that will allow me to open the default terminal installed in my system

Last edited by gaming (2024-08-15 12:58:52)

Offline

#2 2024-08-06 11:02:11

cryptearth
Member
Registered: 2024-02-03
Posts: 619

Re: [RESOLVED] Tools To help open the default terminal in linux

there is no default on Arch - it highly depends on if you have a graphical terminal host even installed
on KDE for example if you only install the base plasma package you end up with a desktop without any filemanager, browser or terminal - there's just none installed
one possible option is Konsole - but there're a metric ton of possible options

it's about the same reason there's no default why the base group contains neither vim nor nano - es the team doesn't want to prefer one over the other (although in my mind rather than including none the base group should contain both - otherwise you end up with an install without any editor at all - and depending on your network setup it cn get quite tricky to get network up to download an editor)

Offline

#3 2024-08-06 13:11:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,122
Website

Re: [RESOLVED] Tools To help open the default terminal in linux

Do you mean you want a simple command that itself will check which terminals are available and pick one to launch?  If so, this is what i3-sensible-terminal is intended to do, though there is really nothing sensible at all about it.

Depending on the actual goal and context, I'd strongly recommend keeping it simple by just setting TERMINAL.  This is a non-standard (i.e., not explicitly defined) environment variable, but it is very widely used with the assumption that it contains the executable name of the user's preferred terminal emulator.  So when you want to launch a terminal, you'd just run $TERMINAL, or in dwm code I believe that'd be SHCMD("$TERMINAL").

Last edited by Trilby (2024-08-06 17:30:20)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2024-08-06 15:06:09

seth
Member
Registered: 2012-09-03
Posts: 56,218

Offline

#5 2024-08-07 15:04:44

gaming
Member
Registered: 2024-04-14
Posts: 25

Re: [RESOLVED] Tools To help open the default terminal in linux

Good idea's i tried implementing $TERMINAL but it would not work if we install a new terminal or new installation.

seth solution also does not work please try something else currently i am using the following code

static const char *termcmd[]  = { "sh", "-c", "alacritty || kitty", NULL };

Last edited by gaming (2024-08-07 15:06:06)

Offline

#6 2024-08-07 15:12:13

seth
Member
Registered: 2012-09-03
Posts: 56,218

Re: [RESOLVED] Tools To help open the default terminal in linux

Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855
"does not work " isn't an error message or even description. Why and how does that not work after doing what (did you reconfig and rebuild dwm?)

Fffw I'd bind the termcmd to some scipt and use that to select a TE

#!/bin/bash
type alacritty && exec alacritty
type kitty && exec kitty
type xterm && exec xterm

Offline

#7 2024-08-07 15:41:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,122
Website

Re: [RESOLVED] Tools To help open the default terminal in linux

gaming wrote:

Good idea's i tried implementing $TERMINAL but it would not work if we install a new terminal or new installation.

Why wouldn't it work?  That's the whole idea, it's a variable, so you can reset it as you wish.  This would take restarting dwm for it to take effect, but you wouldn't need to rebuild dwm.

Or another option is just to make a symlink like /bin/myterm pointing to whatever terminal you actually want to use.  Dwm could have "myterm" as termcmd, then you could recreate the symlink at any time to any terminal and it'd immediately take effect.

But it's still not really clear what your actual goals are.  There are more potential options that we could possibly list here.  Help narrow it down: what's your actual use case?  What do you want to happen?

Last edited by Trilby (2024-08-07 15:44:36)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2024-08-08 14:12:14

gaming
Member
Registered: 2024-04-14
Posts: 25

Re: [RESOLVED] Tools To help open the default terminal in linux

Sorry my bad for not explaining, Seth I am mass deploying so i want someone be able to run my setup.sh and dwm automatically get setup for my configuration, I want MOD KEY + x to lunch the terminal which I use alacritty and kitty and based on the system it launches one of them.

But after apply your fix and rebuilding a clean install, and installed st from git://git.suckless.org/st it still dosen't show any terminal  I was unable to launch any of terminal even tried by installing terminator but still not launching, I want a kind of solution which is able to launch system default terminal when MOD key + x is pressed

Also Trilby I Stated the reason why i don't like a Enviroment variable is stated in my previous response.

Lets try another way to implement

also i check the binary working by using

make

command and to install i use the standard

sudo make clean install

Last edited by gaming (2024-08-08 14:18:54)

Offline

#9 2024-08-08 14:18:41

seth
Member
Registered: 2012-09-03
Posts: 56,218

Re: [RESOLVED] Tools To help open the default terminal in linux

Mass-deploay i3-sensible-terminal or the likes where you can control the terminal (incomrporating $TERMINAL to honor user preferences) and bind that in the dwm config.
Also the default key binding is MOD+Shift+Enter, so if you ddin't change that, MOD+x will of course not spawn any terminal.

Offline

#10 2024-08-08 14:32:54

Head_on_a_Stick
Member
From: Belsize Park
Registered: 2014-02-20
Posts: 8,091
Website

Re: [RESOLVED] Tools To help open the default terminal in linux

As this thread is about "linux" [sic], the OP could switch to Debian and take advantage of their /usr/bin/x-terminal-emulator alternative. I wish Arch had an alternatives system. That would be sweeeeeet.

Offline

#11 2024-08-08 14:38:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,122
Website

Re: [RESOLVED] Tools To help open the default terminal in linux

gaming wrote:

Also Trilby I Stated the reason why i don't like a Enviroment variable is stated in my previous response.

No, you didn't.  You only said it "wouldn't work". *Shrug*, you can't get alternatives that may work better for you if you don't specify what's wrong with the existing options.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2024-08-08 15:11:32

gaming
Member
Registered: 2024-04-14
Posts: 25

Re: [RESOLVED] Tools To help open the default terminal in linux

Thank you Seth it works for now i will use i3-sensible-terminal but will keep looking for better alternatives

- It works and is available in every major distro
I will keep this thread open for now to get suggestion but will close it in 2-3 days again thank you

Offline

#13 2024-08-08 15:21:07

gaming
Member
Registered: 2024-04-14
Posts: 25

Re: [RESOLVED] Tools To help open the default terminal in linux

Trilby wrote:
gaming wrote:

Also Trilby I Stated the reason why i don't like a Enviroment variable is stated in my previous response.

No, you didn't.  You only said it "wouldn't work". *Shrug*, you can't get alternatives that may work better for you if you don't specify what's wrong with the existing options.

Sorry Tribly, I failed to covey my message

My main motive is to have a package/script that would look at the installed gui terminal in the system and launch the most used or in some sort of order.
if i use your method of defining $TERMINAL Enviroment variable it would be fixed and if user install a new terminal if would now work the user will have to rerun the install.sh script again. well thank you for your suggestion.

Offline

#14 2024-08-08 15:37:24

seth
Member
Registered: 2012-09-03
Posts: 56,218

Re: [RESOLVED] Tools To help open the default terminal in linux

They'd only have to alter the $TERMINAL environment?
i3-sensible-terminal should interpret that as well.

So what was the issue? Wrong shortcut?

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#15 2024-08-08 15:48:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,122
Website

Re: [RESOLVED] Tools To help open the default terminal in linux

gaming wrote:

... the user will have to rerun the install.sh script again

No, but now I'm understanding a little better.  The user would not have to rerun your script.  They'd just edit the TERMINAL setting (in their shell profile, xinitrc, or similar startup script) - perhaps end users of your script would not be equipped to do this.  But if that's the case, I'd not think arch linux was a good choice for them.

If they are installing new terminal emulators, they are clearly able of entering pacman commands, though - so I don't see how editing a config file should be a concern.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#16 2024-08-11 09:45:54

gaming
Member
Registered: 2024-04-14
Posts: 25

Re: [RESOLVED] Tools To help open the default terminal in linux

Well my script also works for fedora and debian and those user are pretty new to linux so I am also making it noob friendly also thank for your suggestions.

I have another problem tho when I close my lid while the computer is on it starts showing pixels and solution

Offline

#17 2024-08-11 12:44:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,122
Website

Re: [RESOLVED] Tools To help open the default terminal in linux

But there's no way around getting the user's input on the preference.

Imagine you use the seth's script from post #6 or something similar to that.  Lets also assume that alacritty is installed already, but the user wants to use kitty instead.  So they install kitty (using their distro's package manager).  But kitty will still never run via the terminal key binding - and even if they're a fairly competent user, it could take them a bit to track down why kitty wont run before they realize they then either need to uninstall alacritty, modify the root-owned script to launch a terminal, or patch and recompile their window manager.  All of this is much harder and requires much more knowledge and experience than just having a setting like "export TERMINAL=alacritty" in the ~/.xinitrc (or similar startup file).

You can have a script that picks one of the available / installed terminal emulators.  But there's no way for such a script to know what the human user at the keyboard actually wants without getting input from them at some point.  So I'd think your goal should be to make it as easy as possible for them to provide that input.

Last edited by Trilby (2024-08-11 12:46:24)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#18 2024-08-15 12:58:27

gaming
Member
Registered: 2024-04-14
Posts: 25

Re: [RESOLVED] Tools To help open the default terminal in linux

Okey thank you for all of the suggestions i am now marking this problem as resolved. please help me with my next issue

https://bbs.archlinux.org/viewtopic.php … 2#p2190072

Offline

Board footer

Powered by FluxBB