Giter Site home page Giter Site logo

Comments (2)

FelixKratz avatar FelixKratz commented on June 3, 2024

The way I would keep track of the previously focussed app in sketchybar would not be different from a scripting approach:
when the front app changes, write the current front app to some cache and use it on the next event to retrieve the previously focused window.

For example use this handle script for the front_app_switched event:

#!/bin/bash

if [ "$SENDER" = "front_app_switched" ]; then
  PREVIOUS_FRONT_APP=$(</tmp/front_app)
  echo "$INFO" > /tmp/front_app

  sketchybar --set $NAME label="$INFO" icon.background.image="app.$INFO"
fi

from sketchybar.

chrisgrieser avatar chrisgrieser commented on June 3, 2024

Ah, yeah, that works as well. For reference if anyone finds this issue:

# only trigger on deactivation of $TASK_APP
if [[ "$SENDER" = "front_app_switched" ]]; then
	data="/tmp/sketchybar_front_app"
	[[ -f "$data" ]] && deactivated_app=$(<"$data")
	echo -n "$INFO" >"$data"
	[[ "$deactivated_app" != "$TASK_APP" ]] && return 0
fi
do

from sketchybar.

Related Issues (20)

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.