From fa2f838b63394aacdb5850e70757d0d317374906 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 24 Oct 2024 21:39:04 +0200 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=93=83=20fix(monitor=20setup):=20a=20?= =?UTF-8?q?bug=20with=20utility-functions;=20newlines=20&=20colors=20in=20?= =?UTF-8?q?the=20scripts=20(#713)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixed newlines & changed colors to keep synergy * fixed a bug --- core/tabs/utils/monitor-control/change_orientation.sh | 2 +- core/tabs/utils/monitor-control/disable_monitor.sh | 2 +- core/tabs/utils/monitor-control/enable_monitor.sh | 2 +- core/tabs/utils/monitor-control/extend_displays.sh | 2 +- core/tabs/utils/monitor-control/manage_arrangement.sh | 4 ++-- core/tabs/utils/monitor-control/set_primary_monitor.sh | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/tabs/utils/monitor-control/change_orientation.sh b/core/tabs/utils/monitor-control/change_orientation.sh index d636667d..00ac1b95 100755 --- a/core/tabs/utils/monitor-control/change_orientation.sh +++ b/core/tabs/utils/monitor-control/change_orientation.sh @@ -13,7 +13,7 @@ change_orientation() { printf "%b\n" "${YELLOW}=========================================${RC}" printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}" printf "%b\n" "${YELLOW}=========================================${RC}" - printf "%b" "${YELLOW}Choose a monitor to configure: ${RC}" + printf "%b\n" "${YELLOW}Choose a monitor to configure: ${RC}" i=1 for monitor in $monitor_array; do printf "%b\n" "$i. ${GREEN}$monitor${RC}" diff --git a/core/tabs/utils/monitor-control/disable_monitor.sh b/core/tabs/utils/monitor-control/disable_monitor.sh index d2e1385e..649d71a2 100755 --- a/core/tabs/utils/monitor-control/disable_monitor.sh +++ b/core/tabs/utils/monitor-control/disable_monitor.sh @@ -13,7 +13,7 @@ disable_monitor() { printf "%b\n" "${YELLOW}=========================================${RC}" printf "%b\n" "${YELLOW} Disable Monitor${RC}" printf "%b\n" "${YELLOW}=========================================${RC}" - printf "%b" "Choose a monitor to disable: " + printf "%b\n" "Choose a monitor to disable: " i=1 for monitor in $monitor_array; do printf "%b\n" "$i. ${GREEN}$monitor${RC}" diff --git a/core/tabs/utils/monitor-control/enable_monitor.sh b/core/tabs/utils/monitor-control/enable_monitor.sh index b65af405..ec4db8d6 100755 --- a/core/tabs/utils/monitor-control/enable_monitor.sh +++ b/core/tabs/utils/monitor-control/enable_monitor.sh @@ -13,7 +13,7 @@ enable_monitor() { printf "%b\n" "${YELLOW}=========================================${RC}" printf "%b\n" "${YELLOW} Enable Monitor${RC}" printf "%b\n" "${YELLOW}=========================================${RC}" - printf "%b" "${YELLOW}Choose a monitor to enable: ${RC}" + printf "%b\n" "${YELLOW}Choose a monitor to enable: ${RC}" i=1 for monitor in $monitor_array; do diff --git a/core/tabs/utils/monitor-control/extend_displays.sh b/core/tabs/utils/monitor-control/extend_displays.sh index dca8a1b2..ebe729f3 100755 --- a/core/tabs/utils/monitor-control/extend_displays.sh +++ b/core/tabs/utils/monitor-control/extend_displays.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -. ./utility_functions.sh +. ../utility_functions.sh . ../../common-script.sh diff --git a/core/tabs/utils/monitor-control/manage_arrangement.sh b/core/tabs/utils/monitor-control/manage_arrangement.sh index 35642539..5d73b1ff 100755 --- a/core/tabs/utils/monitor-control/manage_arrangement.sh +++ b/core/tabs/utils/monitor-control/manage_arrangement.sh @@ -13,10 +13,10 @@ manage_arrangement() { printf "%b\n" "${YELLOW}=========================================${RC}" printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}" printf "%b\n" "${YELLOW}=========================================${RC}" - printf "%b" "${YELLOW}Choose the monitor to arrange: ${RC}" + printf "%b\n" "${YELLOW}Choose the monitor to arrange: ${RC}" i=1 for monitor in $monitor_array; do - printf "%b\n" "$i. ${YELLOW}$monitor${RC}" + printf "%b\n" "$i. ${GREEN}$monitor${RC}" i=$((i + 1)) done diff --git a/core/tabs/utils/monitor-control/set_primary_monitor.sh b/core/tabs/utils/monitor-control/set_primary_monitor.sh index 1eea6ed9..d38e6b0f 100755 --- a/core/tabs/utils/monitor-control/set_primary_monitor.sh +++ b/core/tabs/utils/monitor-control/set_primary_monitor.sh @@ -16,7 +16,7 @@ set_primary_monitor() { printf "%b\n" "${YELLOW}Choose a monitor to set as primary:${RC}" i=1 for monitor in $monitor_array; do - printf "%b\n" "$i. ${YELLOW}$monitor${RC}" + printf "%b\n" "$i. ${GREEN}$monitor${RC}" i=$((i + 1)) done From 4f7de594a6b7eea85bf7eb6c6f6ca6918d27f6de Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 24 Oct 2024 21:43:16 +0200 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=94=8D=EF=B8=8F=20exiting=20search=20?= =?UTF-8?q?with=20`Ctrl-C`=20+=20better=20shortcut=20tips=20(#768)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tui/src/filter.rs | 18 ++++++++++++------ tui/src/state.rs | 5 ++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tui/src/filter.rs b/tui/src/filter.rs index e6ff2cc2..984d5d68 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -1,5 +1,5 @@ use crate::{state::ListEntry, theme::Theme}; -use crossterm::event::{KeyCode, KeyEvent}; +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use ego_tree::NodeId; use linutil_core::Tab; use ratatui::{ @@ -116,21 +116,27 @@ impl Filter { pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction { //Insert user input into the search bar match event.code { + KeyCode::Char('c') if event.modifiers.contains(KeyModifiers::CONTROL) => { + return self.exit_search() + } KeyCode::Char(c) => self.insert_char(c), KeyCode::Backspace => self.remove_previous(), KeyCode::Delete => self.remove_next(), KeyCode::Left => return self.cursor_left(), KeyCode::Right => return self.cursor_right(), - KeyCode::Esc => { - self.input_position = 0; - self.search_input.clear(); - return SearchAction::Exit; - } KeyCode::Enter => return SearchAction::Exit, + KeyCode::Esc => return self.exit_search(), _ => return SearchAction::None, }; SearchAction::Update } + + fn exit_search(&mut self) -> SearchAction { + self.input_position = 0; + self.search_input.clear(); + SearchAction::Exit + } + fn cursor_left(&mut self) -> SearchAction { self.input_position = self.input_position.saturating_sub(1); SearchAction::None diff --git a/tui/src/state.rs b/tui/src/state.rs index 9ed61771..4e398ee7 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -119,7 +119,10 @@ impl AppState { match self.focus { Focus::Search => ( "Search bar", - Box::new([Shortcut::new("Finish search", ["Enter"])]), + Box::new([ + Shortcut::new("Abort search", ["Esc", "CTRL-c"]), + Shortcut::new("Search", ["Enter"]), + ]), ), Focus::List => { From c0982a787facca7d8dd801fb125781dce7d8edb2 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 24 Oct 2024 21:45:37 +0200 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=96=20add=20auto=20docs=20generati?= =?UTF-8?q?on=20instructions=20to=20the=20Contributing=20Guidelines=20(#78?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📖 add auto docs generation instructions to the Contributing Guidelines * Commit Contributing Guidelines --------- Co-authored-by: adamperkowski --- .github/CONTRIBUTING.md | 2 ++ docs/contributing.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5a2c71b1..f0b02574 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -16,6 +16,7 @@ cd linutil ``` ## 3. Make your changes + - **Edit the files you want to change**: Make your changes to the relevant files. - **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected. @@ -60,6 +61,7 @@ cd linutil ## 11. Documentation - **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this. +- **Automatic generation**: If you decide to add functionality through a new shell script, make sure to fill out all fields in `tab_data.toml` and run `cargo xtask docgen`. ## 12. License diff --git a/docs/contributing.md b/docs/contributing.md index 4e20b7b7..2eba69f9 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -16,6 +16,7 @@ cd linutil ``` ## 3. Make your changes + - **Edit the files you want to change**: Make your changes to the relevant files. - **Test your changes**: Run `cargo run` to test your modifications in a local environment and ensure everything works as expected. @@ -60,6 +61,7 @@ cd linutil ## 11. Documentation - **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this. +- **Automatic generation**: If you decide to add functionality through a new shell script, make sure to fill out all fields in `tab_data.toml` and run `cargo xtask docgen`. ## 12. License From d39ffad5278a87ce77b63a1b8a099f7115fa78ad Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 24 Oct 2024 21:50:27 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=93=96=20fix(docs):=20newlines=20(#79?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/github-pages.yml | 2 +- docs/contributing.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index b76b092d..30e992d4 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -22,7 +22,7 @@ jobs: - name: Copy Contributing Guidelines run: | - echo "\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md' + echo -e "\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md' - uses: stefanzweifel/git-auto-commit-action@v5 with: diff --git a/docs/contributing.md b/docs/contributing.md index 2eba69f9..4b391959 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,4 +1,6 @@ -\n\n# Contributing Guidelines for Linutil + + +# Contributing Guidelines for Linutil Thank you for considering contributing to Linutil! We appreciate your effort in helping improve this project. To ensure that your contributions align with the goals and quality standards of Linutil, please follow these guidelines: From 51631a16cb187d09e9ce2c04091e6602bbb3da81 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 24 Oct 2024 21:55:56 +0200 Subject: [PATCH 5/7] feat: desktop entry & manpage installation through `linutil-installer.sh` (#802) --- core/tabs/applications-setup/linutil-installer.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/tabs/applications-setup/linutil-installer.sh b/core/tabs/applications-setup/linutil-installer.sh index 4bb241db..fd925e0b 100755 --- a/core/tabs/applications-setup/linutil-installer.sh +++ b/core/tabs/applications-setup/linutil-installer.sh @@ -35,10 +35,10 @@ installLinutil() { printf "%b\n" "${YELLOW}Installing rustup...${RC}" case "$PACKAGER" in pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm curl rustup man-db ;; dnf) - "$ESCALATION_TOOL" "$PACKAGER" install -y rustup + "$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man ;; zypper) "$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make @@ -54,12 +54,23 @@ installLinutil() { rustup default stable cargo install --force linutil_tui printf "%b\n" "${GREEN}Installed successfully.${RC}" + installExtra ;; *) printf "%b\n" "${RED}Linutil not installed.${RC}" ;; esac esac } +installExtra() { + printf "%b\n" "${YELLOW}Installing the manpage...${RC}" + "$ESCALATION_TOOL" mkdir -p /usr/share/man/man1 + curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/man/linutil.1' | "$ESCALATION_TOOL" tee '/usr/share/man/man1/linutil.1' > /dev/null + printf "%b\n" "${YELLOW}Creating a Desktop Entry...${RC}" + "$ESCALATION_TOOL" mkdir -p /usr/share/applications + curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/linutil.desktop' | "$ESCALATION_TOOL" tee /usr/share/applications/linutil.desktop > /dev/null + printf "%b\n" "${GREEN}Done.${RC}" +} + checkEnv checkEscalationTool checkAURHelper From e3688e9b3d2f3594bf2367af87a800db9e2f1bbd Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Thu, 24 Oct 2024 21:59:23 +0200 Subject: [PATCH 6/7] fix+refact(system-cleanup) (#856) * fix(system-cleanup): some issues * new packager quotes --- core/tabs/system-setup/system-cleanup.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) mode change 100644 => 100755 core/tabs/system-setup/system-cleanup.sh diff --git a/core/tabs/system-setup/system-cleanup.sh b/core/tabs/system-setup/system-cleanup.sh old mode 100644 new mode 100755 index 0a625913..2641a14f --- a/core/tabs/system-setup/system-cleanup.sh +++ b/core/tabs/system-setup/system-cleanup.sh @@ -26,16 +26,21 @@ cleanup_system() { "$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1 ;; *) - printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - return 1 + printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}" ;; esac } common_cleanup() { - "$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete - "$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete - "$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; + if [ -d /var/tmp ]; then + "$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete + fi + if [ -d /tmp ]; then + "$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete + fi + if [ -d /var/log ]; then + "$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; + fi "$ESCALATION_TOOL" journalctl --vacuum-time=3d } @@ -45,8 +50,12 @@ clean_data() { case $clean_response in y|Y) printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}" - find "$HOME/.cache/" -type f -atime +5 -delete - find "$HOME/.local/share/Trash" -mindepth 1 -delete + if [ -d "$HOME/.cache" ]; then + find "$HOME/.cache/" -type f -atime +5 -delete + fi + if [ -d "$HOME/.local/share/Trash" ]; then + find "$HOME/.local/share/Trash" -mindepth 1 -delete + fi printf "%b\n" "${GREEN}Cache and trash cleanup completed.${RC}" ;; *) From 696110eae5acfec13a089261befb5d8137e66644 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Fri, 25 Oct 2024 22:44:41 +0200 Subject: [PATCH 7/7] refact(release): better categories (#876) --- .github/release.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 51218dc9..ada1b3e6 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,20 +1,23 @@ changelog: categories: - title: '🚀 Features' - labels: - - 'feature' - - 'enhancement' + label: 'enhancement' - title: '🐛 Bug Fixes' - labels: - - 'fix' - - 'bugfix' - - 'bug' + label: 'bug' + - title: '⚙️ Refactoring' + label: 'refactor' + - title: '🧩 UI/UX' + label: 'UI/UX' - title: '📚 Documentation' label: 'documentation' - title: '🔒 Security' label: 'security' - title: '🧰 GitHub Actions' - label: 'github actions' + label: 'github_actions' + - title: '🦀 Rust' + label: 'rust' + - title: '📃 Scripting' + label: 'script' exclude: labels: - 'skip-changelog' \ No newline at end of file