Basic spectrwm question?

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
beantaxi
Oyster-Slurper
Posts: 24
Joined: Wed Mar 02, 2016 7:37 am

Basic spectrwm question?

Unread post by beantaxi » Fri Mar 04, 2016 1:34 am

Thanks to the good people of these forums, I am up and semi-functional with spectrwm. But one issue has me stumped.

The Goal:
Left monitor - xterm in main area on left, gvim on right
Right monitor - chrome full screen

layout = ws[1]:0:0:0:0:vertical
autorun = ws[1]:x-terminal-emulator
autorun = ws[1]:/usr/bin/gvim
layout = ws[2]:0:0:0:0:fullscreen
autorun = ws[2]:google-chrome-stable

This *almost* works ... except on my left monitor, gvim is always on the left, even if I switch the order of the two autoruns. I've read the man page but I cannot see how to control this. Is this just a bug?

Btw I am using spectrwm 1.0.0 as that is package available for Ubuntu 14.04

Thanks all!
BT
Last edited by pidsley on Fri Mar 04, 2016 2:37 am, edited 1 time in total.
Reason: support question -- moved to /usr/share/doc

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Basic spectrwm question?

Unread post by machinebacon » Fri Mar 04, 2016 2:22 am

what you could try is to add a "sleep 3s &&" before gvim.

I would simply write a wrapper, and put it into /usr/local/bin

1) create /usr/local/bin/gvim-sleep with following content

Code: Select all

#!/bin/sh
sleep 5s && /usr/bin/gvim
2) save and exit, then chmod a+x /usr/local/bin/gvim-sleep
3) in your spectrwm.conf, refer to gvim-sleep instead of gvim

play with the sleep value in the example.

Just a side question -- what terminal are you using?

BTW -- we have a support section, please put questions like this thread there, no matter if basic, simple, advanced or stupid ;) We are usually not very strict with rules, but we like to have shit in an organized mess.
..gnutella..

User avatar
beantaxi
Oyster-Slurper
Posts: 24
Joined: Wed Mar 02, 2016 7:37 am

Re: Basic spectrwm question?

Unread post by beantaxi » Fri Mar 04, 2016 4:19 am

Thanks for the answer. So when I assign two apps to the same workspace, it's a race?

Happy to use Support in the future. I don't know how I missed it; I looked in HOW-TO to see if that was the place for questions, which it clearly wasn't, but somehow I didn't see SUPPORT.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Basic spectrwm question?

Unread post by machinebacon » Fri Mar 04, 2016 4:27 am

yes, it is a race condition. same happens, for example, if ~/.xinitrc is used for autostart. The order in which they are started (with an ampersand behind) does not really play a role - it's more about execution time. You can measure this with the 'time' command.

Code: Select all

time x-terminal-emulator
# hit Ctrl-c after a few seconds
time gvim
# hit Ctrl-c after a few seconds
The one with a higher "sys time" *should* be the second window. IIUC this is the frame on the right hand side. If you add a sleep to the one with a lower sys time, it will be the one that opens on the right. Not sure if it really (100%) works like this, but I have circumvented similar problems with tilers in the past using sleep.
..gnutella..

User avatar
beantaxi
Oyster-Slurper
Posts: 24
Joined: Wed Mar 02, 2016 7:37 am

Re: Basic spectrwm question?

Unread post by beantaxi » Fri Mar 04, 2016 4:49 am

Gotcha. Also I owe you an answer, to what terminal emulator I use. To be honest I have no idea but I copied the config and I'm going with x-terminal-emulator

$ grep term ~/.spectrwm.conf | grep ^autorun
autorun = ws[1]:x-terminal-emulator

As for the rest, I started to get pissy, at the thought having to write a little some-random-app_sleep.sh for every app I want to launch at startup. But then I wrote a little sleep-and-run.sh script, which allows you to make any command sleep before running it. The script in all its glory:

#!/bin/bash
sleep 2s
$("$@")

Example
autorun = ws[1]:/usr/local/bin/sleep-and-run.sh /usr/bin/gvim + -c startinsert ~/.spectrwm.conf

BT

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Basic spectrwm question?

Unread post by machinebacon » Fri Mar 04, 2016 5:42 am

well, x-terminal-emulator is calling the alternative with the highest priority.

Code: Select all

update-alternatives --query x-terminal-emulator
will show you what terminals are installed and which is set as default.
..gnutella..

User avatar
beantaxi
Oyster-Slurper
Posts: 24
Joined: Wed Mar 02, 2016 7:37 am

Re: Basic spectrwm question?

Unread post by beantaxi » Fri Mar 04, 2016 7:06 am

Looks like /usr/bin/gnome-terminal.wrapper?

Alternatives being koi8rxterm, lxterm, uxterm, xterm.

I kind of hate not really knowing what my terminal is, or why.

User avatar
beantaxi
Oyster-Slurper
Posts: 24
Joined: Wed Mar 02, 2016 7:37 am

Re: Basic spectrwm question?

Unread post by beantaxi » Fri Mar 04, 2016 7:39 am

Fyi here's a version of my dumb little script, that lets you put the delay in ~/.spectrwm.conf along with the command

#!/bin/bash
sleep $1
$("${@:2}")

Ex:
autorun = ws[1]:/usr/local/bin/sleep-and-run.sh 2s /usr/bin/gvim + -c startinsert ~/.spectrwm.conf

Any terminal recommendations?

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Basic spectrwm question?

Unread post by machinebacon » Fri Mar 04, 2016 9:06 am

Your first terminal is gnome-terminal, so it seems that opening gnome-terminal takes longer than gvim, and this causes gvim not to be the 2nd started program. (...which makes sense, because gnome-terminal is probably the slowest terminal emulator, along with terminator)

most of us use rxvt-unicode-256color or xterm.

if you like the right-click context menus in your terminal, for example because you like setting your color scheme by click-and-point, you can choose any libvte9-style terminal: sakura, xfce4-terminal, lxterm, terminator, roxterm, termit, gnome-terminal, mate-terminal, ...
(apt-cache search vte)

the snappier xterm and u/rxvt terminal emulators get their color schemes from Xresources. Please see http://www.linuxbbq.org/bbs/viewtopic.php?f=19&t=2074#5 for more details on how to configure your terminal emulator, and see http://www.linuxbbq.org/bbs/viewtopic.php?f=4&t=833 for color schemes. THESE DO NOT WORK WITH STERM, XVT, GNOME-TERMINAL, KONSOLE OR ANY OF THE VTE-EMULATORS MENTIONED ABOVE.
..gnutella..

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Basic spectrwm question?

Unread post by franksinistra » Fri Mar 04, 2016 9:49 am

if you REALLY want those gtk+3 vte term, with some 'minimalist' look, go checkout termite. You can even install something like neovim as it has terminal embedded to it (to replace gvim).

Termite has all the bells and whistles, including better xft support. But like MB already said, most of us use xterm or urxvt or suckless's ST. Because of its smaller footprint (both in memory and disk usage), and it has all the features you'll probably ever need.

or you can install emacs and do M-x eshell or M-x ansi-term
rice no more.

User avatar
beantaxi
Oyster-Slurper
Posts: 24
Joined: Wed Mar 02, 2016 7:37 am

Re: Basic spectrwm question?

Unread post by beantaxi » Fri Mar 04, 2016 10:23 pm

I actually didn't know I had a terminal choice.

I think the fanciest feature I'd want, is copy/paste, possibly via context menu as my keyboard has a context menu key (maybe they all do - dunno). If xterm/urxvt/ST have that I'll give one or all a look.

Your profile pic is truly revolting. Well done sir.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Basic spectrwm question?

Unread post by machinebacon » Sat Mar 05, 2016 4:50 am

You can always copy-paste using the middle mouse button or using the "Shift-Insert" combo on your keyboard. This is only a primary selection, without clipboard collection: the marked item is directly copied. To have the right-clickish secondary clipboard, you would use either a clipboard manager, or a vte terminal.

https://en.wikipedia.org/wiki/X_Window_selection
http://unix.stackexchange.com/questions ... ard-buffer

1) open two windows, one with text, the other blank (you can actually use the Reply field here on the forums)
2) mark item/s on one window, move mouse cursor to the other window
(for example, you select some text, then move the mouse to the Reply field)
3) left-click on the space you want to paste to, and press middle-mouse or Shift-Insert
4) the item is directly copied under the cursor
..gnutella..

Post Reply