Difference between revisions of "Guake"

From ArchWiki
Jump to: navigation, search
m (Window width: rm extraneous list, see also Help:Style)
(rename-tab only renames the tab with the index of 0 on newer versions where rename-current-tab exists)
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
[[Category:Terminal emulators]]
 
[[Category:Terminal emulators]]
 
[[de:Guake]]
 
[[de:Guake]]
 +
[[ja:Guake]]
 
[[ru:Guake]]
 
[[ru:Guake]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|This article demonstrates the installation of Guake}}
+
{{Related|GNOME}}
{{Article summary heading|Related}}
+
{{Related articles end}}
{{Article summary wiki|GNOME}}
+
[http://guake.org Guake] is a top-down terminal for [[GNOME]] (in the style of [[Yakuake]] for [[KDE]], [[Tilda]] or the terminal used in Quake).
{{Article summary end}}
+
[http://guake.org Guake] is a top-down terminal for [[GNOME]] (in the style of Yakuake for [[KDE]], [[Tilda]] or the terminal used in Quake).
+
  
 
== Installation ==
 
== Installation ==
  
[[pacman|Install]] {{Pkg|guake}}, available in the [[official repositories]].
+
[[Install]] {{Pkg|guake}}, available in the [[official repositories]].
  
 
== Usage ==
 
== Usage ==
Line 19: Line 18:
 
  $ guake
 
  $ guake
  
After guake has started you can right click on the interface and select Preferences to change the hotkey to drop the terminal automatically, by default it is set to F12.
+
After guake has started you can right click on the interface and select ''Preferences'' to change the hotkey to drop the terminal automatically, by default it is set to {{ic|F12}}.
 +
 
 +
Also, you can adjust many of the Guake preferences with ''gconf-editor'' tool under ''apps > guake''. If it's not enough for you, you are always free to copy the ''guake'' executable ({{ic|/usr/bin/guake}}) to {{ic|/usr/local/bin/guake}} and edit it in text editor, since it's just a [[Python]] script. Remember to make the file executable.
  
 
== Autostartup ==
 
== Autostartup ==
  
 
You may want Guake to load on starting up Desktop Environment. To do this, you need to
 
You may want Guake to load on starting up Desktop Environment. To do this, you need to
{{bc|# cp /usr/share/applications/guake.desktop /etc/xdg/autostart/}}
+
# cp /usr/share/applications/guake.desktop /etc/xdg/autostart/
  
 
See [[Autostarting]] for more info.
 
See [[Autostarting]] for more info.
  
== Window width ==
+
== Guake scripting ==
 
+
Guake takes all the width of your display by default and there's no such option in "Preferences". To change width you can edit the program itself ({{ic|/usr/bin/guake}}) which is [[Python|python]] script.
+
Find that string:
+
 
+
width = 100
+
 
+
It is width value in percents, change it to whatever you like.
+
  
If you want to align new "narrowed" window left or right find string (just below the 'width' line above).
+
Like [[Yakuake]], Guake allows to control itself at runtime by sending the [[D-Bus]] messages. Thus it can be used to start Guake in a user defined session. You can create tabs, assign names for them and also ask to run any specific command in any opened tab or just to show/hide Guake window, manually in a terminal or by creating a custom script for it.
  
halignment = self.client.get_int(KEY('/general/window_halignment'))
+
Example of such a script is given below this section.
  
and replace the part after the '=' sign with "ALIGN_LEFT" or "ALIGN_RIGHT".
+
You can use ''guake'' executable itself to send D-Bus messages. Here is the list of available options you may be interested in:
  
To avoid overwrites on update, save it as /usr/local/bin/guake and remember to make it executable.
+
* {{ic|-t}}, {{ic|--toggle-visibility}} — toggle the visibility of the terminal window. Actually, you can just type {{ic|guake}}, and it will toggle the visibility of already running instance.
 +
* {{ic|-f}}, {{ic|--fullscreen}} — put Guake to fullscreen mode.
 +
* {{ic|--show}} — show Guake main window.
 +
* {{ic|--hide}} — hide Guake main window.
 +
* {{ic|-n ''CUR_DIR''}}, {{ic|1=--new-tab=''CUR_DIR''}} — create new tab and select it. Value of {{ic|CUR_DIR}} used to set a current directory for the tab, if specified.
 +
* {{ic|-s ''INDEX''}}, {{ic|1=--select-tab=''INDEX''}} — select tab with index {{ic|INDEX}}. Tab indexes are started with 0.
 +
* {{ic|-g}}, {{ic|--selected-tab}} — print index of currently selected tab.
 +
* {{ic|-e ''CMD''}}, {{ic|1=--execute-command=''CMD''}} — execute an arbitrary command {{ic|CMD}} in the selected tab.
 +
* {{ic|-i ''INDEX''}}, {{ic|1=--tab-index=''INDEX''}} — used with {{ic|--rename-tab}} to specify index {{ic|INDEX}} of a tab to rename. Default value is 0.
 +
* {{ic|1=--rename-tab=''TITLE''}} — set the tab name to {{ic|TITLE}}. You can reset tab title to default value by passing a single dash ({{ic|"-"}}). Use {{ic|-i}} option to specify which tab to rename.
 +
* {{ic|1=--bgcolor=''RGB''}} — set the hexadecimal ({{ic|#rrggbb}}) background color {{ic|RGB}} of the selected tab.
 +
* {{ic|1=--fgcolor=''RGB''}} — set the hexadecimal ({{ic|#rrggbb}}) foreground color {{ic|RGB}} of the selected tab.
 +
* {{ic|-r ''TITLE''}}, {{ic|1=--rename-current-tab=''TITLE''}} — same as {{ic|--rename-tab}}, but renames the currently selected tab.
 +
* {{ic|-q}}, {{ic|--quit}} — shutdown running Guake instance.
  
Window alignment can also be set in gconf, under apps > guake > general > halignment. 0 sets it to center, 1 to right, 2 to left. (However, the width setting in gconf seems to have no effect and still requires editing the python script as explained above.)
+
Multiple options may be combined in a single call. If there's no guake instance running, all of the options specified will be applied to the newly created instance.
  
== Dual monitor workaround ==
+
To display list of all available options, type {{ic|guake --help}}.
  
The traditional patch for dual monitors is no longer available, but a workaround is to define the start points for the window.
+
Example:
Edit {{ic|/usr/bin/guake}}.
+
Find that string
+
  
  window_rect.y = 0
+
  #!/bin/bash
 +
 +
/usr/bin/guake &
 +
sleep 5 # let main guake process start and initialize D-Bus session
 +
 +
# adjust tab which was opened by default
 +
guake --rename-tab="iotop" --execute="/usr/bin/iotop"
 +
 +
# create new tab, start bash session in it
 +
guake --new-tab --execute="/usr/bin/bash"
 +
# and then execute htop, renaming the tab to "htop"
 +
guake --execute="/usr/bin/htop" --rename-current-tab="htop"
 +
 +
# ...
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --execute="/usr/bin/atop" --rename-current-tab="atop"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --execute="~/.iptables.sh" --rename-current-tab="iptables -nvL"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --execute="/usr/bin/journalctl --follow --full" --rename-current-tab="journalctl"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --execute="/usr/bin/irssi" --rename-current-tab="irssi"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --execute="/usr/bin/sudo -i" --rename-current-tab="rootshell0"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --execute="/usr/bin/sudo -i" --rename-current-tab="rootshell1"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --rename-current-tab="shell0"
 +
 +
guake --new-tab --execute="/usr/bin/bash"
 +
guake --rename-current-tab="shell1"
  
is the default point in Y coordinate if you need change for the width of top desktop bar (or the long from the top of the bar to below), if you use it,
+
Notice than we should wait some time calling ''sleep'' to avoid race conditions between running instances.
and add the default x coordinate in the line below, for positioned the window I use:
+
  
        window_rect.x = total_width - window_rect.width
+
== Using Guake on multiple monitors ==
        window_rect.y = 24
+
        window_rect.x = 1024
+
        return window_rect
+
  
My first window is 1024 pixels and my second window is 1280 pixels, so guake get size of the first window from left to right which is why I must increase the width by a percentage
+
There are two GConf options allowing you to change the screen on which Guake window will appear:
  
Find that string
+
* {{ic|/apps/guake/general/display_n}} — display to appear on if the {{ic|mouse_display}} option is not set. If this is set to an invalid value (as in the case of removing a screen from a system), the invalid value is automatically updated to the current primary screen.
  
width = 100
+
* {{ic|/apps/guake/general/mouse_display}} — appear on the mouse display. This overrides any setting in {{ic|display_n}}.
  
Change de value 100 for a more greater, in my case 125 (1280 divided by 1024 and multiplicated by 100.
+
Use some tool like ''gconf-editor'' to edit GConf options.
  
If the window width identified wrong, try to change the display number in
+
== Throubleshooting ==
  
window_rect = screen.get_monitor_geometry(0)
+
=== 'Ctrl' keybind problem ===
  
== 'Ctrl' Keybind Problem ==
+
As of {{Pkg|guake}} 0.4.2-7 there has been a noted bug affecting multiple users concerning the use of the {{ic|Ctrl}} key to toggle Guake window visibility (i.e. users that setup {{ic|Ctrl+Shift+z}} to open the guake console are able to open it by just pressing {{ic|Shift+z}}, independent on whether {{ic|Ctrl}} key has been pressed).
  
As of {{Pkg|guake}} 0.4.2-7, there has been a noted bug affecting multiple users concerning the use of the 'Ctrl' key on the Keyboard Shortcuts to toggle guake visibility in the "Keyboard shortcuts" tab of guake-prefs (i.e. Users that setup 'Ctrl+Shift+z' to open the guake console can open it by pressing 'Shift+z', hence having the Ctrl key-bind irrelevant.
+
To solve the problem you should manually fix the value of the GConf key {{ic|/apps/guake/keybindings/global/show_hide}}. Open a ''gconf-editor'', navigate to ''apps > guake > keybindings > global > show_hide'' and replace {{ic|<Primary>}} with {{ic|<Control>}}.
•••••••••••
+
There is a bug in the program that stores the settings in Toggle Guake Visibility that places the Ctrl string as "<Primary>" instead of "<Control>".
+
  
The workaround is to use the command-line gconftool-2 from {{Pkg|gconf}} package, get the current string shortcut string from {{ic|/apps/guake/keybindings/global/show_hide}}, and replace all instances of "<Primary>" to "<Control>".
+
=== In Floating WM ===
  
To get what the current keyboard shortcut string is:
+
If you are using Tilda and a floating WM, you may find out that you can use class string "Tilda" to set the window keep floating. But that Guake's WM_CLASS(STRING)'s out put is "Main.py", so you should use "Main.py" to do this. For example, in i3wm, add this to your .i3/config:
# gconftool-2 -g /apps/guake/keybindings/global/show_hide
+
  
To activate the guake console with Ctrl+Shift+z for example:
+
  for_window [class="Main.py"] floating enable
  # gconftool-2 -t string -s /apps/guake/keybindings/global/show_hide "<Control><Shift>z"
+
  
It would be easier to use the graphical gconftool equivalent {{Pkg|gconf-editor}} to browse for and edit the {{ic|/apps/guake/keybindings/global/show_hide}} string. Replace "<Primary>" in the string with "<Control>".
+
== See also ==
  
Alternatively you can use this script to replace instances of <Primary> with <Control> in the {{ic|/apps/guake/keybindings/global/show_hide}} string:
+
* [http://linux.die.net/man/1/guake man guake(1)] on die.net
{{hc|~/replaceit.sh
+
|#!/bin/bash
+
|2=<nowiki>if which gconftool-2 &> /dev/null
+
then
+
  val=$(printf "%s" $(gconftool-2 -g /apps/guake/keybindings/global/show_hide))
+
  newval=${val/"<Primary>"/"<Control>"}
+
  if [ "$newval" = "$val" ]
+
    then echo "No changes made. Could not find or replace <Primary> in your settings."
+
  else
+
    echo "Replacing old string $val with new string:$newval"
+
    gconftool-2 -t string -s /apps/guake/keybindings/global/show_hide "$newval"
+
  fi
+
else
+
  echo "gconftool-2 not found. Please install gconf. Exiting..."
+
fi</nowiki>}}
+

Latest revision as of 10:44, 3 May 2016

Related articles

Guake is a top-down terminal for GNOME (in the style of Yakuake for KDE, Tilda or the terminal used in Quake).

Installation

Install guake, available in the official repositories.

Usage

Once installed, you can start Guake from the terminal with:

$ guake

After guake has started you can right click on the interface and select Preferences to change the hotkey to drop the terminal automatically, by default it is set to F12.

Also, you can adjust many of the Guake preferences with gconf-editor tool under apps > guake. If it's not enough for you, you are always free to copy the guake executable (/usr/bin/guake) to /usr/local/bin/guake and edit it in text editor, since it's just a Python script. Remember to make the file executable.

Autostartup

You may want Guake to load on starting up Desktop Environment. To do this, you need to

# cp /usr/share/applications/guake.desktop /etc/xdg/autostart/

See Autostarting for more info.

Guake scripting

Like Yakuake, Guake allows to control itself at runtime by sending the D-Bus messages. Thus it can be used to start Guake in a user defined session. You can create tabs, assign names for them and also ask to run any specific command in any opened tab or just to show/hide Guake window, manually in a terminal or by creating a custom script for it.

Example of such a script is given below this section.

You can use guake executable itself to send D-Bus messages. Here is the list of available options you may be interested in:

  • -t, --toggle-visibility — toggle the visibility of the terminal window. Actually, you can just type guake, and it will toggle the visibility of already running instance.
  • -f, --fullscreen — put Guake to fullscreen mode.
  • --show — show Guake main window.
  • --hide — hide Guake main window.
  • -n CUR_DIR, --new-tab=CUR_DIR — create new tab and select it. Value of CUR_DIR used to set a current directory for the tab, if specified.
  • -s INDEX, --select-tab=INDEX — select tab with index INDEX. Tab indexes are started with 0.
  • -g, --selected-tab — print index of currently selected tab.
  • -e CMD, --execute-command=CMD — execute an arbitrary command CMD in the selected tab.
  • -i INDEX, --tab-index=INDEX — used with --rename-tab to specify index INDEX of a tab to rename. Default value is 0.
  • --rename-tab=TITLE — set the tab name to TITLE. You can reset tab title to default value by passing a single dash ("-"). Use -i option to specify which tab to rename.
  • --bgcolor=RGB — set the hexadecimal (#rrggbb) background color RGB of the selected tab.
  • --fgcolor=RGB — set the hexadecimal (#rrggbb) foreground color RGB of the selected tab.
  • -r TITLE, --rename-current-tab=TITLE — same as --rename-tab, but renames the currently selected tab.
  • -q, --quit — shutdown running Guake instance.

Multiple options may be combined in a single call. If there's no guake instance running, all of the options specified will be applied to the newly created instance.

To display list of all available options, type guake --help.

Example:

#!/bin/bash

/usr/bin/guake &
sleep 5 # let main guake process start and initialize D-Bus session

# adjust tab which was opened by default
guake --rename-tab="iotop" --execute="/usr/bin/iotop"

# create new tab, start bash session in it
guake --new-tab --execute="/usr/bin/bash"
# and then execute htop, renaming the tab to "htop"
guake --execute="/usr/bin/htop" --rename-current-tab="htop"

# ...
guake --new-tab --execute="/usr/bin/bash"
guake --execute="/usr/bin/atop" --rename-current-tab="atop"

guake --new-tab --execute="/usr/bin/bash"
guake --execute="~/.iptables.sh" --rename-current-tab="iptables -nvL"

guake --new-tab --execute="/usr/bin/bash"
guake --execute="/usr/bin/journalctl --follow --full" --rename-current-tab="journalctl"

guake --new-tab --execute="/usr/bin/bash"
guake --execute="/usr/bin/irssi" --rename-current-tab="irssi"

guake --new-tab --execute="/usr/bin/bash"
guake --execute="/usr/bin/sudo -i" --rename-current-tab="rootshell0"

guake --new-tab --execute="/usr/bin/bash"
guake --execute="/usr/bin/sudo -i" --rename-current-tab="rootshell1"

guake --new-tab --execute="/usr/bin/bash"
guake --rename-current-tab="shell0"

guake --new-tab --execute="/usr/bin/bash"
guake --rename-current-tab="shell1"

Notice than we should wait some time calling sleep to avoid race conditions between running instances.

Using Guake on multiple monitors

There are two GConf options allowing you to change the screen on which Guake window will appear:

  • /apps/guake/general/display_n — display to appear on if the mouse_display option is not set. If this is set to an invalid value (as in the case of removing a screen from a system), the invalid value is automatically updated to the current primary screen.
  • /apps/guake/general/mouse_display — appear on the mouse display. This overrides any setting in display_n.

Use some tool like gconf-editor to edit GConf options.

Throubleshooting

'Ctrl' keybind problem

As of guake 0.4.2-7 there has been a noted bug affecting multiple users concerning the use of the Ctrl key to toggle Guake window visibility (i.e. users that setup Ctrl+Shift+z to open the guake console are able to open it by just pressing Shift+z, independent on whether Ctrl key has been pressed).

To solve the problem you should manually fix the value of the GConf key /apps/guake/keybindings/global/show_hide. Open a gconf-editor, navigate to apps > guake > keybindings > global > show_hide and replace <Primary> with <Control>.

In Floating WM

If you are using Tilda and a floating WM, you may find out that you can use class string "Tilda" to set the window keep floating. But that Guake's WM_CLASS(STRING)'s out put is "Main.py", so you should use "Main.py" to do this. For example, in i3wm, add this to your .i3/config:

for_window [class="Main.py"] floating enable

See also