From 18131d6f2ac183652157fb597b9f3ec6817a9fab Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Sun, 20 Aug 2023 17:34:53 +0200 Subject: [PATCH] Updates --- 2-install-hyprland.sh | 4 +- hypr/gtk.sh | 15 +++++++ hypr/hyprland.conf | 10 ++++- scripts/grim.sh | 38 ++++++++++++++++ scripts/looking-glass.sh | 7 +++ scripts/powermenu-hypr.sh | 2 +- wal/templates/colors-hyprland.conf | 3 ++ waybar/colors-waybar.css | 38 ++++++++-------- waybar/config | 69 +++++++++++++++++++++--------- waybar/style.css | 10 ++++- 10 files changed, 150 insertions(+), 46 deletions(-) create mode 100755 hypr/gtk.sh create mode 100755 scripts/grim.sh create mode 100644 wal/templates/colors-hyprland.conf diff --git a/2-install-hyprland.sh b/2-install-hyprland.sh index 7da3f90..943a360 100755 --- a/2-install-hyprland.sh +++ b/2-install-hyprland.sh @@ -46,9 +46,9 @@ echo "" # ------------------------------------------------------ echo "" echo "-> Install main packages" -packagesPacman=("waybar"); +packagesPacman=("waybar" "grim" "slurp"); -packagesYay=("hyprland-git" "swww"); +packagesYay=("hyprland-git" "swww" "swaylock"); # ------------------------------------------------------ # Install required packages diff --git a/hypr/gtk.sh b/hypr/gtk.sh new file mode 100755 index 0000000..967620f --- /dev/null +++ b/hypr/gtk.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# usage: import-gsettings +config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" +if [ ! -f "$config" ]; then exit 1; fi + +gnome_schema="org.gnome.desktop.interface" +gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')" +icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')" +cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" +font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" +gsettings set "$gnome_schema" gtk-theme "$gtk_theme" +gsettings set "$gnome_schema" icon-theme "$icon_theme" +gsettings set "$gnome_schema" cursor-theme "$cursor_theme" +gsettings set "$gnome_schema" font-name "$font_name" diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 3b6f230..077bc11 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -21,6 +21,7 @@ exec-once = waybar exec-once = swww init exec-once = ~/dotfiles/scripts/updatewal-swww.sh exec-once = dunst +exec-once = ~/dotfiles/hypr/gtk.sh # ----------------------------------------------------- # Load pywal color file @@ -73,6 +74,10 @@ decoration { size = 3 passes = 1 } + active_opacity = 1.0 + inactive_opacity = 0.9 + fullscreen_opacity = 1.0 + drop_shadow = true shadow_range = 4 shadow_render_power = 3 @@ -121,8 +126,7 @@ device:epic-mouse-v1 { # ----------------------------------------------------- # Window rules # ----------------------------------------------------- -windowrule = tile,title:^(Outlook)(.*)$ -windowrule = tile,title:^(Microsoft)(.*)$ +windowrule = tile,^(Brave-browser)$ # ----------------------------------------------------- # Key bindings @@ -130,6 +134,7 @@ windowrule = tile,title:^(Microsoft)(.*)$ $mainMod = SUPER bind = $mainMod, RETURN, exec, alacritty bind = $mainMod, Q, killactive +bind = $mainMod, F, fullscreen bind = $mainMod CTRL, Q, exec, ~/dotfiles/scripts/powermenu-hypr.sh bind = $mainMod, E, exec, dolphin bind = $mainMod, T, togglefloating @@ -143,6 +148,7 @@ bind = $mainMod, left, movefocus, l bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d +bind = $mainMod, PRINT, exec, ~/dotfiles/scripts/grim.sh bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 diff --git a/scripts/grim.sh b/scripts/grim.sh new file mode 100755 index 0000000..1836d28 --- /dev/null +++ b/scripts/grim.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# ____ _ _ +# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_ +# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __| +# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_ +# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__| +# +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +DIR="$HOME/Pictures/screenshots/" +NAME="screenshot_$(date +%d%m%Y_%H%M%S).png" + +# option1="Selected window (delay 3 sec)" +option2="Selected area" +option3="Fullscreen (delay 3 sec)" + +# options="$option1\n$option2\n$option3" +options="$option2\n$option3" + +choice=$(echo -e "$options" | rofi -dmenu -i -no-show-icons -l 4 -width 30 -p "Take Screenshot") + +case $choice in + $option1) + scrot $DIR$NAME -d 3 -e 'xclip -selection clipboard -t image/png -i $f' -c -z -u + notify-send "Screenshot created" "Mode: Selected window" + ;; + $option2) + grim -g "$(slurp)" $(xdg-user-dir PICTURES)/screenshots/$(date +'%s_grim.png') + notify-send "Screenshot created" "Mode: Selected area" + ;; + $option3) + sleep 3 + grim $(xdg-user-dir PICTURES)/screenshots/$(date +'%s_grim.png') + notify-send "Screenshot created" "Mode: Fullscreen" + ;; +esac diff --git a/scripts/looking-glass.sh b/scripts/looking-glass.sh index cc9e4bb..c0f9799 100755 --- a/scripts/looking-glass.sh +++ b/scripts/looking-glass.sh @@ -9,5 +9,12 @@ # by Stephan Raabe (2023) # ----------------------------------------------------- +tmp=$(virsh --connect qemu:///system list | grep " win11 " | awk '{ print $3}') +if ([ "x$tmp" == "x" ] || [ "x$tmp" != "xrunning" ]) +then + virsh --connect qemu:///system start win11 + echo "Virtual Machine win11 is starting..." + sleep 3 +fi looking-glass-client & exit diff --git a/scripts/powermenu-hypr.sh b/scripts/powermenu-hypr.sh index 6833a4d..cc49d91 100755 --- a/scripts/powermenu-hypr.sh +++ b/scripts/powermenu-hypr.sh @@ -22,7 +22,7 @@ choice=$(echo -e "$options" | rofi -dmenu -i -no-show-icons -l 4 -width 30 -p "P case $choice in $option1) - slock ;; + swaylock ;; $option2) hyprctl dispatch exit ;; $option3) diff --git a/wal/templates/colors-hyprland.conf b/wal/templates/colors-hyprland.conf new file mode 100644 index 0000000..c5dec77 --- /dev/null +++ b/wal/templates/colors-hyprland.conf @@ -0,0 +1,3 @@ +$background = rgb({background.strip}) +$color11 = rgb({color11.strip}) +$color14 = rgb({color14.strip}) \ No newline at end of file diff --git a/waybar/colors-waybar.css b/waybar/colors-waybar.css index 7e39759..93c51d1 100644 --- a/waybar/colors-waybar.css +++ b/waybar/colors-waybar.css @@ -1,20 +1,20 @@ -@define-color foreground #bfc0c0; -@define-color background #010304; -@define-color cursor #bfc0c0; +@define-color foreground #c2c3c4; +@define-color background #0d0f16; +@define-color cursor #c2c3c4; -@define-color color0 #010304; -@define-color color1 #325A65; -@define-color color2 #24636E; -@define-color color3 #466D76; -@define-color color4 #35817E; -@define-color color5 #347985; -@define-color color6 #4CAFB5; -@define-color color7 #bfc0c0; -@define-color color8 #404242; -@define-color color9 #325A65; -@define-color color10 #24636E; -@define-color color11 #466D76; -@define-color color12 #35817E; -@define-color color13 #347985; -@define-color color14 #4CAFB5; -@define-color color15 #bfc0c0; +@define-color color0 #0d0f16; +@define-color color1 #9B93B3; +@define-color color2 #D1939D; +@define-color color3 #99A3CF; +@define-color color4 #ADB2D5; +@define-color color5 #C7B9D2; +@define-color color6 #B2C2DE; +@define-color color7 #c2c3c4; +@define-color color8 #494b50; +@define-color color9 #9B93B3; +@define-color color10 #D1939D; +@define-color color11 #99A3CF; +@define-color color12 #ADB2D5; +@define-color color13 #C7B9D2; +@define-color color14 #B2C2DE; +@define-color color15 #c2c3c4; diff --git a/waybar/config b/waybar/config index e407e5f..594b4fe 100644 --- a/waybar/config +++ b/waybar/config @@ -2,30 +2,59 @@ "layer": "top", // Waybar at top layer "height": 30, // Waybar height (to be removed for auto height) "spacing": 4, // Gaps between modules (4px) - "modules-left": ["custom/appmenu", "wlr/workspaces"], - "modules-center": ["hyprland/window"], - "modules-right": ["hyprland/language", "keyboard-state", "pulseaudio", "cpu", "memory", "battery", "clock", "custom/exit", "tray"], + "modules-left": [ + "custom/appmenu", + "wlr/workspaces", + "custom/brave", + "custom/outlook", + "custom/teams", + "custom/calculator", + "custom/chatgpt", + "custom/lookingglass" + ], + "modules-center": [ + "hyprland/window" + ], + "modules-right": [ + "hyprland/language", + "keyboard-state", + "pulseaudio", + "cpu", + "memory", + "battery", + "clock", + "custom/exit", + "tray" + ], "wlr/workspaces" : { "on-click": "activate" }, - //"hyprland/workspaces": { - // "disable-scroll": true, - // "all-outputs": true, - // "warp-on-scroll": false, - // "format": "{name}: {icon}", - // "format-icons": { - // "1": "", - // "2": "", - // "3": "", - // "4": "", - // "5": "", - // "urgent": "", - // "focused": "", - // "default": "" - // } - //}, + "custom/outlook": { + "format": "", + "on-click": "brave --app=https://outlook.office.com/mail/" + }, + "custom/teams": { + "format": "", + "on-click": "brave --app=https://teams.microsoft.com/go" + }, + "custom/brave": { + "format": "", + "on-click": "brave" + }, + "custom/chatgpt": { + "format": "", + "on-click": "brave --app=https://chat.openai.com" + }, + "custom/calculator": { + "format": "", + "on-click": "~/dotfiles/scripts/calculator.sh" + }, + "custom/lookingglass": { + "format": "", + "on-click": "~/dotfiles/scripts/looking-glass.sh" + }, "custom/appmenu": { - "format": " ", + "format": "", "on-click": "~/dotfiles/scripts/applauncher.sh" }, "custom/exit": { diff --git a/waybar/style.css b/waybar/style.css index 0d92314..7fe56a3 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -40,7 +40,7 @@ button:hover { } #workspaces button { - padding: 0 5px; + padding: 0 10px; color: #ffffff; } @@ -90,9 +90,11 @@ button:hover { #window, #workspaces { - margin: 0 4px; + margin: 0 10px 0 6px; } + + .modules-left > widget:first-child > #workspaces { margin-left: 0; } @@ -105,6 +107,10 @@ button:hover { margin-left:10; } +#custom-brave, #custom-outlook, #custom-teams, #custom-chatgpt, #custom-calculator { + margin-right:10px; +} + #custom-exit { margin-right: 10px; }