Last active
November 9, 2018 10:14
-
-
Save cobodo/177a59544b5ed9b3d480b4c374014fea to your computer and use it in GitHub Desktop.
スクロール位置が一定値より下なら、古いメッセージを消さないようにするmikutterプラグイン。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:timeline_dam) do | |
UserConfig[:timeline_dam_criteria] ||= 80 | |
unless Gtk::TimeLine.method_defined?(:timeline_dam_original_add) | |
class Gtk::TimeLine | |
alias :timeline_dam_original_add :_add | |
def _add(message) | |
@timeline_max ||= UserConfig[:timeline_max] | |
criteria = UserConfig[:timeline_dam_criteria] / 100.0 | |
if @tl.vadjustment.value < criteria | |
@timeline_max = [@timeline_max * criteria, UserConfig[:timeline_max]].max | |
elsif size >= @timeline_max | |
@timeline_max += 1 | |
end | |
timeline_dam_original_add(message) | |
end | |
end | |
end | |
settings "TLダム" do | |
adjustment "スクロール位置の割合が右のパーセンテージ以上ならメッセージの削除をやめる", :timeline_dam_criteria, 0, 100 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment