Neue Antwort schreiben 
 
Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Der Code-Schnippsel-Thread
Nik Offline
Offizieller Aufsichtsrat für Toastbrot

Beiträge: 2.024
Registriert seit: May 2012
Beitrag #701
RE: Der Code-Schnippsel-Thread
(10.01.2016 15:38)Xaar schrieb:  Danke. Scheint wohl doch nicht so das richtige für mich zu sein :D

Zu viele Kombis zu merken? :D

"Mach das Licht entweder an oder aus, aber nicht beides gleichzeitig" - Nik, 2017
10.01.2016 15:41
Webseite des Benutzers besuchen Alle Beiträge dieses Benutzers finden Diese Nachricht in einer Antwort zitieren
Xaar Offline
Wahnsinnige Geschwindigkeit - und los!

Beiträge: 26.082
Registriert seit: Jul 2009
Beitrag #702
RE: Der Code-Schnippsel-Thread
(10.01.2016 15:41)Nik schrieb:  Zu viele Kombis zu merken? :D

Nee, das nicht. Ich mag' einfach nicht mehrere Fenster nebeneinander. Daher sagte ich ja: Ich nutz' das meiste im Vollbild :D Prinzipiell find' ich die Handhabung, wie es unter Windows oder Xfce, Gnome 2 usw. lief bzw. läuft, schon nicht verkehrt (sprich, Leiste mit Knöppen "Maximieren", "Minimieren", "Schließen" usw.). Da hab' ich wohl die ganze Tiling-Geschichte so richtig missverstanden :D

«Ich verstehe Ihre Frage so: Dass es Menschen gibt, die wünschen, dass ein solches OS als "Retro-OS" bezeichnet wird, ja? Mir ist nicht bekannt, dass solche Absichten bestehen, da HP-UX 9.x einfach ein altes OS ist. Niemand hat die Absicht, ein "Retro-OS" zu bauen.» Xaar, 2014

Prozessor gesucht? -> Prozessoren, die ich abgeben kann (unter "Available for trading")
"Überschüssige" Prozessoren oder Hardware? -> Einfach PN an mich schicken b1 -> Hardware, die ich suche
10.01.2016 15:43
Webseite des Benutzers besuchen Alle Beiträge dieses Benutzers finden Diese Nachricht in einer Antwort zitieren
mrshadowtux
Unregistered

 
Beitrag #703
RE: Der Code-Schnippsel-Thread
Für die zshrc, bashrc und co: Screenfetch-Bildchen in der Shell zeigen, aber nur wenn dabei kein X läuft (Zum Beispiel für die Shell vor startx):
Code:
if ! pidof xinit >/dev/null ; then screenfetch ; fi

EDIT: Jaa ich weiß, man kann auch einfach $TERM abfragen ("xterm" bei X, "linux" bei Textmodus). Habs jetzt aber trotzdem so gelöst.
12.01.2016 11:44
Diese Nachricht in einer Antwort zitieren
thosch97 Offline
All things have a right to grow

Beiträge: 9.843
Registriert seit: Feb 2010
Beitrag #704
RE: Der Code-Schnippsel-Thread
[Bild: m14KdC0.png]
Besser $DISPLAY prüfen.

PGP-Key E384 009D 3B54 DCD3 21BF 9532 95EE 94A4 3258 3DB1 | S/MIME-Key 0x1A33706DAD44DA
G d-@ s+:- a--- C+++ UB+L++ P--- L++@ E-@>++ W+ N o? K? w>++ !O !M !V PS+++ PE-- Y+>++ PGP++>+++ !t 5? X? !R tv b+++>++++ DI !D G>+ e>+++ h !r>++ !z
„Die Aachener gelten als Erfinder des 4. Hauptsatzes der Thermodynamik: ‚Thermo schreibt man zweimal.“‘
“Saying that Java is good because it works on all platforms is like saying oral sex is good because it works on all sexes.”
„Es gibt 10 Sorten von Leuten: Die einen verstehen das Binärsystem, die anderen nicht.“
„Manche Männer lieben Männer, Manche Frauen eben Frauen; Da gibt's nix zu bedauern und nichts zu staunen; Das ist genau so normal wie Kaugummi kauen; Doch die meisten werden sich das niemals trauen“
12.01.2016 13:05
Alle Beiträge dieses Benutzers finden Diese Nachricht in einer Antwort zitieren
mrshadowtux
Unregistered

 
Beitrag #705
RE: Der Code-Schnippsel-Thread
$DISPLAY geht natürlich auch. Da ich keinerlei Displaymanager nutze, sondern stattdessen über startx gehe, ist bei mir unter Arch aber immer ein xinit offen unter X.
12.01.2016 13:18
Diese Nachricht in einer Antwort zitieren
tk1908 Offline
Unixer

Beiträge: 7.354
Registriert seit: Apr 2009
Beitrag #706
RE: Der Code-Schnippsel-Thread
(10.01.2016 14:54)mrshadowtux schrieb:  Für alle i3-Nutzer, die das standardmäßig grausame i3status ersetzen möchten: Installiert euch i3pystatus und nehmt folgende, von mir geschriebene Config, um alle wichtigen Infos zu erhalten, eingefärbt je nach Status, inklusive Wetter und CPU-Temparatur:
[Bild: 17142167dd45d4ee4bd4bfa8e6e6e30d.png]

Code:
from i3pystatus import Status
status = Status(standalone=True)


status.register("clock",
    format="%a %-d %b %X KW%V",    
)


status.register("temp",
    format="CPU: {temp:.0f}°C",
)


status.register("runwatch",
    name="DHCP",
    path="/var/run/dhclient*.pid",
)


status.register("network",
    interface="enp0s25",
    format_up="{v4cidr}",
)


status.register("network",
    interface="wlp3s0",
    format_up="{essid} {quality:3.0f}% ({v4cidr})",
)


status.register("disk",
    path="/",
    format="/: {avail}GB",
)


status.register("battery",
    format="{status} {percentage:.2f}% {remaining:%E%hh:%Mm}",
    full_color="#00ff00",
    color="#FFFF00",
    charging_color="#00ff00",
    alert=True,
    alert_percentage=7,
    status={
        "DIS": "Akku",
        "CHR": "Lade",
        "FULL": "Voll",
    },
)


# location_codes unter: https://weather.codes/germany/
status.register("weather",
    location_code="GMXX0446",
    format="Sonsbeck: {current_temp}",
    colorize=False,
    units="metric",
    on_leftclick="qutebrowser http://www.weather.com/de-DE/wetter/heute/l/GMXX0446"
)


status.register("weather",
    location_code="GMXX0028",
    format="Düsseldorf: {current_temp}",
    colorize=False,
    units="metric",
    on_leftclick="qutebrowser http://www.weather.com/de-DE/wetter/heute/l/GMXX0028"
)


status.run()

Wenn ich i3pystatus installiert habe, wo pack ich dann die Konfig hin? Hätte i3pystatus gerne, weil i3status keinen mpc unterstützt.

[Bild: Rz3JNLI.gif]
Meine Beiträge stehen unter der MIT-Lizenz:D

(09.04.2016 13:26)tk1908 schrieb:  externe HDD am Router? Klar ich tausch mein Auto gegen nen Tretroller mit Bremsklotz.
09.02.2016 14:43
Alle Beiträge dieses Benutzers finden Diese Nachricht in einer Antwort zitieren
DosAmp Offline
Anderes Zeigegerät

Beiträge: 12.219
Registriert seit: Jul 2008
Beitrag #707
RE: Der Code-Schnippsel-Thread
(09.02.2016 14:43)tk1908 schrieb:  Wenn ich i3pystatus installiert habe, wo pack ich dann die Konfig hin? Hätte i3pystatus gerne, weil i3status keinen mpc unterstützt.

Der Clou ist, dass die Konfigurationsdatei gleichzeitig das ausgeführte Python-Skript ist, das sich nur i3pystatus importiert. Wie in der Dokumentation beschrieben, kannst du es an beliebiger Stelle ablegen und ausführbar machen. Entweder indem du den entsprechenden Pfad zur Python-3-Installation in das Skript einträgst (z. B. #!/usr/bin/python3.4) oder explizit Python aus i3 heraus aufrufst:
Code:
bar {
    status_command    python3 ~/.path/to/your/config/file.py
}

CCITTグループ4またはZIP圧縮のモノクロ300dpiで最高の再現性
(Dieser Beitrag wurde zuletzt bearbeitet: 09.02.2016 14:51 von DosAmp.)
09.02.2016 14:51
Webseite des Benutzers besuchen Alle Beiträge dieses Benutzers finden Diese Nachricht in einer Antwort zitieren
mrshadowtux
Unregistered

 
Beitrag #708
RE: Der Code-Schnippsel-Thread
Genau wie Dosamp sagt. Hier mal meine i3-Config, in der das auch mit eingebunden ist:

Code:
# vim:filetype=i3

set $mod Mod4
font pango:Roboto 10

floating_modifier $mod
bindsym $mod+Shift+q kill

bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

bindsym $mod+f fullscreen toggle

bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

bindsym $mod+a focus parent
#bindsym $mod+d focus child

bindsym $mod+v split vertical
bindsym $mod+h split horizontal

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10


mode "resize"
{
    bindsym j resize shrink width 10 px or 10 ppt
    bindsym k resize grow height 10 px or 10 ppt
    bindsym l resize shrink height 10 px or 10 ppt
    bindsym semicolon resize grow width 10 px or 10 ppt

    bindsym Left resize shrink width 10 px or 10 ppt
    bindsym Down resize grow height 10 px or 10 ppt
    bindsym Up resize shrink height 10 px or 10 ppt
    bindsym Right resize grow width 10 px or 10 ppt

    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"


bar
{
    status_command python ~/.config/i3/i3pystatus_config.py
    workspace_buttons yes
}


# Baustelle: Window-Assigns
#assign [class="^Kalender"] 10
#assign [class="pidgin"] 1
#assign [class="telegram"] 1
#assign [class="skype"] 1
#assign [class="firefox"] 2
#assign [class="thunderbird"] 3
#assign [class="localc"] 9


# Shortcuts
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

bindsym $mod+Return exec --no-startup-id i3-sensible-terminal
bindsym $mod+d exec i3-dmenu-desktop
bindsym XF86MonBrightnessDown exec --no-startup-id sudo bright_down
bindsym XF86MonBrightnessUp exec --no-startup-id sudo bright_up
bindsym XF86AudioRaiseVolume exec pamixer --increase 5
bindsym XF86AudioLowerVolume exec pamixer --decrease 5
bindsym XF86AudioMute exec pamixer -t
bindsym XF86LaunchA exec --no-startup-id /usr/local/bin/touchpad_toggle.sh &
bindsym --release Print exec --no-startup-id import -window root ~/Bilder/Screens/screen_$(date +%Y-%m-%d_%H-%M-%S).png
bindsym $mod+l exec --no-startup-id xscreensaver-command --lock &
bindsym $mod+shift+l exec --no-startup-id leafpad &
bindsym $mod+x [urgent=latest] focus
bindsym $mod+b exec --no-startup-id firefox &
bindsym $mod+n exec --no-startup-id nemo &
bindsym $mod+z exec --no-startup-id google-chrome-stable --app=http://zattoo.com &
bindsym $mod+j exec --no-startup-id feh --bg-fill "$(find /home/afeld/Bilder/Wallpaper/ | shuf -n1)" &
bindsym $mod+F2 exec --no-startup-id xfce4-appfinder &


# Autostart
exec --no-startup-id /usr/local/bin/touchpad_toggle.sh &
exec --no-startup-id feh --bg-scale Bilder/Wallpaper/Chrome\ OS\ Wallpapers/20130206-212207_image\ \(13\)_high_resolution.jpg &
exec --no-startup-id xscreensaver -no-splash &
exec --no-startup-id dunst &
exec --no-startup-id shutter --min_at_startup &
exec --no-startup-id autokey-gtk &
exec --no-startup-id /usr/local/bin/syno_office.sh &

#exec --no-startup-id polly --minimized &

Den bindsym zum dmenu folgendermaßen ändern:
bindsym $mod+d exec i3-dmenu-desktop

Das sorgt dann dafür, dass dmenu nur GUI-Programme anzeigt. Der Rest der Config ist recht verständlich denke ich.

Mein Tipp für schönere Darstellung: Die Roboto-Font aus dem AUR installieren und die Zeile font pango:Roboto 10 nutzen
09.02.2016 15:00
Diese Nachricht in einer Antwort zitieren
tk1908 Offline
Unixer

Beiträge: 7.354
Registriert seit: Apr 2009
Beitrag #709
RE: Der Code-Schnippsel-Thread
(09.02.2016 15:00)mrshadowtux schrieb:  Genau wie Dosamp sagt. Hier mal meine i3-Config, in der das auch mit eingebunden ist:

Code:
# vim:filetype=i3

set $mod Mod4
font pango:Roboto 10

floating_modifier $mod
bindsym $mod+Shift+q kill

bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

bindsym $mod+f fullscreen toggle

bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

bindsym $mod+a focus parent
#bindsym $mod+d focus child

bindsym $mod+v split vertical
bindsym $mod+h split horizontal

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10


mode "resize"
{
    bindsym j resize shrink width 10 px or 10 ppt
    bindsym k resize grow height 10 px or 10 ppt
    bindsym l resize shrink height 10 px or 10 ppt
    bindsym semicolon resize grow width 10 px or 10 ppt

    bindsym Left resize shrink width 10 px or 10 ppt
    bindsym Down resize grow height 10 px or 10 ppt
    bindsym Up resize shrink height 10 px or 10 ppt
    bindsym Right resize grow width 10 px or 10 ppt

    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"


bar
{
    status_command python ~/.config/i3/i3pystatus_config.py
    workspace_buttons yes
}


# Baustelle: Window-Assigns
#assign [class="^Kalender"] 10
#assign [class="pidgin"] 1
#assign [class="telegram"] 1
#assign [class="skype"] 1
#assign [class="firefox"] 2
#assign [class="thunderbird"] 3
#assign [class="localc"] 9


# Shortcuts
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

bindsym $mod+Return exec --no-startup-id i3-sensible-terminal
bindsym $mod+d exec i3-dmenu-desktop
bindsym XF86MonBrightnessDown exec --no-startup-id sudo bright_down
bindsym XF86MonBrightnessUp exec --no-startup-id sudo bright_up
bindsym XF86AudioRaiseVolume exec pamixer --increase 5
bindsym XF86AudioLowerVolume exec pamixer --decrease 5
bindsym XF86AudioMute exec pamixer -t
bindsym XF86LaunchA exec --no-startup-id /usr/local/bin/touchpad_toggle.sh &
bindsym --release Print exec --no-startup-id import -window root ~/Bilder/Screens/screen_$(date +%Y-%m-%d_%H-%M-%S).png
bindsym $mod+l exec --no-startup-id xscreensaver-command --lock &
bindsym $mod+shift+l exec --no-startup-id leafpad &
bindsym $mod+x [urgent=latest] focus
bindsym $mod+b exec --no-startup-id firefox &
bindsym $mod+n exec --no-startup-id nemo &
bindsym $mod+z exec --no-startup-id google-chrome-stable --app=http://zattoo.com &
bindsym $mod+j exec --no-startup-id feh --bg-fill "$(find /home/afeld/Bilder/Wallpaper/ | shuf -n1)" &
bindsym $mod+F2 exec --no-startup-id xfce4-appfinder &


# Autostart
exec --no-startup-id /usr/local/bin/touchpad_toggle.sh &
exec --no-startup-id feh --bg-scale Bilder/Wallpaper/Chrome\ OS\ Wallpapers/20130206-212207_image\ \(13\)_high_resolution.jpg &
exec --no-startup-id xscreensaver -no-splash &
exec --no-startup-id dunst &
exec --no-startup-id shutter --min_at_startup &
exec --no-startup-id autokey-gtk &
exec --no-startup-id /usr/local/bin/syno_office.sh &

#exec --no-startup-id polly --minimized &

Den bindsym zum dmenu folgendermaßen ändern:
bindsym $mod+d exec i3-dmenu-desktop

Das sorgt dann dafür, dass dmenu nur GUI-Programme anzeigt. Der Rest der Config ist recht verständlich denke ich.

Mein Tipp für schönere Darstellung: Die Roboto-Font aus dem AUR installieren und die Zeile font pango:Roboto 10 nutzen

Ok habs soweit verstanden.
Nur eins noch: Es fehlt das Modul netifaces. Installiert hab ich es, nur wie importiere ich es jetzt?

[Bild: Rz3JNLI.gif]
Meine Beiträge stehen unter der MIT-Lizenz:D

(09.04.2016 13:26)tk1908 schrieb:  externe HDD am Router? Klar ich tausch mein Auto gegen nen Tretroller mit Bremsklotz.
09.02.2016 15:14
Alle Beiträge dieses Benutzers finden Diese Nachricht in einer Antwort zitieren
mrshadowtux
Unregistered

 
Beitrag #710
RE: Der Code-Schnippsel-Thread
Richtiges Modul installiert?
aur/python-netifaces
Das nutze ich.

Nach einem Reload von i3 ($mod+shift+r) sollte die Anzeige dann gehen.
09.02.2016 15:16
Diese Nachricht in einer Antwort zitieren
Neue Antwort schreiben 


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste