unix shell command that make the virtual desktop spin - linux

I'm looking for a way to make my virtual desktop change without using keyboard shortcuts.
I explain: I want to do a java program that will change my current desktop to the desktop at the left for exemple, let's say by clicking on a button. I've done it using keyboard shortcuts sent by the java program, but i want it more universal (i mean, that can work for everyone). Hope I'm clear enough!
Thanks.

This will give you available workspace (virtual desktop) names:
wmctrl -d
then
wmctrl -s <workspace name>
will move to the workspace.
Take a look at here http://tomas.styblo.name/wmctrl/ to see what window managers are supported.
My previous answer was:
xrandr is probably what you want. Take a look at this wikipedia page here too.
I thought xrandr will work but couldn't figure out how. I hope someone will comment and give the definite answer whether xrandr will work or not.

Related

alt-tab like functionality when using terminal?

When working in GUI we do alt-tab (or cmd-tab in mac) to switch between multiple programs, for example I am writing a text file in a text editor and then I do alt-tab to switch to already running browser to google up something then I alt-tab again to come back to keep editing.
How do you perform such "switch between" programs in command line interface - for example working with a ssh command line shell?
EDIT: I forgot to mention it, I am using ssh to connect to my university's server, and they don't have screen & tmux installed, and my account have no right to install any new apps... Is there any built-in functionality to perform this task, or any work around? For exmaple can I "minimize" running proggram and come back to regular shell interface, do some work, then display the "minimized" process again?
Another workaround: use the shell's job control, eg if you're editing a file, CTRL-z pauses the editor and brings you back to the shell, where you can compile, see manpages, browse the web or whatever -- and of course you can background the browser or anything else.
Screen command offers the ability to detach a long running process (or program, or shell-script) from a session and then attach it back at a later time.
As a crude workaround, run multiple terminal windows on your computer, and alt-tab between them.
Incidentally, at the Linux console, you can switch virtual terminals with ctrl+alt+F for at least F1 through F6, commonly F8 or more (depends on how the distro sets them up). Not your case, I know, but in case future visitors should benefit.
If you are comfortable in Emacs, it allows you to run multiple independent ansi-term buffers.
You can also use "GNU screen" to emulate multiple terminals in one terminal.

Extended desktop in Linux

My goal is to have an extended desktop like in windows. Linux only uses my second monitor as a mirror, which is useless. I have searched a lot on google and SO for a way to get this right. I want linux to use both my monitors for one extended desktop, not as a mirror. As of yet I have not found out how to do this. Any help appreciated, thanks.
OK so a colleague explained it to me. Apparantly xrandr comes with almost all linux distributions. The proper way to use xrandr to set multiple monitors to display a different part of the same desktop is as follows:
xrandr
Shows you the names and dimensions of your displays. Say VGA1 and VGA2. Then if VGA1 is the screen on the left and you want VGA2 to extend it to the right you use:
xrandr --output VGA2 --right-of VGA1
Thats it.
Was looking for this on google and SO for hours, finally its working! Hope this will help other people as well. Dont know how to save this setting yet and I dont know if this is the most elegeant/best way to do this.
When you know the answer its easier finding other answers. Here are two sources that show how to save this setting as well. (although that does not work on my system as the files they point to cant be found)......
intel guide to xrandr
thinkwiki guide to xrandr
xrandr --output VGA2 --right-of VGA1
You get xrandr help if the first option is misspelled.
After you get your displays extended as #Leo explains, you can fine tune their placement using arandr from the terminal. It brings up a gui for xrandr.

Gnome - Determine keyboard layout

I was wondering how it might be possible to determine the currently used keyboard layout in a gnome session, when the user switches keyboard layouts via an applet. As of now I do not care, what programming language or libraries (gtk,x,...) I have to use for it.
I asked a similar question before on:
https://askubuntu.com/questions/155879/how-to-get-current-gnome-keyboard-layout-from-terminal
Unfortunatelly nobody could solve the issue, which is why I wanted to ask you. How do you determine the current keyboard layout in your programms/scripts.
Thanks
ftiaronsem
On the command line or from within scripts you can use setxkbmap:
$ setxkbmap -print | awk -F"+" '/xkb_symbols/ {print $2}'
gb
Or the -query option:
$ setxkbmap -query
rules: evdev
model: pc105
layout: gb
The keyboard layout is stored in the settings of X. (/etc/X11/xorg.conf)
Personally I would try parsing that file (or find a parser for it) and try to determine the layout that way.
Since I am not that experienced with X11, I do not know whether there might even be an API to query these settings.
I must say that I do not know whether that is the only place where it can be configured. Someone else might be able to confirm that.

How to programmatically invert screen colors in Linux

In Ubuntu, for example, you can use Super-M to invert the screen colors (requires desktop effects, see [1]). Other OSes have similar abilities, although I'm not really concerned with anything other than Linux.
Which API should I look into if I want to write a simple program that, when run, inverts the screen colors?
The language that I use the API from doesn't particularly matter to me. I am familiar enough with C/C++/Bash/Perl/Python that I can hack this up in whatever language has the easiest access to this API. Working on Ubuntu is required, working on other similar *nixes is not terribly important.
[1] https://help.ubuntu.com/community/KeyboardShortcuts#Desktop%20Effects%20enabled%20shortcuts
You could use xcalib to do what you want.
For example, a simple bash script to invert the screen colors would look like this:
#!/bin/bash
xcalib -invert -alter
Here are scripts and instructions for shifting colors using compton: https://github.com/vn971/linux-color-inversion
xrandr-invert-colors worked out of the box for me.
xcalib does not work for me using xorg and a tiling window manager, with an external display and gives me the following error: "Unable to get a display calibration".
Credit to Imat.

Solaris 10 keyboard problem

Im runing Solaris 10 - but im having problems with the keyboard.
Instead of - i get /, and instead of y i get z, etc. I tried changing every option in the menu "Keyboard Behaviour". I also tried changing kmdconfig from xorg to xsun, but then the graphics goes all wild and ugly - although the keyboard works fine then. Also cant change resolution in xsun mode.
By the way, im runing Solaris from Vmware, but i doubt this has anything to do with this.
Leave the graphic environment to the console:
dtconfig -d
dtconfig -reset
Select the correct keyboard layout you use:
kbd -s
Load it:
loadkeys
Check the keys are working properly. If okay, enable the graphical environment again:
dtconfig -e
If that still works, make that choice persistent after a reboot by updating your eeprom. eg:
eeprom kbd-type=Spanish
This should be migrated to superuser.com
It seems that you are expecting a german keyboard layout but are getting a US layout - at least the differences you are seeing are differences between those layouts. I don't know where to change that in openSolaris, but maybe it helps you find the correct place to look. Whatever desktop environment that you are using, it should have a tool to change the keyboard layout, probably somewhere with the other internationalization settings.

Resources