Coder Social home page Coder Social logo

Comments (2)

rougier avatar rougier commented on May 30, 2024 1

It has been inspired by mu4e-dashboard but requires only the sideframe package. You can then write a regular org-file using mastodon link to adapt the dashboard to your liking:

;; Setup a new org link type "mastodon"
;;
;; Usage is:
;;
;; - mastodon:home          : Load Home timelime
;; - mastodon:local         : Load Local timelime
;; - mastodon:federated     : Load Federated timelime
;; - mastodon:profile       : Load Profile
;; - mastodon:suggestions   : Load Suggestions
;; - mastodon:search        : Search for...

;; - mastodon:notifications : Show Notifications
;; - mastodon:favourites    : Show Favourited
;; - mastodon:bookmarks     : Show Bookmarked
;; - mastodon:filters       : Show Filters

;; - mastodon:toot-reply     : Reply to toot
;; - mastodon:toot-thread    : Show toot thread
;; - mastodon:toot-boost     : Boost toot
;; - mastodon:toot-bookmark  : Add toot to bookmark
;; - mastodon:toot-favourite : Add toot to favourite
;; - mastodon:toot-pin       : Pin toot
;; - mastodon:toot-vote      : Vote
;; - mastodon:toot-spoiler   : Toggle spoiler
;; - mastodon:toot-delete    : Delete toot
;;
;; - mastodon:user-profile   : Show user profile
;; - mastodon:user-follow    : Follow user
;; - mastodon:user-mute      : Mute user
;; - mastodon:user-block     : Block user

;; - mastodon:#xxx           : Show tag "xxx" timeline

(require 'org)
(require 'sideframe)


(org-link-set-parameters
 "mastodon"
 :follow 'org-mastodon-process)

(defun org-mastodon-process (what)
  "Process the WHAT argument. If there is a visible mastodon
window, this window will be used to process the command."

  (interactive)
  (let* ((buffers (cl-remove-if-not
                   #'(lambda (buffer)
                       (with-current-buffer buffer
                         (and (get-buffer-window buffer t)
                              (derived-mode-p 'mastodon-mode))))
                   (buffer-list)))
         (buffer (car buffers))
         (window (get-buffer-window buffer t))
         (frame (window-frame window)))

    ;; Because loading is asynchronous, we immediately select the
    ;; frame/window we want to use such as to make sure the page is
    ;; loaded where we want.
    (select-frame frame)
    (select-window window)
    
    (cond ((string= what "home")           (mastodon-tl--get-home-timeline))
          ((string= what "profile")        (mastodon-profile--my-profile))
          ((string= what "local")          (mastodon-tl--get-local-timeline))
          ((string= what "federated")      (mastodon-tl--get-federated-timeline))
          ((string= what "search")         (mastodon-search--search-query))
          
          ((string= what "filters")        (mastodon-tl--view-filters))
          ((string= what "bookmarks")      (mastodon-profile--view-bookmarks))
          ((string= what "favourites")     (mastodon-profile--view-favourites))
          ((string= what "notifications")  (mastodon-notifications-get))
          ((string= what "suggestions")    (mastodon-tl--get-follow-suggestions))

          ((string= what "toot-compose")   (mastodon-toot))
          ((string= what "toot-reply")     (mastodon-toot--reply))
          ((string= what "toot-boost")     (mastodon-toot--toggle-boost))
          ((string= what "toot-favourite") (mastodon-toot--toggle-favourite))
          ((string= what "toot-bookmark")  (mastodon-toot--bookmark-toot-toggle))

          ((string= what "toot-thread")    (mastodon-tl--thread))
          ((string= what "toot-spoiler")   (mastodon-tl--toggle-spoiler-text))
          ((string= what "toot-vote")      (mastodon-tl--poll-vote))
          ((string= what "toot-pin")       (mastodon-toot--pin-toot-toggle))
          ((string= what "toot-delete")    (mastodon-toot--delete-toot))

          ((string= what "user-profile")   (mastodon-profile--show-user))
          ((string= what "user-follow")    (mastodon-tl--follow-user))
          ((string= what "user-block")     (mastodon-tl--block-user))
          ((string= what "user-mute")      (mastodon-tl--mute-user))
          
          ((string= "#" (substring what 0 1))
           (mastodon-tl--show-tag-timeline (substring what 1))))))
 
(defun mastodon-side-dashboard ()
  "Open a mastodon dashboard on in a side frame."

  (interactive)
  (let ((frame (sideframe-make 'left 32 'dark `((foreground-color . ,nano-dark-foreground)
                                                (background-color . ,nano-dark-background)))))
    (with-selected-frame frame
      (find-file (expand-file-name "mastodon.org" user-emacs-directory))
      (hl-line-mode)
      (read-only-mode)
      (set-window-dedicated-p nil t))))

from mastodon-alt.

bmp avatar bmp commented on May 30, 2024

Thank you! Will give this a try and report back.

from mastodon-alt.

Related Issues (9)

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.