diff options
-rw-r--r-- | init.org | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -153,6 +153,10 @@ ,(car args) "* jao-exec - console *" (string-join (append (list ,@args) other-args) " ")))) + + (defun jao-exec-running-p (pr) + (not (string-blank-p (shell-command-to-string (concat "pidof " pr))))) + #+end_src *** App launcher #+begin_src emacs-lisp @@ -162,9 +166,6 @@ #+end_src *** Brightness control #+begin_src emacs-lisp - (when (eq 'pgtk window-system) - (defalias 'x-change-window-property #'ignore)) - (jao-def-exec jao-bright-set-up "brightnessctl" "-q" "s" "5%+") (jao-def-exec jao-bright-set-down "brightnessctl" "-q" "s" "5%-") @@ -523,11 +524,22 @@ (make-symbolic-link f "~/.wallpaper.sway" t)) (defun jao-sway-run-or-focus (cmd &optional ws) - (if (not (string-blank-p (shell-command-to-string (format "pidof %s" cmd)))) + (if (jao-exec-running-p "firefox") (jao-swaymsg (format "[app_id=%s] focus" cmd)) (jao-swaymsg (format "workspace %s" (or ws 2))) (start-process-shell-command cmd nil cmd))) + (defun jao-sway-run-or-focus-deezer () + (interactive) + (if (jao-exec-running-p "deezer-desktop") + (jao-swaymsg "[app_id=Deezer] scratchpad show") + (start-process-shell-command "deezer" nil "deezer &") + (jao-sway-run-or-focus-deezer))) + + (defun jao-sway-run-or-focus-firefox () + (interactive) + (jao-sway-run-or-focus "firefox")) + (defun jao-sway-enable () (setq jao-browse-doc-use-emacs-p t) (setq jao-minibuffer-right-margin "") @@ -536,9 +548,12 @@ (jao-set-transparency 85) (jao-themes-setup) (display-time-mode 1) + (global-set-key (kbd "s-f") #'jao-sway-run-or-focus-firefox) (message "Welcome to sway")) - (when jao-sway-enabled (add-hook 'after-init-hook #'jao-sway-enable)) + (when jao-sway-enabled + (defalias 'x-change-window-property #'ignore) + (add-hook 'after-init-hook #'jao-sway-enable)) #+end_src *** wallpaper |