greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gitlab block

aogier opened this issue ยท comments

Hi, being in love with the tool, rust language and having to use gitlab for my work, I'd like to implement a gitlab block as per #715!
The four potential endpoints visited by py3status' block depending on configuration looks like a good start to me:

  • single_project
    • {name} project name, eg py3status
    • {star_count} number of stars, eg 2
    • {forks_count} number of forks, eg 3
    • {open_issues_count} number of open issues, eg 4
    • {statistics_commit_count} number of commits, eg 5678
  • merge_requests
    • {open_merge_requests_count} number of open merge requests, eg 9
  • todos
    • {todos_count} number of todos, eg 4
  • pipelines
    • {pipelines_status} project status of pipelines, eg success

also I'd go with a total placeholder which sums:

if single_project {
  issues + project's MR + pipelines
} else {
  all MR, issues user has access to
}
+ todos

In respect to what exactly is counted for each value, I would go a little further than py3status, exposing API parameters for each one:

pipelines
status The status of pipelines, one of: created, waiting_for_resource, preparing, pending, running, success, failed, canceled, skipped, manual, scheduled
todos
state The state of the to-do item. Can be either pending or done
merge requests
state Returns all merge requests or just those that are opened, closed, locked, or merged.
scope Returns merge requests for the given scope: created_by_me, assigned_to_me or all. Defaults to created_by_me.

of course there is plenty of other parameters but I think this subset would provide the most value without too much config bloat.

What do you think? Thank you, regards

Sounds good!

that's great to hear, I'll begin asap as I'm eager to learn more!

Hi, I'm trying to add gitlab icon so I can use it in the block, but so far I'm not having much luck.

What I did so far is adding a line to those files:

  • files/icons/awesome4.toml
  • files/icons/awesome5.toml
  • files/icons/awesome6.toml
  • files/icons/emoji.toml
  • files/icons/material-nf.toml
  • files/icons/material.toml
  • src/icons.rs
basically duplicating the existing github line
diff --git a/files/icons/awesome4.toml b/files/icons/awesome4.toml
index a102a0fd..3941017e 100644
--- a/files/icons/awesome4.toml
+++ b/files/icons/awesome4.toml
@@ -26,6 +26,7 @@ cpu_boost_on = "\uf205" # fa-toggle-on
 disk_drive = "\uf0a0" # fa-hdd-o
 docker = "\uf21a" # fa-ship
 github = "\uf09b" # fa-github
+gitlab = "\uf09b" # fa-github
 gpu = "\uf26c" # fa-television
 headphones = "\uf025" # fa-headphones
 joystick = "\uf11b" # fa-gamepad
diff --git a/files/icons/awesome5.toml b/files/icons/awesome5.toml
index 551104c4..ab6c87f0 100644
--- a/files/icons/awesome5.toml
+++ b/files/icons/awesome5.toml
@@ -26,6 +26,7 @@ cpu_boost_off = "\uf204"
 disk_drive = "\uf0a0"
 docker = "\uf21a"
 github = "\uf09b"
+gitlab = "\uf09b"
 gpu = "\uf26c"
 headphones = "\uf025"
 joystick = "\uf11b"
diff --git a/files/icons/awesome6.toml b/files/icons/awesome6.toml
index 92940627..c6743cae 100644
--- a/files/icons/awesome6.toml
+++ b/files/icons/awesome6.toml
@@ -30,6 +30,7 @@ cpu_boost_off = "\uf204"
 disk_drive = "\uf0a0"
 docker = "\uf21a"
 github = "\uf09b"
+gitlab = "\uf09b"
 gpu = "\uf26c"
 headphones = "\uf025"
 joystick = "\uf11b"
diff --git a/files/icons/emoji.toml b/files/icons/emoji.toml
index 288e411d..f2564f12 100644
--- a/files/icons/emoji.toml
+++ b/files/icons/emoji.toml
@@ -22,6 +22,7 @@ cpu_boost_on = "๐Ÿ‡"
 disk_drive = "๐Ÿ’ฝ"
 docker = "๐Ÿšข"
 github = "๐Ÿ™๐Ÿฑ"
+gitlab = "๐Ÿ™๐Ÿฑ"
 gpu = "๐Ÿ–ฅ๏ธ"
 headphones = "๐ŸŽง"
 joystick = "๐ŸŽฎ"
diff --git a/files/icons/material-nf.toml b/files/icons/material-nf.toml
index 2626560f..5fe17ed3 100644
--- a/files/icons/material-nf.toml
+++ b/files/icons/material-nf.toml
@@ -46,6 +46,7 @@ cpu_boost_off = "\U000f0a19" # nf-md-toggle_switch_off_outline
 disk_drive = "\U000f02ca" # nf-md-harddisk
 docker = "\uf308" # nf-linux-docker
 github = "\U000f02a4" # nf-md-github
+gitlab = "\U000f02a4" # nf-md-github
 gpu = "\U000f0379" # nf-md-monitor
 headphones = "\U000f02cb" # nf-md-headphones
 joystick = "\U000f0297" # nf-md-gamepad_variant
diff --git a/files/icons/material.toml b/files/icons/material.toml
index 4e70556f..4949a924 100644
--- a/files/icons/material.toml
+++ b/files/icons/material.toml
@@ -36,6 +36,7 @@ cpu_boost_off = "\ue836" # radio_button_off
 disk_drive = "\ue1db" # storage
 docker = "\ue532" # directions_boat
 github = "\ue86f" # code
+gitlab = "\ue86f" # code
 gpu = "\ue333" # tv
 headphones = "\ue60f" # bluetooth_audio
 joystick = "\ue30f" # gamepad
diff --git a/src/icons.rs b/src/icons.rs
index 767a4da3..8bb9c72c 100644
--- a/src/icons.rs
+++ b/src/icons.rs
@@ -45,6 +45,7 @@ impl Default for Icons {
             "disk_drive" => "DISK",
             "docker" => "DOCKER",
             "github" => "GITHUB",
+            "gitlab" => "GITLAB",
             "gpu" => "GPU",
             "headphones" => "HEAD",
             "joystick" => "JOY",

but no way to use Value::icon("gitlab"). Icon name exists in fonts. I'm not sure if my specific font include it tho, could you please help me @MaxVerevkin pointing the right process to add a new icon?

Did you ./install.sh your modifications?

ah! Silly me, I did not :( ok now it works as expected, sorry for the noise and thank you! :)