From 1792013f37cda7930e41e106d405de62321771b3 Mon Sep 17 00:00:00 2001 From: Severin Kaderli Date: Tue, 12 Mar 2019 21:26:24 +0100 Subject: [PATCH] Add screenshot menu and update prompt Signed-off-by: Severin Kaderli --- install | 10 +- system/.config/custom/env | 47 +++++++++- system/.config/dconf/root.conf | 6 ++ system/.config/gtk-2.0/gtkfilechooser.ini | 4 +- system/.config/i3/config | 14 ++- system/.config/i3/workspace-2.json | 106 ++++++++++++++++++++++ system/.local/bin/games | 2 +- system/.local/bin/screenshot | 34 +++++++ 8 files changed, 214 insertions(+), 9 deletions(-) create mode 100644 system/.config/i3/workspace-2.json create mode 100755 system/.local/bin/screenshot diff --git a/install b/install index cba2af4..d4dda08 100755 --- a/install +++ b/install @@ -164,4 +164,12 @@ print_header "Copy sudoers content" for file in ${SYSTEM_DIR}/etc/sudoers.d/* do copy_sudoers_content "${file}" -done \ No newline at end of file +done + +print_header "Create issue file" +echo "\e{red}" >> "/tmp/issue" +cat "/etc/hostname" | tr '[:lower:]' '[:upper:]' | figlet -f big | sd '\\' '\\\\' >> "/tmp/issue" + +echo "\r" >> "/tmp/issue" +echo "\e{reset}" >> "/tmp/issue" +sudo mv /tmp/issue /etc/issue \ No newline at end of file diff --git a/system/.config/custom/env b/system/.config/custom/env index 7cd6782..2b61ac9 100644 --- a/system/.config/custom/env +++ b/system/.config/custom/env @@ -58,7 +58,7 @@ export VISUAL=vim export EDITOR="${VISUAL}" export TERMINAL=termite export BROWSER="google-chrome-beta" -export PAGER="most" +export PAGER="less" export MANPAGER="${PAGER}" # QT @@ -87,13 +87,52 @@ function current_branch() { else echo "[${branch}]" fi - } + +function file_count() { + count="$(ls -a -1 | wc -l)" + echo "[${count} files]" +} + +function folder_size() { + size="$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')" + echo "[${size}B]" +} + +function prompt_width() { + hostname="$(hostname)" + branch="$(current_branch)" + pwd="$(print -P %~)" + file_count="$(file_count)" + folder_size="$(folder_size)" + echo "$((${COLUMNS} - 19 - ${#hostname} - ${#branch} - ${#pwd} - ${#file_count} - ${#folder_size}))" +} + +function precmd() { + # Print a newline before the prompt, unless it's the + # first prompt in the process. + if [ -z "$NEW_LINE_BEFORE_PROMPT" ]; then + NEW_LINE_BEFORE_PROMPT=1 + elif [ "$NEW_LINE_BEFORE_PROMPT" -eq 1 ]; then + echo "" + fi +} + # Custom prompt NEWLINE=$'\n' export PS1="┌─" export PS1="${PS1}%F{red}[%*]%f" export PS1="${PS1}%F{blue}[%m]%f" export PS1="${PS1}%F{yellow}[%~]%f" -export PS1="${PS1}%F{blue}"'$(current_branch)'"%f" -export PS1="${PS1}${NEWLINE}└─╼ " \ No newline at end of file +export PS1="${PS1}"'${(r:$(prompt_width)::─:)}' +export PS1="${PS1}%F{yellow}"'$(file_count)'"%f" +export PS1="${PS1}%F{blue}"'$(folder_size)'"%f" +export PS1="${PS1}%F{red}"'$(current_branch)'"%f" +export PS1="${PS1}─┐" +export PS1="${PS1}${NEWLINE}└─╼ " + + +export RPROMPT="╾─┘" + + +#PS1="\n\[\e[30;1m\]\[\016\]l\[\017\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n\[\016\]m\[\017\]-(\[\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]" \ No newline at end of file diff --git a/system/.config/dconf/root.conf b/system/.config/dconf/root.conf index 5756811..8b2080a 100644 --- a/system/.config/dconf/root.conf +++ b/system/.config/dconf/root.conf @@ -13,6 +13,12 @@ show-places-in-to-menus=true [org/nemo/list-view] default-zoom-level='smaller' +[org/nemo/desktop] +show-desktop-icons=false + +[org/cinnamon/desktop/default-applications/terminal] +exec='termite' + [desktop/ibus/general] engines-order=['xkb:ch::ger', 'anthy'] preload-engines=['xkb:ch::ger', 'anthy'] diff --git a/system/.config/gtk-2.0/gtkfilechooser.ini b/system/.config/gtk-2.0/gtkfilechooser.ini index 251c46c..069ebc3 100644 --- a/system/.config/gtk-2.0/gtkfilechooser.ini +++ b/system/.config/gtk-2.0/gtkfilechooser.ini @@ -2,8 +2,8 @@ LocationMode=path-bar ShowHidden=true ShowSizeColumn=true -GeometryX=0 -GeometryY=0 +GeometryX=540 +GeometryY=225 GeometryWidth=840 GeometryHeight=630 SortColumn=name diff --git a/system/.config/i3/config b/system/.config/i3/config index 6a6eed3..ed448e3 100644 --- a/system/.config/i3/config +++ b/system/.config/i3/config @@ -98,6 +98,9 @@ bindsym $mod+G exec games # Open power menu bindsym $mod+F4 exec power +# Open screenshot menu +bindsym Print exec screenshot + # Change focus bindsym $mod+Left focus left bindsym $mod+H focus left @@ -221,7 +224,13 @@ bindsym XF86AudioPrev exec --no-startup-id cmus-remote -r bindsym $mod+Control+Left exec --no-startup-id cmus-remote -r -exec --no-startup-id "i3-msg 'workspace 10: ; append_layout /home/severin/.config/i3/workspace-10.json'" +exec --no-startup-id "i3-msg 'workspace 10: ; append_layout +/home/severin/.config/i3/workspace-10.json'" + +exec --no-startup-id "i3-msg 'workspace 2: ; append_layout +/home/severin/.config/i3/workspace-2.json'" + +exec --no-startup-id "i3-msg 'workspace 1: " ############################################################################### # Startup applications # @@ -245,6 +254,9 @@ exec_always --no-startup-id wallpaper exec autokey-gtk exec google-chrome-beta exec termite +exec termite +exec termite +exec termite exec discord exec nemo exec nemo diff --git a/system/.config/i3/workspace-2.json b/system/.config/i3/workspace-2.json new file mode 100644 index 0000000..d85ae73 --- /dev/null +++ b/system/.config/i3/workspace-2.json @@ -0,0 +1,106 @@ +[ +{ + "border": "none", + "floating": "auto_off", + "fullscreen_mode": 0, + "layout": "splith", + "percent": null, + "type": "con", + "nodes": [ + { + "border": "none", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 0, + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 736, + "x": 0, + "y": 0 + }, + "name": null, + "percent": 0.5, + "swallows": [ + { + "instance": "^termite$" + } + ], + "type": "con" + }, + { + "border": "pixel", + "current_border_width": 0, + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 736, + "x": 0, + "y": 0 + }, + "name": null, + "percent": 0.5, + "swallows": [ + { + "instance": "^termite$" + } + ], + "type": "con" + } + ] + }, + { + "border": "none", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 0, + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 736, + "x": 0, + "y": 0 + }, + "name": null, + "percent": 0.5, + "swallows": [ + { + "instance": "^termite$" + } + ], + "type": "con" + }, + { + "border": "pixel", + "current_border_width": 0, + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 736, + "x": 0, + "y": 0 + }, + "name": null, + "percent": 0.5, + "swallows": [ + { + "instance": "^termite$" + } + ], + "type": "con" + } + ] + } + ] +} +] diff --git a/system/.local/bin/games b/system/.local/bin/games index de5dd23..d5bdadf 100755 --- a/system/.local/bin/games +++ b/system/.local/bin/games @@ -32,7 +32,7 @@ case "${SELECTION}" in gw2 ;; "3") - optirun -b primus minecraft-launcher + optirun -b primus java minecraft-launcher ;; "4") optirun -b primus pegasus-fe diff --git a/system/.local/bin/screenshot b/system/.local/bin/screenshot new file mode 100755 index 0000000..3af4f2a --- /dev/null +++ b/system/.local/bin/screenshot @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# SCRIPT NAME: +# screenshot +# +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# Displays a screenshot menu using rofi. +# +# USAGE: +# ./screenshot + +# The rofi prompt +PROMPT="Screenshot" + +# Actions for the menu +ACTIONS=( + "1: Fullscreen" + "2: Selection" +) + +FILENAME="${HOME}/Pictures/Screenshots/%Y-%m-%d-%H%I%S.png" + +SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -p "${PROMPT}" | cut -d ":" -f1) +case "${SELECTION}" in + "1") + escrotum "${FILENAME}" + ;; + "2") + escrotum -s "${FILENAME}" + ;; +esac