Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference in display from Codeberg Readme #12

Open
bmp opened this issue Apr 29, 2023 · 2 comments
Open

Difference in display from Codeberg Readme #12

bmp opened this issue Apr 29, 2023 · 2 comments

Comments

@bmp
Copy link

bmp commented Apr 29, 2023

Hello, The image on Mastodon (https://toot.aquilenet.fr/@rougier/109496567472689559) suggests a panel on the left-hand side. Is this a new release on Codeberg or just a personal config?

Mastodon-alt_pane

If this is just configuration, would you mind sharing the snippet?

@rougier
Copy link
Owner

rougier commented May 10, 2023

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))))

@bmp
Copy link
Author

bmp commented May 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants