Archive

Posts Tagged ‘gui’

use tmux as a “GUI” interface

November 16, 2019 Leave a comment

Problem
I have a console application that clears the screen, draws a table and updates it every second in an infinite loop (let’s call it Part A). If this application is started with a specific command-line parameter, then it starts in interactive mode (Part B). From Part B I can give some commands that control Part A. How could I display both Part A and Part B in the terminal?

Solution
You can do it with tmux. With tmuxp, it’s even simpler. Here is a config file called sample.yaml that you can load with “tmuxp load sample.yaml“.

session_name: main-pane-height
windows:
- layout: main-horizontal
  options:
    main-pane-height: 35
  panes:
  - shell_command:
    - echo top pane
  - shell_command:
    - echo bottom pane
  window_name: Title Comes Here

This creates two panes and executes the specified commands in the panes. With this I could start Part A in the top pane, and Part B in the bottom pane.

Categories: bash Tags: , , , , ,

[manjaro] change window buttons layout

August 18, 2019 Leave a comment

Problem
On my desktop I have a Manjaro that I installed years ago. It’s a rolling release distro, meaning I get all the updates, but the graphical interface is not always updated. For instance, I installed a new Manjaro on a laptop, and Manjaro looks much better on my laptop than on my old desktop.
On a newly installed Manjaro, the window buttons are on the right side, but on my desktop they are on the left. How could I unify them and move the buttons to the right?

Solution
I found the solution in this video: https://www.youtube.com/watch?v=yVfHDyWcgSA . In short: start the Settings Editor, select xfwm4 on the left, edit “button layout”, and provide the string “O|SHMC” (without quotes).

browse your fonts easily

October 13, 2018 Leave a comment

Problem
I wanted to create a captioned image with Gimp and for this I was looking for a nice font. Under Manjaro I installed the package “aur/ttf-google-fonts-opinionated-git” and thus I got hundreds of fonts. How to visualize and browse them easily?

Solution
FontManager can do exactly this. Install the package “aur/fontmanager.app” and launch the app. with the command FontManager. It looks similar to this:

On the left side click on a font, then use the down arrow to run through the fonts.

Categories: linux, manjaro Tags: , , ,

Robomongo

Robomongo is a native GUI client for MongoDB. So far I’ve used RockMongo, which was perfect for me, but it’s PHP-based and quite hard to install. Also, it seems to be abandoned, the last commit was in 2015. It’s a pity…

Robomongo is simple. Just download, decompress, and launch. It’s free and multi-platform.

Categories: mongodb Tags: , , ,

GUI application to monitor mouse coordinates in real-time

September 11, 2011 Leave a comment

Problem
You want to monitor mouse coordinates in real-time.

But why?
For instance you want to use the autopy Python module. “AutoPy is a simple, cross-platform GUI automation toolkit for Python. It includes functions for controlling the keyboard and mouse, finding colors and bitmaps on-screen, and displaying alerts — all in a cross-platform, efficient, and simple manner.” (source) So, with autopy you can say “move the mouse to position X,Y and click once”. But how do you figure out the X,Y coordinates? This is when my script comes in the picture.

Solution
Just launch my simple GUI and it will show the mouse coordinates in real-time. Available here, in the “mouse/” folder.

Screenshot

Rock-Paper-Scissors: You vs. the Computer

March 8, 2011 1 comment

Computers mimic human reasoning by building on simple rules and statistical averages. Test your strategy against the computer in this rock-paper-scissors game illustrating basic artificial intelligence. Choose from two different modes: novice, where the computer learns to play from scratch, and veteran, where the computer pits over 200,000 rounds of previous experience against you.” (source)

The novice opponent is not too difficult, but it learns quickly. The veteran opponent is tough though, I had the impression that it can read my mind :) The problem is that we, humans, don’t choose our next move randomly and the computer can analyze our strategy.

Choose randomly

After playing with the veteran for a while, I came up with the idea: “Hey, if I could choose randomly, the computer couldn’t analyze my moves”. So here is a simple random number generator:

C:~> python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> li=[1,2,3]
>>> random.choice(li)
2
>>> random.choice(li)
1
>>> random.choice(li)
1

In the “python shell”, you can use the up arrow to call back the previous command(s). With this “cheat” you can surprise the veteran computer :)

I read about this game in this post (in Hungarian).

Update (20110309):

I made a very simple GUI that returns a random number from the interval [1,3] :) Jack’s remark from the comments was taken into account. I’ve never used PyGtk before, I was curious what it’s like. You can get the source code here. Tip: launch the application, right click on it on the task bar, and set “Always On Top” on. This way you can use it together with the game in the browser, you won’t have to switch between the two.

Update (20131007):
There is a Rock Paper Scissors Programming Competition, see the site http://www.rpscontest.com/. Here is an example that its author sent to reddit too.

Change display resolution

February 17, 2011 Leave a comment

In this post, I found two useful utilities:

  • xrandr (from the man: “Xrandr is used to set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size. If invoked without any option, it will dump the state of the outputs, showing the existing modes for each of them, with a ‘+’ after the preferred mode and a ‘*’ after the current mode.“)
  • lxrandr (from the man: “A GTK+2 interface to XRandR. lxrandr is a program that change the resolution and frequency of the monitor using a simple interface.“)

Getting your laptop work with a projector

With lxrandr I could make my laptop work with a projector at the university. I’ve had this problem for months… All I had to do was change (lower) the resolution.

Categories: ubuntu Tags: , , , ,