From fd56f2ca1cf4682b5174602ce6849ccea1328cde Mon Sep 17 00:00:00 2001 From: Simonas Narbutas Date: Mon, 30 Jul 2018 14:57:54 +0200 Subject: [PATCH] kbd notif in awesome --- .bin/kbdswitch | 10 +++++++ .bin/multimonitor | 13 +++++---- .tmux.conf | 5 +++- .../.config/awesome/rc.lua##Linux.epiphanius | 28 ++++++++++++++++--- 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100755 .bin/kbdswitch diff --git a/.bin/kbdswitch b/.bin/kbdswitch new file mode 100755 index 0000000..3d29672 --- /dev/null +++ b/.bin/kbdswitch @@ -0,0 +1,10 @@ +#!/bin/sh +LANG1="us" +LANG2="lt" +CURRENT_LANG=$(setxkbmap -query | grep layout |awk -F" " '{print $2}') +if [ "$CURRENT_LANG" = $LANG1 ]; then + setxkbmap $LANG2 && echo $LANG2 +else + setxkbmap $LANG1 && echo $LANG1 +fi +xmodmap ~/.Xmodmap diff --git a/.bin/multimonitor b/.bin/multimonitor index e208186..8b51a5d 100755 --- a/.bin/multimonitor +++ b/.bin/multimonitor @@ -1,12 +1,15 @@ #!/bin/sh DISPLAY_COUNT=$(xrandr -d :0 -q | grep ' connected' | wc -l) -if [ "$DISPLAY_COUNT" == 2 ] +if [ "$DISPLAY_COUNT" == 3 ] then - xrandr --output HDMI2 --set "Broadcast RGB" "Full" --off --output HDMI1 --mode 2560x1440 --pos 1920x0 --rotate normal --output DP1 --set "Broadcast RGB" "Full" --off --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal --output VIRTUAL1 --off + xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal + xrandr --output DP1-2 --mode 2560x1440 --pos 4480x0 --rotate normal + xrandr --output DP1-1 --mode 2560x1440 --pos 1920x0 --rotate normal elif [ "$DISPLAY_COUNT" == 1 ] then - xrandr --output HDMI2 --off --output HDMI1 --off --output DP1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off -elif [ "$DISPLAY_COUNT" == 3 ] + xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal +elif [ "$DISPLAY_COUNT" == 2 ] then - xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output DP1-2 --mode 2560x1440 --pos 4480x0 --rotate normal --output DP1-1 --mode 2560x1440 --pos 1920x0 --rotate normal + xrandr --output HDMI1 --mode 2560x1440 --pos 1920x0 --rotate normal + xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x360 --rotate normal fi diff --git a/.tmux.conf b/.tmux.conf index 0eaf3b7..c4d7160 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -14,7 +14,10 @@ setw -g pane-base-index 1 #set-window-option -g window-status-current-bg yellow #set -ga terminal-overrides ",xterm-termite:Tc" set -g default-terminal "screen-256color" -#set -g mouse on +set -g mouse on +set -g history-limit 30000 +bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" +bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" set -g status-position bottom set -g status-bg black diff --git a/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius b/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius index a3ece2f..054b729 100644 --- a/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius +++ b/.yadm/alt/.config/awesome/rc.lua##Linux.epiphanius @@ -120,16 +120,15 @@ mykeyboardlayout = awful.widget.keyboardlayout() -- Create a textclock widget mytextclock = wibox.widget.textclock() local cal_notification + +-- {{{ Calendar mytextclock:connect_signal("button::release", function() if cal_notification == nil then awful.spawn.easy_async([[zsh -c "cal -3 -m --color=always |sed 's#\x1B\[7m\([0-9]\+\)\x1B\[27m#\1#'"]], function(stdout, stderr, reason, exit_code) cal_notification = naughty.notify{ - text = stdout, - -- text = string.gsub(string.gsub(stdout, - -- "+", ""), - -- "-", ""), + text = stdout, font = "Source Code Pro", timeout = 0, width = auto, @@ -141,7 +140,24 @@ mytextclock:connect_signal("button::release", naughty.destroy(cal_notification) end end) +-- }}} +-- {{{ change keyboard layout +mykeyboardlayout:connect_signal("button::release", + function() + if kbd_notification == nil then + awful.spawn.easy_async([[sh -c "~/.bin/kbdswitch"]], function(stdout, stderr, reason, exit_code) + kbd_notification = naughty.notify{ + title = "Keyboard", + text = stdout, + timeout = 0.5, + destroy = function() kbd_notification = nil end} + end) + else + naughty.destroy(kbd_notification) + end + end) +-- }}} -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( awful.button({ }, 1, function(t) t:view_only() end), @@ -382,6 +398,10 @@ globalkeys = gears.table.join( function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next", naughty.notify {title = "Next", timeout = 0.5, bg = "#ad11c7"}) end), + awful.key({ "Control", "Mod4" }, "s", + function () + awful.util.spawn_with_shell("sleep .1 && scrot -s '%d-%m-%y_%H:%M:%s_scrot.png' -e 'mv $f ~/Pictures/scrots/'", naughty.notify {text = "scrot complete", timeout = 0.5, bg = "#ad11c7"}) + end), awful.key({ modkey, "Control" }, "n", function ()