Coder Social home page Coder Social logo

gnome-magic-window's Introduction

gnome-magic-window

Bind keys to a specific program in Gnome Shell:

  • When the corresponding key is pressed and this program is in background, its window is brought to the front.
  • When the corresponding key is pressed and this program is already at the front, the last window is brought to the front again.
  • When the corresponding key is pressed and the program isn't launched yet, it is spawned by running the program in the command property.

It is comparable to Guake and Compiz Put, except that gnome-magic-window works with Gnome Shell and the new Wayland display server. (It does not use xdotool and wmctrl, that worked with X11 but not with Wayland.)

Demo

pseudo-video demonstration

Quick install

The following commands assume that one of the elements in BINDINGS has a shortcut property of F12, a title of Terminator and a command of /usr/bin/terminator.

  • Replace F12 with Pause, <Super>a or whichever key you prefer.
  • Replace Terminator by the program to be brought to front when the key is pressed.
  • Replace /usr/bin/terminator by the command to run if no window named Terminator is found. Make sure you use a absolute path.
  • Remove any array elements from BINDINGS that you don't require.
  • Uncomment the example or add a new array element to BINDINGS containing the shortcut, window title and the command to launch (which will be searched for on the PATH if not absolute.)

1. Install the extension

Since Gnome 41, gnome-magic-window is shipped as a Gnome extension. To install this extension from the Git repository:

mkdir -p ~/.local/share/gnome-shell/extensions
cd ~/.local/share/gnome-shell/extensions
git clone https://github.com/adrienverge/gnome-magic-window gnome-magic-window@adrienverge

2. Customize

Edit extension.js to set your favorite key, window name and command to run, for example:

const BINDINGS = [
  {
    shortcut: 'F12',
    title: 'Terminator',
    command: 'terminator'
  },
  // more bindings can be added
];

3. Enable the extension

After installing files and customizing, you probably need to close your session and log in again in order for Gnome to the extension.

Either run:

gnome-extensions enable gnome-magic-window@adrienverge

Or open Gnome "Extensions" utility to enable the extension.

You're set! Try pressing your magic key.

4. Debug

In case it doesn't work, you may need to add your gnome version in metadata.json and reload your session, or debug futher.

# Alt+F2↵ r↵
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/GnomeMagicWindow --method org.gnome.Shell.Extensions.GnomeMagicWindow.magic_key_pressed Terminator terminator

For Gnome versions < 45

Use this repo on commit b640974 or before, and read the README file from that version.

For Gnome versions < 41

Use this repo on commit 26230da or before, and read the README file from that version.

gnome-magic-window's People

Contributors

adrienverge avatar ds4l avatar mikecrowe avatar akaihola avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.